Bug 6893

Summary: LocalTypeDeclaration includes preceeding comment even if there are statements in between
Product: [Eclipse Project] JDT Reporter: Dirk Baeumer <dirk_baeumer>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Dirk Baeumer CLA 2001-12-13 10:35:33 EST
package invalidSelection;

public class A_test131 {
	public void foo() {
		
		/*]*/foo();
		class Inner {
		}
		foo();/*[*/
		
		Inner inner= new Inner();
	}
}

The ASTNode for the local Type declaration class Inner {...} looks like this:

LocalTypeDeclaration.declarationSourceStart == / of /*]*/ although there is a 
method call foo between the comment and the class Inner {...}
Comment 1 Olivier Thomann CLA 2001-12-13 13:41:29 EST
Fix released in HEAD. It is a complement of the fix for 6829, 6833 and 5413. 
The change in checkAnnotation() was necessary, but I forgot to reset the 
scanner.commentPtr in case the token is not a modifier. See change in 
consumeToken(). The problem could be seen if you replace the test case with:
package invalidSelection;

public class A_test131 {
        public void foo() {
                
                /**]*/foo();
                class Inner {
                }
                foo();/*[*/
                
                Inner inner= new Inner();
        }
}