protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) { if (action != null) { HashSet<ActionListener> listenerSet = postActionListeners.get(action.getName()); if (listenerSet != null && listenerSet.size() > 0) { Object[] listeners = listenerSet.toArray(); for (int i = 0; i < listeners.length; i++) { ((ActionListener) listeners[i]).actionPerformed(e); } } } }
protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) { if (action != null) { Set<ActionListener> listenerSet = postActionListeners.get(action.getName()); if (listenerSet != null && listenerSet.size() > 0) { ActionListener[] listeners = listenerSet.toArray(new ActionListener[listenerSet.size()]); for (ActionListener listener : listeners) { listener.actionPerformed(e); } } } }
Clone fragments detected by clone detection tool
File path: /apache-jmeter-2.11/src/reports/org/apache/jmeter/report/gui/action/ReportActionRouter.java File path: /apache-jmeter-2.11/src/core/org/apache/jmeter/gui/action/ActionRouter.java
Method name: void postActionPerformed(Class, ActionEvent) Method name: void postActionPerformed(Class, ActionEvent)
Number of AST nodes: 2 Number of AST nodes: 2
1
protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) {
1
protected void postActionPerformed(Class<? extends Command> action, ActionEvent e) {
2
        if (action != null) {
2
        if (action != null) {
3
            HashSet<ActionListener> listenerSet = postActionListeners.get(action.getName());
3
            Set<ActionListener> listenerSet = postActionListeners.get(action.getName());
4
            if (listenerSet != null && listenerSet.size() > 0) {
4
            if (listenerSet != null && listenerSet.size() > 0) {
5
                Object[] listeners = listenerSet.toArray();
5
                ActionListener[] listeners = listenerSet.toArray(new ActionListener[listenerSet.size()]);
6
                for (int i = 0; i < listeners.length; i++) {
6
                for (ActionListener listener : listeners) {
7
                    ((ActionListener) listeners[i]).actionPerformed(e);
7
                    listener.actionPerformed(e);
8
                }
8
                }
9
            }
9
            }
10
        }
10
        }
11
    }
11
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.600
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    for (int i = 0; i < listeners.length; i++)
    5
    for (int i = 0; i < listeners.length; i++)
    5
    for (ActionListener listener : listeners)
    Differences
    Expression1Expression2Difference
    java.lang.Object[]java.awt.event.ActionListener[]VARIABLE_TYPE_MISMATCH
    java.lang.Object[]java.awt.event.ActionListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object[] of variable listeners does not match with type java.awt.event.ActionListener[] of variable listeners
    • Make classes java.lang.Object[] and java.awt.event.ActionListener[] extend a common superclass
    Type java.lang.Object[] of variable listeners does not match with type java.awt.event.ActionListener[] of variable listeners
    • Make classes java.lang.Object[] and java.awt.event.ActionListener[] extend a common superclass
    5
    for (ActionListener listener : listeners)
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    6
    listener.actionPerformed(e);
    Differences
    Expression1Expression2Difference
    ((ActionListener)listeners[i])listenerTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ((ActionListener)listeners[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression listener cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    listener.actionPerformed(e);
    Precondition Violations (4)
    Row Violation
    1Type java.lang.Object[] of variable listeners does not match with type java.awt.event.ActionListener[] of variable listeners
    2Type java.lang.Object[] of variable listeners does not match with type java.awt.event.ActionListener[] of variable listeners
    3Expression ((ActionListener)listeners[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression listener cannot be parameterized, because it has dependencies to/from statements that will be extracted