Bug 196249 - problem in parsing
Summary: problem in parsing
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-11 19:34 EDT by Kelvin CLA
Modified: 2007-08-07 07:09 EDT (History)
1 user (show)

See Also:


Attachments
test class (135 bytes, text/java)
2007-07-12 13:14 EDT, Kelvin CLA
no flags Details
Proposed fix (15.49 KB, patch)
2007-07-16 14:49 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression test (2.44 KB, patch)
2007-07-16 14:59 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression test (2.26 KB, patch)
2007-07-16 15:01 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (15.84 KB, patch)
2007-07-16 16:00 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kelvin CLA 2007-07-11 19:34:54 EDT
Build ID: 200606281455

Steps To Reproduce:
1. test class (use UTF-8 encoding)
   
/**
 * 
 */
public class Test {
	/**
	* @param		nDataCount:0
	*/
	public static void main(String[] args) {
	}
}  


2. parse this class using eclipse AST parser

3. After parsing, "public" modifier can't be found in BodyDeclaration.modifiers() method (in both class and method)


More information:
Comment 1 Olivier Thomann CLA 2007-07-11 20:54:21 EDT
I could not reproduce with either 3.2.2 or 3.3.
Might be because of the UTF-8 encoding.
Could you please try to reproduce with 3.3 and if you get it, attach your project in a zip file?
Thanks.
Comment 2 Kelvin CLA 2007-07-12 13:14:54 EDT
Created attachment 73682 [details]
test class
Comment 3 Kelvin CLA 2007-07-12 13:15:59 EDT
I can you try test the class in comment #2 and change the encoding to UTF-8.
Comment 4 Olivier Thomann CLA 2007-07-16 12:59:13 EDT
Reproduced using 3.3.0 and the attached source file.
Thanks for the test case.
I am investigating.

Philippe, this might be a candidate for 3.3.1 depending on the risk involved in the fix.
Comment 5 Olivier Thomann CLA 2007-07-16 14:49:19 EDT
Created attachment 73886 [details]
Proposed fix

This fix makes sure that the AbstractCommentParser cannot return without resetting the tokenizeWhitespaces field of the scanner to the previous value.
The problem comes from that this parser sets this field to true and because of an invalid input exception (InvalidDigit), it was never setting it back to false.
So when it was about setting the modifiers, a whitespace token was not expected to be returned and the loop was ended.
This is a no risk fix and I propose to backport it to 3.3.1.
Comment 6 Olivier Thomann CLA 2007-07-16 14:59:23 EDT
Created attachment 73887 [details]
Regression test
Comment 7 Olivier Thomann CLA 2007-07-16 15:01:20 EDT
Created attachment 73888 [details]
Regression test

Cleanup the previous attachment
Comment 8 Olivier Thomann CLA 2007-07-16 16:00:44 EDT
Created attachment 73893 [details]
Proposed fix
Comment 9 Olivier Thomann CLA 2007-07-16 16:15:58 EDT
Released for 3.4M1.
Added regression test in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0680.

Philippe,

This is a candidate for 3.3.1. The fix is safe.
Comment 10 Frederic Fusier CLA 2007-08-07 07:09:10 EDT
Verified for 3.4M1 using build I20070806-1800.