FULL PRODUCT VERSION :
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
According to 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.
javac does not allow a comma after the last entry.
Original bug reported at: -
https://bugs.eclipse.org/bugs/show_bug.cgi?id=112433
STEPS TO REPRODUCE :
Just try and compile the sample test case below (taken from annotations sample from java.sun.com)
---------- BEGIN SOURCE ----------
// Test.java
public class Test {
@RequestForEnhancement(
id = 23,
synopsis = "Sample Synopsis",
engineer = "Test",
date = "9/1/2007",
)
public static void main(String[] args) {
}
}
/**
* Describes the Request-For-Enhancement(RFE) that led
* to the presence of the annotated API element.
*/
public @interface RequestForEnhancement {
int id();
String synopsis();
String engineer() default "[unassigned]";
String date() default "[unimplemented]";
}
---------- END SOURCE ----------
REPRODUCIBILITY :
This bug can be reproduced always.