Encoding enc = isCompatibleWith(other); if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.encoding + " and " + other.getEncoding()); return enc;
Encoding enc = isCompatibleWith(other); if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.encoding + " and " + other.value.encoding); return enc;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyString.java File path: /jruby-1.4.0/src/org/jruby/RubyString.java
Method name: Encoding checkEncoding(EncodingCapable) Method name: Encoding checkEncoding(RubyString)
Number of AST nodes: 4 Number of AST nodes: 4
1
Encoding enc = isCompatibleWith(other);
1
Encoding enc = isCompatibleWith(other);
2
        if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + 
2
        if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + 
3
                                value.encoding + " and " + other.getEncoding());
3
                                value.encoding + " and " + other.value.encoding);
4
        return enc;
4
        return enc;
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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Encoding enc = isCompatibleWith(other);
    1
    Encoding enc = isCompatibleWith(other);
    1
    Encoding enc = isCompatibleWith(other);
    Differences
    Expression1Expression2Difference
    org.jruby.runtime.encoding.EncodingCapableorg.jruby.RubyStringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.runtime.encoding.EncodingCapable of variable other does not match with type org.jruby.RubyString of variable other
    • Make classes org.jruby.runtime.encoding.EncodingCapable and org.jruby.RubyString extend a common superclass
    1
    Encoding enc = isCompatibleWith(other);
    2
    if (enc == null)
    2
    if (enc == null)
    3
    throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.encoding + " and " + other.getEncoding());
    3
    throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.encoding + " and " + other.getEncoding());
    3
    throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.encoding + " and " + other.value.encoding);
    Differences
    Expression1Expression2Difference
    other.getEncoding()other.value.encodingTYPE_COMPATIBLE_REPLACEMENT
    3
    throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.encoding + " and " + other.value.encoding);
    4
    return enc;
    4
    return enc;
    Precondition Violations (1)
    Row Violation
    1Type org.jruby.runtime.encoding.EncodingCapable of variable other does not match with type org.jruby.RubyString of variable other