[jdk16] RFR: 8256266: Binding variables don't correctly support declaration annotations and the final modifier
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Tue Jan 5 11:19:58 UTC 2021
On Mon, 4 Jan 2021 15:50:27 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> [This is a copy of https://github.com/openjdk/jdk/pull/1192, but filled against the JDK 16 branch.]
>
> Basically, javac does not handle code like this properly:
>
> import java.lang.annotation.*;
>
> public class B {
> public void test(Object o) {
> if (o instanceof @A String s) {}
> }
> }
>
> @Target(ElementType.LOCAL_VARIABLE)
> @interface A {}
>
> The parser needs to allow declaration annotations on binding variables, see:
> http://cr.openjdk.java.net/~gbierman/jep394/jep394-20201012/specs/patterns-instanceof-jls.html#jls-14.30.1.1
Marked as reviewed by mcimadamore (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk16/pull/78
More information about the compiler-dev
mailing list