Reported at:
https://mail.openjdk.java.net/pipermail/compiler-dev/2021-June/017333.html
Description from the reporter:
I wanted to report a bug in the type inference with references in
OpenJDK 16 and 17-ea.
I have created a sample project on
https://github.com/mmirwaldt/TypeInferenceBugOfMethodReferences/
<https://github.com/mmirwaldt/TypeInferenceBugOfMethodReferences/>
to reproduce the bug. Just run Main and notice the exception.
However, a friend told me that the bug only occurs with compiling
directly by javac but not by maven compile.
We don't know why. Moreover, it seems to be dependent on the operating
system:
I haven't been able to reproduce the bug on linux (CentOS 7, OpenJDK
16.0.1) yet. Windows 10 and Mac show that bug, though.
Can you please have a look on it, try it out and help me creating a bug
ticket if you can confirm it's a bug?
I mean it must be a bug if the type inference somehow infers the wrong
type of a method reference which leads to an exception at runtime,
doesn't it?
Type inference should either infer the right type or cause a compiler
error if it cannot infer the type or isn't sure about it in order to ask
the developer for an explicit declaration. Is that right?
I am sorry I cannot help you finding the bug in the code of the compiler
which infers types. I would if I could.
https://mail.openjdk.java.net/pipermail/compiler-dev/2021-June/017333.html
Description from the reporter:
I wanted to report a bug in the type inference with references in
OpenJDK 16 and 17-ea.
I have created a sample project on
https://github.com/mmirwaldt/TypeInferenceBugOfMethodReferences/
<https://github.com/mmirwaldt/TypeInferenceBugOfMethodReferences/>
to reproduce the bug. Just run Main and notice the exception.
However, a friend told me that the bug only occurs with compiling
directly by javac but not by maven compile.
We don't know why. Moreover, it seems to be dependent on the operating
system:
I haven't been able to reproduce the bug on linux (CentOS 7, OpenJDK
16.0.1) yet. Windows 10 and Mac show that bug, though.
Can you please have a look on it, try it out and help me creating a bug
ticket if you can confirm it's a bug?
I mean it must be a bug if the type inference somehow infers the wrong
type of a method reference which leads to an exception at runtime,
doesn't it?
Type inference should either infer the right type or cause a compiler
error if it cannot infer the type or isn't sure about it in order to ask
the developer for an explicit declaration. Is that right?
I am sorry I cannot help you finding the bug in the code of the compiler
which infers types. I would if I could.
- is blocked by
-
JDK-8269020 Correct Java code compiles, but fails at runtime with BootstrapMethodError
- Open
-
JDK-8174983 LambdaMetafactory: standardize supported type conversions
- In Progress
- relates to
-
JDK-7120669 4.9: Clarify well-formedness for intersection types & bounded type variables
- Open
-
JDK-8259491 Wrong lambda conversions involving intersection types
- Open
-
JDK-8273350 TypeSymbol::precedes generates an order that depends on the order in which types are seen by the compiler
- Closed
- links to
-
Review openjdk/jdk/5406
(1 links to)