if ( importedStatic == null ) importedStatic = new Vector(); // If it exists, remove it and add it at the end (avoid memory leak) if ( importedStatic.contains( clas ) ) importedStatic.remove( clas ); importedStatic.addElement( clas ); nameSpaceChanged();
if ( importedObjects == null ) importedObjects = new Vector(); // If it exists, remove it and add it at the end (avoid memory leak) if ( importedObjects.contains( obj ) ) importedObjects.remove( obj ); importedObjects.addElement( obj ); nameSpaceChanged();
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: void importStatic(Class) Method name: void importObject(Object)
Number of AST nodes: 6 Number of AST nodes: 6
1
if ( importedStatic == null )
1
if ( importedObjects == null )
2
			importedStatic = new Vector();
2
			importedObjects = new Vector();
3
		// If it exists, remove it and add it at the end (avoid memory leak)
3
		// If it exists, remove it and add it at the end (avoid memory leak)
4
		if ( importedStatic.contains( clas ) )
4
		if ( importedObjects.contains( obj ) )
5
			importedStatic.remove( clas );
5
			importedObjects.remove( obj );
6
		importedStatic.addElement( clas );
6
		importedObjects.addElement( obj );
7
		nameSpaceChanged();
7
		nameSpaceChanged();
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 comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (importedStatic == null)
    1
    if (importedStatic == null)
    1
    if (importedObjects == null)
    Differences
    Expression1Expression2Difference
    importedStaticimportedObjectsVARIABLE_NAME_MISMATCH
    1
    if (importedObjects == null)
    2
    importedStatic = new Vector();
    2
    importedStatic = new Vector();
    2
    importedObjects = new Vector();
    Differences
    Expression1Expression2Difference
    importedStaticimportedObjectsVARIABLE_NAME_MISMATCH
    2
    importedObjects = new Vector();
    3
    if (importedStatic.contains(clas))
    3
    if (importedStatic.contains(clas))
    3
    if (importedObjects.contains(obj))
    Differences
    Expression1Expression2Difference
    clasobjVARIABLE_NAME_MISMATCH
    java.lang.Classjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    importedStaticimportedObjectsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Class of variable clas does not match with type java.lang.Object of variable obj
    • Make classes java.lang.Class and java.lang.Object extend a common superclass
    3
    if (importedObjects.contains(obj))
    4
    importedStatic.remove(clas);
    4
    importedStatic.remove(clas);
    4
    importedObjects.remove(obj);
    Differences
    Expression1Expression2Difference
    clasobjVARIABLE_NAME_MISMATCH
    java.lang.Classjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    importedStaticimportedObjectsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Class of variable clas does not match with type java.lang.Object of variable obj
    • Make classes java.lang.Class and java.lang.Object extend a common superclass
    4
    importedObjects.remove(obj);
    5
    importedStatic.addElement(clas);
    5
    importedStatic.addElement(clas);
    5
    importedObjects.addElement(obj);
    Differences
    Expression1Expression2Difference
    clasobjVARIABLE_NAME_MISMATCH
    java.lang.Classjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    importedStaticimportedObjectsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Class of variable clas does not match with type java.lang.Object of variable obj
    • Make classes java.lang.Class and java.lang.Object extend a common superclass
    5
    importedObjects.addElement(obj);
    6
    nameSpaceChanged();
    6
    nameSpaceChanged();
    Precondition Violations (3)
    Row Violation
    1Type java.lang.Class of variable clas does not match with type java.lang.Object of variable obj
    2Type java.lang.Class of variable clas does not match with type java.lang.Object of variable obj
    3Type java.lang.Class of variable clas does not match with type java.lang.Object of variable obj