RFR: 8256266: Binding variables don't correct support declaration annotations and the final modifier [v4]
Jan Lahoda
jlahoda at openjdk.java.net
Tue Dec 8 09:44:23 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 two additional commits since the last revision:
- Removing forgotten debug call.
- Reject final modifiers on non-pattern matching instanceof.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/1192/files
- new: https://git.openjdk.java.net/jdk/pull/1192/files/fd6a79fe..3923090a
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1192&range=03
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1192&range=02-03
Stats: 20 lines in 3 files changed: 13 ins; 2 del; 5 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