UserParameters up = (UserParameters) super.clone(); up.lock = lock; // ensure that clones share the same lock object return up;
for (int counter = 0; counter < order.length; counter++) { TestElement sampler = test.next(); assertNotNull(sampler); assertEquals("Counter: " + counter, order[counter], sampler.getName()); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/modifiers/UserParameters.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/control/TestThroughputController.java
Method name: Object clone() Method name: void testByNumber()
Number of AST nodes: 3 Number of AST nodes: 4
1
UserParameters up = (UserParameters) super.clone();
2
		up.lock = lock; // ensure that clones share the same lock object
3
		return up;
1
for (int counter = 0; counter < order.length; counter++) {
2
				TestElement sampler = test.next();
3
				assertNotNull(sampler);
4
				assertEquals("Counter: " + counter, order[counter], sampler.getName());
5
			}
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.0
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    UserParameters up = (UserParameters)super.clone();
    1
    UserParameters up = (UserParameters)super.clone();
    22
    TestElement sampler = test.next();
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.modifiers.UserParametersorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    upsamplerVARIABLE_NAME_MISMATCH
    org.apache.jmeter.modifiers.UserParametersorg.apache.jmeter.testelement.TestElementSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.modifiers.UserParametersorg.apache.jmeter.samplers.SamplerSUBCLASS_TYPE_MISMATCH
    (UserParameters)super.clone()test.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call UserParameters up=(UserParameters)super.clone(); cannot be extracted from method
    22
    TestElement sampler = test.next();
    2
    up.lock = lock;
    2
    up.lock = lock;
    Preondition Violations
    Unmatched statement up.lock=lock; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
    3
    return up;
    3
    return up;
    Preondition Violations
    Unmatched statement return up; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return up;
                              
                                                          
    23
    assertNotNull(sampler);
    Preondition Violations
    Unmatched statement assertNotNull(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23
    assertNotNull(sampler);
                                                                                                                                                      
    24
    assertEquals("Counter: " + counter, order[counter], sampler.getName());
    Preondition Violations
    Unmatched statement assertEquals("Counter: " + counter,order[counter],sampler.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    24
    assertEquals("Counter: " + counter, order[counter], sampler.getName());
    Precondition Violations (9)
    Row Violation
    1Expression test.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Super method call UserParameters up=(UserParameters)super.clone(); cannot be extracted from method
    3Unmatched statement up.lock=lock; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement return up; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched return up;
    6Unmatched statement assertNotNull(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement assertEquals("Counter: " + counter,order[counter],sampler.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Clone fragment #1 returns variable up with type org.apache.jmeter.modifiers.UserParameters , while Clone fragment #2 returns variable sampler with type org.apache.jmeter.testelement.TestElement
    9The refactoring of the clones is infeasible, because classes org.apache.jmeter.modifiers.UserParameters and org.apache.jmeter.control.TestThroughputController do not have a common superclass