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 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 13 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 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 | | | 4 | |
| | | 5 | |
22 | return pack(p - s, cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN); | | | |
23 | | | 6 | |
Precondition Violations (4)
Row |
Violation |
1 | Unmatched return CR_BROKEN; |
2 | 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 |
3 | Unmatched return pack(p - s,cl == CHAR_INVALID ? CR_BROKEN : CR_UNKNOWN); |
4 | Clone fragment #1 returns variables cl, p , while Clone fragment #2 returns variables p |