RFR: 8325859: Potential information loss during type inference [v9]

Vicente Romero vromero at openjdk.org
Tue May 20 19:31:55 UTC 2025


On Tue, 20 May 2025 16:25:54 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java line 575:
>> 
>>> 573:                "Undet vars: " + undetvars + '\n';
>>> 574:         if (parentIC != null) {
>>> 575:             result += "\nParent : " + parentIC.toString();
>> 
>> I was thinking about using an indentation, probably with a toString overload, but if the chain of parents gets long then one will need to scroll to the sides to see them all
>
> I see what you mean. The fact that the string representation is multiline, but also recursively used leads to issues -- because every time we do a `\n` we will break indentation. It's not terribly important. Another possibility would be to list the "other variables" (e.g. the ones that appear in the parent contexts), without listing all the parent contexts explicitly. That should scale a bit better.

you mean showing only the variables of the adjacent parent context and ignoring the rest of the chain?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25011#discussion_r2098712518


More information about the compiler-dev mailing list