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/proxy/ProxyTest.java | |||
Method name: AST handleIdentifierError(Token, RecognitionException)
|
Method name: void testFullyLoadedPCSerialization()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 6 | |||
1 | reportWarning( "Keyword '"↵ | |||
2 | + token.getTex↵ | 1 | for ( int dp_indx = 0; dp_indx < nestedDataPointCount; dp_indx++ ) {↵ | |
3 | t()↵ | 2 | DataPoint dp = new DataPoint();↵ | |
4 | + "' is being interpreted as an identifier due to: " + mte.getMessage() );↵ | 3 | ↵ | |
5 | // Add the token to the AST.↵ | |||
6 | ASTPair currentAST = new ASTPair();↵ | |||
7 | token.setType( HqlTokenTypes.WEIRD_IDENT );↵ | |||
8 | astFactory.addASTChild( currentAST, astFactory.create( token↵ | 4 | dp.setDescription( "data-point [" + c_indx + ", " + dp_indx + "]" );↵ | |
5 | // more HSQLDB fun...↵ | |||
6 | // dp.setX( new BigDecimal( c_indx ) );↵ | |||
7 | dp.setX( new BigDecimal( c_indx + dp_indx ) );↵ | |||
9 | ) );↵ | 8 | dp.setY( new BigDecimal( dp_indx ) );↵ | |
10 | consume();↵ | 9 | con↵ | |
11 | AST identifierAST = currentAST.root;↵ | |||
12 | return identifierAST; | 10 | tainer.getDataPoints().add( dp );↵ | |
11 |
| |||
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 | 35 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | reportWarning("Keyword '" + token.getText() + "' is being interpreted as an identifier due to: " + mte.getMessage()); | | ||||||||||||||||||||||
7 | ASTPair currentAST = new ASTPair(); | | ||||||||||||||||||||||
8 | token.setType(HqlTokenTypes.WEIRD_IDENT); | | ||||||||||||||||||||||
9 | astFactory.addASTChild(currentAST, astFactory.create(token)); | | ||||||||||||||||||||||
|
| 11 | DataPoint dp = new DataPoint(); | |||||||||||||||||||||
10 | consume(); |
| 12 | dp.setDescription("data-point [" + c_indx + ", " + dp_indx + "]"); | ||||||||||||||||||||
11 | AST identifierAST = currentAST.root; | | ||||||||||||||||||||||
12 | return identifierAST; |
| | |||||||||||||||||||||
| 13 | dp.setX(new BigDecimal(c_indx + dp_indx)); | ||||||||||||||||||||||
| 14 | dp.setY(new BigDecimal(dp_indx)); | ||||||||||||||||||||||
| 15 | container.getDataPoints().add(dp); |
Row | Violation |
---|---|
1 | Unmatched statement DataPoint dp=new DataPoint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression consume() is a void method call, and thus it cannot be parameterized |
3 | Expression dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]") is a void method call, and thus it cannot be parameterized |
4 | Expression consume() is a void method call, and thus it cannot be parameterized |
5 | Expression dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]") is a void method call, and thus it cannot be parameterized |
6 | Unmatched return identifierAST; |