Type inference bug with method references in OpenJDK 16+ discovered

Guoxiong Li lgxbslgx at gmail.com
Tue Jun 22 18:09:29 UTC 2021


Hi Michael,

I find that this bug depends on the order of the `StringLiteral.java` and
`Variable.java`.
When I put the `Variable.java` in front of `StringLiteral.java`, the error
is gone and the program runs well,
which is the same as your local linux environment.

A file named `files.txt` is attached in this email. Could you use the
following commands in your linux environment to verify it?

```
// move the `files.txt` to the project path. Enter(`cd`) the project path
and run the following commands.
java -m jdk.compiler/com.sun.tools.javac.Main @files.txt
java -classpath src/main/java net.mirwaldt.bug.Main
```

If you can reproduce this bug in your linux environment, it means that this
bug is not related to the OS.
And the maven may compile the source files in different order, so we get
different results locally.

You can verify my idea in your own compile way and only note the order of
the `StringLiteral.java` and `Variable.java`.

Looking forward to your feedback.

Best Regards,
-- Guoxiong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20210623/b4e7dbed/attachment.htm>
-------------- next part --------------
src/main/java/net/mirwaldt/bug/StringVariable.java
src/main/java/net/mirwaldt/bug/Query.java
src/main/java/net/mirwaldt/bug/Main.java
src/main/java/net/mirwaldt/bug/IntVariable.java
src/main/java/net/mirwaldt/bug/Interpreter.java
src/main/java/net/mirwaldt/bug/DummyInterpreter.java
src/main/java/net/mirwaldt/bug/TwoVariablesQuery.java
src/main/java/net/mirwaldt/bug/Literal.java
src/main/java/net/mirwaldt/bug/MyFact.java
src/main/java/net/mirwaldt/bug/OneVariableQuery.java
src/main/java/net/mirwaldt/bug/IntLiteral.java

src/main/java/net/mirwaldt/bug/StringLiteral.java
src/main/java/net/mirwaldt/bug/Variable.java


More information about the compiler-dev mailing list