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

8272776: NullPointerException not reported #5312

wants to merge 1 commit into from


Copy link

@lahodaj lahodaj commented Aug 31, 2021

Code like:

public void foo(Object o) {
        switch (o) {
          default: break;
          case String s :System.out.println(s); break;
public static void main(String[] args) {
        (new X()).foo(null); // NPE expected, but prints null

Should lead to a NPE when executed, because default does not cover null and there is no total pattern in the switch, but the NPE is not thrown. The reason is that when generating the code, a hasTotalPattern flag is used, which means "has a total pattern or default". The code needs to check whether there is a real total pattern (which covers null) or not. That is done by looking for the default case label, but the code only checks the last case for default. It needs to check all cases to differentiate between a switch with a real total pattern and a switch with a default.


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




Using git

Checkout this PR locally:
$ git fetch pull/5312/head:pull/5312
$ git checkout pull/5312

Update a local copy of the PR:
$ git checkout pull/5312
$ git pull pull/5312/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5312

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

Using diff file

Download this PR as a diff file:

Copy link

@bridgekeeper bridgekeeper bot commented Aug 31, 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 label Aug 31, 2021
Copy link

@openjdk openjdk bot commented Aug 31, 2021

@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 label Aug 31, 2021
Copy link

@mlbridge mlbridge bot commented Aug 31, 2021


Copy link

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

looks sensible

Copy link

@openjdk 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 for details.

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

8272776: NullPointerException not reported

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

  • 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 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/ fails due to Unrecognized VM option 'ObjectAlignmentInBytes=64' on x86_32
  • 1a5a2b6: 8271745: Correct block size for KW,KWP mode and use fixed IV for KWP mode for SunJCE
  • 2f01a6f: 8273157: Add convenience methods to Messager
  • ... and 227 more:

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 label Sep 2, 2021
Copy link
Contributor Author

@lahodaj lahodaj commented Sep 3, 2021


Copy link

@openjdk openjdk bot commented Sep 3, 2021

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

  • 7b023a3: 8273257: jshell doesn't compile a sealed hierarchy with a sealed interface and a non-sealed leaf
  • 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
  • ... and 236 more:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 3, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 3, 2021
Copy link

@openjdk openjdk bot commented Sep 3, 2021

@lahodaj Pushed as commit 93eec9a.

💡 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
compiler integrated
2 participants