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

8273257: jshell doesn't compile a sealed hierarchy with a sealed interface and a non-sealed leaf #5348

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Sep 2, 2021

Considering code like:

non-sealed class C implements Undefined {}

javac will currently produce these compile-time errors:

/tmp/C.java:1: error: cannot find symbol
non-sealed class C implements Undefined {}
                              ^
  symbol: class Undefined
/tmp/C.java:1: error: non-sealed modifier not allowed here
non-sealed class C implements Undefined {}
           ^
  (class C does not have any sealed supertypes)
2 errors

The second error confuses JShell in cases like:

sealed interface I permits C {}
non-sealed class C implements I {}

Because when compiling the second snippet, JShell needs to analyze both these snippets together, but the second error seems unrepairable to JShell, so it does not try to include the first snippet in the compilation.

While JShell could be changed to consider the second error repairable, it seems better to tweak the error recovery to skip the second error, as javac does not know whether the Undefined interface is or is not sealed.

There is already code attempting to skip the error for erroneous supertypes, but erroneous superinterfaces are not returned by Types.directSupertypes, so attempting to detect cases where superinterfaces are erroneous.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8273257: jshell doesn't compile a sealed hierarchy with a sealed interface and a non-sealed leaf

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5348/head:pull/5348
$ git checkout pull/5348

Update a local copy of the PR:
$ git checkout pull/5348
$ git pull https://git.openjdk.java.net/jdk pull/5348/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5348

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5348.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 2, 2021

👋 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 openjdk bot added the rfr Pull request is ready for review label Sep 2, 2021
@openjdk
Copy link

openjdk bot commented Sep 2, 2021

@lahodaj The following labels will be automatically applied to this pull request:

  • compiler
  • kulla

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

@openjdk openjdk bot added compiler compiler-dev@openjdk.org kulla kulla-dev@openjdk.org labels Sep 2, 2021
@mlbridge
Copy link

mlbridge bot commented Sep 2, 2021

Webrevs

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.

lgtm

@openjdk
Copy link

openjdk bot commented Sep 2, 2021

@lahodaj 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:

8273257: jshell doesn't compile a sealed hierarchy with a sealed interface and a non-sealed leaf

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

  • aaa6f69: 8273250: Address javadoc issues in Deflater::setDictionationary
  • 5ee5dd9: 8272914: Create hotspot:tier2 and hotspot:tier3 test groups
  • 5245c1c: 8273147: Update and restructure TestGCLogMessages log message list
  • 632a7e0: 8273165: GraphKit::combine_exception_states fails with "matching stack sizes" assert
  • c2e015c: 8273229: Update OS detection code to recognize Windows Server 2022
  • 0c1b16b: 8273243: Fix indentations in java.net.InetAddress methods
  • 152e669: 8273140: Replace usages of Enum.class.getEnumConstants() with Enum.values() where possible
  • 857a930: 8263375: Support stack watermarks in Zero VM
  • 6cfe314: 8272970: Parallelize runtime/InvocationTests/
  • a9a83b2: 8273256: runtime/cds/appcds/TestEpsilonGCWithCDS.java fails due to Unrecognized VM option 'ObjectAlignmentInBytes=64' on x86_32
  • ... and 229 more: https://git.openjdk.java.net/jdk/compare/a86ac0d1e3a6f02e587362c767abdf62b308d321...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 2, 2021
@lahodaj
Copy link
Contributor Author

lahodaj commented Sep 3, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Sep 3, 2021

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

  • f17ee0c: 8273263: Incorrect recovery attribution of record component type when j.l.Record is unavailable
  • fa9c865: 8273112: -Xloggc: should override -verbose:gc
  • dd87181: 8214761: Bug in parallel Kahan summation implementation
  • 7fff22a: 8272805: Avoid looking up standard charsets
  • 92b05fe: 8273251: Call check_possible_safepoint() from SafepointMechanism::process_if_requested()
  • 29e0f13: 8272385: Enforce ECPrivateKey d value to be in the range [1, n-1] for SunEC provider
  • aaa6f69: 8273250: Address javadoc issues in Deflater::setDictionationary
  • 5ee5dd9: 8272914: Create hotspot:tier2 and hotspot:tier3 test groups
  • 5245c1c: 8273147: Update and restructure TestGCLogMessages log message list
  • 632a7e0: 8273165: GraphKit::combine_exception_states fails with "matching stack sizes" assert
  • ... and 235 more: https://git.openjdk.java.net/jdk/compare/a86ac0d1e3a6f02e587362c767abdf62b308d321...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 3, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 3, 2021
@openjdk
Copy link

openjdk bot commented Sep 3, 2021

@lahodaj Pushed as commit 7b023a3.

💡 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 kulla kulla-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants