JMeterGUIComponent guiComp = guiPackage.getCurrentGui(); if (guiComp instanceof Clearable){ ((Clearable) guiComp).clearData(); }
if (node != null) { Object usrobj = node.getUserObject(); if (usrobj instanceof MonitorModel) { GRAPH.updateGui((MonitorModel) usrobj); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/Clear.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/MonitorPerformancePanel.java
Method name: void doAction(ActionEvent) Method name: void addSample(MonitorModel)
Number of AST nodes: 3 Number of AST nodes: 4
1
JMeterGUIComponent guiComp = guiPackage.getCurrentGui
1
if (node != null) {
2
();
2
			Object usrobj = node.getUserObject();
3
			if (guiComp instanceof Clearable){
3
			if (usrobj instanceof 
4
				((Clearable) guiComp).clearData();
4
MonitorModel) {
5
				GRAPH.updateGui((MonitorModel) usrobj);
5
				
6
			}
6
			}
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.2
Clones locationClones are in different classes
Number of node comparisons6
  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)6.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
    4
    JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
    Preondition Violations
    Unmatched statement JMeterGUIComponent guiComp=guiPackage.getCurrentGui(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                      
                                                                                
    9
    Object usrobj = node.getUserObject();
    5
    if (guiComp instanceof Clearable)
    5
    if (guiComp instanceof Clearable)
    10
    if (usrobj instanceof MonitorModel)
    Differences
    Expression1Expression2Difference
    guiCompusrobjVARIABLE_NAME_MISMATCH
    org.apache.jmeter.gui.JMeterGUIComponentjava.lang.ObjectVARIABLE_TYPE_MISMATCH
    org.apache.jmeter.samplers.Clearableorg.apache.jmeter.visualizers.MonitorModelSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.gui.JMeterGUIComponent of variable guiComp does not match with type java.lang.Object of variable usrobj
    • Make classes org.apache.jmeter.gui.JMeterGUIComponent and java.lang.Object extend a common superclass
    Expression guiComp instanceof Clearable cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression usrobj instanceof MonitorModel cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (usrobj instanceof MonitorModel)
    6
    ((Clearable)guiComp).clearData();
    6
    ((Clearable)guiComp).clearData();
    11
    GRAPH.updateGui((MonitorModel)usrobj);
    Differences
    Expression1Expression2Difference
    clearDataupdateGuiMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.jmeter.samplers.Clearableorg.apache.jmeter.visualizers.MonitorGraphSUBCLASS_TYPE_MISMATCH
    ((Clearable)guiComp)GRAPHTYPE_COMPATIBLE_REPLACEMENT
    ((Clearable)guiComp).clearData()GRAPH.updateGui((MonitorModel)usrobj)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression ((Clearable)guiComp).clearData() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression GRAPH.updateGui((MonitorModel)usrobj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((Clearable)guiComp).clearData() is a void method call, and thus it cannot be parameterized
    Expression GRAPH.updateGui((MonitorModel)usrobj) is a void method call, and thus it cannot be parameterized
    Expression ((Clearable)guiComp) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((Clearable)guiComp) cannot be unified with expression GRAPH , because common superclass org.apache.jmeter.samplers.Clearable does not declare member(s) public void updateGui(org.apache.jmeter.visualizers.MonitorModel)
    Expression ((Clearable)guiComp).clearData() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression GRAPH.updateGui((MonitorModel)usrobj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((Clearable)guiComp).clearData() is a void method call, and thus it cannot be parameterized
    Expression GRAPH.updateGui((MonitorModel)usrobj) is a void method call, and thus it cannot be parameterized
    11
    GRAPH.updateGui((MonitorModel)usrobj);
    Precondition Violations (15)
    Row Violation
    1Unmatched statement JMeterGUIComponent guiComp=guiPackage.getCurrentGui(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type org.apache.jmeter.gui.JMeterGUIComponent of variable guiComp does not match with type java.lang.Object of variable usrobj
    3Expression guiComp instanceof Clearable cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression usrobj instanceof MonitorModel cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ((Clearable)guiComp).clearData() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression GRAPH.updateGui((MonitorModel)usrobj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression ((Clearable)guiComp).clearData() is a void method call, and thus it cannot be parameterized
    8Expression GRAPH.updateGui((MonitorModel)usrobj) is a void method call, and thus it cannot be parameterized
    9Expression ((Clearable)guiComp) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression ((Clearable)guiComp) cannot be unified with expression GRAPH , because common superclass org.apache.jmeter.samplers.Clearable does not declare member(s) public void updateGui(org.apache.jmeter.visualizers.MonitorModel)
    11Expression ((Clearable)guiComp).clearData() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression GRAPH.updateGui((MonitorModel)usrobj) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression ((Clearable)guiComp).clearData() is a void method call, and thus it cannot be parameterized
    14Expression GRAPH.updateGui((MonitorModel)usrobj) is a void method call, and thus it cannot be parameterized
    15The refactoring of the clones is infeasible, because classes org.apache.jmeter.gui.action.Clear and org.apache.jmeter.visualizers.MonitorPerformancePanel do not have a common superclass