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: 6 | |||
1 | if ( importedStatic!= null )↵ | 1 | if ( importedStatic!= null )↵ | |
2 | for(int i=0; i<importedStatic.size(); i++)↵ | 2 | for(int i=0; i<importedStatic.size(); i++)↵ | |
3 | {↵ | 3 | {↵ | |
4 | Class clas = (Class)importedStatic.elementAt(i);↵ | 4 | Class clas = (Class)importedStatic.elementAt(i);↵ | |
5 | Method method = Reflect.resolveJavaMethod( ↵ | 5 | Field field = Reflect.resolveJavaField( ↵ | |
6 | getClassManager(), clas, name, sig, true/*onlyStatic*/ );↵ | 6 | clas, name, true/*onlyStatic*/ );↵ | |
7 | if ( method != null )↵ | 7 | if ( field != null )↵ | |
8 | return new BshMethod( method, null/*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 | 14 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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); |
| |
Row | Violation |
---|---|
1 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression Reflect.resolveJavaField(clas,name,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression Reflect.resolveJavaMethod(getClassManager(),clas,name,sig,true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression Reflect.resolveJavaField(clas,name,true) 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(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(field)); |
7 | 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 |
8 | Unmatched return new BshMethod(method,null); |
9 | Clone fragment #1 returns variable method with type java.lang.reflect.Method , while Clone fragment #2 returns variable field with type java.lang.reflect.Field |