String[] args = rmic.getCurrentCompilerArgs(); assertNotNull(args); assertEquals("no args", 0, args.length); Rmic.ImplementationSpecificArgument arg = rmic.createCompilerArg(); String ford = "Ford"; String prefect = "Prefect"; String testArg = ford + " " + prefect; arg.setValue(testArg); args = rmic.getCurrentCompilerArgs(); assertEquals("unconditional single arg", 1, args.length); assertEquals(testArg, args[0]); arg.setCompiler("weblogic"); args = rmic.getCurrentCompilerArgs(); assertNotNull(args); assertEquals("implementation is weblogic but build.rmic is null", 0, args.length); project.setProperty("build.rmic", "sun"); args = rmic.getCurrentCompilerArgs(); assertNotNull(args); assertEquals("implementation is weblogic but build.rmic is sun", 0, args.length); project.setProperty("build.rmic", "weblogic"); args = rmic.getCurrentCompilerArgs(); assertEquals("both are weblogic", 1, args.length); assertEquals(testArg, args[0]);
String[] args = javac.getCurrentCompilerArgs(); assertNotNull(args); assertEquals("no args", 0, args.length); Javac.ImplementationSpecificArgument arg = javac.createCompilerArg(); String ford = "Ford"; String prefect = "Prefect"; String testArg = ford + " " + prefect; arg.setValue(testArg); args = javac.getCurrentCompilerArgs(); assertEquals("unconditional single arg", 1, args.length); assertEquals(testArg, args[0]); arg.setCompiler("jikes"); args = javac.getCurrentCompilerArgs(); assertNotNull(args); assertEquals("implementation is jikes but build.compiler is null", 0, args.length); project.setProperty("build.compiler", "jvc"); args = javac.getCurrentCompilerArgs(); assertNotNull(args); assertEquals("implementation is jikes but build.compiler is jvc", 0, args.length); project.setProperty("build.compiler", "jikes"); args = javac.getCurrentCompilerArgs(); assertEquals("both are jikes", 1, args.length); assertEquals(testArg, args[0]);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
Method name: void testCompilerArg() Method name: void testCompilerArg()
Number of AST nodes: 23 Number of AST nodes: 23
1
String[] args = rmic.getCurrentCompilerArgs();
1
String[] args = javac.getCurrentCompilerArgs();
2
        assertNotNull(args);
2
        assertNotNull(args);
3
        assertEquals("no args", 0, args.length);
3
        assertEquals("no args", 0, args.length);
4
        Rmic.ImplementationSpecificArgument arg = rmic.createCompilerArg();
4
        Javac.ImplementationSpecificArgument arg = javac.createCompilerArg();
5
        String ford = "Ford";
5
        String ford = "Ford";
6
        String prefect = "Prefect";
6
        String prefect = "Prefect";
7
        String testArg = ford + " " + prefect;
7
        String testArg = ford + " " + prefect;
8
        arg.setValue(testArg);
8
        arg.setValue(testArg);
9
        args = rmic.getCurrentCompilerArgs();
9
        args = javac.getCurrentCompilerArgs();
10
        assertEquals("unconditional single arg", 1, args.length);
10
        assertEquals("unconditional single arg", 1, args.length);
11
        assertEquals(testArg, args[0]);
11
        assertEquals(testArg, args[0]);
12
        arg.setCompiler("weblogic");
12
        arg.setCompiler("jikes");
13
        args = rmic.getCurrentCompilerArgs();
13
        args = javac.getCurrentCompilerArgs();
14
        assertNotNull(args);
14
        assertNotNull(args);
15
        assertEquals("implementation is weblogic but build.rmic is null",
15
        assertEquals("implementation is jikes but build.compiler is null",
16
                     0, args.length);
16
                     0, args.length);
17
        project.setProperty("build.rmic", "sun");
17
        project.setProperty("build.compiler", "jvc");
18
        args = rmic.getCurrentCompilerArgs();
18
        args = javac.getCurrentCompilerArgs();
