for (IndexInfo index : indexes) { if (!index.isNonUnique()) { uniqueIndexes.add(index); } }
if (filename.startsWith("squirrel-sql_")) { result.add(filename); }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/refactoring/src/net/sourceforge/squirrel_sql/plugins/refactoring/commands/DropUniqueConstraintCommand.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/UpdateUtilImpl.java
Method name: void onExecute() Method name: Set getInstalledTranslations()
Number of AST nodes: 3 Number of AST nodes: 2
1
for (IndexInfo index : indexes) {
2
            if (!index.isNonUnique()) {
3
                uniqueIndexes.add(index);
4
            }
5
        
1
if (filename.startsWith("squirrel-sql_"))
2
			{
3
				result.add(filename);
6
}
4
			}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)26.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    if (!index.isNonUnique())
    5
    if (!index.isNonUnique())
    4
    if (filename.startsWith("squirrel-sql_"))
    Differences
    Expression1Expression2Difference
    !index.isNonUnique()filename.startsWith("squirrel-sql_")TYPE_COMPATIBLE_REPLACEMENT
    4
    if (filename.startsWith("squirrel-sql_"))
    6
    uniqueIndexes.add(index);
    6
    uniqueIndexes.add(index);
    5
    result.add(filename);
    Differences
    Expression1Expression2Difference
    indexfilenameVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.IndexInfojava.lang.StringVARIABLE_TYPE_MISMATCH
    uniqueIndexesresultVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.HashSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.fw.sql.IndexInfo of variable index does not match with type java.lang.String of variable filename
    • Make classes net.sourceforge.squirrel_sql.fw.sql.IndexInfo and java.lang.String extend a common superclass
    Type java.util.List<net.sourceforge.squirrel_sql.fw.sql.IndexInfo> of variable uniqueIndexes does not match with type java.util.HashSet<java.lang.String> of variable result
    • Make classes java.util.List and java.util.HashSet extend a common superclass
    5
    result.add(filename);
    Precondition Violations (3)
    Row Violation
    1Type net.sourceforge.squirrel_sql.fw.sql.IndexInfo of variable index does not match with type java.lang.String of variable filename
    2Type java.util.List<net.sourceforge.squirrel_sql.fw.sql.IndexInfo> of variable uniqueIndexes does not match with type java.util.HashSet<java.lang.String> of variable result
    3The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.plugins.refactoring.commands.DropUniqueConstraintCommand and net.sourceforge.squirrel_sql.client.update.UpdateUtilImpl do not have a common superclass