if (isReference()) {
return getCheckedRef().hashCode();
}
String name = getName();
return MAGIC * (name == null ? NULL_NAME : name.hashCode());
if (isReference()) {
return getCheckedRef().toString();
}
String n = getName();
return n == null ? "(anonymous)" : n;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/Resource.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/Resource.java
|
Method name: int hashCode()
|
|
Method name: String toString()
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | if (isReference()) {↵ | | 1 | if (isReference()) {↵
|
2 | return getCheckedRef().hashCode();↵ | | 2 | return getCheckedRef().toString();↵
|
3 | }↵ | | 3 | }↵
|
4 | String name = getName();↵ | | 4 | String n = getName();↵
|
5 | return MAGIC * (name == null ? NULL_NAME : name.hashCode()); | | 5 | return n == null ? "(anonymous)" : n;
|
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.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (isReference()) | | 1 | if (isReference()) |
| | | 2 | return getCheckedRef().toString(); |
2 | return getCheckedRef().hashCode(); | | | |
3 | String name = getName(); | | 3 | String n = getName(); |
| | | 4 | return n == null ? "(anonymous)" : n; |
4 | return MAGIC * (name == null ? NULL_NAME : name.hashCode()); | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched return getCheckedRef().toString(); |
2 | Unmatched return getCheckedRef().hashCode(); |