JDK-8357653 : Inner classes of type parameters emitted as raw types in signatures
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 21,25
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2025-05-23
  • Updated: 2025-05-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26Unresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
The test method fails to compile, as javac believes that getter.get() returns just Object:

class Scratch {
    static abstract class Getters<T> {
        abstract class Getter {
            abstract T get();
        }
    }

    static class Usage<T, G extends Getters<T>> {
        public T test(G.Getter getter) {
            return getter.get();
        }
    }
}


FREQUENCY : always

If we merely address the issue in allparams() (as in the new backed-off 8343580), the test method compiles, but the emitted signature is as if it was T test(Scratch.Getters.Getter getter), where the Getter inner class appears as a raw type.

For the attached test on 25 mainline JDK as of 2025 May 23, this fails compilation with such a message:

TypeVarInners.java:11: error: incompatible types: TypeVarInners.Base cannot be converted to S
	return handler.owner();
	                    ^
  where S is a type-variable:
    S extends TypeVarInners.Base<S> declared in method <S>getOwner(TypeVarInners.Base.Handler)
1 error
error: compilation failed

Note the method's signature is already wrong in the error message: it should be <S>getOwner(S.Handler)

Note that assembleClassSig independently examines outer to detect whether it is raw or not:

if (outer.allparams().nonEmpty()) { 
   // rawOuter detection
   // code that emits generic encl type signature
} else {
   append(externalize(c.flatname));
}
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25451 Date: 2025-05-26 15:51:06 +0000
26-05-2025