if (instance == null) { synchronized (TagManager.class) { if (instance == null) instance = new TagManager(); } } return instance;
if (instance == null) { synchronized (AssociationStore.class) { if (instance == null) instance = new AssociationStore(); } } return instance;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/tagging/TagManager.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/association/AssociationStore.java
Method name: TagManager getInstance() Method name: AssociationStore getInstance()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (instance == null) {
1
if (instance == null) {
2
			synchronized (TagManager.class) {
2
			synchronized (AssociationStore.class) {
3
				if (instance == null)
3
				if (instance == null)
4
					instance = new TagManager();
4
					instance = new AssociationStore();
5
			}
5
			}
6
		}
6
		}
7
		return instance;
7
		return instance;
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.5
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (instance == null)
    1
    if (instance == null)
    1
    if (instance == null)
    Differences
    Expression1Expression2Difference
    org.columba.core.tagging.TagManagerorg.columba.core.association.AssociationStoreVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.tagging.TagManager of variable instance does not match with type org.columba.core.association.AssociationStore of variable instance
    • Make classes org.columba.core.tagging.TagManager and org.columba.core.association.AssociationStore extend a common superclass
    1
    if (instance == null)
    2
    synchronized (TagManager.class)
    2
    synchronized (TagManager.class)
    2
    synchronized (AssociationStore.class)
    Differences
    Expression1Expression2Difference
    TagManager.classAssociationStore.classLITERAL_VALUE_MISMATCH
    2
    synchronized (AssociationStore.class)
    3
    if (instance == null)
    3
    if (instance == null)
    3
    if (instance == null)
    Differences
    Expression1Expression2Difference
    org.columba.core.tagging.TagManagerorg.columba.core.association.AssociationStoreVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.core.tagging.TagManager of variable instance does not match with type org.columba.core.association.AssociationStore of variable instance
    • Make classes org.columba.core.tagging.TagManager and org.columba.core.association.AssociationStore extend a common superclass
    3
    if (instance == null)
                                                                          
    4
    instance = new AssociationStore();
    Preondition Violations
    Unmatched statement instance=new AssociationStore(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    instance = new AssociationStore();
    4
    instance = new TagManager();
    4
    instance = new TagManager();
    Preondition Violations
    Unmatched statement instance=new TagManager(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement instance=new TagManager(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                              
                                          
    5
    return instance;
    Preondition Violations
    Unmatched return instance;
    5
    return instance;
    5
    return instance;
    5
    return instance;
    Preondition Violations
    Unmatched return instance;
                                          
    Precondition Violations (8)
    Row Violation
    1Type org.columba.core.tagging.TagManager of variable instance does not match with type org.columba.core.association.AssociationStore of variable instance
    2Type org.columba.core.tagging.TagManager of variable instance does not match with type org.columba.core.association.AssociationStore of variable instance
    3Unmatched statement instance=new AssociationStore(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement instance=new TagManager(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement instance=new TagManager(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Unmatched return instance;
    7Unmatched return instance;
    8The refactoring of the clones is infeasible, because classes org.columba.core.tagging.TagManager and org.columba.core.association.AssociationStore do not have a common superclass