Bug 112433 - [1.5][compiler] JDT ignore array annotation last comma
Summary: [1.5][compiler] JDT ignore array annotation last comma
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows Server 2003
: P3 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 138443 209286 219237 284088 286204 309414 315491 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-13 01:56 EDT by Xiang Qinxian CLA
Modified: 2019-01-20 06:44 EST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xiang Qinxian CLA 2005-10-13 01:56:25 EDT
when use annotation array attributes, jdt ignore last comma in array expression.
e.g.
//ejb persistence annotations
@AttributeOverrides(  {
  @AttributeOverride(name="from", column=@Column(name="StartDate")),
  @AttributeOverride(name="to", column=@Column(name="EndDate")),  //last comma
ignored by jdt,but sun javac cannot ignore it.
}
)
Comment 1 Philipe Mulet CLA 2005-10-13 04:04:24 EDT
Normally, grammar says that array initializers accept extra comma at the end. 
Olivier - pls investigate
Comment 2 Olivier Thomann CLA 2005-10-13 13:53:36 EDT
This is a javac bug as far as I can say regarding the JLS3 (see
http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.7).

    NormalAnnotation:
        @ TypeName ( ElementValuePairsopt )

    ElementValuePairs:
        ElementValuePair
        ElementValuePairs , ElementValuePair

    ElementValuePair:
        Identifier = ElementValue

    ElementValue:
        ConditionalExpression
        Annotation
        ElementValueArrayInitializer

    ElementValueArrayInitializer:
        { ElementValuesopt ,opt }

    ElementValues:
        ElementValue
        ElementValues , ElementValue

So a ElementValueArrayInitializer can have an optional comma before the closing
brace. If present, it is simply ignored.
Please report the bug against javac.
Closing as INVALID.
Comment 3 Olivier Thomann CLA 2005-10-13 14:05:02 EDT
Added regression test in
org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest.test179.
Comment 4 Xiang Qinxian CLA 2006-04-25 21:22:33 EDT
(In reply to comment #3)
> Added regression test in
> org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest.test179.

Comment 5 Olivier Thomann CLA 2007-11-08 20:36:31 EST
*** Bug 209286 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2008-02-16 16:54:40 EST
*** Bug 219237 has been marked as a duplicate of this bug. ***
Comment 7 Olivier Thomann CLA 2009-07-22 15:51:36 EDT
*** Bug 284088 has been marked as a duplicate of this bug. ***
Comment 8 Olivier Thomann CLA 2009-08-11 09:02:06 EDT
*** Bug 286204 has been marked as a duplicate of this bug. ***
Comment 9 Walter Harley CLA 2010-04-16 00:12:26 EDT
*** Bug 309414 has been marked as a duplicate of this bug. ***
Comment 10 Sean Flanigan CLA 2010-05-31 19:59:36 EDT
For anyone else who's looking, the Sun bug report is here: http://bugs.sun.com/view_bug.do?bug_id=6337964
Comment 11 Walter Harley CLA 2010-06-02 16:48:28 EDT
*** Bug 315491 has been marked as a duplicate of this bug. ***
Comment 12 Olivier Thomann CLA 2011-05-19 13:11:46 EDT
*** Bug 138443 has been marked as a duplicate of this bug. ***
Comment 13 Stephan Herrmann CLA 2019-01-20 06:44:28 EST
Updating the test case, since the javac bug got fixed in 6.

Marked as fixed in 7 via https://bugs.openjdk.java.net/browse/JDK-6337964 but then backported to 6 via https://bugs.openjdk.java.net/browse/JDK-2214945