if(this == other) { return true; } if(!(other instanceof Block)) { return false; } Block bOther = (Block)other; return this.binding.equals(bOther.binding) && this.body == bOther.body;
if(this == other) { return true; } if(!(other instanceof Binding)) { return false; } Binding bOther = (Binding)other; return this.self == bOther.self && this.dynamicScope == bOther.dynamicScope;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/runtime/Block.java File path: /jruby-1.4.0/src/org/jruby/runtime/Binding.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 6 Number of AST nodes: 6
1
if(this == other) {
1
if(this == other) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if(!(other instanceof Block)) {
4
        if(!(other instanceof Binding)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        Block bOther = (Block)other;
7
        Binding bOther = (Binding)other;
8
        return this.binding.equals(bOther.binding) &&
8
        return this.self == bOther.self &&
9
            this.body == bOther.body;
9
            this.dynamicScope == bOther.dynamicScope;
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.3
Clones locationClones are in different classes
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (this == other)
    1
    if (this == other)
    2
    return true;
    2
    return true;
    3
    if (!(other instanceof Block))
    3
    if (!(other instanceof Block))
    3
    if (!(other instanceof Binding))
    Differences
    Expression1Expression2Difference
    org.jruby.runtime.Blockorg.jruby.runtime.BindingVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type boolean of variable other instanceof Block does not match with type boolean of variable other instanceof Binding
    • Make classes org.jruby.runtime.Block and org.jruby.runtime.Binding extend a common superclass
    3
    if (!(other instanceof Binding))
    4
    return false;
    4
    return false;
                                                                      
    5
    Binding bOther = (Binding)other;
    5
    Block bOther = (Block)other;
                                                              
                                                                                                                                                                  
    6
    return this.self == bOther.self && this.dynamicScope == bOther.dynamicScope;
    Preondition Violations
    Unmatched return this.self == bOther.self && this.dynamicScope == bOther.dynamicScope;
    6
    return this.self == bOther.self && this.dynamicScope == bOther.dynamicScope;
    6
    return this.binding.equals(bOther.binding) && this.body == bOther.body;
    6
    return this.binding.equals(bOther.binding) && this.body == bOther.body;
    Preondition Violations
    Unmatched return this.binding.equals(bOther.binding) && this.body == bOther.body;
                                                                                                                                                        
    Precondition Violations (3)
    Row Violation
    1Type boolean of variable other instanceof Block does not match with type boolean of variable other instanceof Binding
    2Unmatched return this.self == bOther.self && this.dynamicScope == bOther.dynamicScope;
    3Unmatched return this.binding.equals(bOther.binding) && this.body == bOther.body;