if (arg0 instanceof RubyRegexp) { getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored"); return initializeByRegexp19((RubyRegexp)arg0); } int options = arg1 instanceof RubyFixnum ? RubyNumeric.fix2int(arg1) : arg1.isTrue() ? RE_OPTION_IGNORECASE : 0; return initializeCommon19(arg0.convertToString(), options);
if (arg0 instanceof RubyRegexp) { getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored"); return initializeByRegexp((RubyRegexp)arg0); } int options = arg1 instanceof RubyFixnum ? RubyNumeric.fix2int(arg1) : arg1.isTrue() ? RE_OPTION_IGNORECASE : 0; return initializeCommon(arg0.convertToString().getByteList(), options);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java File path: /jruby-1.4.0/src/org/jruby/RubyRegexp.java
Method name: IRubyObject initialize_m19(IRubyObject, IRubyObject) Method name: IRubyObject initialize_m(IRubyObject, IRubyObject)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (arg0 instanceof RubyRegexp) {
1
if (arg0 instanceof RubyRegexp) {
2
            getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");            
2
            getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");            
3
            return initializeByRegexp19((RubyRegexp)arg0);
3
            return initializeByRegexp((RubyRegexp)arg0);
4
        }
4
        }
5
        
5
        
6
        int options = arg1 instanceof RubyFixnum ? RubyNumeric.fix2int(arg1) : arg1.isTrue() ? RE_OPTION_IGNORECASE : 0;
6
        int options = arg1 instanceof RubyFixnum ? RubyNumeric.fix2int(arg1) : arg1.isTrue() ? RE_OPTION_IGNORECASE : 0;
7
        return initializeCommon19(arg0.convertToString(), options);
7
        return initializeCommon(arg0.convertToString().getByteList(), options);
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.1
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (arg0 instanceof RubyRegexp)
    1
    if (arg0 instanceof RubyRegexp)
    2
    getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");
    2
    getRuntime().getWarnings().warn(ID.REGEXP_IGNORED_FLAGS, "flags ignored");
    3
    return initializeByRegexp19((RubyRegexp)arg0);
    3
    return initializeByRegexp19((RubyRegexp)arg0);
    3
    return initializeByRegexp((RubyRegexp)arg0);
    Differences
    Expression1Expression2Difference
    initializeByRegexp19initializeByRegexpMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression initializeByRegexp19((RubyRegexp)arg0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method initializeByRegexp19
    Expression initializeByRegexp((RubyRegexp)arg0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method initializeByRegexp
    3
    return initializeByRegexp((RubyRegexp)arg0);
    4
    int options = arg1 instanceof RubyFixnum ? RubyNumeric.fix2int(arg1) : arg1.isTrue() ? RE_OPTION_IGNORECASE : 0;
    4
    int options = arg1 instanceof RubyFixnum ? RubyNumeric.fix2int(arg1) : arg1.isTrue() ? RE_OPTION_IGNORECASE : 0;
                                                                                                                                                      
    5
    return initializeCommon(arg0.convertToString().getByteList(), options);
    5
    return initializeCommon19(arg0.convertToString(), options);
                                                                                                                              
    Precondition Violations (2)
    Row Violation
    1Expression initializeByRegexp19((RubyRegexp)arg0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression initializeByRegexp((RubyRegexp)arg0) cannot be parameterized, because it has dependencies to/from statements that will be extracted