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: 5 | Number of AST nodes: 4 | |||
1 | Object object = importedObjects.elementAt(i);↵ | 1 | Class clas = (Class)importedStatic.elementAt(i);↵ | |
2 | Class clas = object.getClass();↵ | 2 | ↵ | |
3 | Method method = Reflect.resolveJavaMethod( ↵ | 3 | Field field = Reflect.resolveJavaField( ↵ | |
4 | getClassManager(), clas, name, sig, false/*onlyStatic*/ );↵ | 4 | clas, name, true/*onlyStatic*/ );↵ | |
5 | if ( method != null )↵ | 5 | if ( field != null )↵ | |
6 | return new BshMethod( method, object ); | 6 | return new Variable( name, field.getType(), new LHS( field ) ); | |
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 | 10 |
Number of mapped statements | 2 |
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 | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 Class clas=object.getClass(); 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=(Class)importedStatic.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | 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 |
4 | Unmatched return new BshMethod(method,object); |
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 | 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 |