BuildEvent event = new BuildEvent(target); event.setException(exception); Iterator iter = listeners.iterator(); while (iter.hasNext()) { BuildListener listener = (BuildListener) iter.next(); listener.targetFinished(event); }
registerThreadTask(Thread.currentThread(), task); BuildEvent event = new BuildEvent(task); Iterator iter = listeners.iterator(); while (iter.hasNext()) { BuildListener listener = (BuildListener) iter.next(); listener.taskStarted(event); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java
Method name: void fireTargetFinished(Target, Throwable) Method name: void fireTaskStarted(Task)
Number of AST nodes: 6 Number of AST nodes: 6
1
BuildEvent event = new BuildEvent(target);
2
        event.setException(exception
1
registerThreadTask(Thread.currentThread(), task);
3
);
2
        BuildEvent event = new BuildEvent(task);
4
        Iterator iter = listeners.iterator();
3
        Iterator iter = listeners.iterator();
5
        while (iter.hasNext()) {
4
        while (iter.hasNext()) {
6
            BuildListener listener = (BuildListener) iter.next();
5
            BuildListener listener = (BuildListener) iter.next();
7
            listener.targetFinished(event);
6
            listener.taskStarted(event);
8
        }
7
        }
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 declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)597.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    BuildEvent event = new BuildEvent(target);
    1
    BuildEvent event = new BuildEvent(target);
    2
    BuildEvent event = new BuildEvent(task);
    Differences
    Expression1Expression2Difference
    targettaskVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.Targetorg.apache.tools.ant.TaskVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.Target of variable target does not match with type org.apache.tools.ant.Task of variable task
    • Make classes org.apache.tools.ant.Target and org.apache.tools.ant.Task extend a common superclass
    2
    BuildEvent event = new BuildEvent(task);
    2
    event.setException(exception);
    2
    event.setException(exception);
    1
    registerThreadTask(Thread.currentThread(), task);
    Differences
    Expression1Expression2Difference
    setExceptionregisterThreadTaskMETHOD_INVOCATION_NAME_MISMATCH
    event.setException(exception)registerThreadTask(Thread.currentThread(),task)ARGUMENT_NUMBER_MISMATCH
    eventMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression event.setException(exception) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression event.setException(exception) is a void method call, and thus it cannot be parameterized
    Expression registerThreadTask(Thread.currentThread(),task) is a void method call, and thus it cannot be parameterized
    Expression event.setException(exception) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression event.setException(exception) is a void method call, and thus it cannot be parameterized
    Expression registerThreadTask(Thread.currentThread(),task) is a void method call, and thus it cannot be parameterized
    1
    registerThreadTask(Thread.currentThread(), task);
    3
    Iterator iter = listeners.iterator();
    3
    Iterator iter = listeners.iterator();
    4
    while (iter.hasNext())
    4
    while (iter.hasNext())
    5
    BuildListener listener = (BuildListener)iter.next();
    5
    BuildListener listener = (BuildListener)iter.next();
    6
    listener.targetFinished(event);
    6
    listener.targetFinished(event);
    6
    listener.taskStarted(event);
    Differences
    Expression1Expression2Difference
    targetFinishedtaskStartedMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression listener.targetFinished(event) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression listener.taskStarted(event) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression listener.targetFinished(event) is a void method call, and thus it cannot be parameterized
    Expression listener.taskStarted(event) is a void method call, and thus it cannot be parameterized
    6
    listener.taskStarted(event);
    Precondition Violations (11)
    Row Violation
    1Type org.apache.tools.ant.Target of variable target does not match with type org.apache.tools.ant.Task of variable task
    2Expression event.setException(exception) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression event.setException(exception) is a void method call, and thus it cannot be parameterized
    4Expression registerThreadTask(Thread.currentThread(),task) is a void method call, and thus it cannot be parameterized
    5Expression event.setException(exception) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression event.setException(exception) is a void method call, and thus it cannot be parameterized
    7Expression registerThreadTask(Thread.currentThread(),task) is a void method call, and thus it cannot be parameterized
    8Expression listener.targetFinished(event) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression listener.taskStarted(event) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression listener.targetFinished(event) is a void method call, and thus it cannot be parameterized
    11Expression listener.taskStarted(event) is a void method call, and thus it cannot be parameterized