reportWarning( "Keyword '" + token.getText() + "' is being interpreted as an identifier due to: " + mte.getMessage() ); // Add the token to the AST. ASTPair currentAST = new ASTPair(); token.setType( HqlTokenTypes.WEIRD_IDENT ); astFactory.addASTChild( currentAST, astFactory.create( token ) ); consume(); AST identifierAST = currentAST.root; return identifierAST;
for ( int dp_indx = 0; dp_indx < nestedDataPointCount; dp_indx++ ) { DataPoint dp = new DataPoint(); dp.setDescription( "data-point [" + c_indx + ", " + dp_indx + "]" ); // more HSQLDB fun... // dp.setX( new BigDecimal( c_indx ) ); dp.setX( new BigDecimal( c_indx + dp_indx ) ); dp.setY( new BigDecimal( dp_indx ) ); container.getDataPoints().add( dp ); }
Clone fragments detected by clone detection tool
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
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes
Number of node comparisons35
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    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();
    Preondition Violations
    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
    11
    DataPoint dp = new DataPoint();
    10
    consume();
    10
    consume();
    12
    dp.setDescription("data-point [" + c_indx + ", " + dp_indx + "]");
    Differences
    Expression1Expression2Difference
    consumesetDescriptionMETHOD_INVOCATION_NAME_MISMATCH
    consume()dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]")ARGUMENT_NUMBER_MISMATCH
    dpMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression consume() is a void method call, and thus it cannot be parameterized
    Expression dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]") is a void method call, and thus it cannot be parameterized
    Expression consume() is a void method call, and thus it cannot be parameterized
    Expression dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]") is a void method call, and thus it cannot be parameterized
    12
    dp.setDescription("data-point [" + c_indx + ", " + dp_indx + "]");
    11
    AST identifierAST = currentAST.root;
                                                                                
    12
    return identifierAST;
    12
    return identifierAST;
    Preondition Violations
    Unmatched return identifierAST;
                                                      
                                                                                                
    13
    dp.setX(new BigDecimal(c_indx + dp_indx));
                                                                              
    14
    dp.setY(new BigDecimal(dp_indx));
                                                                                
    15
    container.getDataPoints().add(dp);
    Precondition Violations (6)
    Row Violation
    1Unmatched 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
    2Expression consume() is a void method call, and thus it cannot be parameterized
    3Expression dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]") is a void method call, and thus it cannot be parameterized
    4Expression consume() is a void method call, and thus it cannot be parameterized
    5Expression dp.setDescription("data-point [" + c_indx + ", "+ dp_indx+ "]") is a void method call, and thus it cannot be parameterized
    6Unmatched return identifierAST;