while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return pack(p - s, cl == CHAR_INVALID ? CR_BROKEN: CR_UNKNOWN); p += cl; }
while (p < end) { int cl = preciseLength(enc, bytes, p, end); if (cl <= 0) return CR_BROKEN; p += cl; }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/StringSupport.java File path: /jruby-1.4.0/src/org/jruby/util/StringSupport.java
Method name: long codeRangeScanRestartable(Encoding, byte[], int, int, int) Method name: int codeRangeScanNonAsciiCompatible(Encoding, byte[], int, int)
Number of AST nodes: 5 Number of AST nodes: 5
1
while (p < end) {
1
while (p < end) {
2
      
2
        
3
          int cl = preciseLength(enc, bytes, p, end);
3
            int cl = preciseLength(enc, bytes, p, end);
4
                if (cl <= 0) return pack(p - s, cl == CHAR_INVALID ? CR_BROKEN: CR_UNKNOWN);
4
            if (cl <= 0) return 
5
    
5
CR_BROKEN;
6
            p += cl;
6
            p += cl;
7
            }
7
        }
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 comparisons13
  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)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    19
    while (p < end)
    2
    while (p < end)
    20
    int cl = preciseLength(enc, bytes, p, end);
    3
    int cl = preciseLength(enc, bytes, p, end);
    21
    if (cl <= 0)
    4
    if (cl <= 0)
                                            
    5
    return CR_BROKEN;
    Preondition Violations
    Unmatched return CR_BROKEN;
    5
    return CR_BROKEN;
    22
    return pack(p - s, cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN);
    22
    return pack(p - s, cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN);
    Preondition Violations
    Unmatched statement return pack(p - s,cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return pack(p - s,cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN);
                                                                                                                                          
    23
    p += cl;
    6
    p += cl;
    Precondition Violations (4)
    Row Violation
    1Unmatched return CR_BROKEN;
    2Unmatched statement return pack(p - s,cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return pack(p - s,cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN);
    4Clone fragment #1 returns variables cl, p , while Clone fragment #2 returns variables p