try { JUnitTest t = (JUnitTest) super.clone(); t.props = props == null ? null : (Properties) props.clone(); t.formatters = (Vector) formatters.clone(); return t; } catch (CloneNotSupportedException e) { // plain impossible return this; }
try { SysProperties c = (SysProperties) super.clone(); c.variables = (Vector) variables.clone(); c.propertySets = (Vector) propertySets.clone(); return c; } catch (CloneNotSupportedException e) { return null; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/CommandlineJava.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 5 Number of AST nodes: 5
1
try {
1
try {
2
            JUnitTest t = (JUnitTest) super.clone();
2
                SysProperties c = (SysProperties) super.clone();
3
            t.props = props == null ? null : (Properties) props.clone();
3
                c.variables = (Vector) variables.clone();
4
            t.formatters = (Vector) formatters.clone();
4
                c.propertySets = (Vector) propertySets.clone();
5
            return t;
5
                return c;
6
        } catch (CloneNotSupportedException e) {
6
            } catch (CloneNotSupportedException e) {
7
            // plain impossible
7
    
8
            return this;
8
            return 
9
null;
9
        }
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.1
Clones locationClones are in different classes
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    1
    try
    Differences
    Expression1Expression2Difference
    thisnullTYPE_COMPATIBLE_REPLACEMENT
    1
    try
                                                                                                    
    2
    SysProperties c = (SysProperties)super.clone();
    Preondition Violations
    Unmatched statement SysProperties c=(SysProperties)super.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2
    SysProperties c = (SysProperties)super.clone();
    2
    JUnitTest t = (JUnitTest)super.clone();
    2
    JUnitTest t = (JUnitTest)super.clone();
    Preondition Violations
    Unmatched statement JUnitTest t=(JUnitTest)super.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                    
                                                                                      
    3
    c.variables = (Vector)variables.clone();
    3
    t.props = props == null ? null : (Properties)props.clone();
                                                                                                                            
    4
    t.formatters = (Vector)formatters.clone();
    4
    t.formatters = (Vector)formatters.clone();
    4
    c.propertySets = (Vector)propertySets.clone();
    Differences
    Expression1Expression2Difference
    tcVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.junit.BaseTestorg.apache.tools.ant.types.CommandlineJava.SysPropertiesVARIABLE_TYPE_MISMATCH
    formatterspropertySetsVARIABLE_NAME_MISMATCH
    formatterspropertySetsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.junit.BaseTest of variable t does not match with type org.apache.tools.ant.types.CommandlineJava.SysProperties of variable c
    • Make classes org.apache.tools.ant.taskdefs.optional.junit.BaseTest and org.apache.tools.ant.types.CommandlineJava.SysProperties extend a common superclass
    4
    c.propertySets = (Vector)propertySets.clone();
                            
    5
    return c;
    Preondition Violations
    Unmatched return c;
    5
    return c;
    5
    return t;
    5
    return t;
    Preondition Violations
    Unmatched return t;
                            
    Precondition Violations (5)
    Row Violation
    1Unmatched statement SysProperties c=(SysProperties)super.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched statement JUnitTest t=(JUnitTest)super.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Type org.apache.tools.ant.taskdefs.optional.junit.BaseTest of variable t does not match with type org.apache.tools.ant.types.CommandlineJava.SysProperties of variable c
    4Unmatched return c;
    5Unmatched return t;