File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/HqlParser.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/reattachment/ProxyReattachmentTest.java | |||
Method name: AST handleIdentifierError(Token, RecognitionException)
|
Method name: void testIterateWithEvictTopOfLoop()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 6 | |||
1 | reportWarning( "Keyword '"↵ | |||
2 | + token.getText()↵ | |||
3 | + "' is being interpreted as an identifier due to: " + mte.getMessage() );↵ | 1 | Parent p = new Parent( String.valueOf( i + 100 ) ); ↵ | |
4 | // Add the token to the AST.↵ | 2 | ↵ | |
5 | ASTPair currentAST = new ASTPair();↵ | |||
6 | token.setType( HqlTokenTypes.WEIRD_IDENT↵ | 3 | Child child = new Child( "child" + i );↵ | |
7 | );↵ | 4 | child.setParent( p ); ↵ | |
8 | astFactory.addASTChild( currentAST, astFactory.create( token ) );↵ | 5 | p.getChildren().add( child ); ↵ | |
9 | consume();↵ | 6 | ↵ | |
10 | AST identifierAST = currentAST.root;↵ | |||
11 | return identifierAST↵ | 7 | s.save( p );↵ | |
12 | ; | 8 | parents.add(p); | |
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.0 |
Clones location | Clones are in different classes |
Number of node comparisons | 42 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 5 | Parent p = new Parent(String.valueOf(i + 100)); | |||||||||||||||||||||
|
| 6 | Child child = new Child("child" + i); | |||||||||||||||||||||
6 | reportWarning("Keyword '" + token.getText() + "' is being interpreted as an identifier due to: " + mte.getMessage()); | | ||||||||||||||||||||||
7 | ASTPair currentAST = new ASTPair(); | | ||||||||||||||||||||||
| 8 | p.getChildren().add(child); | ||||||||||||||||||||||
8 | token.setType(HqlTokenTypes.WEIRD_IDENT); | | ||||||||||||||||||||||
| 9 | s.save(p); | ||||||||||||||||||||||
9 | astFactory.addASTChild(currentAST, astFactory.create(token)); | | ||||||||||||||||||||||
10 | consume(); |
| 7 | child.setParent(p); | ||||||||||||||||||||
| 10 | parents.add(p); | ||||||||||||||||||||||
11 | AST identifierAST = currentAST.root; | | ||||||||||||||||||||||
12 | return identifierAST; |
| |
Row | Violation |
---|---|
1 | Unmatched statement Parent p=new Parent(String.valueOf(i + 100)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Child child=new Child("child" + i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Expression consume() is a void method call, and thus it cannot be parameterized |
4 | Expression child.setParent(p) is a void method call, and thus it cannot be parameterized |
5 | Expression consume() is a void method call, and thus it cannot be parameterized |
6 | Expression child.setParent(p) is a void method call, and thus it cannot be parameterized |
7 | Unmatched return identifierAST; |