c = codePoint(runtime, enc, bytes, s, end); if (enc.isUpper(c)) { enc.codeToMbc(toLower(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c);
c = codePoint(runtime, enc, bytes, s, end); if (enc.isLower(c)) { enc.codeToMbc(toUpper(enc, c), bytes, s); modify = true; } s += codeLength(runtime, enc, c);
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: IRubyObject multiByteDowncase(Ruby, Encoding, byte[], int, int) Method name: IRubyObject multiByteUpcase(Ruby, Encoding, byte[], int, int)
Number of AST nodes: 5 Number of AST nodes: 5
1
c = codePoint(runtime, enc, bytes, s, end);
1
c = codePoint(runtime, enc, bytes, s, end);
2
                if (enc.isUpper(c)) {
2
                if (enc.isLower(c)) {
3
                    enc.codeToMbc(toLower(enc, c), bytes, s);
3
                    enc.codeToMbc(toUpper(enc, c), bytes, s);
4
                    modify = true;
4
                    modify = true;
5
                }
5
                }
6
                s += codeLength(runtime, enc, c);
6
                s += codeLength(runtime, enc, c);
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.8
Clones locationClones are declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    c = codePoint(runtime, enc, bytes, s, end);
    9
    c = codePoint(runtime, enc, bytes, s, end);
    10
    if (enc.isUpper(c))
    10
    if (enc.isUpper(c))
    10
    if (enc.isLower(c))
    Differences
    Expression1Expression2Difference
    isUpperisLowerMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression enc.isUpper(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression enc.isLower(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (enc.isLower(c))
    11
    enc.codeToMbc(toLower(enc, c), bytes, s);
    11
    enc.codeToMbc(toLower(enc, c), bytes, s);
    11
    enc.codeToMbc(toUpper(enc, c), bytes, s);
    Differences
    Expression1Expression2Difference
    toLowertoUpperMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression toLower(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression toUpper(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    enc.codeToMbc(toUpper(enc, c), bytes, s);
    12
    modify = true;
    12
    modify = true;
    13
    s += codeLength(runtime, enc, c);
    13
    s += codeLength(runtime, enc, c);
    Precondition Violations (5)
    Row Violation
    1Expression enc.isUpper(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression enc.isLower(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression toLower(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression toUpper(enc,c) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables s, modify , while Clone fragment #2 returns variables s, modify