if (default_proc != null) { return default_proc; } else { return context.getRuntime().getNil(); }
if (resource != null) { return resource; } else { return path.toURI().toURL(); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyJRuby.java File path: /jruby-1.4.0/src/org/jruby/runtime/load/LoadServiceResource.java
Method name: IRubyObject getDefaultProc(ThreadContext) Method name: URL getURL()
Number of AST nodes: 3 Number of AST nodes: 3
1
if (default_proc != null) {
1
if (resource != null) {
2
                return default_proc;
2
            return 
3
    
3
resource;
4
        } else {
4
        } else {
5
                return context.getRuntime().getNil();
5
            return 
6
    
6
path.toURI().toURL();
7
        }
7
        }
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
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (default_proc != null)
    1
    if (default_proc != null)
    1
    if (resource != null)
    Differences
    Expression1Expression2Difference
    default_procresourceVARIABLE_NAME_MISMATCH
    org.jruby.RubyProcjava.net.URLVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyProc of variable default_proc does not match with type java.net.URL of variable resource
    • Make classes org.jruby.RubyProc and java.net.URL extend a common superclass
    1
    if (resource != null)
                                          
    2
    return resource;
    Preondition Violations
    Unmatched return resource;
    2
    return resource;
    2
    return default_proc;
    2
    return default_proc;
    Preondition Violations
    Unmatched return default_proc;
                                                  
    else
            
                                                                  
    3
    return path.toURI().toURL();
    Preondition Violations
    Unmatched return path.toURI().toURL();
    3
    return path.toURI().toURL();
    3
    return context.getRuntime().getNil();
    3
    return context.getRuntime().getNil();
    Preondition Violations
    Unmatched return context.getRuntime().getNil();
                                                                                    
    Precondition Violations (5)
    Row Violation
    1Type org.jruby.RubyProc of variable default_proc does not match with type java.net.URL of variable resource
    2Unmatched return resource;
    3Unmatched return default_proc;
    4Unmatched return path.toURI().toURL();
    5Unmatched return context.getRuntime().getNil();