try {
Class<?>[] parameterTypes = buildClassArgs(args);
Constructor<?> constructor = javaClass().getDeclaredConstructor (parameterTypes);
return new JavaConstructor(getRuntime(), constructor);
} catch (NoSuchMethodException nsme) {
throw getRuntime().newNameError("no matching java constructor", null);
}
try {
Class<?>[] parameterTypes = buildClassArgs(args);
Constructor<?> constructor = javaClass().getConstructor(parameterTypes);
return new JavaConstructor(getRuntime(), constructor);
} catch (NoSuchMethodException nsme) {
throw getRuntime().newNameError("no matching java constructor", null);
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java
|
|
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java
|
Method name: JavaConstructor declared_constructor(IRubyObject[])
|
|
Method name: JavaConstructor constructor(IRubyObject[])
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | try {↵ | | 1 | try {↵
|
2 | Class<?>[] parameterTypes = buildClassArgs(args);↵ | | 2 | Class<?>[] parameterTypes = buildClassArgs(args);↵
|
3 | Constructor<?> constructor = javaClass().getDeclaredConstructor (parameterTypes);↵ | | 3 | Constructor<?> constructor = javaClass().getConstructor(parameterTypes);↵
|
4 | return new JavaConstructor(getRuntime(), constructor);↵ | | 4 | return new JavaConstructor(getRuntime(), constructor);↵
|
5 | } catch (NoSuchMethodException nsme) {↵ | | 5 | } catch (NoSuchMethodException nsme) {↵
|
6 | throw getRuntime().newNameError("no matching java constructor", null);↵ | | 6 | throw getRuntime().newNameError("no matching java constructor", null);↵
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 16 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | try | | 1 | try |
2 | Class<?>[] parameterTypes = buildClassArgs(args); | | 2 | Class<?>[] parameterTypes = buildClassArgs(args); |
3 | Constructor<?> constructor = javaClass().getDeclaredConstructor(parameterTypes); | | 3 | Constructor<?> constructor = javaClass().getConstructor(parameterTypes); |
4 | return new JavaConstructor(getRuntime(), constructor); | | 4 | return new JavaConstructor(getRuntime(), constructor); |
Precondition Violations (2)
Row |
Violation |
1 | Expression javaClass().getDeclaredConstructor(parameterTypes) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression javaClass().getConstructor(parameterTypes) cannot be parameterized, because it has dependencies to/from statements that will be extracted |