synchronized (finalizersMutex) { if (finalizers == null) { finalizers = new WeakHashMap<Finalizable, Object>(); } finalizers.put(finalizer, null); }
synchronized (internalFinalizersMutex) { if (internalFinalizers == null) { internalFinalizers = new WeakHashMap<Finalizable, Object>(); } internalFinalizers.put(finalizer, null); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/Ruby.java File path: /jruby-1.4.0/src/org/jruby/Ruby.java
Method name: void addFinalizer(Finalizable) Method name: void addInternalFinalizer(Finalizable)
Number of AST nodes: 4 Number of AST nodes: 4
1
synchronized (finalizersMutex) {
1
synchronized (internalFinalizersMutex) {
2
            if (finalizers == null) {
2
            if (internalFinalizers == null) {
3
                finalizers = new WeakHashMap<Finalizable, Object>();
3
                internalFinalizers = new WeakHashMap<Finalizable, Object>();
4
            }
4
            }
5
            finalizers.put(finalizer, null);
5
            internalFinalizers.put(finalizer, null);
6
        }
6
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    synchronized (finalizersMutex)
    1
    synchronized (finalizersMutex)
    1
    synchronized (internalFinalizersMutex)
    Differences
    Expression1Expression2Difference
    finalizersMutexinternalFinalizersMutexVARIABLE_NAME_MISMATCH
    1
    synchronized (internalFinalizersMutex)
    2
    if (finalizers == null)
    2
    if (finalizers == null)
    2
    if (internalFinalizers == null)
    Differences
    Expression1Expression2Difference
    finalizersinternalFinalizersVARIABLE_NAME_MISMATCH
    2
    if (internalFinalizers == null)
    3
    finalizers = new WeakHashMap<Finalizable, Object>();
    3
    finalizers = new WeakHashMap<Finalizable, Object>();
    3
    internalFinalizers = new WeakHashMap<Finalizable, Object>();
    Differences
    Expression1Expression2Difference
    finalizersinternalFinalizersVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression finalizers is a field being modified, and thus it cannot be parameterized
    Expression internalFinalizers is a field being modified, and thus it cannot be parameterized
    3
    internalFinalizers = new WeakHashMap<Finalizable, Object>();
    4
    finalizers.put(finalizer, null);
    4
    finalizers.put(finalizer, null);
    4
    internalFinalizers.put(finalizer, null);
    Differences
    Expression1Expression2Difference
    finalizersinternalFinalizersVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression finalizers cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression internalFinalizers cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    internalFinalizers.put(finalizer, null);
    Precondition Violations (4)
    Row Violation
    1Expression finalizers is a field being modified, and thus it cannot be parameterized
    2Expression internalFinalizers is a field being modified, and thus it cannot be parameterized
    3Expression finalizers cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression internalFinalizers cannot be parameterized, because it has dependencies to/from statements that will be extracted