File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java | |||
Method name: String getEntityName(Criteria, String)
|
Method name: String getPropertyName(String)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | if ( propertyName.indexOf( '.' ) > 0 ) {↵ | 1 | if ( propertyName.indexOf( '.' ) > 0 ) {↵ | |
2 | String root = StringHelper.root( propertyName );↵ | 2 | String root = StringHelper.root( propertyName );↵ | |
3 | Criteria crit = getAliasedCriteria( root );↵ | 3 | Criteria crit = getAliasedCriteria( root );↵ | |
4 | if ( crit != null ) {↵ | 4 | if ( crit != null ) {↵ | |
5 | return getEntityName( crit );↵ | 5 | return ↵ | |
6 | }↵ | |||
7 | }↵ | |||
8 | return getEntityName( subcriteria )↵ | 6 | propertyName.substring( root.length() + 1 );↵ | |
7 | }↵ | |||
8 | }↵ | |||
9 | ; | 9 | return propertyName; | |
See real code fragment | See real code fragment |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 14 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (propertyName.indexOf('.') > 0) | 1 | if (propertyName.indexOf('.') > 0) | |||||||||||
2 | String root = StringHelper.root(propertyName); | 2 | String root = StringHelper.root(propertyName); | |||||||||||
3 | Criteria crit = getAliasedCriteria(root); | 3 | Criteria crit = getAliasedCriteria(root); | |||||||||||
4 | if (crit != null) | 4 | if (crit != null) | |||||||||||
|
| 5 | return propertyName.substring(root.length() + 1); | |||||||||||
5 | return getEntityName(crit); |
| | |||||||||||
6 | return getEntityName(subcriteria); |
| 6 | return propertyName; |
Row | Violation |
---|---|
1 | Unmatched statement return propertyName.substring(root.length() + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched return propertyName.substring(root.length() + 1); |
3 | Unmatched statement return getEntityName(crit); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched return getEntityName(crit); |
5 | Clone fragment #1 returns variable crit with type org.hibernate.Criteria , while Clone fragment #2 returns variable root with type java.lang.String |