Skip to content
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

8291154: Create a non static nested class without enclosing class throws VerifyError #11954

Closed
wants to merge 2 commits into from

Conversation

archiecobbs
Copy link
Contributor

@archiecobbs archiecobbs commented Jan 11, 2023

The fix for JDK-8254321 opened a loophole where a Java source file that defines a static nested class B that extends a non-static nested class A no longer generates an error if B is nested within A.

Here's an example:

class StaticNestedNonStaticSuper {
    public abstract class NonStaticNested {
        public static class StaticNested extends NonStaticNested {
            public StaticNested() {
                // where is StaticNestedNonStaticSuper.this for super() going to come from??
            }
        }
    }
}

Of course this is illegal because the non-static nested superclass requires an outer 'this' instance to be passed as the first argument to all of its constructors, but the static nested subclass has no such outer 'this' to provide. The compiler was proceeding anyway, resulting in unverifiable bytecode.

This PR adds a check for this situation. The check is added at the point in Lower.java where superclass constructor invocations in subclasses of non-static nested classes add the outer 'this' instance as a first parameter to super().

I'm not sure if this is the most appropriate location for this additional check, but at least it is in an optimal place to observe the problem when it happens.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8291154: Create a non static nested class without enclosing class throws VerifyError

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/11954/head:pull/11954
$ git checkout pull/11954

Update a local copy of the PR:
$ git checkout pull/11954
$ git pull https://git.openjdk.org/jdk.git pull/11954/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11954

View PR using the GUI difftool:
$ git pr show -t 11954

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11954.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 11, 2023

👋 Welcome back archiecobbs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 11, 2023
@openjdk
Copy link

openjdk bot commented Jan 11, 2023

@archiecobbs The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the compiler compiler-dev@openjdk.org label Jan 11, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 11, 2023

Webrevs

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 9, 2023

@archiecobbs This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@archiecobbs
Copy link
Contributor Author

/open

@openjdk
Copy link

openjdk bot commented Feb 9, 2023

@archiecobbs This pull request is already open

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 9, 2023

@archiecobbs This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@archiecobbs
Copy link
Contributor Author

/keepalive

@openjdk
Copy link

openjdk bot commented Mar 9, 2023

@archiecobbs Unknown command keepalive - for a list of valid commands use /help.

@vicente-romero-oracle
Copy link
Contributor

this looks good, running regression tests now

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@openjdk
Copy link

openjdk bot commented Mar 24, 2023

@archiecobbs This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8291154: Create a non static nested class without enclosing class throws VerifyError

Reviewed-by: vromero

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 1137 new commits pushed to the master branch:

  • 4ec720d: 8297977: vmTestbase/nsk/stress/except/except012.java fails with unexpected Exception
  • 13dd19a: 8304802: After JDK-8297639 the flag G1UsePreventiveGC needs to be added to the obsoletion table
  • d61de14: 8303508: Vector.lane() gets wrong value on x86
  • 941a7ac: 8304301: Remove the global option SuperWordMaxVectorSize
  • ac6af6a: 7176515: ExceptionInInitializerError for an enum with multiple switch statements
  • dd23ee9: 8303917: Update ISO 639 language codes table
  • 6f67abd: 8304557: java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java times out
  • 568dd57: 8304716: Clean up G1Policy::calc_max_old_cset_length()
  • af0504e: 8304691: Remove jlink --post-process-path option
  • 3859faf: 8231349: Move intrinsic stubs generation to compiler runtime initialization code
  • ... and 1127 more: https://git.openjdk.org/jdk/compare/d53cac379419b7b74df045bb119df6d5f9e91878...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vicente-romero-oracle) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 24, 2023
@archiecobbs
Copy link
Contributor Author

/integrate

@vicente-romero-oracle
Copy link
Contributor

/sponsor

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 24, 2023
@openjdk
Copy link

openjdk bot commented Mar 24, 2023

@archiecobbs
Your change (at version fc8db58) is now ready to be sponsored by a Committer.

@openjdk
Copy link

openjdk bot commented Mar 24, 2023

Going to push as commit f96aee7.
Since your change was applied there have been 1137 commits pushed to the master branch:

  • 4ec720d: 8297977: vmTestbase/nsk/stress/except/except012.java fails with unexpected Exception
  • 13dd19a: 8304802: After JDK-8297639 the flag G1UsePreventiveGC needs to be added to the obsoletion table
  • d61de14: 8303508: Vector.lane() gets wrong value on x86
  • 941a7ac: 8304301: Remove the global option SuperWordMaxVectorSize
  • ac6af6a: 7176515: ExceptionInInitializerError for an enum with multiple switch statements
  • dd23ee9: 8303917: Update ISO 639 language codes table
  • 6f67abd: 8304557: java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java times out
  • 568dd57: 8304716: Clean up G1Policy::calc_max_old_cset_length()
  • af0504e: 8304691: Remove jlink --post-process-path option
  • 3859faf: 8231349: Move intrinsic stubs generation to compiler runtime initialization code
  • ... and 1127 more: https://git.openjdk.org/jdk/compare/d53cac379419b7b74df045bb119df6d5f9e91878...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 24, 2023
@openjdk openjdk bot closed this Mar 24, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Mar 24, 2023
@openjdk
Copy link

openjdk bot commented Mar 24, 2023

@vicente-romero-oracle @archiecobbs Pushed as commit f96aee7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants