for (int i = 1; i < args.length; i++) { JavaClass type; if (args[i] instanceof JavaClass) { type = (JavaClass)args[i]; } else if (args[i].respondsTo("java_class")) { type = (JavaClass)args[i].callMethod(getRuntime().getCurrentContext(), "java_class"); } else { type = for_name(this, args[i]); } argumentTypes[i - 1] = type.javaClass(); }
for (int i = 0; i < args.length; i++) { JavaClass type; if (args[i] instanceof JavaClass) { type = (JavaClass)args[i]; } else if (args[i].respondsTo("java_class")) { type = (JavaClass)args[i].callMethod(getRuntime().getCurrentContext(), "java_class"); } else { type = for_name(this, args[i]); } parameterTypes[i] = type.javaClass(); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java
Method name: Class[] buildArgumentTypes(IRubyObject[]) Method name: Class[] buildClassArgs(IRubyObject[])
Number of AST nodes: 8 Number of AST nodes: 8
1
for (int i = 1; i < args.length; i++) {
1
for (int i = 0; i < args.length; i++) {
2
            JavaClass type;
2
            JavaClass type;
3
            if (args[i] instanceof JavaClass) {
3
            if (args[i] instanceof JavaClass) {
4
                type = (JavaClass)args[i];
4
                type = (JavaClass)args[i];
5
            } else if (args[i].respondsTo("java_class")) {
5
            } else if (args[i].respondsTo("java_class")) {
6
                type = (JavaClass)args[i].callMethod(getRuntime().getCurrentContext(), "java_class");
6
                type = (JavaClass)args[i].callMethod(getRuntime().getCurrentContext(), "java_class");
7
            } else {
7
            } else {
8
                type = for_name(this, args[i]);
8
                type = for_name(this, args[i]);
9
            }
9
            }
10
            argumentTypes[i - 1] = type.javaClass();
10
            parameterTypes[i] = type.javaClass();
11
        }
11
        }
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.6
Clones locationClones are declared in the same class
Number of node comparisons29
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (int i = 1; i < args.length; i++)
    4
    for (int i = 1; i < args.length; i++)
    2
    for (int i = 0; i < args.length; i++)
    Differences
    Expression1Expression2Difference
    10LITERAL_VALUE_MISMATCH
    2
    for (int i = 0; i < args.length; i++)
    5
    JavaClass type;
    3
    JavaClass type;
    6
    if (args[i] instanceof JavaClass)
    4
    if (args[i] instanceof JavaClass)
    7
    type = (JavaClass)args[i];
    5
    type = (JavaClass)args[i];
    8
    else if (args[i].respondsTo("java_class"))
    6
    else if (args[i].respondsTo("java_class"))
    9
    type = (JavaClass)args[i].callMethod(getRuntime().getCurrentContext(), "java_class");
    7
    type = (JavaClass)args[i].callMethod(getRuntime().getCurrentContext(), "java_class");
    else
    else
    10
    type = for_name(this, args[i]);
    8
    type = for_name(this, args[i]);
    11
    argumentTypes[i - 1] = type.javaClass();
    11
    argumentTypes[i - 1] = type.javaClass();
    9
    parameterTypes[i] = type.javaClass();
    Differences
    Expression1Expression2Difference
    argumentTypesparameterTypesVARIABLE_NAME_MISMATCH
    i - 1iTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression i - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    parameterTypes[i] = type.javaClass();
    Precondition Violations (2)
    Row Violation
    1Expression i - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted