RFR: 8256266: Declaration annotations don't work properly for binding variables
Jan Lahoda
jlahoda at openjdk.java.net
Fri Nov 13 16:52:07 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
-------------
Commit messages:
- Removing an extra whitespace.
- 8256266: Declaration annotations don't work properly for binding variables
Changes: https://git.openjdk.java.net/jdk/pull/1192/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1192&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8256266
Stats: 201 lines in 6 files changed: 198 ins; 1 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