try { context.setWithinDefined(true); String definition = expressionNode.definition(runtime, context, self, aBlock); return definition != null ? runtime.newString(definition) : runtime.getNil(); } finally { context.setWithinDefined(false); }
try { context.setWithinDefined(true); return node.definition(runtime, context, self, aBlock); } finally { context.setWithinDefined(false); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ast/DefinedNode.java File path: /jruby-1.4.0/src/org/jruby/evaluator/ASTInterpreter.java
Method name: IRubyObject interpret(Ruby, ThreadContext, IRubyObject, Block) Method name: String getDefinition(Ruby, ThreadContext, Node, IRubyObject, Block)
Number of AST nodes: 4 Number of AST nodes: 3
1
try {
1
try {
2
            context.setWithinDefined(true);
2
            context.setWithinDefined(true);
3
            String definition = expressionNode.definition(runtime, context, self, aBlock);
3
            return node.definition(runtime, context, self, aBlock);
4
            return definition != null ? runtime.newString(definition) : runtime.getNil();
5
        } finally {
4
        } finally {
6
            context.setWithinDefined(false);
5
            context.setWithinDefined(false);
7
        }
6
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    2
    context.setWithinDefined(true);
    2
    context.setWithinDefined(true);
                                                                                                                  
    3
    return node.definition(runtime, context, self, aBlock);
    Preondition Violations
    Unmatched return node.definition(runtime,context,self,aBlock);
    3
    return node.definition(runtime, context, self, aBlock);
    3
    String definition = expressionNode.definition(runtime, context, self, aBlock);
    3
    String definition = expressionNode.definition(runtime, context, self, aBlock);
    Preondition Violations
    Unmatched statement String definition=expressionNode.definition(runtime,context,self,aBlock); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                            
    4
    return definition != null ? runtime.newString(definition) : runtime.getNil();
    4
    return definition != null ? runtime.newString(definition) : runtime.getNil();
    Preondition Violations
    Unmatched return definition != null ? runtime.newString(definition) : runtime.getNil();
                                                                                                                                                                    
    Precondition Violations (3)
    Row Violation
    1Unmatched return node.definition(runtime,context,self,aBlock);
    2Unmatched statement String definition=expressionNode.definition(runtime,context,self,aBlock); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched return definition != null ? runtime.newString(definition) : runtime.getNil();