Bug 243715 - [DOM] Parser.createASTs() throws exception on 'illogical' JavaDoc
Summary: [DOM] Parser.createASTs() throws exception on 'illogical' JavaDoc
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 04:57 EDT by Argus Development CLA
Modified: 2008-09-15 07:51 EDT (History)
2 users (show)

See Also:


Attachments
Plug-in project to reproduce bug (9.39 KB, application/zip)
2008-08-11 04:57 EDT, Argus Development CLA
no flags Details
Proposed fix (954 bytes, patch)
2008-08-11 12:04 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 Argus Development CLA 2008-08-11 04:57:32 EDT
Created attachment 109634 [details]
Plug-in project to reproduce bug

Build ID: I20080617-2000

Steps To Reproduce:
1. Have a compilation unit with 'illogical' JavaDoc (explained in more information).
2. Create an array of compilation units for parsing including the one created in step 1.
3. Create a Parser object with resolveBindings set to false.
4. Call Parser.createASTs(...).
5. An IllegalArgumentException is thrown, while it shouldn't.

The easiest way to reproduce the bug is using our attached sample code: 
i) run plug-in project ("CreateASTs") in Eclipse; 
ii) in the launched environment open "someproject" ; 
iii) then press the "reproduce bug" button.


More information:
We encountered this strange bug while testing our codechecker tool on large projects. It occurs when there is a JavaDoc comment inside a method body _and_ the next element is 'final'. Such a JavaDoc is meaning-less according to conventions but should be harmless according to Java specifications as it is a comment. The stack trace shows the IllegalArgumentException on the compilation unit immediately after the 'offending' compilation unit. 

More specific research showed us, JavaDoc reference didn't get reset and this causes the problem on the package statement of next compilation unit in Parser.consumePackageDeclarationName().
Comment 1 Olivier Thomann CLA 2008-08-11 11:03:53 EDT
Thanks for the good test case.

The field javadoc should indeed be reset for a local variable.
It is done properly for a field declaration, but never for a local.

This would be a good candidate for 3.4.1.
Jérôme, +1 for 3.4.1 ?
Comment 2 Olivier Thomann CLA 2008-08-11 12:04:43 EDT
Created attachment 109677 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2008-08-11 12:51:59 EDT
Released for 3.5M2.
Added regression tests in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0693
org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0694
Comment 4 Jerome Lanneluc CLA 2008-09-15 07:39:52 EDT
(In reply to comment #1)
> Thanks for the good test case.
> 
> The field javadoc should indeed be reset for a local variable.
> It is done properly for a field declaration, but never for a local.
> 
> This would be a good candidate for 3.4.1.
> Jérôme, +1 for 3.4.1 ?
> 
It looks like I didn't see this backport request. Is this a regression comparing to 3.3.x?
Comment 5 Jerome Lanneluc CLA 2008-09-15 07:51:52 EDT
Verified for 3.5M2 using I20080914-2000