Constructor cons = c.getConstructor(new Class[] {OutputStream.class, String.class}); Object compiler = cons.newInstance(new Object[] {logstr, "javac"}); // Call the compile() method Method compile = c.getMethod("compile", new Class [] {String[].class});
Constructor cons = c.getConstructor(new Class[] {OutputStream.class, String.class}); Object rmic = cons.newInstance(new Object[] {logstr, "rmic"}); Method doRmic = c.getMethod("compile", new Class [] {String[].class});
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/compilers/Javac12.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
Method name: boolean execute() Method name: boolean execute()
Number of AST nodes: 3 Number of AST nodes: 3
1
Constructor cons =
1
Constructor cons
2
                c.getConstructor(new Class[] {OutputStream.class,
2
                = c.getConstructor(new Class[]  {OutputStream.class,
3
                                              String.class});
3
 String.class});
4
            Object compiler
4
            Object 
5
                = cons.newInstance(new Object[] {logstr, "javac"});
5
rmic = cons.newInstance(new Object[] {logstr, "rmic"});
6
            // Call the compile() method
6
            
7
            Method compile = c.getMethod("compile",
7
Method doRmic = c.getMethod("compile",
8
                                         new Class [] {String[].class});
8
                                        new Class [] {String[].class});
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.0
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    Constructor cons = c.getConstructor(new Class[] {OutputStream.class, String.class});
    6
    Constructor cons = c.getConstructor(new Class[] {OutputStream.class, String.class});
    7
    Object compiler = cons.newInstance(new Object[] {logstr, "javac"});
    7
    Object compiler = cons.newInstance(new Object[] {logstr, "javac"});
    7
    Object rmic = cons.newInstance(new Object[] {logstr, "rmic"});
    Differences
    Expression1Expression2Difference
    compilerrmicVARIABLE_NAME_MISMATCH
    java.io.OutputStreamorg.apache.tools.ant.taskdefs.LogOutputStreamSUBCLASS_TYPE_MISMATCH
    "javac""rmic"LITERAL_VALUE_MISMATCH
    7
    Object rmic = cons.newInstance(new Object[] {logstr, "rmic"});
    8
    Method compile = c.getMethod("compile", new Class[] {String[].class});
    8
    Method compile = c.getMethod("compile", new Class[] {String[].class});
    8
    Method doRmic = c.getMethod("compile", new Class[] {String[].class});
    Differences
    Expression1Expression2Difference
    compiledoRmicVARIABLE_NAME_MISMATCH
    8
    Method doRmic = c.getMethod("compile", new Class[] {String[].class});
    Precondition Violations (2)
    Row Violation
    1Clone fragment #1 returns variables compiler, compile , while Clone fragment #2 returns variables rmic, doRmic
    2The refactoring of the clones is infeasible, because classes org.apache.tools.ant.taskdefs.compilers.Javac12 and org.apache.tools.ant.taskdefs.rmic.SunRmic do not have a common superclass