for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) { if (hash == e.hash && object == e.objectRef.get()) { if (proxy == e.proxyRef.get()) return; // entry exists, proxy doesn't match. replace. // this could happen if old proxy was gc'ed // TODO: raise exception if stored proxy is non-null? (not gc'ed) remove(table, hash, e); potentialNewSize--; break; } }
for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) { if (hash == e.hash && object == e.objectRef.get()) { if ((proxy = e.proxyRef.get()) != null) return proxy; // entry exists, proxy has been gc'ed. replace entry. remove(table, hash, e); potentialNewSize--; break; } }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/util/ObjectProxyCache.java File path: /jruby-1.4.0/src/org/jruby/javasupport/util/ObjectProxyCache.java
Method name: void put(Object, int, T) Method name: T getOrCreate(Object, int, A)
Number of AST nodes: 7 Number of AST nodes: 7
1
for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) {
1
for (e = table[index = hash & (table.length - 1)]; e != null; e = e.next) {
2
                    if (hash == e.hash && object == e.objectRef.get()) {
2
                    if (hash == e.hash && object == e.objectRef.get()) {
3
                        if (proxy == e.proxyRef.get()) return;
3
                        if ((proxy = e.proxyRef.get()) != null) return proxy;
4
                        // entry exists, proxy doesn't match. replace.
4
                        // entry exists, proxy 
5
                        // this could happen if old proxy was gc'ed
6
                        // TODO: raise exception if stored proxy is non-null? (not gc'ed)
5
has been gc'ed. replace entry.
7
                        remove(table, hash, e);
6
                        remove(table, hash, e);
8
                        potentialNewSize--;
7
                        potentialNewSize--;
9
                        break;
8
                        break;
10
                    }
9
                    }
11
                }
10
                }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons1