RFR: 8036019: Insufficient alternatives listed in some errors produced by the parser
Aggelos Biboudis
duke at openjdk.java.net
Wed Jan 19 17:11:27 UTC 2022
On Tue, 18 Jan 2022 17:27:29 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Adjusts the corresponding "expected-" errors for `argumentOpt`, `typeArgumentsOpt` and `annotationValue`.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3382:
>
>> 3380: }
>> 3381: }
>> 3382: accept(RBRACE, tk -> Errors.AnnotationMissingElementValue);
>
> I think that this method needs some more massage, annotations like this one are being accepted:
>
>
> @SuppressWarnings({,})
>
> even previous to your patch, if my reading of the spec is correct, there should be at least one `ElementValue`
Indeed, that was my observation as well but then I noticed this:
https://bugs.openjdk.java.net/browse/JDK-8012722
This is among the positive tests of that contribution:
public class SingleCommaAnnotationValue {
@Foo({}) void a() { }
@Foo({,}) void b() { }
@Foo({0}) void c() { }
@Foo({0,}) void d() { }
@Foo({0,0}) void e() { }
@Foo({0,0,}) void f() { }
}
@interface Foo { int[] value(); }
What do you think?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7019
More information about the compiler-dev
mailing list