if(str == null) { dout.writeInt(0); } else { dout.writeInt(str.length); for(int i = 0; i < str.length; i++) { writeString(dout,str[i]); } }
if(bools == null) { dout.writeInt(0); } else { dout.writeInt(bools.length); for(int i = 0; i < bools.length; i++) { dout.writeBoolean(bools[i]); } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/PluginJAR.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/PluginJAR.java
Method name: void writeStringArray(DataOutputStream, String[]) Method name: void writeBooleanArray(DataOutputStream, boolean[])
Number of AST nodes: 5 Number of AST nodes: 5
1
if(str == null)
1
if(bools == null)
2
			{
2
			{
3
				dout.writeInt(0);
3
				dout.writeInt(0);
4
			}
4
			}
5
			else
5
			else
6
			{
6
			{
7
				dout.writeInt(str.length);
7
				dout.writeInt(bools.length);
8
				for(int i = 0; i < str.length; i++)
8
				for(int i = 0; i < bools.length; i++)
9
				{
9
				{
10
					writeString(dout,str[i]);
10
					dout.writeBoolean(bools[i]);
11
				}
11
				}
12
			}
12
			}
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 declared in the same class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (str == null)
    1
    if (str == null)
    1
    if (bools == null)
    Differences
    Expression1Expression2Difference
    strboolsVARIABLE_NAME_MISMATCH
    java.lang.String[]boolean[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable str does not match with type boolean[] of variable bools
    • Make classes java.lang.String[] and boolean[] extend a common superclass
    1
    if (bools == null)
    2
    dout.writeInt(0);
    2
    dout.writeInt(0);
    else
    else
    3
    dout.writeInt(str.length);
    3
    dout.writeInt(str.length);
    3
    dout.writeInt(bools.length);
    Differences
    Expression1Expression2Difference
    strboolsVARIABLE_NAME_MISMATCH
    java.lang.String[]boolean[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable str does not match with type boolean[] of variable bools
    • Make classes java.lang.String[] and boolean[] extend a common superclass
    3
    dout.writeInt(bools.length);
    4
    for (int i = 0; i < str.length; i++)
    4
    for (int i = 0; i < str.length; i++)
    4
    for (int i = 0; i < bools.length; i++)
    Differences
    Expression1Expression2Difference
    strboolsVARIABLE_NAME_MISMATCH
    java.lang.String[]boolean[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable str does not match with type boolean[] of variable bools
    • Make classes java.lang.String[] and boolean[] extend a common superclass
    4
    for (int i = 0; i < bools.length; i++)
    5
    writeString(dout, str[i]);
    5
    writeString(dout, str[i]);
    5
    dout.writeBoolean(bools[i]);
    Differences
    Expression1Expression2Difference
    writeStringwriteBooleanMETHOD_INVOCATION_NAME_MISMATCH
    writeString(dout,str[i])dout.writeBoolean(bools[i])ARGUMENT_NUMBER_MISMATCH
    doutMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression writeString(dout,str[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method writeString
    Expression dout.writeBoolean(bools[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeString(dout,str[i]) is a void method call, and thus it cannot be parameterized
    Expression dout.writeBoolean(bools[i]) is a void method call, and thus it cannot be parameterized
    Expression writeString(dout,str[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method writeString
    Expression dout.writeBoolean(bools[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeString(dout,str[i]) is a void method call, and thus it cannot be parameterized
    Expression dout.writeBoolean(bools[i]) is a void method call, and thus it cannot be parameterized
    5
    dout.writeBoolean(bools[i]);
    Precondition Violations (11)
    Row Violation
    1Type java.lang.String[] of variable str does not match with type boolean[] of variable bools
    2Type java.lang.String[] of variable str does not match with type boolean[] of variable bools
    3Type java.lang.String[] of variable str does not match with type boolean[] of variable bools
    4Expression writeString(dout,str[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression dout.writeBoolean(bools[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression writeString(dout,str[i]) is a void method call, and thus it cannot be parameterized
    7Expression dout.writeBoolean(bools[i]) is a void method call, and thus it cannot be parameterized
    8Expression writeString(dout,str[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression dout.writeBoolean(bools[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression writeString(dout,str[i]) is a void method call, and thus it cannot be parameterized
    11Expression dout.writeBoolean(bools[i]) is a void method call, and thus it cannot be parameterized