File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/condition/HasMethod.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/condition/HasMethod.java | |||
Method name: boolean isFieldFound(Class)
|
Method name: boolean isMethodFound(Class)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | Field[] fields = clazz.getDeclaredFields();↵ | 1 | Method[] methods = clazz.getDeclaredMethods();↵ | |
2 | for (int i = 0; i < fields.length; i++) {↵ | 2 | for (int i = 0; i < methods.length; i++) {↵ | |
3 | Field fieldEntry = fields[i];↵ | 3 | Method methodEntry = methods[i];↵ | |
4 | if (fieldEntry.getName().equals(field)) {↵ | 4 | if (methodEntry.getName().equals(method)) {↵ | |
5 | return true;↵ | 5 | return true;↵ | |
6 | }↵ | 6 | }↵ | |
7 | }↵ | 7 | }↵ | |
8 | return false; | 8 |
| |
See real code fragment | See real code fragment |
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 | 12 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Method[] methods = clazz.getDeclaredMethods(); | |||||||||||||||||||
1 | Field[] fields = clazz.getDeclaredFields(); | | |||||||||||||||||||
2 | for (int i = 0; i < fields.length; i++) |
| 2 | for (int i = 0; i < methods.length; i++) | |||||||||||||||||
|
| 3 | Method methodEntry = methods[i]; | ||||||||||||||||||
3 | Field fieldEntry = fields[i]; |
| | ||||||||||||||||||
4 | if (fieldEntry.getName().equals(field)) |
| 4 | if (methodEntry.getName().equals(method)) | |||||||||||||||||
5 | return true; | 5 | return true; | ||||||||||||||||||
6 | return false; | 6 | return false; |
Row | Violation |
---|---|
1 | Type java.lang.reflect.Field[] of variable fields does not match with type java.lang.reflect.Method[] of variable methods |
2 | Unmatched statement Method methodEntry=methods[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement Field fieldEntry=fields[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression fieldEntry cannot be unified with expression methodEntry , because common superclass java.lang.reflect.AccessibleObject does not declare member(s) public java.lang.String getName() |