if (element instanceof InterfaceMethodRefCPInfo) { InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo) element; if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals( interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals( interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals( interfaceMethodType)) { index = i; } }
Object element = entries.elementAt(i); if (element instanceof NameAndTypeCPInfo) { NameAndTypeCPInfo nameAndTypeEntry = (NameAndTypeCPInfo) element; if (nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type)) { index = i; } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java
Method name: int getInterfaceMethodRefEntry(String, String, String) Method name: int getNameAndTypeEntry(String, String)
Number of AST nodes: 4 Number of AST nodes: 5
1
Object element = entries.elementAt(i);
1
if (element instanceof InterfaceMethodRefCPInfo) {
2
            if (element instanceof NameAndTypeCPInfo) {
2
                InterfaceMethodRefCPInfo interfaceMethodRefEntry
3
                NameAndTypeCPInfo nameAndTypeEntry
3
                     = (InterfaceMethodRefCPInfo) element;
4
                    = (NameAndTypeCPInfo) element;
4
                if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(
5
                if (
5
                        interfaceMethodClassName)
6
                     && interfaceMethodRefEntry.getInterfaceMethodName().equals(
7
                         interfaceMethodName)
8
                     && interfaceMethodRefEntry.getInterfaceMethodType().equals(
9
                         interfaceMethodT
6
nameAndTypeEntry.getName().equals(name)
10
ype)) {
7
                     && nameAndTypeEntry.getType().equals(type)) {
11
                    index = i;
8
                    index = i;
12
                }
9
                }
13
            }
10
            }
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 declared in the same class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                  
    3
    Object element = entries.elementAt(i);
    Preondition Violations
    Unmatched statement Object element=entries.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    Object element = entries.elementAt(i);
    4
    if (element instanceof InterfaceMethodRefCPInfo)
    4
    if (element instanceof InterfaceMethodRefCPInfo)
    4
    if (element instanceof NameAndTypeCPInfo)
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.optional.depend.constantpool.InterfaceMethodRefCPInfoorg.apache.tools.ant.taskdefs.optional.depend.constantpool.NameAndTypeCPInfoSUBCLASS_TYPE_MISMATCH
    4
    if (element instanceof NameAndTypeCPInfo)
    5
    InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo)element;
    5
    InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo)element;
    5
    NameAndTypeCPInfo nameAndTypeEntry = (NameAndTypeCPInfo)element;
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.optional.depend.constantpool.InterfaceMethodRefCPInfoorg.apache.tools.ant.taskdefs.optional.depend.constantpool.NameAndTypeCPInfoSUBCLASS_TYPE_MISMATCH
    interfaceMethodRefEntrynameAndTypeEntryVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.depend.constantpool.InterfaceMethodRefCPInfoorg.apache.tools.ant.taskdefs.optional.depend.constantpool.NameAndTypeCPInfoSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.taskdefs.optional.depend.constantpool.InterfaceMethodRefCPInfoorg.apache.tools.ant.taskdefs.optional.depend.constantpool.NameAndTypeCPInfoSUBCLASS_TYPE_MISMATCH
    5
    NameAndTypeCPInfo nameAndTypeEntry = (NameAndTypeCPInfo)element;
    6
    if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType))
    6
    if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType))
    6
    if (nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type))
    Differences
    Expression1Expression2Difference
    interfaceMethodClassNamenameVARIABLE_NAME_MISMATCH
    getInterfaceMethodClassNamegetNameMETHOD_INVOCATION_NAME_MISMATCH
    interfaceMethodRefEntrynameAndTypeEntryVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.depend.constantpool.InterfaceMethodRefCPInfoorg.apache.tools.ant.taskdefs.optional.depend.constantpool.NameAndTypeCPInfoSUBCLASS_TYPE_MISMATCH
    interfaceMethodNametypeVARIABLE_NAME_MISMATCH
    getInterfaceMethodNamegetTypeMETHOD_INVOCATION_NAME_MISMATCH
    interfaceMethodRefEntrynameAndTypeEntryVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.depend.constantpool.InterfaceMethodRefCPInfoorg.apache.tools.ant.taskdefs.optional.depend.constantpool.NameAndTypeCPInfoSUBCLASS_TYPE_MISMATCH
    interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType)nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type)INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    Preondition Violations
    Expression interfaceMethodRefEntry.getInterfaceMethodClassName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression nameAndTypeEntry.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression interfaceMethodRefEntry.getInterfaceMethodName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression nameAndTypeEntry.getType() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type))
    7
    index = i;
    7
    index = i;
    Precondition Violations (7)
    Row Violation
    1Unmatched statement Object element=entries.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression interfaceMethodRefEntry.getInterfaceMethodClassName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression nameAndTypeEntry.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression interfaceMethodRefEntry.getInterfaceMethodName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression nameAndTypeEntry.getType() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression interfaceMethodRefEntry.getInterfaceMethodClassName().equals(interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals(interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals(interfaceMethodType) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type) cannot be parameterized, because it has dependencies to/from statements that will be extracted