if (desc.actualRequired <= 3) {
specificArity = desc.actualRequired;
} else {
specificArity = -1;
}
if (desc.actualRequired <= 3) {
// actual required is less than 3, so we use specific arity
specificArity = desc.actualRequired;
} else {
// actual required is greater than 3, raise error (we don't support actual required > 3)
throw new RuntimeException("Invalid specific-arity number of arguments (" + desc.actualRequired + ") on method " + desc.declaringClassName + "." + desc.name);
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/internal/runtime/methods/InvocationMethodFactory.java
|
|
File path: /jruby-1.4.0/src/org/jruby/internal/runtime/methods/InvocationMethodFactory.java
|
Method name: Class getAnnotatedMethodClass(JavaMethodDescriptor)
|
|
Method name: void DescriptorInfo(List)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | if (desc.actualRequired <= 3) {↵ | | 1 | if (desc.actualRequired <= 3) {↵
|
| | | 2 | // actual required is less than 3, so we use specific arity↵
|
2 | specificArity = desc.actualRequired;↵ | | 3 | specificArity = desc.actualRequired;↵
|
3 | } else {↵ | | 4 | } else {↵
|
4 | ↵ | | 5 | // actual required is greater than 3, raise error (we don't support actual required > 3)↵
|
5 | specificArity = -1;↵ | | 6 | throw new RuntimeException("Invalid specific-arity ↵
|
| | | 7 | number of arguments (" + desc.actualRequired + ") on method " + desc.declaringClassName + "." + desc.name);↵
|
6 | } | | 8 | }
|
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.3 |
Clones location | Clones are in the same java file |
Number of node comparisons | 10 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
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) | 0.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
14 | if (desc.actualRequired <= 3) | | 16 | if (desc.actualRequired <= 3) |
15 | specificArity = desc.actualRequired; | | 17 | specificArity = desc.actualRequired; |
| | | | |
16 | | | | |
| | | 18 | throw new RuntimeException("Invalid specific-arity number of arguments (" + desc.actualRequired + ") on method " + desc.declaringClassName + "." + desc.name); |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement throw new RuntimeException("Invalid specific-arity number of arguments (" + desc.actualRequired + ") on method "+ desc.declaringClassName+ "."+ desc.name); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched throw new RuntimeException("Invalid specific-arity number of arguments (" + desc.actualRequired + ") on method "+ desc.declaringClassName+ "."+ desc.name); |