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