BeanShellTestElement o = (BeanShellTestElement) super.clone(); o.init(); return o;
while (i.hasNext()) { JavaSampler sampler = (JavaSampler) i.next(); sampler.releaseJavaClient(); i.remove(); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/util/BeanShellTestElement.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
Method name: Object clone() Method name: void testEnded()
Number of AST nodes: 3 Number of AST nodes: 4
1
BeanShellTestElement o = (BeanShellTestElement) super.clone();
2
        o.init();
3
       return o;
1
while (i.hasNext()) {
2
				JavaSampler sampler = (JavaSampler) i.next();
3
				sampler.releaseJavaClient();
4
				i.remove();
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 having the same super class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    BeanShellTestElement o = (BeanShellTestElement)super.clone();
    1
    BeanShellTestElement o = (BeanShellTestElement)super.clone();
    5
    JavaSampler sampler = (JavaSampler)i.next();
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.util.BeanShellTestElementorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    osamplerVARIABLE_NAME_MISMATCH
    org.apache.jmeter.util.BeanShellTestElementorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.util.BeanShellTestElementorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    super.clone()i.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (JavaSampler)i.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression i.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call BeanShellTestElement o=(BeanShellTestElement)super.clone(); cannot be extracted from method
    5
    JavaSampler sampler = (JavaSampler)i.next();
    2
    o.init();
    2
    o.init();
    6
    sampler.releaseJavaClient();
    Differences
    Expression1Expression2Difference
    initreleaseJavaClientMETHOD_INVOCATION_NAME_MISMATCH
    osamplerVARIABLE_NAME_MISMATCH
    org.apache.jmeter.util.BeanShellTestElementorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression o.init() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method init
    Expression sampler.releaseJavaClient() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method releaseJavaClient
    Expression o.init() is a void method call, and thus it cannot be parameterized
    Expression sampler.releaseJavaClient() is a void method call, and thus it cannot be parameterized
    Expression o cannot be unified with expression sampler , because common superclass org.apache.jmeter.testelement.AbstractTestElement does not declare member(s) private void init() , private void releaseJavaClient()
    6
    sampler.releaseJavaClient();
    3
    return o;
    3
    return o;
    Preondition Violations
    Unmatched statement return o; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return o;
                            
                                
    7
    i.remove();
    Precondition Violations (11)
    Row Violation
    1Expression (JavaSampler)i.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression i.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Super method call BeanShellTestElement o=(BeanShellTestElement)super.clone(); cannot be extracted from method
    4Expression o.init() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression sampler.releaseJavaClient() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression o.init() is a void method call, and thus it cannot be parameterized
    7Expression sampler.releaseJavaClient() is a void method call, and thus it cannot be parameterized
    8Expression o cannot be unified with expression sampler , because common superclass org.apache.jmeter.testelement.AbstractTestElement does not declare member(s) private void init() , private void releaseJavaClient()
    9Unmatched statement return o; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched return o;
    11Clone fragment #1 returns variables o , while Clone fragment #2 returns variables