File path: /jruby-1.4.0/src/org/jruby/RubyString.java | File path: /jruby-1.4.0/src/org/jruby/RubyArray.java | |||
Method name: RubyClass createStringClass(Ruby)
|
Method name: RubyClass createArrayClass(Ruby)
|
|||
Number of AST nodes: 9 | Number of AST nodes: 7 | |||
1 | RubyClass stringClass = runtime.defineClass("String", runtime.getObject(), STRING_ALLOCATOR);↵ | 1 | RubyClass arrayc = runtime.defineClass("Array", runtime.getObject(), ARRAY_ALLOCATOR);↵ | |
2 | runtime.setString(stringClass);↵ | 2 | runtime.set↵ | |
3 | stringClass↵ | 3 | Array(arrayc);↵ | |
4 | .index = ClassIndex.STRING;↵ | 4 | arrayc.index = ClassIndex.ARRAY;↵ | |
5 | stringClass.kindOf = new RubyModule.KindOf() {↵ | 5 | arrayc.kindOf = new RubyModule.KindOf() {↵ | |
6 | @Override↵ | 6 | @Override↵ | |
7 | public boolean isKindOf(IRubyObject obj, RubyModule type) {↵ | 7 | public boolean isKindOf(IRubyObject obj, RubyModule type) {↵ | |
8 | return obj instanceof RubyString;↵ | 8 | return obj instanceof RubyArray;↵ | |
9 | }↵ | 9 | ↵ | |
10 | ↵ | 10 | }↵ | |
11 | };↵ | 11 | };↵ | |
12 | stringClass.includeModule(runtime.getComparable());↵ | 12 | ↵ | |
13 | if (!runtime.is1_9()) stringClass.includeModule(runtime.getEnumerable());↵ | 13 | arrayc.includeModule(runtime.getEnumerable());↵ | |
14 | stringClass.defineAnnotatedMethods(RubyString.class);↵ | 14 | arrayc.defineAnnotatedMethods(RubyArray.class);↵ | |
15 | return stringClass; | 15 | return arrayc; | |
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.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 25 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | RubyClass stringClass = runtime.defineClass("String", runtime.getObject(), STRING_ALLOCATOR); |
| 1 | RubyClass arrayc = runtime.defineClass("Array", runtime.getObject(), ARRAY_ALLOCATOR); | |||||||||||||||||
2 | runtime.setString(stringClass); |
| 2 | runtime.setArray(arrayc); | |||||||||||||||||
3 | stringClass.index = ClassIndex.STRING; |
| 3 | arrayc.index = ClassIndex.ARRAY; | |||||||||||||||||
4 | stringClass.kindOf = new RubyModule.KindOf() {...}; |
| 4 | arrayc.kindOf = new RubyModule.KindOf() {...}; | |||||||||||||||||
5 | stringClass.includeModule(runtime.getComparable()); |
| 5 | arrayc.includeModule(runtime.getEnumerable()); | |||||||||||||||||
6 | if (!runtime.is1_9()) | | |||||||||||||||||||
7 | stringClass.includeModule(runtime.getEnumerable()); | | |||||||||||||||||||
8 | stringClass.defineAnnotatedMethods(RubyString.class); |
| 6 | arrayc.defineAnnotatedMethods(RubyArray.class); | |||||||||||||||||
9 | return stringClass; |
| 7 | return arrayc; |
Row | Violation |
---|---|
1 | Expression runtime.setString(stringClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression runtime.setArray(arrayc) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression runtime.setString(stringClass) is a void method call, and thus it cannot be parameterized |
4 | Expression runtime.setArray(arrayc) is a void method call, and thus it cannot be parameterized |
5 | Clone fragment #1 returns variables stringClass , while Clone fragment #2 returns variables |