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

8341608: jdeps in JDK 23 crashes when parsing signatures while jdeps in JDK 22 works fine #24604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liach
Copy link
Member

@liach liach commented Apr 11, 2025

When jdeps was migrated from old classfile to ClassFile API, the parsing semantic changed - error checks are now made lazily, and nested crashes from malformed signature or other problems is now latent, after a ClassModel instance is available. (The old error check existed only for constructing a ClassModel)

To address this issue, I have updated the way of iterating class files to be handler/consumer based like in the ClassFile API. This has the advantage that when one invocation of the handler fails of a ClassFileError, other invocations for other class files can proceed, and the exception handler has sufficient information to report a useful message indicating the source of error.

For the particular example of examining a proguard processed dummy-scala.jar, here is the new output of jdeps dummy-scala.jar:

Warning: com.sun.tools.jdeps.Dependencies$ClassFileError: Unexpected character ; at position 59, expected an identifier: Lscala/collection/immutable/TreeMap$TreeMapBuilder<TA;TB;>.;: scala/collection/immutable/TreeMap$TreeMapBuilder.class (dummy-scala.jar)
Warning: com.sun.tools.jdeps.Dependencies$ClassFileError: Unexpected character ; at position 49, expected an identifier: Lscala/collection/parallel/mutable/ParArray<TT;>.;: scala/collection/parallel/mutable/ParArray.class (dummy-scala.jar)

Now, jdeps shows the bad class files. Inspection into the files reveal that proguard incorrectly deleted the simple class names with trailing $, for example, the original signature of the broken ParArray was Lscala/collection/parallel/mutable/ParArray<TT;>.ParArrayIterator$;, so the ParArrayIterator$ part was incorrectly dropped by proguard.

Testing: langtools/tools/jdeps.


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

Warning

 ⚠️ Found leading lowercase letter in issue title for 8341608: jdeps in JDK 23 crashes when parsing signatures while jdeps in JDK 22 works fine

Issue

  • JDK-8341608: jdeps in JDK 23 crashes when parsing signatures while jdeps in JDK 22 works fine (Bug - P3)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24604

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 11, 2025

👋 Welcome back liach! 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 Apr 11, 2025

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

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 11, 2025
@openjdk
Copy link

openjdk bot commented Apr 11, 2025

@liach The following label will be automatically applied to this pull request:

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Apr 11, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 11, 2025

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

1 participant