RFR: 8256266: Binding variables don't correct support declaration annotations and the final modifier [v3]

Jan Lahoda jlahoda at openjdk.java.net
Mon Dec 7 11:21:26 UTC 2020


> 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

Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:

  Fixing tests.

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1192/files
  - new: https://git.openjdk.java.net/jdk/pull/1192/files/f1551ef1..fd6a79fe

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1192&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1192&range=01-02

  Stats: 6 lines in 2 files changed: 0 ins; 4 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1192.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1192/head:pull/1192

PR: https://git.openjdk.java.net/jdk/pull/1192


More information about the compiler-dev mailing list