RFR: 8213766: Assertion error in TypeAnnotations$TypeAnnotationPositions.resolveFrame [v2]
Guoxiong Li
gli at openjdk.java.net
Sat Jun 12 15:16:43 UTC 2021
> Hi all,
>
> This regression is caused by [PATCH-8078093](https://github.com/openjdk/jdk/commit/981c6dc2989b66f3691090c9f81e23d2b0a00087).
>
> The method `DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally` uses `attribSpeculativeLambda`. Later, the `ArgumentAttr.visitLambda(JCLambda that)` would be invoked, which sets the `ExplicitLambdaType.tree.type` to its `ExplicitLambdaType`. Note: currently, the `ExplicitLambdaType.tree` was not attributed and only the `ExplicitLambdaType.speculativeTree` was attributed.
>
> Then, `DeferredAttr$RecoveryDeferredTypeMap.typeOf` would not invoke the method `recover` to attribute the `ExplicitLambdaType.tree` because the `owntype` is not equal to `Type.noType`. The code and some comments are shown below for you.
>
>
> protected Type typeOf(DeferredType dt, Type pt) {
> Type owntype = super.typeOf(dt, pt); // The `super.typeOf(dt, pt)` returns the `ExplicitLambdaType` which is set previously.
> return owntype == Type.noType ?
> recover(dt, pt) : owntype; // Here, the method `recover` is not invoked because `owntype == Type.noType` returns false.
> }
>
>
> Because the tree is not attributed, some regressions will occur, including this bug.
>
> Although I found the cause of this bug, I think my patch is the simplest solution but it may be not the best solution.
>
> Another solution is that method `DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally` uses other way instead of using `attribSpeculativeLambda`. The old way which is before PATCH-8078093 is a candidate.
>
> Any better solution is appreciated. Thank you for taking the time to review.
>
> Best Regards.
Guoxiong Li 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 four additional commits since the last revision:
- Use meaningful name
- Merge branch 'master' into JDK-8213766
- Merge branch 'master' into JDK-8213766
- 8213766: Assertion error in TypeAnnotations.resolveFrame
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2118/files
- new: https://git.openjdk.java.net/jdk/pull/2118/files/25a49c45..cba260ff
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2118&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2118&range=00-01
Stats: 1446174 lines in 15377 files changed: 716422 ins; 659174 del; 70578 mod
Patch: https://git.openjdk.java.net/jdk/pull/2118.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2118/head:pull/2118
PR: https://git.openjdk.java.net/jdk/pull/2118
More information about the compiler-dev
mailing list