for (PropertyInfo propertyInfo : _propertyInfos) { if(propertyInfo.getCompareString().equals(attrName)) { return propertyInfo; } } return null;
for (DockHandle dockHandle : _dockHandles) { if (dockHandle.getDockFrame() == component) { return dockHandle; } } return null;
Clone fragments detected by clone detection tool
File path: /sql12/plugins/hibernate/src/net/sourceforge/squirrel_sql/plugins/hibernate/mapping/MappedClassInfo.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/DockTabDesktopPane.java
Method name: PropertyInfo getAttributeByName(String) Method name: DockHandle getDockHandleForComponent(Component)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (PropertyInfo propertyInfo : _propertyInfos)
1
for (DockHandle dockHandle : _dockHandles)
2
      {
2
      {
3
         if(propertyInfo.getCompareString().equals(attrName))
3
         if (dockHandle.getDockFrame() == component)
4
         {
4
         {
5
            return propertyInfo;
5
            return dockHandle;
6
         }
6
         }
7
      }
7
      }
8
      return null;
8
      return null;
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 comparisons3
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (PropertyInfo propertyInfo : _propertyInfos)
    1
    for (PropertyInfo propertyInfo : _propertyInfos)
    1
    for (DockHandle dockHandle : _dockHandles)
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfonet.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandleVARIABLE_TYPE_MISMATCH
    _propertyInfos_dockHandlesVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo[]java.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandle
    • Make classes net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo and net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandle extend a common superclass
    Type net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo[] of variable _propertyInfos does not match with type java.util.ArrayList<net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandle> of variable _dockHandles
    • Make classes net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo[] and java.util.ArrayList extend a common superclass
    1
    for (DockHandle dockHandle : _dockHandles)
                                                                                              
    2
    if (dockHandle.getDockFrame() == component)
    Preondition Violations
    Unmatched statement if(dockHandle.getDockFrame() == component) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    if (dockHandle.getDockFrame() == component)
                                              
    3
    return dockHandle;
    Preondition Violations
    Unmatched statement return dockHandle; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return dockHandle;
    3
    return dockHandle;
    2
    if (propertyInfo.getCompareString().equals(attrName))
    2
    if (propertyInfo.getCompareString().equals(attrName))
    Preondition Violations
    Unmatched statement if(propertyInfo.getCompareString().equals(attrName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    3
    return propertyInfo;
    3
    return propertyInfo;
    Preondition Violations
    Unmatched statement return propertyInfo; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return propertyInfo;
                                                  
    4
    return null;
    4
    return null;
    Precondition Violations (10)
    Row Violation
    1Type net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandle
    2Type net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo[] of variable _propertyInfos does not match with type java.util.ArrayList<net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandle> of variable _dockHandles
    3Unmatched statement if(dockHandle.getDockFrame() == component) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement return dockHandle; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched return dockHandle;
    6Unmatched statement if(propertyInfo.getCompareString().equals(attrName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement return propertyInfo; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched return propertyInfo;
    9Clone fragment #1 returns variable propertyInfo with type net.sourceforge.squirrel_sql.plugins.hibernate.mapping.PropertyInfo , while Clone fragment #2 returns variable dockHandle with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockHandle
    10The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.plugins.hibernate.mapping.MappedClassInfo and net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.DockTabDesktopPane do not have a common superclass