if ((typeName.charAt(0) == 'L') && (typeName.charAt(typeName.length() - 1) == ';') || (typeName.charAt(0) == '[')) { // reference type code.addAload(i); } else if (typeName.equals("Z") || typeName.equals("B") || typeName.equals("C") || typeName.equals("I") || typeName.equals("S")) { // boolean, byte, char, int, short code.addIload(i); } else if (typeName.equals("D")) { // double code.addDload(i); } else if (typeName.equals("F")) { // float code.addFload(i); } else if (typeName.equals("J")) { // long code.addLload(i); } else { // bad type throw new RuntimeException("bad type: " + typeName); }
if ((typeName.charAt(0) == 'L') && (typeName.charAt(typeName.length() - 1) == ';') || (typeName.charAt(0) == '[')) { // reference type code.addAstore(i); } else if (typeName.equals("Z") || typeName.equals("B") || typeName.equals("C") || typeName.equals("I") || typeName.equals("S")) { // boolean, byte, char, int, short code.addIstore(i); } else if (typeName.equals("D")) { // double code.addDstore(i); } else if (typeName.equals("F")) { // float code.addFstore(i); } else if (typeName.equals("J")) { // long code.addLstore(i); } else { // bad type throw new RuntimeException("bad type: " + typeName); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/FieldTransformer.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/FieldTransformer.java
Method name: void addTypeDependDataLoad(Bytecode, String, int) Method name: void addTypeDependDataStore(Bytecode, String, int)
Number of AST nodes: 11 Number of AST nodes: 11
1
if ((typeName.charAt(0) == 'L')
1
if ((typeName.charAt(0) == 'L')
2
		    && (typeName.charAt(typeName.length() - 1) == ';')
2
		    && (typeName.charAt(typeName.length() - 1) == ';')
3
		    || (typeName.charAt(0) == '[')) {
3
		    || (typeName.charAt(0) == '[')) {
4
			// reference type
4
			// reference type
5
			code.addAload(i);
5
			code.addAstore(i);
6
		} else if (typeName.equals("Z") || typeName.equals("B")
6
		} else if (typeName.equals("Z") || typeName.equals("B")
7
		           || typeName.equals("C") || typeName.equals("I")
7
		           || typeName.equals("C") || typeName.equals("I")
8
		           || typeName.equals("S")) {
8
		           || typeName.equals("S")) {
9
			// boolean, byte, char, int, short
9
			// boolean, byte, char, int, short
10
			code.addIload(i);
10
			code.addIstore(i);
11
		} else if (typeName.equals("D")) {
11
		} else if (typeName.equals("D")) {
12
			// double
12
			// double
13
			code.addDload(i);
13
			code.addDstore(i);
14
		} else if (typeName.equals("F")) {
14
		} else if (typeName.equals("F")) {
15
			// float
15
			// float
16
			code.addFload(i);
16
			code.addFstore(i);
17
		} else if (typeName.equals("J")) {
17
		} else if (typeName.equals("J")) {
18
			// long
18
			// long
19
			code.addLload(i);
19
			code.addLstore(i);
20
		} else {
20
		} else {
21
			// bad type
21
			// bad type
22
			throw new RuntimeException("bad type: " + typeName);
22
			throw new RuntimeException("bad type: " + typeName);
23
		}
23
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)2.5
Clones locationClones are declared in the same class
Number of node comparisons83
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if ((typeName.charAt(0) == 'L') && (typeName.charAt(typeName.length() - 1) == ';') || (typeName.charAt(0) == '['))
    1
    if ((typeName.charAt(0) == 'L') && (typeName.charAt(typeName.length() - 1) == ';') || (typeName.charAt(0) == '['))
    2
    code.addAload(i);
    2
    code.addAload(i);
    2
    code.addAstore(i);
    Differences
    Expression1Expression2Difference
    addAloadaddAstoreMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression code.addAload(i) is a void method call, and thus it cannot be parameterized
    Expression code.addAstore(i) is a void method call, and thus it cannot be parameterized
    2
    code.addAstore(i);
    3
    else if (typeName.equals("Z") || typeName.equals("B") || typeName.equals("C") || typeName.equals("I") || typeName.equals("S"))
    3
    else if (typeName.equals("Z") || typeName.equals("B") || typeName.equals("C") || typeName.equals("I") || typeName.equals("S"))
    4
    code.addIload(i);
    4
    code.addIload(i);
    4
    code.addIstore(i);
    Differences
    Expression1Expression2Difference
    addIloadaddIstoreMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression code.addIload(i) is a void method call, and thus it cannot be parameterized
    Expression code.addIstore(i) is a void method call, and thus it cannot be parameterized
    4
    code.addIstore(i);
    5
    else if (typeName.equals("D"))
    5
    else if (typeName.equals("D"))
    6
    code.addDload(i);
    6
    code.addDload(i);
    6
    code.addDstore(i);
    Differences
    Expression1Expression2Difference
    addDloadaddDstoreMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression code.addDload(i) is a void method call, and thus it cannot be parameterized
    Expression code.addDstore(i) is a void method call, and thus it cannot be parameterized
    6
    code.addDstore(i);
    7
    else if (typeName.equals("F"))
    7
    else if (typeName.equals("F"))
    8
    code.addFload(i);
    8
    code.addFload(i);
    8
    code.addFstore(i);
    Differences
    Expression1Expression2Difference
    addFloadaddFstoreMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression code.addFload(i) is a void method call, and thus it cannot be parameterized
    Expression code.addFstore(i) is a void method call, and thus it cannot be parameterized
    8
    code.addFstore(i);
    9
    else if (typeName.equals("J"))
    9
    else if (typeName.equals("J"))
    10
    code.addLload(i);
    10
    code.addLload(i);
    10
    code.addLstore(i);
    Differences
    Expression1Expression2Difference
    addLloadaddLstoreMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression code.addLload(i) is a void method call, and thus it cannot be parameterized
    Expression code.addLstore(i) is a void method call, and thus it cannot be parameterized
    10
    code.addLstore(i);
    else
    else
    11
    throw new RuntimeException("bad type: " + typeName);
    11
    throw new RuntimeException("bad type: " + typeName);
    Precondition Violations (10)
    Row Violation
    1Expression code.addAload(i) is a void method call, and thus it cannot be parameterized
    2Expression code.addAstore(i) is a void method call, and thus it cannot be parameterized
    3Expression code.addIload(i) is a void method call, and thus it cannot be parameterized
    4Expression code.addIstore(i) is a void method call, and thus it cannot be parameterized
    5Expression code.addDload(i) is a void method call, and thus it cannot be parameterized
    6Expression code.addDstore(i) is a void method call, and thus it cannot be parameterized
    7Expression code.addFload(i) is a void method call, and thus it cannot be parameterized
    8Expression code.addFstore(i) is a void method call, and thus it cannot be parameterized
    9Expression code.addLload(i) is a void method call, and thus it cannot be parameterized
    10Expression code.addLstore(i) is a void method call, and thus it cannot be parameterized