if (rubyModule == null || rubyModule.isNil()) {
rubyModule = context.getCurrentScope().getStaticScope().getModule();
if (rubyModule == null) {
throw context.getRuntime().newTypeError("no outer class/module");
}
}
module = context.getCurrentScope().getStaticScope().getModule();
if (module == null) {
// TODO: wire into new exception handling mechanism
throw runtime.newTypeError("no class/module to define constant");
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/util/RuntimeHelpers.java
|
|
File path: /jruby-1.4.0/src/org/jruby/ast/ConstDeclNode.java
|
Method name: RubyModule prepareClassNamespace(ThreadContext, IRubyObject)
|
|
Method name: IRubyObject assign(Ruby, ThreadContext, IRubyObject, IRubyObject, Block, boolean)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 3
|
|
1 | if (rubyModule == null || rubyModule.isNil()) {↵ | | |
|
2 | rubyModule = context.getCurrentScope().getStaticScope().getModule();↵ | | 1 | module = context.getCurrentScope().getStaticScope().getModule();↵
|
| | | 2 | ↵
|
3 | if (rubyModule == null) {↵ | | 3 | if (module == null) {↵
|
4 | throw context.getR↵ | | 4 | // TODO: wire into new exception handling mechanism↵
|
5 | untime().newTypeError("no outer class/module");↵ | | 5 | throw runtime.newTypeError("no class/module to define constant");↵
|
6 | }↵ | | 6 | }
|
7 | } | | | |
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 6 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 3 |
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) | 34.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | rubyModule = context.getCurrentScope().getStaticScope().getModule(); | | 3 | module = context.getCurrentScope().getStaticScope().getModule(); |
3 | if (rubyModule == null) | | 4 | if (module == null) |
4 | throw context.getRuntime().newTypeError("no outer class/module"); | | 5 | throw runtime.newTypeError("no class/module to define constant"); |
Precondition Violations (0)
Row |
Violation |