RFR: 8343580: Type error with inner classes of generic classes in functions generic by outer
Chen Liang
liach at openjdk.org
Wed May 21 14:40:52 UTC 2025
On Wed, 21 May 2025 14:34:12 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java line 1155:
>>
>>> 1153: if (allparams_field == null) {
>>> 1154: Type enclosingType = getEnclosingType();
>>> 1155: if (!enclosingType.isUnbound() && enclosingType.getUpperBound() instanceof Type t) {
>>
>> Shouldn't this be a while loop in case you have G bounded by another type variable?
>
> You mean an intersection type? I think you are right. So, do you have something like the following, in mind?
>
>
> static class Usage<T, G extends Getters<T> && SomethingElse> {
> public T test(G.Getter getter) {
> return getter.get();
> }
> }
>
>
> `G` would be raw if `SomethingElse` is raw if its definition is parametric, e.g. `interface SomethingElse<T>` and not raw if its definition is really `interface SomethingElse`. Did you mean that?
Nah, I was more thinking about
<T, U extends Getters<T>, G extends U>
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25346#discussion_r2100469586
More information about the compiler-dev
mailing list