int index = -1; for (int i = 0; i < entries.size() && index == -1; ++i) { Object element = entries.elementAt(i); if (element instanceof InterfaceMethodRefCPInfo) { InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo) element; if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals( interfaceMethodClassName) && interfaceMethodRefEntry.getInterfaceMethodName().equals( interfaceMethodName) && interfaceMethodRefEntry.getInterfaceMethodType().equals( interfaceMethodType)) { index = i; } } } return index;
int index = -1; for (int i = 0; i < entries.size() && index == -1; ++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; } } } return index;
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: 8 Number of AST nodes: 8
1
int index = -1;
1
int index = -1;
2
        for (int i = 0; i < entries.size() && index == -1; ++i) {
2
        for (int i = 0; i < entries.size() && index == -1; ++i) {
3
            Object element = entries.elementAt(i);
3
            Object element = entries.elementAt(i);
4
            if (element instanceof InterfaceMethodRefCPInfo) {
4
            if (element instanceof NameAndTypeCPInfo) {
5
                InterfaceMethodRefCPInfo interfaceMethodRefEntry
5
                NameAndTypeCPInfo nameAndTypeEntry
6
                     = (InterfaceMethodRefCPInfo) element;
6
                    = (NameAndTypeCPInfo) element;
7
                if (interfaceMethodRefEntry.getInterfaceMethodClassName().equals(
7
                if (
8
                        interfaceMethodClassName)
9
                     && interfaceMethodRefEntry.getInterfaceMethodName().equals(
10
                         interfaceMethodName)
11
                     && interfaceMethodRefEntry.getInterfaceMethodType().equals(
12
                         interfaceMethodT
8
nameAndTypeEntry.getName().equals(name)
13
ype)) {
9
                     && nameAndTypeEntry.getType().equals(type)) {
14
                    index = i;
10
                    index = i;
15
                }
11
                }
16
            }
12
            }
17
        }
13
        }
18
        return index;
14
        return index;
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.7
Clones locationClones are declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int index = -1;
    1
    int index = -1;
    2
    for (int i = 0; i < entries.size() && index == -1; ++i)
    2
    for (int i = 0; i < entries.size() && index == -1; ++i)
    3
    Object element = entries.elementAt(i);
    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
    Preondition Violations
    Expression element instanceof InterfaceMethodRefCPInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression element instanceof NameAndTypeCPInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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
    Preondition Violations
    Expression (InterfaceMethodRefCPInfo)element cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (NameAndTypeCPInfo)element cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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;
    8
    return index;
    8
    return index;
    Precondition Violations (10)
    Row Violation
    1Expression element instanceof InterfaceMethodRefCPInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression element instanceof NameAndTypeCPInfo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression (InterfaceMethodRefCPInfo)element cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression (NameAndTypeCPInfo)element cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression interfaceMethodRefEntry.getInterfaceMethodClassName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression nameAndTypeEntry.getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression interfaceMethodRefEntry.getInterfaceMethodName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression nameAndTypeEntry.getType() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression 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
    10Expression nameAndTypeEntry.getName().equals(name) && nameAndTypeEntry.getType().equals(type) cannot be parameterized, because it has dependencies to/from statements that will be extracted