String [] sa = new String [cparams.length]; for(int i=0; i<sa.length; i++) sa[i] = BSHType.getTypeDescriptor( cparams[i] ); return sa;
Object [] oa = new Object[ args.length ]; for(int i=0; i<args.length; i++) oa[i] = unwrap( args[i] ); return oa;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/ClassGeneratorUtil.java File path: /jEdit-4.2/src/bsh/Primitive.java
Method name: String[] getTypeDescriptors(Class[]) Method name: Object[] unwrap(Object[])
Number of AST nodes: 4 Number of AST nodes: 4
1
String [] sa = new String [cparams.length];
1
Object [] oa = new Object[ args.length ];
2
		for(int i=0; i<sa.length; i++)
2
        for(int i=0; i<args.length; i++)
3
			sa[i] = BSHType.getTypeDescriptor( cparams[i] );
3
            oa[i] = unwrap( args[i] );
4
		return sa;
4
		return oa;
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.3
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                  
    1
    Object[] oa = new Object[args.length];
    1
    String[] sa = new String[cparams.length];
                                                                                        
    2
    for (int i = 0; i < sa.length; i++)
    2
    for (int i = 0; i < sa.length; i++)
    2
    for (int i = 0; i < args.length; i++)
    Differences
    Expression1Expression2Difference
    saargsVARIABLE_NAME_MISMATCH
    java.lang.String[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable sa.length does not match with type int of variable args.length
    • Make classes java.lang.String[] and java.lang.Object[] extend a common superclass
    2
    for (int i = 0; i < args.length; i++)
                                                      
    3
    oa[i] = unwrap(args[i]);
    Preondition Violations
    Unmatched statement oa[i]=unwrap(args[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    oa[i] = unwrap(args[i]);
    3
    sa[i] = BSHType.getTypeDescriptor(cparams[i]);
    3
    sa[i] = BSHType.getTypeDescriptor(cparams[i]);
    Preondition Violations
    Unmatched statement sa[i]=BSHType.getTypeDescriptor(cparams[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                  
                              
    4
    return oa;
    Preondition Violations
    Unmatched return oa;
    4
    return oa;
    4
    return sa;
    4
    return sa;
    Preondition Violations
    Unmatched return sa;
                              
    Precondition Violations (6)
    Row Violation
    1Type int of variable sa.length does not match with type int of variable args.length
    2Unmatched statement oa[i]=unwrap(args[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement sa[i]=BSHType.getTypeDescriptor(cparams[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return oa;
    5Unmatched return sa;
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero