SimpleInterface si = (SimpleInterface) manager.eval("ruby", "(java)", 1, 1, "EMPTY_LIST = SimpleInterfaceImpl.new"); List list = si.getNilList(); assertTrue(list == null); si.setNilList(null); assertTrue(si.isNilListNil());
SimpleInterface si = (SimpleInterface) manager.eval("ruby", "(java)", 1, 1, "SimpleInterfaceImpl.new"); Map map = si.getNilMap(); assertTrue(map == null); si.setNilMap(null); assertTrue(si.isNilMapNil());
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/test/org/jruby/javasupport/test/TestBSF.java File path: /jruby-1.4.0/test/org/jruby/javasupport/test/TestBSF.java
Method name: void testNilList() Method name: void testNilMap()
Number of AST nodes: 5 Number of AST nodes: 5
1
SimpleInterface si = (SimpleInterface) manager.eval("ruby", "(java)", 1, 1, "EMPTY_LIST = SimpleInterfaceImpl.new");
1
SimpleInterface si = (SimpleInterface) manager.eval("ruby", "(java)", 1, 1, "SimpleInterfaceImpl.new");
2
        List list = si.getNilList();
2
        Map map = si.getNilMap();
3
        
3
        
4
        assertTrue(list == null);
4
        assertTrue(map == null);
5
        
5
        
6
        si.setNilList(null);
6
        si.setNilMap(null);
7
        
7
        
8
        assertTrue(si.isNilListNil());
8
        assertTrue(si.isNilMapNil());
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 declared in the same class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    SimpleInterface si = (SimpleInterface)manager.eval("ruby", "(java)", 1, 1, "EMPTY_LIST = SimpleInterfaceImpl.new");
    1
    SimpleInterface si = (SimpleInterface)manager.eval("ruby", "(java)", 1, 1, "EMPTY_LIST = SimpleInterfaceImpl.new");
    1
    SimpleInterface si = (SimpleInterface)manager.eval("ruby", "(java)", 1, 1, "SimpleInterfaceImpl.new");
    Differences
    Expression1Expression2Difference
    "EMPTY_LIST = SimpleInterfaceImpl.new""SimpleInterfaceImpl.new"LITERAL_VALUE_MISMATCH
    1
    SimpleInterface si = (SimpleInterface)manager.eval("ruby", "(java)", 1, 1, "SimpleInterfaceImpl.new");
                                                        
    2
    Map map = si.getNilMap();
    Preondition Violations
    Unmatched statement Map map=si.getNilMap(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    Map map = si.getNilMap();
    2
    List list = si.getNilList();
    2
    List list = si.getNilList();
    Preondition Violations
    Unmatched statement List list=si.getNilList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    3
    assertTrue(list == null);
    3
    assertTrue(list == null);
    3
    assertTrue(map == null);
    Differences
    Expression1Expression2Difference
    listmapVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable list does not match with type java.util.Map of variable map
    • Make classes java.util.List and java.util.Map extend a common superclass
    3
    assertTrue(map == null);
    4
    si.setNilList(null);
    4
    si.setNilList(null);
    4
    si.setNilMap(null);
    Differences
    Expression1Expression2Difference
    setNilListsetNilMapMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression si.setNilList(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression si.setNilMap(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression si.setNilList(null) is a void method call, and thus it cannot be parameterized
    Expression si.setNilMap(null) is a void method call, and thus it cannot be parameterized
    4
    si.setNilMap(null);
    5
    assertTrue(si.isNilListNil());
    5
    assertTrue(si.isNilListNil());
    5
    assertTrue(si.isNilMapNil());
    Differences
    Expression1Expression2Difference
    isNilListNilisNilMapNilMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression si.isNilListNil() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression si.isNilMapNil() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    assertTrue(si.isNilMapNil());
    Precondition Violations (9)
    Row Violation
    1Unmatched statement Map map=si.getNilMap(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement List list=si.getNilList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type java.util.List of variable list does not match with type java.util.Map of variable map
    4Expression si.setNilList(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression si.setNilMap(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression si.setNilList(null) is a void method call, and thus it cannot be parameterized
    7Expression si.setNilMap(null) is a void method call, and thus it cannot be parameterized
    8Expression si.isNilListNil() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression si.isNilMapNil() cannot be parameterized, because it has dependencies to/from statements that will be extracted