New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8292756: java.lang.AssertionError at at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl.leave(Scope.java:386) #10347
Conversation
…vac.code.Scope$ScopeImpl.leave(Scope.java:386)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
*/ | ||
private int shared; | ||
private boolean shared; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
@lahodaj This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 91 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
/integrate |
Going to push as commit 0be2b2c.
Your commit was automatically rebased without conflicts. |
Any chance this can be backported to JDK 19? |
Several benefits of backporting to JDK 19:
|
Consider code like:
Compiling this leads to a crash:
The reason for the failure is this: in
Attr.handleSwitch
, there is an input scopeenv
, and a sub-scope of it,switchEnv
, is created for the switch. Eventually, another (shared) sub-scope is created for the guard expression,bodyEnv
. Allenv
,switchEnv
andbodyEnv
share an internal table. But, thebodyEnv
sub-scope is created fromenv
, not fromswitchEnv
(as it should). Which mostly works, but if the internal table forbodyEnv
is resized, it will correctly fix onlyenv
, but notswitchEnv
.The solution to this problem is to simply base the
bodyEnv
onswitchEnv
, not onenv
. But, in addition to that, it does not seem right the scopes don't protect from an accident like this. So the proposed patch here is enhancing the assertions inScope
so that a shared duplicate of a Scope can only be done from a leaf Scope.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10347/head:pull/10347
$ git checkout pull/10347
Update a local copy of the PR:
$ git checkout pull/10347
$ git pull https://git.openjdk.org/jdk pull/10347/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10347
View PR using the GUI difftool:
$ git pr show -t 10347
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10347.diff