if (subNode.isEnabled()) { TestElement element = (TestElement) subNode.getUserObject(); if (myClass.isInstance(element)) { if (ascending) { elements.addFirst(element); } else { elements.add(element); } } }
TestPlan tp = (TestPlan) element; Arguments args = tp.getArguments(); if (myClass.isInstance(args)) { if (ascending) { elements.addFirst(args); } else { elements.add(args); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/ProxyControl.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Method name: Collection findApplicableElements(JMeterTreeNode, Class, boolean) Method name: Collection findApplicableElements(JMeterTreeNode, Class, boolean)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (subNode.isEnabled()) {
2
				TestElement element = (TestElement) subNode.getUserObject
1
TestPlan tp = (TestPlan) element;
3
();
2
						Arguments args = tp.getArguments();
4
				if (myClass.isInstance(element)) {
3
						if (myClass.isInstance(args)) {
5
					if (ascending) {
4
							if (ascending) {
6
						elements.addFirst(element);
5
								elements.addFirst(args);
7
					} else {
6
							} else {
8
						elements.add(element);
7
								elements.add(args);
9
					}
8
							}
10
				}
9
				
11
			}
10
		}
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 in the same method
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    TestElement element = (TestElement)subNode.getUserObject();
    7
    TestElement element = (TestElement)subNode.getUserObject();
    Preondition Violations
    Unmatched statement TestElement element=(TestElement)subNode.getUserObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
                                                                        
    24
    TestPlan tp = (TestPlan)element;
                                                                              
    25
    Arguments args = tp.getArguments();
    Preondition Violations
    Unmatched statement Arguments args=tp.getArguments(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    25
    Arguments args = tp.getArguments();
    8
    if (myClass.isInstance(element))
    8
    if (myClass.isInstance(element))
    26
    if (myClass.isInstance(args))
    Differences
    Expression1Expression2Difference
    elementargsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.testelement.TestElementorg.apache.jmeter.config.ArgumentsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.testelement.TestElement of variable element does not match with type org.apache.jmeter.config.Arguments of variable args
    • Make classes org.apache.jmeter.testelement.TestElement and org.apache.jmeter.config.Arguments extend a common superclass
    26
    if (myClass.isInstance(args))
    9
    if (ascending)
    27
    if (ascending)
    10
    elements.addFirst(element);
    10
    elements.addFirst(element);
    28
    elements.addFirst(args);
    Differences
    Expression1Expression2Difference
    elementargsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.testelement.TestElementorg.apache.jmeter.config.ArgumentsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.testelement.TestElement of variable element does not match with type org.apache.jmeter.config.Arguments of variable args
    • Make classes org.apache.jmeter.testelement.TestElement and org.apache.jmeter.config.Arguments extend a common superclass
    28
    elements.addFirst(args);
    else
    else
    11
    elements.add(element);
    11
    elements.add(element);
    29
    elements.add(args);
    Differences
    Expression1Expression2Difference
    elementargsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.testelement.TestElementorg.apache.jmeter.config.ArgumentsVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.testelement.TestElement of variable element does not match with type org.apache.jmeter.config.Arguments of variable args
    • Make classes org.apache.jmeter.testelement.TestElement and org.apache.jmeter.config.Arguments extend a common superclass
    29
    elements.add(args);
    Precondition Violations (5)
    Row Violation
    1Unmatched statement TestElement element=(TestElement)subNode.getUserObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Arguments args=tp.getArguments(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.apache.jmeter.testelement.TestElement of variable element does not match with type org.apache.jmeter.config.Arguments of variable args
    4Type org.apache.jmeter.testelement.TestElement of variable element does not match with type org.apache.jmeter.config.Arguments of variable args
    5Type org.apache.jmeter.testelement.TestElement of variable element does not match with type org.apache.jmeter.config.Arguments of variable args