RFR: JDK-8252409: JShell: Intersection types cause NoSuchFieldError
Jan Lahoda
jlahoda at openjdk.java.net
Thu Jan 28 10:58:58 UTC 2021
>From the bug:
jshell> var test = (Serializable & Runnable) () -> {};
test ==> $Lambda$26/0x0000000800ba4248 at 5910e440
jshell> test
| Exception java.lang.NoSuchFieldError: test
| at (#2:1)
jshell> test.toString()
| Exception java.lang.NoSuchFieldError: test
| at (#3:1)
The reason is that the field generated for `var test = ...` has type `j.l.Object`, but the references to it use `Serializable`, and hence the field is not found. The proposal is to generate the field's type as an erased type of the intersection type.
-------------
Commit messages:
- Test cleanup.
- JDK-8252409: JShell: Intersection types cause NoSuchFieldError
Changes: https://git.openjdk.java.net/jdk/pull/2284/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2284&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8252409
Stats: 26 lines in 5 files changed: 15 ins; 0 del; 11 mod
Patch: https://git.openjdk.java.net/jdk/pull/2284.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2284/head:pull/2284
PR: https://git.openjdk.java.net/jdk/pull/2284
More information about the kulla-dev
mailing list