Skip to content

Conversation

@xerial
Copy link
Owner

@xerial xerial commented Nov 24, 2025

Summary

  • Documents JEP 472 native access requirements for JDK 24+ users

Details

This PR adds comprehensive documentation to help users understand and address the native access warnings they encounter when running snappy-java on JDK 24 or later.

What changed

  • Added "JDK 24+ Native Access Requirements" section to README.md
  • Included practical examples for Maven, Gradle, sbt, and command-line usage
  • Explained the rationale based on JEP 472's "integrity by default" policy

Why this approach

Per JEP 472 and the official guidance, it is the application developer's responsibility (not the library maintainer's) to enable native access. The Enable-Native-Access manifest attribute is only for executable JARs, not libraries.

No code changes needed

This is purely a documentation update. No changes to snappy-java's code are required - users simply need to add the --enable-native-access=ALL-UNNAMED JVM flag when running on JDK 24+.

Test plan

  • Documentation is clear and accurate
  • Examples provided for common build tools
  • Links to official JEP 472 documentation

Fixes #689

🤖 Generated with Claude Code

Add documentation for JEP 472 native access requirements that affect
users running snappy-java on JDK 24 or later.

Since snappy-java uses JNI to load native libraries, applications
running on JDK 24+ must add the --enable-native-access=ALL-UNNAMED
JVM flag. Per JEP 472 guidance, this is the application developer's
responsibility (not the library's).

The new section includes:
- Clear explanation of the requirement
- Examples for Maven, Gradle, sbt, and command-line usage
- Warning message examples users will encounter
- Rationale based on JEP 472's "integrity by default" policy

No code changes are needed - this is purely documentation to help
users understand and address the warnings they see on JDK 24+.

Fixes #689

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the doc label Nov 24, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @xerial, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request provides essential documentation to address the new native access restrictions introduced in JDK 24 and beyond, as defined by JEP 472. It guides snappy-java users on how to properly configure their applications with the necessary JVM flag to ensure continued functionality and avoid runtime warnings or errors, without altering the library's core implementation.

Highlights

  • JDK 24+ Native Access Documentation: A new section has been added to the README.md to document the native access requirements for snappy-java users on JDK 24 and later, necessitated by JEP 472.
  • Required JVM Flag: The documentation specifies the --enable-native-access=ALL-UNNAMED JVM flag that users must apply to their applications when running on JDK 24+.
  • Build Tool Examples: Practical examples are provided for configuring the required JVM flag across various build tools, including Maven, Gradle, sbt, and for direct JAR execution.
  • Rationale and Warnings: The PR explains the rationale behind JEP 472's 'integrity by default' policy and illustrates the warnings users will encounter if the native access flag is not enabled.
  • No Code Changes: This pull request is exclusively a documentation update and does not introduce any changes to the snappy-java library's source code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds important documentation to the README.md file regarding the necessary JVM flags for running snappy-java on JDK 24 and later, due to changes in JEP 472. The documentation is clear and provides useful examples for command-line usage and various build tools. My review includes a couple of suggestions to make the Maven and Gradle examples more comprehensive by mentioning how to apply the JVM flag not just for tests, but also for application execution, which would further improve the documentation's helpfulness for developers.

Comment on lines +85 to +94
**Maven:**
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--enable-native-access=ALL-UNNAMED</argLine>
</configuration>
</plugin>
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The provided Maven example only covers the maven-surefire-plugin, which is used for running unit tests. This is a very common use case, but it would be beneficial to also mention that a similar configuration is needed for other execution scenarios, such as:

  • Integration tests with maven-failsafe-plugin.
  • Running the application with exec-maven-plugin.

This would help users configure their projects more completely. You could add a short note to clarify this.

Comment on lines +96 to +101
**Gradle:**
```gradle
tasks.withType(Test) {
jvmArgs '--enable-native-access=ALL-UNNAMED'
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Gradle example configures the JVM arguments for all tasks of type Test. This is great for testing, but users might also run their application using other tasks (e.g., the run task from the application plugin, or custom JavaExec tasks).

It would be helpful to either mention this or provide an example for configuring application execution as well. For instance, for the application plugin:

application {
    applicationDefaultJvmArgs = ['--enable-native-access=ALL-UNNAMED']
}

This would provide more comprehensive guidance for Gradle users.

@xerial xerial merged commit 92540f3 into main Nov 24, 2025
5 checks passed
@xerial xerial deleted the jdk-24-native-access-docs branch November 24, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JDK 25 warning: Restricted method called java.lang.System::load

1 participant