RFR: 8357653: Inner classes of type parameters emitted as raw types in signatures [v10]
Aggelos Biboudis
abimpoudis at openjdk.org
Wed Jul 9 11:43:51 UTC 2025
On Tue, 8 Jul 2025 21:07:13 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix imports again
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 2260:
>
>> 2258: */
>> 2259: public Type asEnclosingSuper(Type t, Symbol sym) {
>> 2260: return asOuter(t, sym, type -> getOwnerEnclosingClassType(type));
>
> You could also use a method reference here.
>
> Also... I guess here we have to decide whether it's better to use a method reference, and leave a method like `getOwnerEnclosingClassType` permanently there, or, perhaps, just accept the fact that the logic represented by `getOwnerEnclosingClassType` is a bit weird, and has only really one use, and it belongs to a lambda expression, so as to achieve full encapsulation.
Also, the one is on `Type::getEnclosingType` and the other would be on `Types::getOwnerEnclosingClassType`.
I this this is too special to make it part of the hierarchy of `Type` and specially the `class DeclaredType`.
I think I would slightly prefer to keep it as a lambda ultimately to promote the custom logic here. I would strongly prefer to inline it even in the lambda, but there we lose the nice name.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25451#discussion_r2194799326
More information about the compiler-dev
mailing list