Object object = importedObjects.elementAt(i); Class clas = object.getClass(); Method method = Reflect.resolveJavaMethod( getClassManager(), clas, name, sig, false/*onlyStatic*/ ); if ( method != null ) return new BshMethod( method, object );
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: BshMethod getImportedMethod(String, Class[]) Method name: Variable getImportedVar(String)
Number of AST nodes: 5 Number of AST nodes: 4
1
Object object = importedObjects.elementAt(i);
1
Class clas = (Class)importedStatic.elementAt(i);
2
			Class clas = object.getClass();
2
			
3
			Method method = Reflect.resolveJavaMethod( 
3
Field field = Reflect.resolveJavaField( 
4
				getClassManager(), clas, name, sig, false/*onlyStatic*/ );
4
				clas, name, true/*onlyStatic*/ );
5
			if ( method != null )
5
			if ( field != null )
6
				return new BshMethod( method, object );
6
				return new Variable( name, field.getType(), new LHS( field ) );
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 declared in the same class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    Object object = importedObjects.elementAt(i);
                                                                                                
    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
    Method method = Reflect.resolveJavaMethod(getClassManager(), clas, name, sig, false);
    5
    Method method = Reflect.resolveJavaMethod(getClassManager(), clas, name, sig, false);
    11
    Field field = Reflect.resolveJavaField(clas, name, true);
    Differences
    Expression1Expression2Difference
    java.lang.reflect.Methodjava.lang.reflect.FieldSUBCLASS_TYPE_MISMATCH
    methodfieldVARIABLE_NAME_MISMATCH
    java.lang.reflect.Methodjava.lang.reflect.FieldSUBCLASS_TYPE_MISMATCH
    resolveJavaMethodresolveJavaFieldMETHOD_INVOCATION_NAME_MISMATCH
    Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,false)Reflect.resolveJavaField(clas,name,true)ARGUMENT_NUMBER_MISMATCH
    11
    Field field = Reflect.resolveJavaField(clas, name, true);
    6
    if (method != null)
    6
    if (method != null)
    12
    if (field != null)
    Differences
    Expression1Expression2Difference
    methodfieldVARIABLE_NAME_MISMATCH
    java.lang.reflect.Methodjava.lang.reflect.FieldSUBCLASS_TYPE_MISMATCH
    12
    if (field != null)
    7
    return new BshMethod(method, object);
    7
    return new BshMethod(method, object);
    Preondition Violations
    Unmatched statement return new BshMethod(method,object); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return new BshMethod(method,object);
                                                                                  
                                                                                                                              
    13
    return new Variable(name, field.getType(), new LHS(field));
    Preondition Violations
    Unmatched statement return new Variable(name,field.getType(),new LHS(field)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return new Variable(name,field.getType(),new LHS(field));
    13
    return new Variable(name, field.getType(), new LHS(field));
    Precondition Violations (7)
    Row Violation
    1Unmatched 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
    2Unmatched 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
    3Unmatched statement return new BshMethod(method,object); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return new BshMethod(method,object);
    5Unmatched statement return new Variable(name,field.getType(),new LHS(field)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return new Variable(name,field.getType(),new LHS(field));
    7Clone fragment #1 returns variable method with type java.lang.reflect.Method , while Clone fragment #2 returns variable field with type java.lang.reflect.Field