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: IRubyObject rb_import(ThreadContext, IRubyObject, IRubyObject)
|
Method name: IRubyObject rb_import(ThreadContext, IRubyObject, IRubyObject, IRubyObject)
|
|||
Number of AST nodes: 9 | Number of AST nodes: 9 | |||
1 | String className = name.toString();↵ | 1 | String className = name.toString();↵ | |
2 | try {↵ | 2 | try {↵ | |
3 | Class cls = findClass(context.getRuntime().getJRubyClassLoader(), className);↵ | 3 | Class cls = findClass(context.getRuntime().getJRubyClassLoader(), className);↵ | |
4 | RubyModule namespace;↵ | 4 | RubyModule namespace;↵ | |
5 | if (self instanceof RubyModule) {↵ | 5 | if (self instanceof RubyModule) {↵ | |
6 | namespace = (RubyModule) self;↵ | 6 | namespace = (RubyModule) self;↵ | |
7 | } else {↵ | 7 | } else {↵ | |
8 | namespace = self.getMetaClass().getRealClass();↵ | 8 | namespace = self.getMetaClass().getRealClass();↵ | |
9 | }↵ | 9 | }↵ | |
10 | namespace.defineConstant(cls.getSimpleName(), getMirrorForClass(context.getRuntime(), cls));↵ | 10 | namespace.defineConstant(as.toString(), getMirrorForClass(context.getRuntime(), cls));↵ | |
11 | return context.getRuntime().getNil();↵ | 11 | return context.getRuntime().getNil();↵ | |
12 | } catch (Exception e) {↵ | 12 | } catch (Exception e) {↵ | |
13 | if (context.getRuntime().getDebug().isTrue()) {↵ | 13 | if (context.getRuntime().getDebug().isTrue()) {↵ | |
14 | e.printStackTrace();↵ | 14 | e.printStackTrace();↵ | |
15 | }↵ | 15 | }↵ | |
16 | throw context.getRuntime().newTypeError("Could not find class " + className + ", exception: " + e);↵ | 16 | throw context.getRuntime().newTypeError("Could not find class " + className + ", exception: " + e);↵ | |
17 | } | 17 |
| |
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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 35 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | String className = name.toString(); | 1 | String className = name.toString(); | |
2 | try | 2 | try | |
3 | Class cls = findClass(context.getRuntime().getJRubyClassLoader(), className); | 3 | Class cls = findClass(context.getRuntime().getJRubyClassLoader(), className); | |
4 | RubyModule namespace; | 4 | RubyModule namespace; | |
5 | if (self instanceof RubyModule) | 5 | if (self instanceof RubyModule) | |
6 | namespace = (RubyModule)self; | 6 | namespace = (RubyModule)self; | |
else | else | |||
7 | namespace = self.getMetaClass().getRealClass(); | 7 | namespace = self.getMetaClass().getRealClass(); | |
| 8 | namespace.defineConstant(as.toString(), getMirrorForClass(context.getRuntime(), cls)); | ||
8 | namespace.defineConstant(cls.getSimpleName(), getMirrorForClass(context.getRuntime(), cls)); | | ||
9 | return context.getRuntime().getNil(); | 9 | return context.getRuntime().getNil(); |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables cls, namespace , while Clone fragment #2 returns variables cls, namespace |