try {
Method method;
method = obj.getClass().getMethod(
methodName, new Class[] {argType1, argType2});
return method.invoke(obj, new Object[] {arg1, arg2});
} catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
try {
Method method;
method = obj.getClass().getMethod(
methodName, new Class[] {argType});
return method.invoke(obj, new Object[] {arg});
} catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/ReflectUtil.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/ReflectUtil.java
|
Method name: Object invoke(Object, String, Class, Object, Class, Object)
|
|
Method name: Object invoke(Object, String, Class, Object)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | try {↵ | | 1 | try {↵
|
2 | Method method;↵ | | 2 | Method method;↵
|
3 | method = obj.getClass().getMethod(↵ | | 3 | method = obj.getClass().getMethod(↵
|
4 | methodName, new Class[] {argType1, argType2});↵ | | 4 | methodName, new Class[] {argType});↵
|
5 | return method.invoke(obj, new Object[] {arg1, arg2});↵ | | 5 | return method.invoke(obj, new Object[] {arg});↵
|
6 | } catch (Exception t) {↵ | | 6 | } catch (Exception t) {↵
|
7 | throwBuildException(t);↵ | | 7 | throwBuildException(t);↵
|
8 | return null; // NotReached↵ | | 8 | return null; // NotReached↵
|
9 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
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 | 16 |
-
{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) | 0.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | try | | 1 | try |
2 | | | 2 | |
3 | method = obj.getClass().getMethod(methodName, new Class[] {argType1, argType2}); | | 3 | method = obj.getClass().getMethod(methodName, new Class[] {argType}); |
4 | return method.invoke(obj, new Object[] {arg1, arg2}); | | 4 | return method.invoke(obj, new Object[] {arg}); |
Precondition Violations (0)
Row |
Violation |