if (object instanceof InternalJavaProxy) {
InternalJavaProxy internalJavaProxy = (InternalJavaProxy) object;
IRubyObject orig = internalJavaProxy.___getInvocationHandler().getOrig();
if (orig != null) {
return orig;
}
}
if (existing instanceof Map) {
Map m = (Map) existing;
Callback cb = (Callback) m.get(proc);
if (cb != null) {
return cb;
}
}
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/ext/ffi/jffi/CallbackManager.java
|
Method name: IRubyObject trySimpleConversions(Ruby, Object)
|
|
Method name: org.jruby.ext.ffi.Pointer getCallback(Ruby, CallbackInfo, RubyObject)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | if (object instanceof InternalJavaProxy) {↵ | | 1 | if (existing instanceof ↵
|
2 | InternalJavaProxy internalJavaProxy = (InternalJavaProxy) object;↵ | | |
|
3 | IRubyObject orig = internalJavaProxy.___getInvocationHandler().getOrig();↵ | | |
|
|
| | | 2 | Map) {↵
|
| | | 3 | Map m = (Map) existing;↵
|
| | | 4 | Callback cb = (Callback) m.get(proc);↵
|
4 | if (orig != null) {↵ | | 5 | if (cb != null) {↵
|
5 | return orig;↵ | | 6 | return ↵
|
| | | 7 | cb;↵
|
6 | }↵ | | 8 | }↵
|
7 | } | | 9 | }
|
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 in different classes |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
6 | InternalJavaProxy internalJavaProxy = (InternalJavaProxy)object; | | | |
7 | IRubyObject orig = internalJavaProxy.___getInvocationHandler().getOrig(); | | | |
| | | 8 | Map m = (Map)existing; |
| | | 9 | Callback cb = (Callback)m.get(proc); |
8 | if (orig != null) | | 10 | if (cb != null) |
9 | | | | |
| | | 11 | |
Precondition Violations (3)
Row |
Violation |
1 | Type org.jruby.runtime.builtin.IRubyObject of variable orig does not match with type org.jruby.ext.ffi.jffi.CallbackManager.Callback of variable cb |
2 | Unmatched return orig; |
3 | Unmatched return cb; |