RFR: 8332507: compilation result depends on compilation order [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri May 31 14:32:04 UTC 2024


On Fri, 31 May 2024 14:07:22 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Wildcards and separate compilation haven't been friends since like: forever. Javac has had a long standing issue of not being able to restore wildcard bounds when they are read from the classfile. Part of this is due to a restriction of not reading another class file while a given class file is being read. Without breaking this restriction we can "wait" until a class symbol is completed from a class file to have access to richer information and being able to set the right bounds to wildcards. The fix seems simple enough. Basically the proposal is to register listeners that will be invoked once a given class symbol is completely read from a class file. This tactic has been used in type inference and other areas of the compiler where another layer of indirection has been a must to fix similar problems.
>> 
>> It will be a great pleasure if this proposal can be the solution to this long standing issue,
>> 
>> TIA
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review comments

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java line 639:

> 637:                         @Override
> 638:                         public List<Type> getTypeArguments() {
> 639:                             List<Type> formalsCp = ((ClassType)t.type.tsym.type).typarams_field;

This works. You might use another boolean flag up top to say whether you actually need to adjust the type arguments (which is only needed the first time) ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19400#discussion_r1622512373


More information about the compiler-dev mailing list