if (default_proc != null) { return default_proc; } else { return context.getRuntime().getNil(); }
if (scriptFileName != null) { return scriptFileName; } else { return "-e"; }
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/RubyInstanceConfig.java
Method name: IRubyObject getDefaultProc(ThreadContext) Method name: String displayedFileName()
Number of AST nodes: 3 Number of AST nodes: 3
1
if (default_proc != null) {
1
if (scriptFileName != null) {
2
                return default_proc;
2
                return scriptFileName;
3
            } else {
3
            } else {
4
                return context.getRuntime().getNil();
4
                return "-e";
5
            }
5
            }
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)
    2
    if (scriptFileName != null)
    Differences
    Expression1Expression2Difference
    default_procscriptFileNameVARIABLE_NAME_MISMATCH
    org.jruby.RubyProcjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.RubyProc of variable default_proc does not match with type java.lang.String of variable scriptFileName
    • Make classes org.jruby.RubyProc and java.lang.String extend a common superclass
    2
    if (scriptFileName != null)
    2
    return default_proc;
    2
    return default_proc;
    Preondition Violations
    Unmatched return default_proc;
                                                  
    else
            
    3
    return context.getRuntime().getNil();
    3
    return context.getRuntime().getNil();
    Preondition Violations
    Unmatched return context.getRuntime().getNil();
                                                                                    
                                  
    4
    return "-e";
    Preondition Violations
    Unmatched return "-e";
    4
    return "-e";
                                                      
    3
    return scriptFileName;
    Preondition Violations
    Unmatched return scriptFileName;
    3
    return scriptFileName;
    Precondition Violations (5)
    Row Violation
    1Type org.jruby.RubyProc of variable default_proc does not match with type java.lang.String of variable scriptFileName
    2Unmatched return default_proc;
    3Unmatched return context.getRuntime().getNil();
    4Unmatched return "-e";
    5Unmatched return scriptFileName;