if (instr instanceof TransformOperation) { PlanarImage op = ((TransformOperation) instr).executeTransformOperation(null); BufferedImage child = op.getAsBufferedImage(); log("\tDrawing to x=" + xloc + " y=" + yloc); graphics.drawImage(child, null, xloc, yloc); PlanarImage.wrapRenderedImage(bi); }
String name = (String) e.nextElement(); Class expect = (Class) attrMap.get(name); assertNotNull("Support for "+name+" in IntrospectionHelperTest?", expect); assertEquals("Type of "+name, expect, ih.getAttributeType(name)); attrMap.remove(name);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Draw.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
Method name: PlanarImage executeTransformOperation(PlanarImage) Method name: void testGetAttributes()
Number of AST nodes: 6 Number of AST nodes: 5
1
if (instr instanceof TransformOperation) {
1
Strin
2
                PlanarImage op
2
g name = (String) e.nextElement();
3
                    = ((TransformOperation) instr).executeTransformOperation(null);
3
            Class expect = (Class) attrMap.get(name);
4
                BufferedImage child = op.getAsBufferedImage();
4
            
5
                log("\tDrawing to x=" + xloc + " y=" + yloc);
6
                graphics.drawImage(child, null, xloc, yloc);
7
                PlanarImage.wrapRenderedImage(bi);
8
            }
5
assertNotNull("Support for "+name+" in IntrospectionHelperTest?",
6
                          expect);
7
            assertEquals("Type of "+name, expect, ih.getAttributeType(name));
8
            attrMap.remove(name);
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 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)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                  
    4
    String name = (String)e.nextElement();
    Preondition Violations
    Unmatched statement String name=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    String name = (String)e.nextElement();
                                                                                      
    5
    Class expect = (Class)attrMap.get(name);
    Preondition Violations
    Unmatched statement Class expect=(Class)attrMap.get(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    Class expect = (Class)attrMap.get(name);
    10
    PlanarImage op = ((TransformOperation)instr).executeTransformOperation(null);
                                                                                                                                                                  
    11
    BufferedImage child = op.getAsBufferedImage();
    11
    BufferedImage child = op.getAsBufferedImage();
    Preondition Violations
    Unmatched statement BufferedImage child=op.getAsBufferedImage(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    12
    log("\tDrawing to x=" + xloc + " y=" + yloc);
    12
    log("\tDrawing to x=" + xloc + " y=" + yloc);
    6
    assertNotNull("Support for " + name + " in IntrospectionHelperTest?", expect);
    Differences
    Expression1Expression2Difference
    logassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    log("\tDrawing to x=" + xloc + " y="+ yloc)assertNotNull("Support for " + name + " in IntrospectionHelperTest?",expect)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression log("\tDrawing to x=" + xloc + " y="+ yloc) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull("Support for " + name + " in IntrospectionHelperTest?",expect) is a void method call, and thus it cannot be parameterized
    Expression log("\tDrawing to x=" + xloc + " y="+ yloc) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull("Support for " + name + " in IntrospectionHelperTest?",expect) is a void method call, and thus it cannot be parameterized
    6
    assertNotNull("Support for " + name + " in IntrospectionHelperTest?", expect);
    13
    graphics.drawImage(child, null, xloc, yloc);
    13
    graphics.drawImage(child, null, xloc, yloc);
    7
    assertEquals("Type of " + name, expect, ih.getAttributeType(name));
    Differences
    Expression1Expression2Difference
    drawImageassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    graphics.drawImage(child,null,xloc,yloc)assertEquals("Type of " + name,expect,ih.getAttributeType(name))ARGUMENT_NUMBER_MISMATCH
    graphicsMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression graphics.drawImage(child,null,xloc,yloc) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("Type of " + name,expect,ih.getAttributeType(name)) is a void method call, and thus it cannot be parameterized
    Expression graphics.drawImage(child,null,xloc,yloc) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("Type of " + name,expect,ih.getAttributeType(name)) is a void method call, and thus it cannot be parameterized
    7
    assertEquals("Type of " + name, expect, ih.getAttributeType(name));
                                                    
    8
    attrMap.remove(name);
    14
    PlanarImage.wrapRenderedImage(bi);
                                                                                
    Precondition Violations (11)
    Row Violation
    1Unmatched statement String name=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Class expect=(Class)attrMap.get(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement BufferedImage child=op.getAsBufferedImage(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression log("\tDrawing to x=" + xloc + " y="+ yloc) is a void method call, and thus it cannot be parameterized
    5Expression assertNotNull("Support for " + name + " in IntrospectionHelperTest?",expect) is a void method call, and thus it cannot be parameterized
    6Expression log("\tDrawing to x=" + xloc + " y="+ yloc) is a void method call, and thus it cannot be parameterized
    7Expression assertNotNull("Support for " + name + " in IntrospectionHelperTest?",expect) is a void method call, and thus it cannot be parameterized
    8Expression graphics.drawImage(child,null,xloc,yloc) is a void method call, and thus it cannot be parameterized
    9Expression assertEquals("Type of " + name,expect,ih.getAttributeType(name)) is a void method call, and thus it cannot be parameterized
    10Expression graphics.drawImage(child,null,xloc,yloc) is a void method call, and thus it cannot be parameterized
    11Expression assertEquals("Type of " + name,expect,ih.getAttributeType(name)) is a void method call, and thus it cannot be parameterized