IMessageSelectionEvent e = new MessageSelectionEvent(this, folder, messageId); // 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] == IMessageSelectionListener.class) { ((IMessageSelectionListener) listeners[i + 1]).selectionChanged(e); } }
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); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/MessageController.java File path: /columba-1.4-src/plugins/org.columba.chat.altura/src/org/columba/chat/Connection.java
Method name: void fireMessageSelectionChangedEvent(IMailbox, String) Method name: void fireSelectionChanged(IAccount, STATUS)
Number of AST nodes: 5 Number of AST nodes: 5
1
IMessageSelectionEvent e = new MessageSelectionEvent(this, folder, messageId);
1
ConnectionChangedEvent e = new ConnectionChangedEvent(this, account, status);
2
		// Guaranteed to return a non-null array
2
		// Guaranteed to return a non-null array
3
		Object[] listeners = listenerList.getListenerList();
3
		Object[] listeners = listenerList.getListenerList();
4
		// Process the listeners last to first, notifying
4
		// Process the listeners last to first, notifying
5
		// those that are interested in this event
5
		// those that are interested in this event
6
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
6
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
7
			if (listeners[i] == IMessageSelectionListener.class) {
7
			if (listeners[i] == IConnectionChangedListener.class) {
8
				((IMessageSelectionListener) listeners[i + 1]).sel
8
				((IConnectionChangedListener) listeners[i + 1])
9
ectionChanged(e);
9
						.connectionChanged(e);
10
			}
10
			}
11
		}
11
		}
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 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)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                            
    1
    ConnectionChangedEvent e = new ConnectionChangedEvent(this, account, status);
    1
    IMessageSelectionEvent e = new MessageSelectionEvent(this, folder, messageId);
                                                                                                                                                              
    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] == IMessageSelectionListener.class)
    4
    if (listeners[i] == IConnectionChangedListener.class)
    5
    ((IMessageSelectionListener)listeners[i + 1]).selectionChanged(e);
    5
    ((IMessageSelectionListener)listeners[i + 1]).selectionChanged(e);
    5
    ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e);
    Differences
    Expression1Expression2Difference
    selectionChangedconnectionChangedMETHOD_INVOCATION_NAME_MISMATCH
    org.columba.mail.gui.message.IMessageSelectionEventorg.columba.chat.conn.api.ConnectionChangedEventVARIABLE_TYPE_MISMATCH
    org.columba.mail.gui.message.IMessageSelectionListenerorg.columba.chat.conn.api.IConnectionChangedListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((IMessageSelectionListener)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) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IMessageSelectionListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) is a void method call, and thus it cannot be parameterized
    Type org.columba.mail.gui.message.IMessageSelectionEvent of variable e does not match with type org.columba.chat.conn.api.ConnectionChangedEvent of variable e
    • Make classes org.columba.mail.gui.message.IMessageSelectionEvent and org.columba.chat.conn.api.ConnectionChangedEvent extend a common superclass
    Expression (IMessageSelectionListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IConnectionChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.columba.mail.gui.message.IMessageSelectionListener of variable (IMessageSelectionListener)listeners[i + 1] does not match with type org.columba.chat.conn.api.IConnectionChangedListener of variable (IConnectionChangedListener)listeners[i + 1]
    • Make classes org.columba.mail.gui.message.IMessageSelectionListener and org.columba.chat.conn.api.IConnectionChangedListener extend a common superclass
    5
    ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e);
    Precondition Violations (8)
    Row Violation
    1Expression ((IMessageSelectionListener)listeners[i + 1]).selectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((IMessageSelectionListener)listeners[i + 1]).selectionChanged(e) is a void method call, and thus it cannot be parameterized
    4Expression ((IConnectionChangedListener)listeners[i + 1]).connectionChanged(e) is a void method call, and thus it cannot be parameterized
    5Type org.columba.mail.gui.message.IMessageSelectionEvent of variable e does not match with type org.columba.chat.conn.api.ConnectionChangedEvent of variable e
    6Expression (IMessageSelectionListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (IConnectionChangedListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.columba.mail.gui.message.IMessageSelectionListener of variable (IMessageSelectionListener)listeners[i + 1] does not match with type org.columba.chat.conn.api.IConnectionChangedListener of variable (IConnectionChangedListener)listeners[i + 1]