Community
Participate
Working Groups
The Eclipse compiler does not report an error for the following invalid Java annotation (trailing comma in the array initializer): /** * All JUnit tests of this component. */ @RunWith(Suite.class) @Suite.SuiteClasses({ PackagerTest.class, MetadataMarshallerTest.class, PackageMetadataPackagerTest.class, }) public final class AllTests { // nothing to do } The javac Compiler (1.6) reports the following error: [INFO] Compilation failure AllTests.java:[29,0] illegal start of expression
Looking at JLS §9.7 ("Annotations") the trailing comma is actually legal: ElementValueArrayInitializer: { ElementValuesopt ,opt } ElementValues: ElementValue ElementValues , ElementValue (see the ",opt": optional comma) Also the full grammar in §18.1 states: ElementValueArrayInitializer: { [ElementValues] [,] } Unless I'm missing something the difference is a bug in javac, not Eclipse.
Yes, this is a javac bug. We already have a dup for this one. I'll try to find it later.
Closing as a dup of bug 112433. *** This bug has been marked as a duplicate of bug 112433 ***
Verified for 3.6M1