RFR: 8256266: Declaration annotations don't work properly for binding variables [v2]

Jan Lahoda jlahoda at openjdk.java.net
Mon Dec 7 09:05:36 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-

Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'JDK-8256266' of https://github.com/lahodaj/jdk into JDK-8256266
 - Removing an extra whitespace.
 - The 'final' modifier should be allowed on binding variables.
 - Merge branch 'master' into JDK-8256266
 - 8256266: Declaration annotations don't work properly for binding variables


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

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

  Stats: 242691 lines in 2055 files changed: 158164 ins; 59697 del; 24830 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