Class c = Class.forName(APT_ENTRY_POINT); Object compiler = c.newInstance(); Method compile = c.getMethod(APT_METHOD_NAME, new Class[]{(new String[]{}).getClass()}); int result = ((Integer) compile.invoke (compiler, new Object[]{cmd.getArguments()})) .intValue(); return (result == APT_COMPILER_SUCCESS);
Class c = Class.forName ("com.sun.tools.javac.Main"); Object compiler = c.newInstance (); Method compile = c.getMethod ("compile", new Class [] {(new String [] {}).getClass ()}); int result = ((Integer) compile.invoke (compiler, new Object[] {cmd.getArguments()})) .intValue (); return (result == MODERN_COMPILER_SUCCESS);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/compilers/Javac13.java
Method name: boolean execute() Method name: boolean execute()
Number of AST nodes: 5 Number of AST nodes: 5
1
Class c = Class.forName(APT_ENTRY_POINT);
1
Class c = Class.forName ("com.sun.tools.javac.Main");
2
            Object compiler = c.newInstance();
2
            Object compiler = c.newInstance ();
3
            Method compile = c.getMethod(APT_METHOD_NAME,
3
            Method compile = c.getMethod
4
    
4
 ("compile",
5
                new Class[]{(new String[]{}).getClass()});
5
                new Class [] {(new String [] {}).getClass ()});
6
            int result = ((Integer) compile.invoke
6
            int result = ((Integer) compile.invoke
7
                    (compiler, new Object[]{cmd.getArguments()}))
7
                          (compiler, new Object[] {cmd.getArguments()}))
8
                    .intValue();
8
                .intValue ();
9
            return (result == APT_COMPILER_SUCCESS);
9
            return (result == MODERN_COMPILER_SUCCESS);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons14
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    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
    5
    Class c = Class.forName(APT_ENTRY_POINT);
    5
    Class c = Class.forName(APT_ENTRY_POINT);
    4
    Class c = Class.forName("com.sun.tools.javac.Main");
    Differences
    Expression1Expression2Difference
    APT_ENTRY_POINT"com.sun.tools.javac.Main"TYPE_COMPATIBLE_REPLACEMENT
    4
    Class c = Class.forName("com.sun.tools.javac.Main");
    6
    Object compiler = c.newInstance();
    5
    Object compiler = c.newInstance();
    7
    Method compile = c.getMethod(APT_METHOD_NAME, new Class[] {(new String[] {}).getClass()});
    7
    Method compile = c.getMethod(APT_METHOD_NAME, new Class[] {(new String[] {}).getClass()});
    6
    Method compile = c.getMethod("compile", new Class[] {(new String[] {}).getClass()});
    Differences
    Expression1Expression2Difference
    APT_METHOD_NAME"compile"TYPE_COMPATIBLE_REPLACEMENT
    6
    Method compile = c.getMethod("compile", new Class[] {(new String[] {}).getClass()});
    8
    int result = ((Integer)compile.invoke(compiler, new Object[] {cmd.getArguments()})).intValue();
    7
    int result = ((Integer)compile.invoke(compiler, new Object[] {cmd.getArguments()})).intValue();
    9
    return (result == APT_COMPILER_SUCCESS);
    9
    return (result == APT_COMPILER_SUCCESS);
    8
    return (result == MODERN_COMPILER_SUCCESS);
    Differences
    Expression1Expression2Difference
    APT_COMPILER_SUCCESSMODERN_COMPILER_SUCCESSVARIABLE_NAME_MISMATCH
    8
    return (result == MODERN_COMPILER_SUCCESS);
    Precondition Violations (0)
    Row Violation