String key = elementClass.getName(); ImageIcon icon = (ImageIcon) (enabled ? ICON_MAP.get(key) : DISABLED_ICON_MAP.get(key)); if (icon != null) { return icon; } if (elementClass.getSuperclass() != null) { return getIcon(elementClass.getSuperclass(), enabled); } return null;
String key = elementClass.getName(); JComponent gui = (JComponent) GUI_MAP.get(key); if (gui != null) { return gui; } if (elementClass.getSuperclass() != null) { return getGUI(elementClass.getSuperclass()); } return null;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/GUIFactory.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/GUIFactory.java
Method name: ImageIcon getIcon(Class, boolean) Method name: JComponent getGUI(Class)
Number of AST nodes: 7 Number of AST nodes: 7
1
String key = elementClass.getName();
1
String key = elementClass.getName();
2
		ImageIcon icon = (ImageIcon) (enabled ? ICON_MAP.get(key) : DISABLED_ICON_MAP.get(key));
2
		JComponent gui = (JComponent) GUI_MAP.get(key);
3
		if (icon != null) {
3
		if (gui != null) {
4
			return icon;
4
			return gui;
5
		}
5
		}
6
		if (elementClass.getSuperclass() != null) {
6
		if (elementClass.getSuperclass() != null) {
7
			return getIcon(elementClass.getSuperclass(), enabled);
7
			return getGUI(elementClass.getSuperclass());
8
		}
8
		}
9
		return null;
9
		return null;
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 declared in the same class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String key = elementClass.getName();
    1
    String key = elementClass.getName();
                                                                                                  
    2
    JComponent gui = (JComponent)GUI_MAP.get(key);
    Preondition Violations
    Unmatched statement JComponent gui=(JComponent)GUI_MAP.get(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    JComponent gui = (JComponent)GUI_MAP.get(key);
    2
    ImageIcon icon = (ImageIcon)(enabled ? ICON_MAP.get(key) : DISABLED_ICON_MAP.get(key));
    2
    ImageIcon icon = (ImageIcon)(enabled ? ICON_MAP.get(key) : DISABLED_ICON_MAP.get(key));
    Preondition Violations
    Unmatched statement ImageIcon icon=(ImageIcon)(enabled ? ICON_MAP.get(key) : DISABLED_ICON_MAP.get(key)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                    
    3
    if (icon != null)
    3
    if (icon != null)
    3
    if (gui != null)
    Differences
    Expression1Expression2Difference
    iconguiVARIABLE_NAME_MISMATCH
    javax.swing.ImageIconjavax.swing.JComponentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type javax.swing.ImageIcon of variable icon does not match with type javax.swing.JComponent of variable gui
    • Make classes javax.swing.ImageIcon and javax.swing.JComponent extend a common superclass
    3
    if (gui != null)
                                
    4
    return gui;
    Preondition Violations
    Unmatched return gui;
    4
    return gui;
    4
    return icon;
    4
    return icon;
    Preondition Violations
    Unmatched return icon;
                                  
    5
    if (elementClass.getSuperclass() != null)
    5
    if (elementClass.getSuperclass() != null)
                                                                                                  
    6
    return getGUI(elementClass.getSuperclass());
    Preondition Violations
    Unmatched statement return getGUI(elementClass.getSuperclass()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return getGUI(elementClass.getSuperclass());
    6
    return getGUI(elementClass.getSuperclass());
    6
    return getIcon(elementClass.getSuperclass(), enabled);
    6
    return getIcon(elementClass.getSuperclass(), enabled);
    Preondition Violations
    Unmatched statement return getIcon(elementClass.getSuperclass(),enabled); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return getIcon(elementClass.getSuperclass(),enabled);
                                                                                                                    
    7
    return null;
    7
    return null;
    Precondition Violations (9)
    Row Violation
    1Unmatched statement JComponent gui=(JComponent)GUI_MAP.get(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement ImageIcon icon=(ImageIcon)(enabled ? ICON_MAP.get(key) : DISABLED_ICON_MAP.get(key)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type javax.swing.ImageIcon of variable icon does not match with type javax.swing.JComponent of variable gui
    4Unmatched return gui;
    5Unmatched return icon;
    6Unmatched statement return getGUI(elementClass.getSuperclass()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched return getGUI(elementClass.getSuperclass());
    8Unmatched statement return getIcon(elementClass.getSuperclass(),enabled); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched return getIcon(elementClass.getSuperclass(),enabled);