eclipse-jdt / eclipse-jdt/eclipse.jdt.core
Performance issues of type inference, and tricks
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
There's a [discussion](https://mail.openjdk.org/pipermail/compiler-dev/2025-January/029197.html) on https://mail.openjdk.org/mailman/listinfo/compiler-dev under the heading "Exponential compilation time for List.of(Map.entry) expressions"
Someone presented an [example program](https://gist.github.com/dweiss/93caf579a89f3dbbfac5c292048e42ad) which makes javac, intellij and also ecj go into deep thought mode for a long time.
Some take-aways from that discussion:
* the core problem is inherent in JLS, or even in the father of all similar type systems: ML. The problem **is** exponential. Period.
* IntelliJ has an [inspection + quickfix](https://www.jetbrains.com/help/inspectopedia/JavacQuirks.html) that let's users add explicit type arguments where it helps to avoid the problem
* javac already performs some tricks to cut down the number of inference variables, see https://mail.openjdk.org/pipermail/compiler-dev/2025-January/029239.html
Items (2) and (3) are worth considering also in JDT.
Contributor guide
Assessment
This issue has not been assessed yet.