RFR: 8357653: Inner classes of type parameters emitted as raw types in signatures [v13]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Jul 10 12:39:43 UTC 2025
On Thu, 10 Jul 2025 12:32:03 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 2285:
>>
>>> 2283: * @param nextType a unary operator that emits the next type to be examined
>>> 2284: */
>>> 2285: public Type asSuperClosure(Type t, Symbol sym, UnaryOperator<Type> nextType) {
>>
>> Thinking more about naming -- javac is using the term `closure` typically to denote method that return a "bag of stuff" (e.g. transitive _closure_ of supertypes, members, etc.). Here `closure` doesn't mean really that, so I'm having second thoughts :-(
>
> It also occurred to me that this `asSuperClosure` we're trying to add can be expressed using streams (I think):
>
>
> Type input = ...
> UnaryFunction<Type> updateFunction = ...
> Function<Type, Type> mapFunction = ...
>
> Stream.iterate(input, updateFunction)
> .map(mapFunction)
> .filter(site -> !site.hasTag(NONE))
> .findFirst();
>
>
> Where `mapFunction` is `asSuper(t, sym)`, and `updateFunction` differs, depending on whether we want `asEnclosingSuper` or `asOuterSuper`.
My other feeling is that, while there is indeed some hidden commonality between `asEnclosingSuper` and `asOuterSuper` -- perhaps the addition of this new method is not super interesting -- as it is effectively only used in these two cases -- and it seems too specific to be used anywhere else (because it always uses `asSuper` and cannot be customized much). So perhaps, for now, the more honest approach is to leave it out.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25451#discussion_r2197616611
More information about the compiler-dev
mailing list