Object[] listeners = _listeners.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event. SQLPanelEvent evt = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ISQLPanelListener.class) { // Lazily create the event: if (evt == null) { evt = new SQLPanelEvent(_session, this); } ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt); } }
Object[] listeners = _listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event. UIFactoryComponentCreatedEvent evt = null; for (int i = listeners.length - 2; i >= 0; i-=2 ) { if (listeners[i] == IUIFactoryListener.class) { // Lazily create the event. if (evt == null) { evt = new UIFactoryComponentCreatedEvent(this, tabPnl); } ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SQLPanel.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/builders/UIFactory.java
Method name: void fireSQLEntryAreaInstalled() Method name: void fireTabbedPaneCreated(JTabbedPane)
Number of AST nodes: 7 Number of AST nodes: 7
1
Object[] listeners = _listeners.getListenerList();
1
Object[] listeners = _listenerList.getListenerList();
2
		// Process the listeners last to first, notifying
2
		// Process the listeners last to first, notifying
3
		// those that are interested in this event.
3
		// those that are interested in this event.
4
		SQLPanelEvent evt = null;
4
		UIFactoryComponentCreatedEvent evt = null;
5
		for (int i = listeners.length - 2; i >= 0; i -= 2)
5
		for (int i = listeners.length - 2; i >= 0; i-=2 )
6
		{
6
		{
7
			if (listeners[i] == ISQLPanelListener.class)
7
			if (listeners[i] == IUIFactoryListener.class)
8
			{
8
			{
9
				// Lazily create the event:
9
				// Lazily create the event.
10
				if (evt == null)
10
				if (evt == null)
11
				{
11
				{
12
					evt = new SQLPanelEvent(_session, this);
12
					evt = new UIFactoryComponentCreatedEvent(this, tabPnl);
13
				}
13
				}
14
				((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt);
14
				((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt);
15
			}
15
			}
16
		}
16
		}
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Object[] listeners = _listeners.getListenerList();
    1
    Object[] listeners = _listeners.getListenerList();
    1
    Object[] listeners = _listenerList.getListenerList();
    Differences
    Expression1Expression2Difference
    _listeners_listenerListVARIABLE_NAME_MISMATCH
    1
    Object[] listeners = _listenerList.getListenerList();
    2
    SQLPanelEvent evt = null;
    2
    SQLPanelEvent evt = null;
    2
    UIFactoryComponentCreatedEvent evt = null;
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.event.SQLPanelEventnet.sourceforge.squirrel_sql.client.gui.builders.UIFactoryComponentCreatedEventSUBCLASS_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.session.event.SQLPanelEventnet.sourceforge.squirrel_sql.client.gui.builders.UIFactoryComponentCreatedEventSUBCLASS_TYPE_MISMATCH
    2
    UIFactoryComponentCreatedEvent evt = null;
    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] == ISQLPanelListener.class)
    4
    if (listeners[i] == ISQLPanelListener.class)
    4
    if (listeners[i] == IUIFactoryListener.class)
    Differences
    Expression1Expression2Difference
    ISQLPanelListener.classIUIFactoryListener.classLITERAL_VALUE_MISMATCH
    4
    if (listeners[i] == IUIFactoryListener.class)
    5
    if (evt == null)
    5
    if (evt == null)
    5
    if (evt == null)
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.event.SQLPanelEventnet.sourceforge.squirrel_sql.client.gui.builders.UIFactoryComponentCreatedEventSUBCLASS_TYPE_MISMATCH
    5
    if (evt == null)
                                                                                                                  
    6
    evt = new UIFactoryComponentCreatedEvent(this, tabPnl);
    Preondition Violations
    Unmatched statement evt=new UIFactoryComponentCreatedEvent(this,tabPnl); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement evt=new UIFactoryComponentCreatedEvent(this,tabPnl); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6
    evt = new UIFactoryComponentCreatedEvent(this, tabPnl);
    6
    evt = new SQLPanelEvent(_session, this);
    6
    evt = new SQLPanelEvent(_session, this);
    Preondition Violations
    Unmatched statement evt=new SQLPanelEvent(_session,this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement evt=new SQLPanelEvent(_session,this); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                    
    7
    ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt);
    7
    ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt);
    7
    ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt);
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.session.event.SQLPanelEventnet.sourceforge.squirrel_sql.client.gui.builders.UIFactoryComponentCreatedEventSUBCLASS_TYPE_MISMATCH
    sqlEntryAreaInstalledtabbedPaneCreatedMETHOD_INVOCATION_NAME_MISMATCH
    net.sourceforge.squirrel_sql.client.session.event.ISQLPanelListenernet.sourceforge.squirrel_sql.client.gui.builders.IUIFactoryListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt) is a void method call, and thus it cannot be parameterized
    Expression ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt) is a void method call, and thus it cannot be parameterized
    Expression (ISQLPanelListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IUIFactoryListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.client.session.event.ISQLPanelListener does not match with type net.sourceforge.squirrel_sql.client.gui.builders.IUIFactoryListener
    • Make classes net.sourceforge.squirrel_sql.client.session.event.ISQLPanelListener and net.sourceforge.squirrel_sql.client.gui.builders.IUIFactoryListener extend a common superclass
    7
    ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt);
    Precondition Violations (12)
    Row Violation
    1Unmatched statement evt=new UIFactoryComponentCreatedEvent(this,tabPnl); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement evt=new UIFactoryComponentCreatedEvent(this,tabPnl); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement evt=new SQLPanelEvent(_session,this); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement evt=new SQLPanelEvent(_session,this); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5Expression ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression ((ISQLPanelListener)listeners[i + 1]).sqlEntryAreaInstalled(evt) is a void method call, and thus it cannot be parameterized
    8Expression ((IUIFactoryListener)listeners[i + 1]).tabbedPaneCreated(evt) is a void method call, and thus it cannot be parameterized
    9Expression (ISQLPanelListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression (IUIFactoryListener)listeners[i + 1] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type net.sourceforge.squirrel_sql.client.session.event.ISQLPanelListener does not match with type net.sourceforge.squirrel_sql.client.gui.builders.IUIFactoryListener
    12Clone fragment #1 returns variable evt with type net.sourceforge.squirrel_sql.client.session.event.SQLPanelEvent , while Clone fragment #2 returns variable evt with type net.sourceforge.squirrel_sql.client.gui.builders.UIFactoryComponentCreatedEvent