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: 14 | Number of AST nodes: 14 | |||
1 | if ( importedObjects != null )↵ | 1 | if ( importedObjects != null )↵ | |
2 | for(int i=0; i<importedObjects.size(); i++)↵ | 2 | for(int i=0; i<importedObjects.size(); i++)↵ | |
3 | {↵ | 3 | {↵ | |
4 | Object object = importedObjects.elementAt(i);↵ | 4 | Object object = importedObjects.elementAt(i);↵ | |
5 | Class clas = object.getClass();↵ | 5 | Class clas = object.getClass();↵ | |
6 | Method method = Reflect.resolveJavaMethod( ↵ | 6 | Field field = Reflect.resolveJavaField( ↵ | |
7 | getClassManager(), clas, name, sig, false/*onlyStatic*/ );↵ | 7 | clas, name, false/*onlyStatic*/ );↵ | |
8 | if ( method != null )↵ | 8 | if ( field != null )↵ | |
9 | return new BshMethod( method, object↵ | 9 | return new Variable( ↵ | |
10 | );↵ | 10 | name, field.getType(), new LHS( object, field ) );↵ | |
11 | }↵ | 11 | }↵ | |
12 | // Try static imports↵ | 12 | // Try static imports↵ | |
13 | if ( importedStatic!= null )↵ | 13 | if ( importedStatic!= null )↵ | |
14 | for(int i=0; i<importedStatic.size(); i++)↵ | 14 | for(int i=0; i<importedStatic.size(); i++)↵ | |
15 | {↵ | 15 | {↵ | |
16 | Class clas = (Class)importedStatic.elementAt(i);↵ | 16 | Class clas = (Class)importedStatic.elementAt(i);↵ | |
17 | Method method = Reflect.resolveJavaMethod( ↵ | 17 | Field field = Reflect.resolveJavaField( ↵ | |
18 | getClassManager(), clas, name, sig, true/*onlyStatic*/ );↵ | 18 | clas, name, true/*onlyStatic*/ );↵ | |
19 | if ( method != null )↵ | 19 | if ( field != null )↵ | |
20 | return new BshMethod( method, null/*object*/ );↵ | 20 | return new Variable( name, field.getType(), new LHS( field ) );↵ | |
21 | }↵ | 21 | }↵ | |
22 | return null; | 22 |
| |
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) | 1.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 45 |
Number of mapped statements | 12 |
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) | 4.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (importedObjects != null) | 1 | if (importedObjects != null) | |||||||||||||||||||||||||||
2 | for (int i = 0; i < importedObjects.size(); i++) | 2 | for (int i = 0; i < importedObjects.size(); i++) | |||||||||||||||||||||||||||
3 | Object object = importedObjects.elementAt(i); | 3 | Object object = importedObjects.elementAt(i); | |||||||||||||||||||||||||||
4 | Class clas = object.getClass(); | 4 | Class clas = object.getClass(); | |||||||||||||||||||||||||||
5 | Method method = Reflect.resolveJavaMethod(getClassManager(), clas, name, sig, false); |
| 5 | Field field = Reflect.resolveJavaField(clas, name, false); | ||||||||||||||||||||||||||
6 | if (method != null) |
| 6 | if (field != null) | ||||||||||||||||||||||||||
|
| 7 | return new Variable(name, field.getType(), new LHS(object, field)); | |||||||||||||||||||||||||||
7 | return new BshMethod(method, object); |
| | |||||||||||||||||||||||||||
8 | if (importedStatic != null) | 8 | if (importedStatic != null) | |||||||||||||||||||||||||||
9 | for (int i = 0; i < importedStatic.size(); i++) | 9 | for (int i = 0; i < importedStatic.size(); i++) | |||||||||||||||||||||||||||
10 | Class clas = (Class)importedStatic.elementAt(i); | 10 | Class clas = (Class)importedStatic.elementAt(i); | |||||||||||||||||||||||||||
11 | Method method = Reflect.resolveJavaMethod(getClassManager(), clas, name, sig, true); |
| 11 | Field field = Reflect.resolveJavaField(clas, name, true); | ||||||||||||||||||||||||||
12 | if (method != null) |
| 12 | if (field != null) | ||||||||||||||||||||||||||
|
| 13 | return new Variable(name, field.getType(), new LHS(field)); | |||||||||||||||||||||||||||
13 | return new BshMethod(method, null); |
| | |||||||||||||||||||||||||||
14 | return null; | 14 | return null; |
Row | Violation |
---|---|
1 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression Reflect.resolveJavaField(clas,name,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression Reflect.resolveJavaField(clas,name,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement return new Variable(name,field.getType(),new LHS(object,field)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched return new Variable(name,field.getType(),new LHS(object,field)); |
7 | 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 |
8 | Unmatched return new BshMethod(method,object); |
9 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression Reflect.resolveJavaField(clas,name,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression Reflect.resolveJavaField(clas,name,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | 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 |
14 | Unmatched return new Variable(name,field.getType(),new LHS(field)); |
15 | Unmatched statement return new BshMethod(method,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
16 | Unmatched return new BshMethod(method,null); |
17 | Clone fragment #1 returns variables object, method, method , while Clone fragment #2 returns variables object, field, field |