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

8284283: javac crashes when several transitive supertypes are missing #8095

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Apr 4, 2022

Consider this testcase:

---Lib.java
package lib;
public class Lib implements A, B {}
interface A {}
interface B {}
---Test.java
public class Test<E> extends lib.Lib {}
---

$ javac -d out Lib.java
$ rm out/lib/A.class out/lib/B.class
$ javac -classpath out -XDdev Test.java
Test.java:1: error: cannot access A
public class Test<E> extends lib.Lib {}
       ^
  class file for lib.A not found
1 error
An exception has occurred in the compiler (17-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com/) after checking the Bug Database (http://bugs.java.com/) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Type.hasTag(com.sun.tools.javac.code.TypeTag)" because the return value of "com.sun.tools.javac.code.Type$TypeVar.getUpperBound()" is null
        at jdk.compiler/com.sun.tools.javac.code.Types.getBounds(Types.java:2732)
....

The reason for the cache is insufficient error recovery - when the missing class A and B are encountered, the processing in TypeEnter (TypeEnter.HierarchyPhase for A and TypeEnter.HeaderPhase for B) is interrupted, and the rest of the processing is skipped to the end of the phase, leaving unprocessed tree, which ultimately leads to the exception.

The proposed patch is to enhance the error recovery, catch the CompletionFailure for the missing classes sooner, and let the rest of the TypeEnter processing finish normally.


Progress

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

Issue

  • JDK-8284283: javac crashes when several transitive supertypes are missing

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8095

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

Using diff file

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

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 4, 2022

👋 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 Apr 4, 2022
@openjdk
Copy link

openjdk bot commented Apr 4, 2022

@lahodaj 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 Apr 4, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 4, 2022

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.

looks sensible

@openjdk
Copy link

openjdk bot commented Apr 26, 2022

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

8284283: javac crashes when several transitive supertypes are missing

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

  • 03bcf7b: 8283620: System.out does not use the encoding/charset specified in the Javadoc
  • 20a132d: 8284994: -Xdoclint:all returns warning for records, even when documented properly
  • a3b7881: 8284930: Re-examine FilterInputStream mark/reset
  • 97a0a29: 8283643: [AIX, testbug] MachCodeFramesInErrorFile test fails to find 'Native frames' text
  • 67755ed: 8284890: Support for Do not fragment IP socket options
  • a7b5157: 8282541: AArch64: Auto-vectorize Math.round API
  • 8de3c65: 8284951: Compile::flatten_alias_type asserts with "indeterminate pointers come only from unsafe ops"
  • 552e1b0: 8284779: Test java/util/logging/Logger/logrb/TestLogrbResourceBundle.java fails intermittently with vthreads wrapper
  • e333cd3: 8285611: Retrofit (Doc)Pretty with java.io.UncheckedIOException
  • 9478696: 8283441: C2: segmentation fault in ciMethodBlocks::make_block_at(int)
  • ... and 257 more: https://git.openjdk.java.net/jdk/compare/1012d59e64327817b9a2e01b94c1ad1b962c070f...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 Apr 26, 2022
@lahodaj
Copy link
Contributor Author

lahodaj commented May 12, 2022

/integrate

@openjdk
Copy link

openjdk bot commented May 12, 2022

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

  • 752ad1c: 8286422: Add OIDs for RC2 and Blowfish
  • 36bdd25: 8286573: Remove the unnecessary method Attr#attribTopLevel and its usage
  • dea6e88: 8284680: sun.font.FontConfigManager.getFontConfig() leaks charset
  • 40f43c6: 8286601: Mac Aarch: Excessive warnings to be ignored for build jdk
  • be97b4b: 8278348: [macos12] javax/swing/JTree/4908142/bug4908142.java fails in macos12
  • ff17f49: 8284888: [macos] javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java failed with "NimbusLookAndFeel] : ERROR: icon and imageIcon not same."
  • 50d47de: 8286582: Build fails on macos aarch64 when using --with-zlib=bundled
  • 89392fb: 8285820: C2: LCM prioritizes locally dependent CreateEx nodes over projections after 8270090
  • 96d48f3: 8286433: Cache certificates decoded from TLS session tickets
  • 7567627: 8286467: G1: Collection set pruning adds one region too many
  • ... and 506 more: https://git.openjdk.java.net/jdk/compare/1012d59e64327817b9a2e01b94c1ad1b962c070f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 12, 2022
@openjdk openjdk bot closed this May 12, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 12, 2022
@openjdk
Copy link

openjdk bot commented May 12, 2022

@lahodaj Pushed as commit e4439ca.

💡 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.

None yet

2 participants