for(int i=0; i<importedObjects.size(); i++) { Object object = importedObjects.elementAt(i); Class clas = object.getClass(); Field field = Reflect.resolveJavaField( clas, name, false/*onlyStatic*/ ); if ( field != null ) return new Variable( name, field.getType(), new LHS( object, field ) ); }
if ( importedStatic!= null ) for(int i=0; i<importedStatic.size(); i++) { Class clas = (Class)importedStatic.elementAt(i); Field field = Reflect.resolveJavaField( clas, name, true/*onlyStatic*/ ); if ( field != null ) return new Variable( name, field.getType(), new LHS( field ) ); }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/NameSpace.java File path: /jEdit-4.2/src/bsh/NameSpace.java
Method name: Variable getImportedVar(String) Method name: Variable getImportedVar(String)
Number of AST nodes: 6 Number of AST nodes: 6
1
if ( importedStatic!= null )
1
for(int i=0; i<importedObjects.size(); i++)
2
		for(int i=0; i<importedStatic.size(); i++)
2
		{
3
		{
3
			Object object = importedObjects.elementAt(i);
4
			Class clas = (Class)importedStatic.elementAt(i);
4
			Class clas = object.getClass();
5
			
5
			Field field = Reflect.resolveJavaField( 
6
Field field = Reflect.resolveJavaField( 
6
				clas, name, false/*onlyStatic*/ );
7
				clas, name, true/*onlyStatic*/ );
7
			if ( field != null )
8
			if ( field != null )
8
				return new Variable( 
9
				return new Variable( 
9
					name, field.getType(), new LHS( object, field ) );
10
name, field.getType(), new LHS( field ) );
10
		}
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.4
Clones locationClones are in the same method
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < importedObjects.size(); i++)
    2
    for (int i = 0; i < importedObjects.size(); i++)
    9
    for (int i = 0; i < importedStatic.size(); i++)
    Differences
    Expression1Expression2Difference
    importedObjectsimportedStaticVARIABLE_NAME_MISMATCH
    9
    for (int i = 0; i < importedStatic.size(); i++)
    3
    Object object = importedObjects.elementAt(i);
    3
    Object object = importedObjects.elementAt(i);
    Preondition Violations
    Unmatched statement Object object=importedObjects.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
    4
    Class clas = object.getClass();
    4
    Class clas = object.getClass();
    Preondition Violations
    Unmatched statement Class clas=object.getClass(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                    
                                                                                                        
    10
    Class clas = (Class)importedStatic.elementAt(i);
    Preondition Violations
    Unmatched statement Class clas=(Class)importedStatic.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    Class clas = (Class)importedStatic.elementAt(i);
    5
    Field field = Reflect.resolveJavaField(clas, name, false);
    5
    Field field = Reflect.resolveJavaField(clas, name, false);
    11
    Field field = Reflect.resolveJavaField(clas, name, true);
    Differences
    Expression1Expression2Difference
    falsetrueLITERAL_VALUE_MISMATCH
    11
    Field field = Reflect.resolveJavaField(clas, name, true);
    6
    if (field != null)
    12
    if (field != null)
    7
    return new Variable(name, field.getType(), new LHS(object, field));
    7
    return new Variable(name, field.getType(), new LHS(object, field));
    13
    return new Variable(name, field.getType(), new LHS(field));
    Differences
    Expression1Expression2Difference
    new LHS(object,field)new LHS(field)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new LHS(object,field) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new LHS(field) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    return new Variable(name, field.getType(), new LHS(field));
    Precondition Violations (5)
    Row Violation
    1Unmatched statement Object object=importedObjects.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Class clas=object.getClass(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement Class clas=(Class)importedStatic.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression new LHS(object,field) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression new LHS(field) cannot be parameterized, because it has dependencies to/from statements that will be extracted