File path: /jruby-1.4.0/src/org/jruby/java/MiniJava.java | File path: /jruby-1.4.0/src/org/jruby/java/MiniJava.java | |||
Method name: RubyClass createImplClass(Class[], Ruby, String)
|
Method name: Class createOldStyleImplClass(Class[], RubyClass, Ruby, String)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 11 | |||
1 | String[] superTypeNames = new String[superTypes.length];↵ | 1 | String[] superTypeNames = new String[superTypes.length];↵ | |
2 | Map<String, List<Method>> simpleToAll = new HashMap<String, List<Method>>();↵ | 2 | Map<String, List<Method>> simpleToAll = new HashMap<String, List<Method>>();↵ | |
3 | for (int i = 0; i < superTypes.length; i++) {↵ | 3 | for (int i = 0; i < superTypes.length; i++) {↵ | |
4 | superTypeNames[i] = p(superTypes[i]);↵ | 4 | superTypeNames[i] = p(superTypes[i]);↵ | |
5 | ↵ | 5 | ↵ | |
6 | for (Method method : superTypes[i].getMethods()) {↵ | 6 | for (Method method : superTypes[i].getMethods()) {↵ | |
7 | List<Method> methods = simpleToAll.get(method.getName());↵ | 7 | List<Method> methods = simpleToAll.get(method.getName());↵ | |
8 | if (methods == null) simpleToAll.put(method.getName(), methods = new ArrayList<Method>());↵ | 8 | if (methods == null) simpleToAll.put(method.getName(), methods = new ArrayList<Method>());↵ | |
9 | methods.add(method);↵ | 9 | methods.add(method);↵ | |
10 | }↵ | 10 | }↵ | |
11 | }↵ | 11 | }↵ | |
12 | ↵ | 12 | ↵ | |
13 | Class newClass = defineImplClass(ruby, name, superTypeNames, simpleToAll);↵ | 13 | Class newClass = defineOldStyleImplClass(ruby, name, superTypeNames, simpleToAll);↵ | |
14 | RubyClass rubyCls = populateImplClass(ruby, newClass, simpleToAll);↵ | |||
15 | ↵ | 14 | ↵ | |
16 | return rubyCls; | 15 | return newClass; | |
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 | 31 |
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 5.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String[] superTypeNames = new String[superTypes.length]; | 1 | String[] superTypeNames = new String[superTypes.length]; | |||||||||||||
2 | Map<String, List<Method>> simpleToAll = new HashMap<String, List<Method>>(); | 2 | Map<String, List<Method>> simpleToAll = new HashMap<String, List<Method>>(); | |||||||||||||
3 | for (int i = 0; i < superTypes.length; i++) | 3 | for (int i = 0; i < superTypes.length; i++) | |||||||||||||
4 | superTypeNames[i] = p(superTypes[i]); | 4 | superTypeNames[i] = p(superTypes[i]); | |||||||||||||
5 | for (Method method : superTypes[i].getMethods()) | 5 | for (Method method : superTypes[i].getMethods()) | |||||||||||||
6 | List<Method> methods = simpleToAll.get(method.getName()); | 6 | List<Method> methods = simpleToAll.get(method.getName()); | |||||||||||||
7 | if (methods == null) | 7 | if (methods == null) | |||||||||||||
8 | simpleToAll.put(method.getName(), methods = new ArrayList<Method>()); | 8 | simpleToAll.put(method.getName(), methods = new ArrayList<Method>()); | |||||||||||||
9 | methods.add(method); | 9 | methods.add(method); | |||||||||||||
10 | Class newClass = defineImplClass(ruby, name, superTypeNames, simpleToAll); |
| 10 | Class newClass = defineOldStyleImplClass(ruby, name, superTypeNames, simpleToAll); | ||||||||||||
| 11 | return newClass; | ||||||||||||||
11 | RubyClass rubyCls = populateImplClass(ruby, newClass, simpleToAll); | | ||||||||||||||
12 | return rubyCls; |
| |
Row | Violation |
---|---|
1 | Expression defineImplClass(ruby,name,superTypeNames,simpleToAll) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression defineOldStyleImplClass(ruby,name,superTypeNames,simpleToAll) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return rubyCls; |
4 | Clone fragment #1 returns variables simpleToAll, newClass , while Clone fragment #2 returns variables newClass |