for (String methodName: methods.keySet()) { if (!EXCLUDE_METHODS.contains(methodName)) { names.add(methodName); } }
synchronized(classProviders) { if (!classProviders.contains(provider)) { classProviders.add(provider); } }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/proxy/JavaProxyClass.java File path: /jruby-1.4.0/src/org/jruby/RubyModule.java
Method name: RubyObject get_with_class(IRubyObject, IRubyObject) Method name: void addClassProvider(ClassProvider)
Number of AST nodes: 3 Number of AST nodes: 3
1
for (String methodName: methods.keySet()) {
2
      
1
synchronized(classProviders) {
3
                  if (!EXCLUDE_METHODS.contains(methodName)) {
2
                if (!classProviders.contains(provider)) {
4
                            names.add(methodName);
3
                    
5
       
4
classProviders.add(provider);
6
                 }
5
                }
7
                    }
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 in different classes having the same super class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    66
    if (!EXCLUDE_METHODS.contains(methodName))
    66
    if (!EXCLUDE_METHODS.contains(methodName))
    6
    if (!classProviders.contains(provider))
    Differences
    Expression1Expression2Difference
    methodNameproviderVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.jruby.util.ClassProviderVARIABLE_TYPE_MISMATCH
    EXCLUDE_METHODSclassProvidersVARIABLE_NAME_MISMATCH
    java.util.HashSetjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable methodName does not match with type org.jruby.util.ClassProvider of variable provider
    • Make classes java.lang.String and org.jruby.util.ClassProvider extend a common superclass
    Type java.util.HashSet<java.lang.String> of variable EXCLUDE_METHODS does not match with type java.util.List<org.jruby.util.ClassProvider> of variable classProviders
    • Make classes java.util.HashSet and java.util.List extend a common superclass
    6
    if (!classProviders.contains(provider))
    67
    names.add(methodName);
    67
    names.add(methodName);
    7
    classProviders.add(provider);
    Differences
    Expression1Expression2Difference
    methodNameproviderVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.jruby.util.ClassProviderVARIABLE_TYPE_MISMATCH
    namesclassProvidersVARIABLE_NAME_MISMATCH
    java.util.Setjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable methodName does not match with type org.jruby.util.ClassProvider of variable provider
    • Make classes java.lang.String and org.jruby.util.ClassProvider extend a common superclass
    Type java.util.Set<java.lang.String> of variable names does not match with type java.util.List<org.jruby.util.ClassProvider> of variable classProviders
    • Make classes java.util.Set and java.util.List extend a common superclass
    7
    classProviders.add(provider);
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String of variable methodName does not match with type org.jruby.util.ClassProvider of variable provider
    2Type java.util.HashSet<java.lang.String> of variable EXCLUDE_METHODS does not match with type java.util.List<org.jruby.util.ClassProvider> of variable classProviders
    3Type java.lang.String of variable methodName does not match with type org.jruby.util.ClassProvider of variable provider
    4Type java.util.Set<java.lang.String> of variable names does not match with type java.util.List<org.jruby.util.ClassProvider> of variable classProviders