File path: /jEdit-4.2/src/bsh/NameSpace.java | File path: /jEdit-4.2/src/bsh/NameSpace.java | |||
Method name: BshMethod getImportedMethod(String, Class[])
|
Method name: Variable getImportedVar(String)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 5 | |||
1 | for(int i=0; i<importedObjects.size(); i++)↵ | 1 | for(int i=0; i<importedStatic.size(); i++)↵ | |
2 | {↵ | 2 | {↵ | |
3 | Object object = importedObjects.elementAt(i);↵ | 3 | Class clas = (Class)importedStatic.elementAt(i);↵ | |
4 | Class clas = object.getClass();↵ | 4 | ↵ | |
5 | Method method = Reflect.resolveJavaMethod( ↵ | 5 | Field field = Reflect.resolveJavaField( ↵ | |
6 | getClassManager(), clas, name, sig, false/*onlyStatic*/ );↵ | 6 | clas, name, true/*onlyStatic*/ );↵ | |
7 | if ( method != null )↵ | 7 | if ( field != null )↵ | |
8 | return new BshMethod( method, object );↵ | 8 | return new Variable( name, field.getType(), new LHS( field ) );↵ | |
9 | } | 9 |
| |
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | for (int i = 0; i < importedObjects.size(); i++) |
| 9 | for (int i = 0; i < importedStatic.size(); i++) | ||||||||||||||||||||||||||
3 | Object object = importedObjects.elementAt(i); |
| | |||||||||||||||||||||||||||
4 | Class clas = object.getClass(); |
| | |||||||||||||||||||||||||||
|
| 10 | Class clas = (Class)importedStatic.elementAt(i); | |||||||||||||||||||||||||||
5 | Method method = Reflect.resolveJavaMethod(getClassManager(), clas, name, sig, false); |
| 11 | Field field = Reflect.resolveJavaField(clas, name, true); | ||||||||||||||||||||||||||
6 | if (method != null) |
| 12 | if (field != null) | ||||||||||||||||||||||||||
7 | return new BshMethod(method, object); |
| | |||||||||||||||||||||||||||
|
| 13 | return new Variable(name, field.getType(), new LHS(field)); |
Row | Violation |
---|---|
1 | Unmatched statement Object object=importedObjects.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Class clas=object.getClass(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement Class clas=(Class)importedStatic.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression Reflect.resolveJavaField(clas,name,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression Reflect.resolveJavaField(clas,name,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement return new BshMethod(method,object); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched return new BshMethod(method,object); |
10 | Unmatched statement return new Variable(name,field.getType(),new LHS(field)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched return new Variable(name,field.getType(),new LHS(field)); |
12 | Clone fragment #1 returns variables i, method , while Clone fragment #2 returns variables i, field |