final CallNode iVisited = (CallNode) node; Object isnull = context.getNewEnding(); Object ending = context.getNewEnding(); compileGetDefinition(iVisited.getReceiverNode(), context); context.ifNull(isnull); context.rescue(new BranchCallback() { public void branch(BodyCompiler context) { compile(iVisited.getReceiverNode(), context,true); //[IRubyObject] context.duplicateCurrentValue(); //[IRubyObject, IRubyObject] context.metaclass(); //[IRubyObject, RubyClass] context.duplicateCurrentValue(); //[IRubyObject, RubyClass, RubyClass] context.getVisibilityFor(iVisited.getName()); //[IRubyObject, RubyClass, Visibility] context.duplicateCurrentValue(); //[IRubyObject, RubyClass, Visibility, Visibility] final Object isfalse = context.getNewEnding(); Object isreal = context.getNewEnding(); Object ending = context.getNewEnding(); context.isPrivate(isfalse, 3); //[IRubyObject, RubyClass, Visibility] context.isNotProtected(isreal, 1); //[IRubyObject, RubyClass] context.selfIsKindOf(isreal); //[IRubyObject] context.consumeCurrentValue(); context.go(isfalse); context.setEnding(isreal); //[] context.isMethodBound(iVisited.getName(), new BranchCallback() { public void branch(BodyCompiler context) { compileGetArgumentDefinition(iVisited.getArgsNode(), context, "method"); } }, new BranchCallback() { public void branch(BodyCompiler context) { context.go(isfalse); } }); context.go(ending); context.setEnding(isfalse); context.pushNull(); context.setEnding(ending); } }, JumpException.class, new BranchCallback() { public void branch(BodyCompiler context) { context.pushNull(); } }, String.class); // context.swapValues(); //context.consumeCurrentValue(); context.go(ending); context.setEnding(isnull); context.pushNull(); context.setEnding(ending); break;
final AttrAssignNode iVisited = (AttrAssignNode) node; Object isnull = context.getNewEnding(); Object ending = context.getNewEnding(); compileGetDefinition(iVisited.getReceiverNode(), context); context.ifNull(isnull); context.rescue(new BranchCallback() { public void branch(BodyCompiler context) { compile(iVisited.getReceiverNode(), context,true); //[IRubyObject] context.duplicateCurrentValue(); //[IRubyObject, IRubyObject] context.metaclass(); //[IRubyObject, RubyClass] context.duplicateCurrentValue(); //[IRubyObject, RubyClass, RubyClass] context.getVisibilityFor(iVisited.getName()); //[IRubyObject, RubyClass, Visibility] context.duplicateCurrentValue(); //[IRubyObject, RubyClass, Visibility, Visibility] final Object isfalse = context.getNewEnding(); Object isreal = context.getNewEnding(); Object ending = context.getNewEnding(); context.isPrivate(isfalse, 3); //[IRubyObject, RubyClass, Visibility] context.isNotProtected(isreal, 1); //[IRubyObject, RubyClass] context.selfIsKindOf(isreal); //[IRubyObject] context.consumeCurrentValue(); context.go(isfalse); context.setEnding(isreal); //[] context.isMethodBound(iVisited.getName(), new BranchCallback() { public void branch(BodyCompiler context) { compileGetArgumentDefinition(iVisited.getArgsNode(), context, "assignment"); } }, new BranchCallback() { public void branch(BodyCompiler context) { context.go(isfalse); } }); context.go(ending); context.setEnding(isfalse); context.pushNull(); context.setEnding(ending); } }, JumpException.class, new BranchCallback() { public void branch(BodyCompiler context) { context.pushNull(); } }, String.class); context.go(ending); context.setEnding(isnull); context.pushNull(); context.setEnding(ending); break;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java
Method name: void compileGetDefinition(Node, BodyCompiler) Method name: void compileGetDefinition(Node, BodyCompiler)
Number of AST nodes: 11 Number of AST nodes: 11
1
final CallNode iVisited = (CallNode) node;
1
final AttrAssignNode iVisited = (AttrAssignNode) node;
2
                    Object isnull = context.getNewEnding();
2
                    Object isnull = context.getNewEnding();
3
                    Object ending = context.getNewEnding();
3
                    Object ending = context.getNewEnding();
4
                    compileGetDefinition(iVisited.getReceiverNode(), context);
4
                    compileGetDefinition(iVisited.getReceiverNode(), context);
5
                    context.ifNull(isnull);
5
                    context.ifNull(isnull);
6
                    context.rescue(new BranchCallback() {
6
                    context.rescue(new BranchCallback() {
7
                                public void branch(BodyCompiler context) {
7
                                public void branch(BodyCompiler context) {
8
                                    compile(iVisited.getReceiverNode(), context,true); //[IRubyObject]
8
                                    compile(iVisited.getReceiverNode(), context,true); //[IRubyObject]
9
                                    context.duplicateCurrentValue(); //[IRubyObject, IRubyObject]
9
                                    context.duplicateCurrentValue(); //[IRubyObject, IRubyObject]
10
                                    context.metaclass(); //[IRubyObject, RubyClass]
10
                                    context.metaclass(); //[IRubyObject, RubyClass]
11
                                    context.duplicateCurrentValue(); //[IRubyObject, RubyClass, RubyClass]
11
                                    context.duplicateCurrentValue(); //[IRubyObject, RubyClass, RubyClass]
12
                                    context.getVisibilityFor(iVisited.getName()); //[IRubyObject, RubyClass, Visibility]
12
                                    context.getVisibilityFor(iVisited.getName()); //[IRubyObject, RubyClass, Visibility]
13
                                    context.duplicateCurrentValue(); //[IRubyObject, RubyClass, Visibility, Visibility]
13
                                    context.duplicateCurrentValue(); //[IRubyObject, RubyClass, Visibility, Visibility]
14
                                    final Object isfalse = context.getNewEnding();
14
                                    final Object isfalse = context.getNewEnding();
15
                                    Object isreal = context.getNewEnding();
15
                                    Object isreal = context.getNewEnding();
16
                                    Object ending = context.getNewEnding();
16
                                    Object ending = context.getNewEnding();
17
                                    context.isPrivate(isfalse, 3); //[IRubyObject, RubyClass, Visibility]
17
                                    context.isPrivate(isfalse, 3); //[IRubyObject, RubyClass, Visibility]
18
                                    context.isNotProtected(isreal, 1); //[IRubyObject, RubyClass]
18
                                    context.isNotProtected(isreal, 1); //[IRubyObject, RubyClass]
19
                                    context.selfIsKindOf(isreal); //[IRubyObject]
19
                                    context.selfIsKindOf(isreal); //[IRubyObject]
20
                                    context.consumeCurrentValue();
20
                                    context.consumeCurrentValue();
21
                                    context.go(isfalse);
21
                                    context.go(isfalse);
22
                                    context.setEnding(isreal); //[]
22
                                    context.setEnding(isreal); //[]
23
                                    context.isMethodBound(iVisited.getName(), new BranchCallback() {
23
                                    context.isMethodBound(iVisited.getName(), new BranchCallback() {
24
                                                public void branch(BodyCompiler context) {
24
                                                public void branch(BodyCompiler context) {
25
                                                    compileGetArgumentDefinition(iVisited.getArgsNode(), context, "method");
25
                                                    compileGetArgumentDefinition(iVisited.getArgsNode(), context, "assignment");
26
                                                }
26
                                                }
27
                                            },
27
                                            },
28
                                            new BranchCallback() {
28
                                            new BranchCallback() {
29
                                                public void branch(BodyCompiler context) {
29
                                                public void branch(BodyCompiler context) {
30
                                                    context.go(isfalse);
30
                                                    context.go(isfalse);
31
                                                }
31
                                                }
32
                                            });
32
                                            });
33
                                    context.go(ending);
33
                                    context.go(ending);
34
                                    context.setEnding(isfalse);
34
                                    context.setEnding(isfalse);
35
                                    context.pushNull();
35
                                    context.pushNull();
36
                                    context.setEnding(ending);
36
                                    context.setEnding(ending);
37
                                }
37
                                }
38
                            }, JumpException.class,
38
                            }, JumpException.class,
39
                            new BranchCallback() {
39
                            new BranchCallback() {
40
                                public void branch(BodyCompiler context) {
40
                                public void branch(BodyCompiler context) {
41
                                    context.pushNull();
41
                                    context.pushNull();
42
                                }
42
                                }
43
                            }, String.class);
43
                            }, String.class);
44
                    //          context.swapValues();
45
            //context.consumeCurrentValue();
46
                    context.go(ending);
44
                    context.go(ending);
47
                    context.setEnding(isnull);
45
                    context.setEnding(isnull);
48
                    context.pushNull();
46
                    context.pushNull();
49
                    context.setEnding(ending);
47
                    context.setEnding(ending);
50
                    break;
48
                    break;
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 the same method
Number of node comparisons121
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    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
    73
    final CallNode iVisited = (CallNode)node;
    73
    final CallNode iVisited = (CallNode)node;
    163
    final AttrAssignNode iVisited = (AttrAssignNode)node;
    Differences
    Expression1Expression2Difference
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    163
    final AttrAssignNode iVisited = (AttrAssignNode)node;
    74
    Object isnull = context.getNewEnding();
    164
    Object isnull = context.getNewEnding();
    75
    Object ending = context.getNewEnding();
    165
    Object ending = context.getNewEnding();
    76
    compileGetDefinition(iVisited.getReceiverNode(), context);
    76
    compileGetDefinition(iVisited.getReceiverNode(), context);
    166
    compileGetDefinition(iVisited.getReceiverNode(), context);
    Differences
    Expression1Expression2Difference
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode()
    166
    compileGetDefinition(iVisited.getReceiverNode(), context);
    77
    context.ifNull(isnull);
    167
    context.ifNull(isnull);
    78
    context.rescue(new BranchCallback() {...}, JumpException.class, new BranchCallback() {...}, String.class);
    78
    context.rescue(new BranchCallback() {...}, JumpException.class, new BranchCallback() {...}, String.class);
    168
    context.rescue(new BranchCallback() {...}, JumpException.class, new BranchCallback() {...}, String.class);
    Differences
    Expression1Expression2Difference
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    org.jruby.ast.CallNodeorg.jruby.ast.AttrAssignNodeSUBCLASS_TYPE_MISMATCH
    "method""assignment"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    168
    context.rescue(new BranchCallback() {...}, JumpException.class, new BranchCallback() {...}, String.class);
    79
    context.go(ending);
    169
    context.go(ending);
    80
    context.setEnding(isnull);
    170
    context.setEnding(isnull);
    81
    context.pushNull();
    171
    context.pushNull();
    82
    context.setEnding(ending);
    172
    context.setEnding(ending);
    83
    break;
    173
    break;
    Precondition Violations (5)
    Row Violation
    1Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode()
    2Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    3Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    4Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()
    5Expression iVisited cannot be unified with expression iVisited , because common superclass org.jruby.ast.Node does not declare member(s) public org.jruby.ast.Node getReceiverNode() , public java.lang.String getName() , public org.jruby.ast.Node getArgsNode()