Skip to content

8313323: javac -g on a java file which uses unnamed variable leads to ClassFormatError when launching that class #15083

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

Closed
wants to merge 2 commits into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Jul 31, 2023

When unnamed (_) variables are present, and javac emits the LocalVariableTable (and potentially the LocalVariableTypeTable), it includes the unnamed variable in the table. As the variable does not have a name, the table contains an empty name, which is not allowed by the spec, see [1], [2], [3].

The proposed solution is to simply not include the unnamed variables in these tables, by not adding them to the internal Code.varBuffer.

[1] https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.2.2
[2] https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.7.13
[3] https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-4.html#jvms-4.7.14


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-8313323: javac -g on a java file which uses unnamed variable leads to ClassFormatError when launching that class (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15083

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 31, 2023

👋 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 Jul 31, 2023
@openjdk
Copy link

openjdk bot commented Jul 31, 2023

@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 Jul 31, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 31, 2023

Webrevs

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 28, 2023

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

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 Sep 1, 2023

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

8313323: javac -g on a java file which uses unnamed variable leads to ClassFormatError when launching that class

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

  • 2f7c65e: 8303427: Fixpath confused if unix root contains "/jdk"
  • e9e0c56: 8314319: LogCompilation doesn't reset lateInlining when it encounters a failure.
  • 56b8db1: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF
  • 0d4cadb: 8315195: RISC-V: Update hwprobe query for new extensions
  • b4f7069: 8315446: G1: Remove unused G1AllocRegion::attempt_allocation
  • cf02cf3: 8315098: Improve URLEncodeDecode microbenchmark
  • c32e340: 8315321: [aix] os::attempt_reserve_memory_at must map at the requested address or fail
  • 42f5b9e: 8315436: HttpsServer does not send TLS alerts
  • 033f311: 8315069: Relativize extended_sp in interpreter frames
  • c2e01eb: 8313983: jmod create --target-platform should replace existing ModuleTarget attribute
  • ... and 385 more: https://git.openjdk.org/jdk/compare/47c4b992b44a5ce120aa4fe9e01279d4c52bca0a...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 1, 2023
@lahodaj
Copy link
Contributor Author

lahodaj commented Sep 4, 2023

/integrate

@lahodaj
Copy link
Contributor Author

lahodaj commented Sep 4, 2023

/backport jdk21u

@openjdk
Copy link

openjdk bot commented Sep 4, 2023

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

  • 2dc930d: 8314997: Missing optimization opportunities due to missing try_clean_mem_phi() calls
  • ab12c5d: 8315549: CITime misreports code/total nmethod sizes
  • ba8d5c2: 8315582: Exclude compiler/codecache/CodeCacheFullCountTest.java with Xcomp
  • 75d4ac2: 8311775: [TEST] duplicate verifyHeapDump in several tests
  • 4f90aba: 8311585: Add JRadioButtonMenuItem to bug8031573.java
  • 2a11bc4: 8314837: 5 compiled/codecache tests ignore VM flags
  • 2f7c65e: 8303427: Fixpath confused if unix root contains "/jdk"
  • e9e0c56: 8314319: LogCompilation doesn't reset lateInlining when it encounters a failure.
  • 56b8db1: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF
  • 0d4cadb: 8315195: RISC-V: Update hwprobe query for new extensions
  • ... and 391 more: https://git.openjdk.org/jdk/compare/47c4b992b44a5ce120aa4fe9e01279d4c52bca0a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 4, 2023

@lahodaj Pushed as commit adfc1d6.

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

@openjdk
Copy link

openjdk bot commented Sep 4, 2023

@lahodaj the backport was successfully created on the branch lahodaj-backport-adfc1d6c in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit adfc1d6c from the openjdk/jdk repository.

The commit being backported was authored by Jan Lahoda on 4 Sep 2023 and was reviewed by Vicente Romero.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u:

$ git fetch https://github.com/openjdk-bots/jdk21u.git lahodaj-backport-adfc1d6c:lahodaj-backport-adfc1d6c
$ git checkout lahodaj-backport-adfc1d6c
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u.git lahodaj-backport-adfc1d6c

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