File path: /jruby-1.4.0/src/org/jruby/RubyBoolean.java | File path: /jruby-1.4.0/src/org/jruby/RubyBoolean.java | |||
Method name: RubyClass createTrueClass(Ruby)
|
Method name: RubyClass createFalseClass(Ruby)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | RubyClass trueClass = runtime.defineClass("TrueClass", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);↵ | 1 | RubyClass falseClass = runtime.defineClass("FalseClass", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);↵ | |
2 | runtime.setTrueClass(trueClass);↵ | 2 | runtime.setFalseClass(falseClass);↵ | |
3 | trueClass.index = ClassIndex.TRUE;↵ | 3 | falseClass.index = ClassIndex.FALSE;↵ | |
4 | ↵ | 4 | ↵ | |
5 | trueClass.defineAnnotatedMethods(True.class);↵ | 5 | falseClass.defineAnnotatedMethods(False.class);↵ | |
6 | ↵ | 6 | ↵ | |
7 | trueClass.getMetaClass().undefineMethod("new");↵ | 7 | falseClass.getMetaClass().undefineMethod("new");↵ | |
8 | ↵ | 8 | ↵ | |
9 | return trueClass; | 9 | return falseClass; | |
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 declared in the same class |
Number of node comparisons | 20 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | RubyClass trueClass = runtime.defineClass("TrueClass", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); |
| 1 | RubyClass falseClass = runtime.defineClass("FalseClass", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); | |||||||||||||||||
2 | runtime.setTrueClass(trueClass); |
| 2 | runtime.setFalseClass(falseClass); | |||||||||||||||||
3 | trueClass.index = ClassIndex.TRUE; |
| 3 | falseClass.index = ClassIndex.FALSE; | |||||||||||||||||
4 | trueClass.defineAnnotatedMethods(True.class); |
| 4 | falseClass.defineAnnotatedMethods(False.class); | |||||||||||||||||
5 | trueClass.getMetaClass().undefineMethod("new"); |
| 5 | falseClass.getMetaClass().undefineMethod("new"); | |||||||||||||||||
6 | return trueClass; |
| 6 | return falseClass; |
Row | Violation |
---|---|
1 | Expression runtime.setTrueClass(trueClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression runtime.setFalseClass(falseClass) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression runtime.setTrueClass(trueClass) is a void method call, and thus it cannot be parameterized |
4 | Expression runtime.setFalseClass(falseClass) is a void method call, and thus it cannot be parameterized |