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;
Parent p = new Parent( String.valueOf( i + 100 ) ); Child child = new Child( "child" + i ); child.setParent( p ); p.getChildren().add( child ); s.save( p ); parents.add(p);
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/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);
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 comparisons42
  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 fragment5
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                    
    5
    Parent p = new Parent(String.valueOf(i + 100));
    Preondition Violations
    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
    5
    Parent p = new Parent(String.valueOf(i + 100));
                                                                                
    6
    Child child = new Child("child" + i);
    Preondition Violations
    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
    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();
    10
    consume();
    7
    child.setParent(p);
    Differences
    Expression1Expression2Difference
    consumesetParentMETHOD_INVOCATION_NAME_MISMATCH
    consume()child.setParent(p)ARGUMENT_NUMBER_MISMATCH
    childMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression consume() is a void method call, and thus it cannot be parameterized
    Expression child.setParent(p) 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 child.setParent(p) is a void method call, and thus it cannot be parameterized
    7
    child.setParent(p);
                                          
    10
    parents.add(p);
    11
    AST identifierAST = currentAST.root;
                                                                                
    12
    return identifierAST;
    12
    return identifierAST;
    Preondition Violations
    Unmatched return identifierAST;
                                                      
    Precondition Violations (7)
    Row Violation
    1Unmatched 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
    2Unmatched 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
    3Expression consume() is a void method call, and thus it cannot be parameterized
    4Expression child.setParent(p) is a void method call, and thus it cannot be parameterized
    5Expression consume() is a void method call, and thus it cannot be parameterized
    6Expression child.setParent(p) is a void method call, and thus it cannot be parameterized
    7Unmatched return identifierAST;