TabHandleListener[] clone = _tabHandleListeners.toArray(new TabHandleListener[_tabHandleListeners.size()]); for (TabHandleListener listener : clone) { listener.tabDeselected(new TabHandleEvent(this, null)); }
WidgetListener[] clone = _listeners.toArray(new WidgetListener[_listeners.size()]); for (WidgetListener listener : clone) { listener.widgetIconified(widgetEvent); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/TabHandle.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/WidgetEventCaster.java
Method name: void fireDeselected(ActionEvent) Method name: void fireWidgetIconified(WidgetEvent)
Number of AST nodes: 3 Number of AST nodes: 3
1
TabHandleListener[] clone = _tabHandleListeners.toArray(new TabHandleListener[_tabHandleListeners.size()]);
1
WidgetListener[] clone = _listeners.toArray(new WidgetListener[_listeners.size()]);
2
      for (TabHandleListener listener : clone)
2
      for (WidgetListener listener : clone)
3
      {
3
      {
4
         listener.tabDeselected(new TabHandleEvent(this, null));
4
         listener.widgetIconified(widgetEvent);
5
      }
5
      }
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.1
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                            
    1
    WidgetListener[] clone = _listeners.toArray(new WidgetListener[_listeners.size()]);
    1
    TabHandleListener[] clone = _tabHandleListeners.toArray(new TabHandleListener[_tabHandleListeners.size()]);
                                                                                                                                                                                                                            
    2
    for (TabHandleListener listener : clone)
    2
    for (TabHandleListener listener : clone)
    2
    for (WidgetListener listener : clone)
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListenernet.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListenerVARIABLE_TYPE_MISMATCH
    net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener[]net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener
    • Make classes net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener and net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener extend a common superclass
    Type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener[] of variable clone does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener[] of variable clone
    • Make classes net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener[] and net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener[] extend a common superclass
    2
    for (WidgetListener listener : clone)
                                                                                      
    3
    listener.widgetIconified(widgetEvent);
    Preondition Violations
    Unmatched statement listener.widgetIconified(widgetEvent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    listener.widgetIconified(widgetEvent);
    3
    listener.tabDeselected(new TabHandleEvent(this, null));
    3
    listener.tabDeselected(new TabHandleEvent(this, null));
    Preondition Violations
    Unmatched statement listener.tabDeselected(new TabHandleEvent(this,null)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                      
    Precondition Violations (6)
    Row Violation
    1Type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener
    2Type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener[] of variable clone does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener[] of variable clone
    3Unmatched statement listener.widgetIconified(widgetEvent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement listener.tabDeselected(new TabHandleEvent(this,null)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variable listener with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleListener , while Clone fragment #2 returns variable listener with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.WidgetListener
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero