RFR: 8305007: Within-lambda subclass of local class using method param causes compiler crash [v2]

Vicente Romero vromero at openjdk.org
Mon Apr 22 22:48:54 UTC 2024


> javac is crashing while compiling code like:
> 
> 
> public abstract class CompilerCrashLambdaPlusLocalClass {
>     public abstract void consume(Runnable r);
> 
>     public void doThing(String parameter) {
>         class LocalClass {
>             @Override
>             public String toString() {
>                 return parameter;
>             }
>         }
>         consume(() -> {
>             class LambdaLocalClass extends LocalClass {}
>             new LocalClass();
>         });
>     }
> }
> 
> the reason for the issue is that the mappings for captured variables created by LambdaToMethod are not copying the `adr`, local address, field of the original VarSymbol it is mapping. Later on during code generation an assertion was being triggered due to a variable with an `adr < 0` this patch fixes this issue.
> 
> Thanks,
> Vicente

Vicente Romero has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'master' into JDK-8305007
 - jans proposal
 - keeping address of original VarSymbol
 - Merge branch 'master' into JDK-8305007
 - 8305007: Within-lambda subclass of local class using method param causes compiler crash

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17151/files
  - new: https://git.openjdk.org/jdk/pull/17151/files/e956528d..7352fd3c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=17151&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=17151&range=00-01

  Stats: 670431 lines in 8381 files changed: 143259 ins; 163664 del; 363508 mod
  Patch: https://git.openjdk.org/jdk/pull/17151.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17151/head:pull/17151

PR: https://git.openjdk.org/jdk/pull/17151


More information about the compiler-dev mailing list