if (obj == null) { return false; } if (obj.getClass() != getClass()) { return false; } Attribute other = (Attribute) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (defaultValue == null) { if (other.defaultValue != null) { return false; } } else if (!defaultValue.equals(other.defaultValue)) { return false; } return true;
if (obj == null) { return false; } if (obj.getClass() != getClass()) { return false; } Text other = (Text) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } if (optional != other.optional) { return false; } if (trim != other.trim) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/MacroDef.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/MacroDef.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 15
1
if (obj == null) {
1
if (obj == null) {
2
                return false;
2
                return false;
3
            }
3
            }
4
            if (obj.getClass() != getClass()) {
4
            if (obj.getClass() != getClass()) {
5
                return false;
5
                return false;
6
            }
6
            }
7
            Attribute other = (Attribute) obj;
7
            Text other = (Text) obj;
8
            if (name == null) {
8
            if (name == null) {
9
                if (other.name != null) {
9
                if (other.name != null) {
10
                    return false;
10
                    return false;
11
                }
11
                }
12
            } else if (!name.equals(other.name)) {
12
            } else if (!name.equals(other.name)) {
13
                return false;
13
                return false;
14
            }
14
            }
15
            if (defaultValue == null) {
15
            if (
16
                if (other.defaultValue != null) {
17
    
16
optional != other.optional) {
18
                return false;
17
                return false;
19
                }
18
            }
20
            } else if (!defaultValue.equals(other.defaultValue)) {
19
            if (trim != other.trim) {
21
                return false;
20
                return false;
22
            }
21
            }
23
            return true;
22
            return true;
Summary
Number of common nesting structure subtrees2
Number of refactorable cases0
Number of non-refactorable cases2
Time elapsed for finding largest common nesting structure subtrees (ms)2.0
Clones locationClones are in the same java file
Number of node comparisons58
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == null)
    1
    if (obj == null)
    2
    return false;
    2
    return false;
    2
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    2
    return false;
    3
    if (obj.getClass() != getClass())
    3
    if (obj.getClass() != getClass())
    3
    if (obj.getClass() != getClass())
    Differences
    Expression1Expression2Difference
    java.lang.Classjava.lang.ClassVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class<> of variable getClass() does not match with type java.lang.Class<> of variable getClass()
    • Make classes java.lang.Class and java.lang.Class extend a common superclass
    3
    if (obj.getClass() != getClass())
    4
    return false;
    4
    return false;
    4
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    4
    return false;
                                                    
    5
    Text other = (Text)obj;
    5
    Attribute other = (Attribute)obj;
                                                                        
    6
    if (name == null)
    6
    if (name == null)
    7
    if (other.name != null)
    7
    if (other.name != null)
    7
    if (other.name != null)
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.MacroDef.Attributeorg.apache.tools.ant.taskdefs.MacroDef.TextVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    • Make classes org.apache.tools.ant.taskdefs.MacroDef.Attribute and org.apache.tools.ant.taskdefs.MacroDef.Text extend a common superclass
    7
    if (other.name != null)
    8
    return false;
    8
    return false;
    8
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    8
    return false;
    9
    else if (!name.equals(other.name))
    9
    else if (!name.equals(other.name))
    9
    else if (!name.equals(other.name))
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.MacroDef.Attributeorg.apache.tools.ant.taskdefs.MacroDef.TextVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    • Make classes org.apache.tools.ant.taskdefs.MacroDef.Attribute and org.apache.tools.ant.taskdefs.MacroDef.Text extend a common superclass
    9
    else if (!name.equals(other.name))
    10
    return false;
    10
    return false;
    10
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    10
    return false;
    Precondition Violations (11)
    Row Violation
    1Type java.lang.Class<> of variable getClass() does not match with type java.lang.Class<> of variable getClass()
    2Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    3Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    4Conditional return false;
    5Conditional return false;
    6Conditional return false;
    7Conditional return false;
    8Conditional return false;
    9Conditional return false;
    10Conditional return false;
    11Conditional return false;
  2. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == null)
    1
    if (obj == null)
    2
    return false;
    2
    return false;
    2
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    2
    return false;
    3
    if (obj.getClass() != getClass())
    3
    if (obj.getClass() != getClass())
    3
    if (obj.getClass() != getClass())
    Differences
    Expression1Expression2Difference
    java.lang.Classjava.lang.ClassVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class<> of variable getClass() does not match with type java.lang.Class<> of variable getClass()
    • Make classes java.lang.Class and java.lang.Class extend a common superclass
    3
    if (obj.getClass() != getClass())
    4
    return false;
    4
    return false;
    4
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    4
    return false;
                                                    
    5
    Text other = (Text)obj;
    5
    Attribute other = (Attribute)obj;
                                                                        
    6
    if (name == null)
                                          
    7
    if (other.name != null)
                                                      
    8
    return false;
    8
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    9
    else if (!name.equals(other.name))
                                                                  
    10
    return false;
    10
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    11
    if (defaultValue == null)
    11
    if (defaultValue == null)
    6
    if (name == null)
    Differences
    Expression1Expression2Difference
    defaultValuenameVARIABLE_NAME_MISMATCH
    6
    if (name == null)
    12
    if (other.defaultValue != null)
    12
    if (other.defaultValue != null)
    7
    if (other.name != null)
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.MacroDef.Attributeorg.apache.tools.ant.taskdefs.MacroDef.TextVARIABLE_TYPE_MISMATCH
    defaultValuenameVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    • Make classes org.apache.tools.ant.taskdefs.MacroDef.Attribute and org.apache.tools.ant.taskdefs.MacroDef.Text extend a common superclass
    7
    if (other.name != null)
    13
    return false;
    13
    return false;
    8
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    8
    return false;
    14
    else if (!defaultValue.equals(other.defaultValue))
    14
    else if (!defaultValue.equals(other.defaultValue))
    9
    else if (!name.equals(other.name))
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.MacroDef.Attributeorg.apache.tools.ant.taskdefs.MacroDef.TextVARIABLE_TYPE_MISMATCH
    defaultValuenameVARIABLE_NAME_MISMATCH
    defaultValuenameVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    • Make classes org.apache.tools.ant.taskdefs.MacroDef.Attribute and org.apache.tools.ant.taskdefs.MacroDef.Text extend a common superclass
    9
    else if (!name.equals(other.name))
    15
    return false;
    15
    return false;
    10
    return false;
    Preondition Violations
    Conditional return false;
    Conditional return false;
    10
    return false;
    Precondition Violations (13)
    Row Violation
    1Type java.lang.Class<> of variable getClass() does not match with type java.lang.Class<> of variable getClass()
    2Unmatched return false;
    3Unmatched return false;
    4Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    5Type org.apache.tools.ant.taskdefs.MacroDef.Attribute of variable other does not match with type org.apache.tools.ant.taskdefs.MacroDef.Text of variable other
    6Conditional return false;
    7Conditional return false;
    8Conditional return false;
    9Conditional return false;
    10Conditional return false;
    11Conditional return false;
    12Conditional return false;
    13Conditional return false;