| Summary: | [1.5][compiler] JDT ignore array annotation last comma | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Xiang Qinxian <fyaoxy> |
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | avantnoisebot, bishen, christian.georgi, darryl.smith, hans.hofmann, Knut.Friedhelm, martin.ahrer, philippe_mulet, sflaniga, stephan.herrmann |
| Version: | 3.2 | ||
| Target Milestone: | 3.2 M3 | ||
| Hardware: | PC | ||
| OS: | Windows Server 2003 | ||
| Whiteboard: | |||
Normally, grammar says that array initializers accept extra comma at the end. Olivier - pls investigate 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. Added regression test in org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest.test179. (In reply to comment #3) > Added regression test in > org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest.test179. *** Bug 209286 has been marked as a duplicate of this bug. *** *** Bug 219237 has been marked as a duplicate of this bug. *** *** Bug 284088 has been marked as a duplicate of this bug. *** *** Bug 286204 has been marked as a duplicate of this bug. *** *** Bug 309414 has been marked as a duplicate of this bug. *** For anyone else who's looking, the Sun bug report is here: http://bugs.sun.com/view_bug.do?bug_id=6337964 *** Bug 315491 has been marked as a duplicate of this bug. *** *** Bug 138443 has been marked as a duplicate of this bug. *** 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 |
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. } )