File path: /jruby-1.4.0/src/org/jruby/RubyEncoding.java | File path: /jruby-1.4.0/src/org/jruby/RubyConverter.java | |||
Method name: RubyClass createEncodingClass(Ruby)
|
Method name: RubyClass createConverterClass(Ruby)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 6 | |||
1 | RubyClass encodingc = runtime.defineClass("Encoding", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);↵ | 1 | RubyClass converterc = runtime.defineClassUnder("Converter", runtime.getClass("Data"), CONVERTER_ALLOCATOR, runtime.getEncoding());↵ | |
2 | runtime.setEncoding(encodingc);↵ | 2 | runtime.setConverter(converterc);↵ | |
3 | encodingc.index = ClassIndex.ENCODING;↵ | 3 | converterc.index = ClassIndex.CONVERTER;↵ | |
4 | encodingc.kindOf = new RubyModule.KindOf() {↵ | 4 | converterc.kindOf = new RubyModule.KindOf() {↵ | |
5 | @Override↵ | 5 | @Override↵ | |
6 | public boolean isKindOf(IRubyObject obj, RubyModule type) {↵ | 6 | public boolean isKindOf(IRubyObject obj, RubyModule type) {↵ | |
7 | return obj instanceof RubyEncoding;↵ | 7 | return obj instanceof RubyConverter;↵ | |
8 | }↵ | 8 | }↵ | |
9 | };↵ | 9 | };↵ | |
10 | encodingc.getSingletonClass().undefineMethod("allocate");↵ | 10 | ↵ | |
11 | encodingc.defineAnnotatedMethods(RubyEncoding.class);↵ | 11 | converterc.defineAnnotatedMethods(RubyConverter.class);↵ | |
12 | return encodingc; | 12 | return converterc; | |
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 | 24 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 1 |
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 encodingc = runtime.defineClass("Encoding", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); |
| 1 | RubyClass converterc = runtime.defineClassUnder("Converter", runtime.getClass("Data"), CONVERTER_ALLOCATOR, runtime.getEncoding()); | |||||||||||||||||
2 | runtime.setEncoding(encodingc); |
| 2 | runtime.setConverter(converterc); | |||||||||||||||||
3 | encodingc.index = ClassIndex.ENCODING; |
| 3 | converterc.index = ClassIndex.CONVERTER; | |||||||||||||||||
4 | encodingc.kindOf = new RubyModule.KindOf() {...}; |
| 4 | converterc.kindOf = new RubyModule.KindOf() {...}; | |||||||||||||||||
5 | encodingc.getSingletonClass().undefineMethod("allocate"); | | |||||||||||||||||||
6 | encodingc.defineAnnotatedMethods(RubyEncoding.class); |
| 5 | converterc.defineAnnotatedMethods(RubyConverter.class); | |||||||||||||||||
7 | return encodingc; |
| 6 | return converterc; |
Row | Violation |
---|---|
1 | Expression runtime.setEncoding(encodingc) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression runtime.setConverter(converterc) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression runtime.setEncoding(encodingc) is a void method call, and thus it cannot be parameterized |
4 | Expression runtime.setConverter(converterc) is a void method call, and thus it cannot be parameterized |
5 | Clone fragment #1 returns variables encodingc , while Clone fragment #2 returns variables |