if (externalEncodingOption != null && !externalEncodingOption.isNil()) { if (dash.eql(externalEncodingOption)) { externalEncodingOption = RubyEncoding.getDefaultExternal(runtime); } setExternalEncoding(context, externalEncodingOption); }
if (internalEncodingOption != null && !internalEncodingOption.isNil()) { if (dash.eql(internalEncodingOption)) { internalEncodingOption = RubyEncoding.getDefaultInternal(runtime); } setInternalEncoding(context, internalEncodingOption); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyIO.java File path: /jruby-1.4.0/src/org/jruby/RubyIO.java
Method name: ModeFlags parseOptions(ThreadContext, IRubyObject, ModeFlags) Method name: ModeFlags parseOptions(ThreadContext, IRubyObject, ModeFlags)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (externalEncodingOption != null && !externalEncodingOption.isNil()) {
1
if (internalEncodingOption != null && !internalEncodingOption.isNil()) {
2
            if (dash.eql(externalEncodingOption)) {
2
            if (dash.eql(internalEncodingOption)) {
3
                externalEncodingOption = RubyEncoding.getDefaultExternal(runtime);
3
                internalEncodingOption = RubyEncoding.getDefaultInternal(runtime);
4
            }
4
            }
5
            setExternalEncoding(context, externalEncodingOption);
5
            setInternalEncoding(context, internalEncodingOption);
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.3
Clones locationClones are in the same method
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.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (externalEncodingOption != null && !externalEncodingOption.isNil())
    6
    if (externalEncodingOption != null && !externalEncodingOption.isNil())
    10
    if (internalEncodingOption != null && !internalEncodingOption.isNil())
    Differences
    Expression1Expression2Difference
    externalEncodingOptioninternalEncodingOptionVARIABLE_NAME_MISMATCH
    externalEncodingOptioninternalEncodingOptionVARIABLE_NAME_MISMATCH
    10
    if (internalEncodingOption != null && !internalEncodingOption.isNil())
    7
    if (dash.eql(externalEncodingOption))
    7
    if (dash.eql(externalEncodingOption))
    11
    if (dash.eql(internalEncodingOption))
    Differences
    Expression1Expression2Difference
    externalEncodingOptioninternalEncodingOptionVARIABLE_NAME_MISMATCH
    11
    if (dash.eql(internalEncodingOption))
    8
    externalEncodingOption = RubyEncoding.getDefaultExternal(runtime);
    8
    externalEncodingOption = RubyEncoding.getDefaultExternal(runtime);
    12
    internalEncodingOption = RubyEncoding.getDefaultInternal(runtime);
    Differences
    Expression1Expression2Difference
    externalEncodingOptioninternalEncodingOptionVARIABLE_NAME_MISMATCH
    getDefaultExternalgetDefaultInternalMETHOD_INVOCATION_NAME_MISMATCH
    12
    internalEncodingOption = RubyEncoding.getDefaultInternal(runtime);
    9
    setExternalEncoding(context, externalEncodingOption);
    9
    setExternalEncoding(context, externalEncodingOption);
    13
    setInternalEncoding(context, internalEncodingOption);
    Differences
    Expression1Expression2Difference
    setExternalEncodingsetInternalEncodingMETHOD_INVOCATION_NAME_MISMATCH
    externalEncodingOptioninternalEncodingOptionVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression setExternalEncoding(context,externalEncodingOption) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method setExternalEncoding
    Expression setInternalEncoding(context,internalEncodingOption) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method setInternalEncoding
    Expression setExternalEncoding(context,externalEncodingOption) is a void method call, and thus it cannot be parameterized
    Expression setInternalEncoding(context,internalEncodingOption) is a void method call, and thus it cannot be parameterized
    13
    setInternalEncoding(context, internalEncodingOption);
    Precondition Violations (4)
    Row Violation
    1Expression setExternalEncoding(context,externalEncodingOption) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression setInternalEncoding(context,internalEncodingOption) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression setExternalEncoding(context,externalEncodingOption) is a void method call, and thus it cannot be parameterized
    4Expression setInternalEncoding(context,internalEncodingOption) is a void method call, and thus it cannot be parameterized