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

8341966: Broken annotated module may lead to an exception in javac #192

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Oct 17, 2024

Hi all,

This pull request contains a backport of commit [7ff4ea8d](https://github.com/openjdk/jdk/commit/7ff4ea8d01c681b90ad59be04007557d84c8db94) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository.

The commit being backported was authored by Jan Lahoda on 17 Oct 2024 and was reviewed by Adam Sotona.

Thanks!

The original description:

Consider a module-info.class, that both:

  • is wrong, so it will produce a bad-classfile error, for example due to an illegal requires transitive java.base;
  • and the module is annotated

If the javac proceeds to resolve the annotations (which is not the default, but can be pushed to do it), it will crash with an AssertionError while trying to un-proxy the annotations. This is because there's an assert that requestingOwner.owner.kind == MDL, but since the module is erroneous, the kind is ERR, and the assert fails.

The proposal is to loosen the assert a bit, and require requestingOwner.owner instanceof ModuleSymbol. That should still be sufficiently strong, while permitting broken modules to be handled.


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
  • JDK-8341966 needs maintainer approval

Issue

  • JDK-8341966: Broken annotated module may lead to an exception in javac (Task - P4 - Approved)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 192

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk23u/pull/192.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 17, 2024

👋 Welcome back jlahoda! 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
Copy link

openjdk bot commented Oct 17, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 7ff4ea8d01c681b90ad59be04007557d84c8db94 8341966: Broken annotated module may lead to an exception in javac Oct 17, 2024
@openjdk
Copy link

openjdk bot commented Oct 17, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk
Copy link

openjdk bot commented Oct 17, 2024

⚠️ @lahodaj This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 17, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 17, 2024

Webrevs

@lahodaj
Copy link
Contributor Author

lahodaj commented Oct 17, 2024

/approval request This problem crashes javac with an exception when working with erroneous module-info.class. javac should report an error (and it does) but should not crash. The fix is just to down-tune an assert, so it should be very safe. Thanks!

@openjdk
Copy link

openjdk bot commented Oct 17, 2024

@lahodaj
8341966: The approval request has been created successfully.

@openjdk openjdk bot added the approval label Oct 17, 2024
@openjdk openjdk bot removed the clean label Oct 17, 2024
Copy link
Member

@asotona asotona 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 to me.

@openjdk openjdk bot removed the approval label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants