if (obj1 == obj2)
return true;
// if both objs are null, then they matched in the previous test,
// so at this point we know that at least one of them (or both) is not null.
// However, one of them may still be null, and we cannot call equals() on
// the null object, so make sure that the one we call it on is not null.
// The equals() method handles the other one being null, if it is.
if (obj1 != null)
return ((ClobDescriptor)obj1).equals((ClobDescriptor)obj2);
else
return ((ClobDescriptor)obj2).equals((ClobDescriptor)obj1);
if (obj1 == obj2) {
return true;
}
// if both objs are null, then they matched in the previous test,
// so at this point we know that at least one of them (or both) is not
// null.
// However, one of them may still be null, and we cannot call equals() on
// the null object, so make sure that the one we call it on is not null.
// The equals() method handles the other one being null, if it is.
if (obj1 != null)
return ((DerbyClobDescriptor) obj1).equals((DerbyClobDescriptor) obj2);
else
return ((DerbyClobDescriptor) obj2).equals((DerbyClobDescriptor) obj1);
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeClob.java
|
|
File path: /sql12/plugins/derby/src/net/sourceforge/squirrel_sql/plugins/derby/types/DerbyClobDataTypeComponent.java
|
Method name: boolean areEqual(Object, Object)
|
|
Method name: boolean areEqual(Object, Object)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | if (obj1 == obj2)↵ | | 1 | if (obj1 == obj2)↵
|
2 | ↵ | | 2 | {↵
|
3 | return true;↵ | | 3 | return true;↵
|
|
4 | ↵ | | 4 | }↵
|
|
5 | // if both objs are null, then they matched in the previous test,↵ | | 5 | // if both objs are null, then they matched in the previous test,↵
|
6 | // so at this point we know that at least one of them (or both) is not↵ | | 6 | // so at this point we know that at least one of them (or both) is not↵
|
7 | null.↵ | | 7 | // null.↵
|
8 | // However, one of them may still be null, and we cannot call equals() on↵ | | 8 | // However, one of them may still be null, and we cannot call equals() on↵
|
9 | // the null object, so make sure that the one we call it on is not null.↵ | | 9 | // the null object, so make sure that the one we call it on is not null.↵
|
10 | // The equals() method handles the other one being null, if it is.↵ | | 10 | // The equals() method handles the other one being null, if it is.↵
|
11 | if (obj1 != null)↵ | | 11 | if (obj1 != null)↵
|
12 | return ((ClobDescriptor)obj1).equals((ClobDescriptor)obj2);↵ | | 12 | return ((DerbyClobDescriptor) obj1).equals((DerbyClobDescriptor) obj2);↵
|
13 | else↵ | | |
|
14 | ↵ | | 13 | else↵
|
15 | return ((ClobDescriptor)obj2).equals((ClobDescriptor)obj1); | | 14 | return ((DerbyClobDescriptor) obj2).equals((DerbyClobDescriptor) obj1);
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 15 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (obj1 == obj2) | | 1 | if (obj1 == obj2) |
2 | | | 2 | |
3 | if (obj1 != null) | | 3 | if (obj1 != null) |
4 | return ((ClobDescriptor)obj1).equals((ClobDescriptor)obj2); | | 4 | return ((DerbyClobDescriptor)obj1).equals((DerbyClobDescriptor)obj2); |
| | | | |
5 | return ((ClobDescriptor)obj2).equals((ClobDescriptor)obj1); | | 5 | return ((DerbyClobDescriptor)obj2).equals((DerbyClobDescriptor)obj1); |
Precondition Violations (8)
Row |
Violation |
1 | Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor does not match with type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor |
2 | Expression (ClobDescriptor)obj1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression (DerbyClobDescriptor)obj1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor does not match with type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor |
5 | Expression (ClobDescriptor)obj1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression (DerbyClobDescriptor)obj1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor does not match with type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor |
8 | Type net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.ClobDescriptor does not match with type net.sourceforge.squirrel_sql.plugins.derby.types.DerbyClobDescriptor |