Ruby runtime = context.getRuntime(); RubyArray result = runtime.newArray(); callEach(runtime, context, self, new AppendBlockCallback(runtime, result)); result.sort_bang(context, block); return result;
Ruby runtime = context.getRuntime(); RubyArray result = runtime.newArray(); RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(), Arity.OPTIONAL, new AppendBlockCallback(runtime, result), context)); return result;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyEnumerable.java File path: /jruby-1.4.0/src/org/jruby/RubyEnumerable.java
Method name: IRubyObject sort(ThreadContext, IRubyObject, Block) Method name: IRubyObject to_a19(ThreadContext, IRubyObject, IRubyObject[])
Number of AST nodes: 5 Number of AST nodes: 4
1
Ruby runtime = context.getRuntime();
1
Ruby runtime = context.getRuntime();
2
        RubyArray result = runtime.newArray();
2
        RubyArray result = runtime.newArray();
3
        callEach(runtime, context, self, new AppendBlockCallback(runtime, result));
3
        
4
        result.sort_bang(context, block);
5
        
4
RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(), 
5
                Arity.OPTIONAL, new AppendBlockCallback(runtime, result), context));
6
        return result;
6
        return result;
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.0
Clones locationClones are declared in the same class
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Ruby runtime = context.getRuntime();
    1
    Ruby runtime = context.getRuntime();
    2
    RubyArray result = runtime.newArray();
    2
    RubyArray result = runtime.newArray();
    3
    callEach(runtime, context, self, new AppendBlockCallback(runtime, result));
    3
    callEach(runtime, context, self, new AppendBlockCallback(runtime, result));
    3
    RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(), Arity.OPTIONAL, new AppendBlockCallback(runtime, result), context));
    Differences
    Expression1Expression2Difference
    callEachinvokeMETHOD_INVOCATION_NAME_MISMATCH
    callEach(runtime,context,self,new AppendBlockCallback(runtime,result))RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context))ARGUMENT_NUMBER_MISMATCH
    RuntimeHelpersMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression callEach(runtime,context,self,new AppendBlockCallback(runtime,result)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression callEach(runtime,context,self,new AppendBlockCallback(runtime,result)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(), Arity.OPTIONAL, new AppendBlockCallback(runtime, result), context));
    4
    result.sort_bang(context, block);
    4
    result.sort_bang(context, block);
    Preondition Violations
    Unmatched statement result.sort_bang(context,block); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    5
    return result;
    4
    return result;
    Precondition Violations (6)
    Row Violation
    1Expression callEach(runtime,context,self,new AppendBlockCallback(runtime,result)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression callEach(runtime,context,self,new AppendBlockCallback(runtime,result)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression RuntimeHelpers.invoke(context,self,"each",args,CallBlock.newCallClosure(self,runtime.getEnumerable(),Arity.OPTIONAL,new AppendBlockCallback(runtime,result),context)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement result.sort_bang(context,block); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Clone fragment #1 returns variables result , while Clone fragment #2 returns variables