ConnectionChangedEvent e = new ConnectionChangedEvent(this, account, status); // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == IConnectionChangedListener.class) { ((IConnectionChangedListener) listeners[i + 1]) .connectionChanged(e); } }
IMessageListSelectionEvent e = new MessageListSelectionEvent(this, messageIds); // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == IMessageListSelectionListener.class) { ((IMessageListSelectionListener) listeners[i + 1]).selectionChanged(e); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/plugins/org.columba.chat.altura/src/org/columba/chat/Connection.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/table/TableController.java
Method name: void fireSelectionChanged(IAccount, STATUS) Method name: void fireMessageListSelectionChangedEvent(List)
Number of AST nodes: 5 Number of AST nodes: 5
1
ConnectionChangedEvent e = new ConnectionChangedEvent(this, account, status);
2
		
1
IMessageListSelectionEvent e = new MessageListSelectionEvent(this, messageIds);
3
// Guaranteed to return a non-null array
2
    // Guaranteed to return a non-null array
4
		Object[] listeners = listenerList.getListenerList();
3
    Object[] listeners = listenerList.getListenerList();
5
		// Process the listeners last to first, notifying
4
    // Process the listeners last to first, notifying
6
		// those that are interested in this event
5
    // those that are interested in this event
7
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
6
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
8
			if (listeners[i] == IConnectionChangedListener.class) {
7
      if (listeners[i] == I
9
				((IConnectionChanged
8
MessageListSelectionListener.class) {
10
Listener) listeners[i + 1])
9
        ((IMessageListSelectionListener) listeners[i + 1])
11
						.connectionChanged(e);
10
.selectionChanged(e);
12
			}
13
		
11
      }
14
}
12
    }
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.5
Clones locationClones are in different classes
Number of node comparisons9
  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 fragment1
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                  
    1
    IMessageListSelectionEvent e = new MessageListSelectionEvent(this, messageIds);
    1
    ConnectionChangedEvent e = new ConnectionChangedEvent(this, account, status);
    1
    ConnectionChangedEvent e = new ConnectionChangedEvent(this, account, status);
    Preondition Violations
    Unmatched statement ConnectionChangedEvent e=new ConnectionChangedEvent(this,account,status); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                            
    2
    Object[] listeners = listenerList.getListenerList();
    2
    Object[] listeners = listenerList.getListenerList();
    3
    for (int i = listeners.length - 2; i >= 0; i -= 2)
    3
    for (int i = listeners.length - 2; i >= 0; i -= 2)
    4
    if (listeners[i] == IConnectionChangedListener.class)
    4
    if (listeners[i] == IConnectionChangedListener.class)
    4
    if (listeners[i] == IMessageListSelectionListener.class)
    Differences
    Expression1Expression2Difference
    IConnectionChangedListener.classIMessageListSelectionListener.classLITERAL_VALUE_MISMATCH
    4
    if (listeners[i] == IMessageListSelectionListener.class)
    5
    ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e);
    5
    ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e);
    5
    ((IMessageListSelectionListener)listeners[i + 1]).selectionChanged(e);
    Differences
    Expression1Expression2Difference
    org.columba.chat.conn.api.ConnectionChangedEventorg.columba.mail.gui.table.IMessageListSelectionEventVARIABLE_TYPE_MISMATCH
    connectionChangedselectionChangedMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.chat.conn.api.IConnectionChangedListenerorg.columba.mail.gui.table.IMessageListSelectionListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.chat.conn.api.ConnectionChangedEvent of variable e does not match with type org.columba.mail.gui.table.IMessageListSelectionEvent of variable e
    • Make classes org.columba.chat.conn.api.ConnectionChangedEvent and org.columba.mail.gui.table.IMessageListSelectionEvent extend a common superclass
    Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IMessageListSelectionListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) is a void method call, and thus it cannot be parameterized
    Expression ((IMessageListSelectionListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    Expression (IConnectionChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IMessageListSelectionListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.chat.conn.api.IConnectionChangedListener does not match with type org.columba.mail.gui.table.IMessageListSelectionListener
    • Make classes org.columba.chat.conn.api.IConnectionChangedListener and org.columba.mail.gui.table.IMessageListSelectionListener extend a common superclass
    5
    ((IMessageListSelectionListener)listeners[i + 1]).selectionChanged(e);
    Precondition Violations (10)
    Row Violation
    1Unmatched statement ConnectionChangedEvent e=new ConnectionChangedEvent(this,account,status); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type org.columba.chat.conn.api.ConnectionChangedEvent of variable e does not match with type org.columba.mail.gui.table.IMessageListSelectionEvent of variable e
    3Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression ((IMessageListSelectionListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) is a void method call, and thus it cannot be parameterized
    6Expression ((IMessageListSelectionListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    7Expression (IConnectionChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression (IMessageListSelectionListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type org.columba.chat.conn.api.IConnectionChangedListener does not match with type org.columba.mail.gui.table.IMessageListSelectionListener
    10The refactoring of the clones is infeasible, because classes org.columba.chat.Connection and org.columba.mail.gui.table.TableController do not have a common superclass