-
Bug
-
Resolution: Fixed
-
P4
-
5.0, 6, 6u10
-
b74
-
x86
-
windows_2003, windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2214945 | 6u30 | Dmeetry Degrave | P2 | Closed | Fixed | b10 |
JDK-2183557 | OpenJDK6 | Joe Darcy | P3 | Resolved | Fixed | b17 |
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.
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.
- backported by
-
JDK-2183557 should ignore last comma in annotation array
- Resolved
-
JDK-2214945 should ignore last comma in annotation array
- Closed
- duplicates
-
JDK-6670278 ClassCastException com.sun.tools.javac.tree.JCTree$JCErroneous in APT
- Closed
- relates to
-
JDK-7078543 Accepted syntax change b/w JDK 6 & 7 w/ -source 6: trailing ',' in ann value array
- Closed