RubyObject rubyObject = (RubyObject) javaObject;
if (!rubyObject.respondsTo("java_object")) {
return convertProcToInterface(context, rubyObject, target);
}
// can't be converted any more, return it
return javaObject;
RubyObject rubyObject = (RubyObject) arg;
if (!rubyObject.respondsTo("java_object")) {
return convertProcToInterface(context, rubyObject, target);
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaUtil.java
|
|
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaUtil.java
|
Method name: Object coerceJavaObjectToType(ThreadContext, Object, Class)
|
|
Method name: Object coerceOtherToType(ThreadContext, IRubyObject, Class)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 3
|
|
1 | RubyObject rubyObject = (RubyObject) javaObject;↵ | | 1 | RubyObject rubyObject = (RubyObject) arg;↵
|
2 | if (!rubyObject.respondsTo("java_object")) {↵ | | 2 | if (!rubyObject.respondsTo("java_object")) {↵
|
3 | return convertProcToInterface(context, rubyObject, target);↵ | | 3 | return convertProcToInterface(context, rubyObject, target);↵
|
4 | }↵ | | 4 | }
|
|
5 | // can't be converted any more, return it↵ | | | |
6 | return javaObject; | | | |
See real code fragment |
|
See real code fragment |
Summary
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 7 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
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.7 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | RubyObject rubyObject = (RubyObject)javaObject; | | 3 | RubyObject rubyObject = (RubyObject)arg; |
3 | if (!rubyObject.respondsTo("java_object")) | | 4 | if (!rubyObject.respondsTo("java_object")) |
4 | return convertProcToInterface(context, rubyObject, target); | | 5 | return convertProcToInterface(context, rubyObject, target); |
5 | return javaObject; | | | |
Precondition Violations (2)
Row |
Violation |
1 | Type java.lang.Object of variable javaObject does not match with type org.jruby.runtime.builtin.IRubyObject of variable arg |
2 | Unmatched return javaObject; |