RFR: 8334037: Local class creation in lambda in pre-construction context crashes javac

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jun 24 13:21:13 UTC 2024


On Mon, 24 Jun 2024 09:15:48 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 3893:
>> 
>>> 3891:     @Override
>>> 3892:     public void visitLambda(JCLambda tree) {
>>> 3893:         Type expectedRet = types.findDescriptorType(tree.type).getReturnType();
>> 
>> shouldn't we erase the return type here?
>
> `tree.type` should be erased (from `TransTypes`)

After following up offline, we realized that this does indeed require erasure of the `getReturnType`, given `findDescriptorType` calls `findDescriptor` on the type's symbol (and symbols are not erased).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19836#discussion_r1651023081


More information about the compiler-dev mailing list