comp = (TestBeanGUI) testBeanGUIs.get(testClass); if (comp == null) { comp = new TestBeanGUI(testClass); testBeanGUIs.put(testClass, comp); }
synchronized (accumulators) { myTotals = (Totals) accumulators.get(myName); if (myTotals == null){ myTotals = new Totals(); accumulators.put(myName, myTotals); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/GuiPackage.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/reporters/Summariser.java
Method name: JMeterGUIComponent getGuiFromCache(Class, Class) Method name: void threadStarted()
Number of AST nodes: 4 Number of AST nodes: 5
1
comp = (TestBeanGUI) testBeanGUIs.get(testClass);
2
			if (comp
1
synchronized (accumulators) {
2
            myTotals = (Totals) accumulators.get(myName);
3
 == null) {
3
            if (myTotals == null){
4
				comp = new TestBeanGUI(testClass);
5
				testBeanGUIs.put(testClass, comp);
6
			
4
                myTotals = new Totals();
5
                accumulators.put(myName, myTotals);
6
            }
7
}
7
        }
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.1
Clones locationClones are in different classes
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                              
    3
    myTotals = (Totals)accumulators.get(myName);
    Preondition Violations
    Unmatched statement myTotals=(Totals)accumulators.get(myName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    myTotals = (Totals)accumulators.get(myName);
    3
    comp = (TestBeanGUI)testBeanGUIs.get(testClass);
    3
    comp = (TestBeanGUI)testBeanGUIs.get(testClass);
    Preondition Violations
    Unmatched statement comp=(TestBeanGUI)testBeanGUIs.get(testClass); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                      
    4
    if (comp == null)
    4
    if (comp == null)
    4
    if (myTotals == null)
    Differences
    Expression1Expression2Difference
    compmyTotalsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.gui.JMeterGUIComponentorg.apache.jmeter.reporters.Summariser.TotalsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.gui.JMeterGUIComponent of variable comp does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    • Make classes org.apache.jmeter.gui.JMeterGUIComponent and org.apache.jmeter.reporters.Summariser.Totals extend a common superclass
    4
    if (myTotals == null)
                                                      
    5
    myTotals = new Totals();
    Preondition Violations
    Unmatched statement myTotals=new Totals(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    myTotals = new Totals();
    5
    comp = new TestBeanGUI(testClass);
    5
    comp = new TestBeanGUI(testClass);
    Preondition Violations
    Unmatched statement comp=new TestBeanGUI(testClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    6
    testBeanGUIs.put(testClass, comp);
    6
    testBeanGUIs.put(testClass, comp);
    6
    accumulators.put(myName, myTotals);
    Differences
    Expression1Expression2Difference
    testClassmyNameVARIABLE_NAME_MISMATCH
    java.lang.Classjava.lang.StringVARIABLE_TYPE_MISMATCH
    compmyTotalsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.gui.JMeterGUIComponentorg.apache.jmeter.reporters.Summariser.TotalsVARIABLE_TYPE_MISMATCH
    testBeanGUIsaccumulatorsVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.HashtableSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class of variable testClass does not match with type java.lang.String of variable myName
    • Make classes java.lang.Class and java.lang.String extend a common superclass
    Type org.apache.jmeter.gui.JMeterGUIComponent of variable comp does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    • Make classes org.apache.jmeter.gui.JMeterGUIComponent and org.apache.jmeter.reporters.Summariser.Totals extend a common superclass
    6
    accumulators.put(myName, myTotals);
    Precondition Violations (8)
    Row Violation
    1Unmatched statement myTotals=(Totals)accumulators.get(myName); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement comp=(TestBeanGUI)testBeanGUIs.get(testClass); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Type org.apache.jmeter.gui.JMeterGUIComponent of variable comp does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    4Unmatched statement myTotals=new Totals(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement comp=new TestBeanGUI(testClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type java.lang.Class of variable testClass does not match with type java.lang.String of variable myName
    7Type org.apache.jmeter.gui.JMeterGUIComponent of variable comp does not match with type org.apache.jmeter.reporters.Summariser.Totals of variable myTotals
    8The refactoring of the clones is infeasible, because classes org.apache.jmeter.gui.GuiPackage and org.apache.jmeter.reporters.Summariser do not have a common superclass