19
        assertNotNull(args);
19
        assertNotNull(args);
20
        assertEquals("implementation is weblogic but build.rmic is sun",
20
        assertEquals("implementation is jikes but build.compiler is jvc",
21
                     0, args.length);
21
                     0, args.length);
22
        project.setProperty("build.rmic", "weblogic");
22
        project.setProperty("build.compiler", "jikes");
23
        args = rmic.getCurrentCompilerArgs();
23
        args = javac.getCurrentCompilerArgs();
24
        assertEquals("both are weblogic", 1, args.length);
24
        assertEquals("both are jikes", 1, args.length);
25
        assertEquals(testArg, args[0]);
25
        assertEquals(testArg, args[0]);
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 having the same super class
Number of node comparisons247
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements23
    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
    1
    String[] args = rmic.getCurrentCompilerArgs();
    1
    String[] args = rmic.getCurrentCompilerArgs();
    1
    String[] args = javac.getCurrentCompilerArgs();
    Differences
    Expression1Expression2Difference
    rmicjavacVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    1
    String[] args = javac.getCurrentCompilerArgs();
    2
    assertNotNull(args);
    2
    assertNotNull(args);
    3
    assertEquals("no args", 0, args.length);
    3
    assertEquals("no args", 0, args.length);
    4
    Rmic.ImplementationSpecificArgument arg = rmic.createCompilerArg();
    4
    Rmic.ImplementationSpecificArgument arg = rmic.createCompilerArg();
    4
    Javac.ImplementationSpecificArgument arg = javac.createCompilerArg();
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgumentorg.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgumentSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgumentorg.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgumentSUBCLASS_TYPE_MISMATCH
    rmicjavacVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression Rmic cannot be unified with expression Javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgument createCompilerArg() , public org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument createCompilerArg()
    Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgument createCompilerArg() , public org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument createCompilerArg()
    4
    Javac.ImplementationSpecificArgument arg = javac.createCompilerArg();
    5
    String ford = "Ford";
    5
    String ford = "Ford";
    6
    String prefect = "Prefect";
    6
    String prefect = "Prefect";
    7
    String testArg = ford + " " + prefect;
    7
    String testArg = ford + " " + prefect;
    8
    arg.setValue(testArg);
    8
    arg.setValue(testArg);
    8
    arg.setValue(testArg);
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgumentorg.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgumentSUBCLASS_TYPE_MISMATCH
    8
    arg.setValue(testArg);
    9
    args = rmic.getCurrentCompilerArgs();
    9
    args = rmic.getCurrentCompilerArgs();
    9
    args = javac.getCurrentCompilerArgs();
    Differences
    Expression1Expression2Difference
    rmicjavacVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    9
    args = javac.getCurrentCompilerArgs();
    10
    assertEquals("unconditional single arg", 1, args.length);
    10
    assertEquals("unconditional single arg", 1, args.length);
    11
    assertEquals(testArg, args[0]);
    11
    assertEquals(testArg, args[0]);
    12
    arg.setCompiler("weblogic");
    12
    arg.setCompiler("weblogic");
    12
    arg.setCompiler("jikes");
    Differences
    Expression1Expression2Difference
    "weblogic""jikes"LITERAL_VALUE_MISMATCH
    org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgumentorg.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgumentSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression arg cannot be unified with expression arg , because common superclass org.apache.tools.ant.util.facade.ImplementationSpecificArgument does not declare member(s) public void setCompiler(java.lang.String)
    12
    arg.setCompiler("jikes");
    13
    args = rmic.getCurrentCompilerArgs();
    13
    args = rmic.getCurrentCompilerArgs();
    13
    args = javac.getCurrentCompilerArgs();
    Differences
    Expression1Expression2Difference
    rmicjavacVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    13
    args = javac.getCurrentCompilerArgs();
    14
    assertNotNull(args);
    14
    assertNotNull(args);
    15
    assertEquals("implementation is weblogic but build.rmic is null", 0, args.length);
    15
    assertEquals("implementation is weblogic but build.rmic is null", 0, args.length);
    15
    assertEquals("implementation is jikes but build.compiler is null", 0, args.length);
    Differences
    Expression1Expression2Difference
    "implementation is weblogic but build.rmic is null""implementation is jikes but build.compiler is null"LITERAL_VALUE_MISMATCH
    15
    assertEquals("implementation is jikes but build.compiler is null", 0, args.length);
    16
    project.setProperty("build.rmic", "sun");
    16
    project.setProperty("build.rmic", "sun");
    16
    project.setProperty("build.compiler", "jvc");
    Differences
    Expression1Expression2Difference
    "build.rmic""build.compiler"LITERAL_VALUE_MISMATCH
    "sun""jvc"LITERAL_VALUE_MISMATCH
    16
    project.setProperty("build.compiler", "jvc");
    17
    args = rmic.getCurrentCompilerArgs();
    17
    args = rmic.getCurrentCompilerArgs();
    17
    args = javac.getCurrentCompilerArgs();
    Differences
    Expression1Expression2Difference
    rmicjavacVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    17
    args = javac.getCurrentCompilerArgs();
    18
    assertNotNull(args);
    18
    assertNotNull(args);
    19
    assertEquals("implementation is weblogic but build.rmic is sun", 0, args.length);
    19
    assertEquals("implementation is weblogic but build.rmic is sun", 0, args.length);
    19
    assertEquals("implementation is jikes but build.compiler is jvc", 0, args.length);
    Differences
    Expression1Expression2Difference
    "implementation is weblogic but build.rmic is sun""implementation is jikes but build.compiler is jvc"LITERAL_VALUE_MISMATCH
    19
    assertEquals("implementation is jikes but build.compiler is jvc", 0, args.length);
    20
    project.setProperty("build.rmic", "weblogic");
    20
    project.setProperty("build.rmic", "weblogic");
    20
    project.setProperty("build.compiler", "jikes");
    Differences
    Expression1Expression2Difference
    "build.rmic""build.compiler"LITERAL_VALUE_MISMATCH
    "weblogic""jikes"LITERAL_VALUE_MISMATCH
    20
    project.setProperty("build.compiler", "jikes");
    21
    args = rmic.getCurrentCompilerArgs();
    21
    args = rmic.getCurrentCompilerArgs();
    21
    args = javac.getCurrentCompilerArgs();
    Differences
    Expression1Expression2Difference
    rmicjavacVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Rmicorg.apache.tools.ant.taskdefs.JavacSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    21
    args = javac.getCurrentCompilerArgs();
    22
    assertEquals("both are weblogic", 1, args.length);
    22
    assertEquals("both are weblogic", 1, args.length);
    22
    assertEquals("both are jikes", 1, args.length);
    Differences
    Expression1Expression2Difference
    "both are weblogic""both are jikes"LITERAL_VALUE_MISMATCH
    22
    assertEquals("both are jikes", 1, args.length);
    23
    assertEquals(testArg, args[0]);
    23
    assertEquals(testArg, args[0]);
    Precondition Violations (9)
    Row Violation
    1Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    2Expression Rmic cannot be unified with expression Javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgument createCompilerArg() , public org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument createCompilerArg()
    3Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public org.apache.tools.ant.taskdefs.Rmic.ImplementationSpecificArgument createCompilerArg() , public org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument createCompilerArg()
    4Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    5Expression arg cannot be unified with expression arg , because common superclass org.apache.tools.ant.util.facade.ImplementationSpecificArgument does not declare member(s) public void setCompiler(java.lang.String)
    6Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    7Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    8Expression rmic cannot be unified with expression javac , because common superclass org.apache.tools.ant.taskdefs.MatchingTask does not declare member(s) public java.lang.String[] getCurrentCompilerArgs()
    9Clone fragment #1 returns variables , while Clone fragment #2 returns variables arg, testArg, args, ford, prefect