Skip to content

add module info #45

Closed
Closed

Description

@stephengold

JSnapLoader v1.1.1 does not define a module, so Java considers it part of the Unnamed Module.

For this reason, when jSnapLoader invokes the System.load() method, Java 24 issues a runtime warning:

WARNING: A restricted method in java.lang.System has been called

This warning can be suppressed using --enable-native-access=ALL-UNNAMED. However, this workaround is risky from a security standpoint because it might give access to large swaths of code that don't need such access.

To mitigate this risk, it would better if jSnapLoader defined its own module, which should probably be named electrostatic4j.snaploader.

Activity

  1. pavly-gerges commented on Oct 9, 2026

    @pavly-gerges
    Member

    Notice that; Java Modules are supported from Java 9+. Therefore, once updated, jSnapLoader will not work anymore on applications compiled with Java 8.

  2. pavly-gerges commented on Oct 9, 2026

    @pavly-gerges
    Member

    These used to cause annoying problems for platforms that were primarily dependent on Java 8 (e.g., Android). I don't know the new Android updates. However, I believe all Java 11 features are supported now.

  3. stephengold commented on Oct 9, 2026

    @stephengold
    ContributorAuthor

    As of 2026, I believe Java 21 support is more vital than Java 8 support, but I don't have any data to support that belief.
    Have you ever tested jSnapLoader with Java 8?

  4. pavly-gerges commented on Oct 9, 2026

    @pavly-gerges
    Member

    6. As of 2026, I believe Java 21 support is more vital than Java 8 support, but I don't have any data to support that belief.
    Have you ever tested jSnapLoader with Java 8?

    jSnapLoader was first bundled with Serial4j that was working on Java 8; then upgraded to 19 w/o changing the code; since that, the library has been separated. It should work flawlessly as it uses legacy language features.

    For this reason, when jSnapLoader invokes the System.load() method, Java 24 issues a runtime warning:

    WARNING: A restricted method in java.lang.System has been called

    Furthermore, I believe this warning was thrown because of Gradle libraries, and not particularly from jSnapLoader:

    WARNING: A restricted method in java.lang.System has been called
    WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/home/runner/.gradle/wrapper/dists/gradle-9.8.1-bin/a2l6ltp3k1vth6lwipzm5p2jp/gradle-9.8.1/lib/native-platform-0.22-milestone-29.jar)
    WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
    WARNING: Restricted methods will be blocked in a future release unless native access is enabled

    It is thrown even though after introducing modules.

    May you please test a standalone JAR?

  5. pavly-gerges commented on Oct 9, 2026

    @pavly-gerges
    Member
  6. stephengold commented on Oct 9, 2026

    @stephengold
    ContributorAuthor

    Have you tried:

    $ ./gradlew :wrapper --gradle-version=9.8.1 && ./gradlew :wrapper

    ?

  7. pavly-gerges commented on Oct 10, 2026

    @pavly-gerges
    Member

    9. Have you tried:
    $ ./gradlew :wrapper --gradle-version=9.8.1 && ./gradlew :wrapper

    No, I haven't. I've updated the gradle wrapper from the gradle properties.

  8. pavly-gerges commented on Oct 10, 2026

    @pavly-gerges
    Member
  9. pavly-gerges commented on Oct 10, 2026

    @pavly-gerges
    Member

    I will try to update the JAR file instead.

  10. stephengold commented on Oct 10, 2026

    @stephengold
    ContributorAuthor

    ./gradlew :wrapper --gradle-version=9.8.1 && ./gradlew :wrapper is the correct way to update Gradle to version 9.8.1. It manages the necessary changes to 4 files:

    • gradlew
    • gradlew.bat
    • gradle/wrapper/gradle-wrapper.jar and
    • gradle/wrapper/gradle-wrapper.properties .

    Merely updating the properties file and the JAR file isn't always sufficient to complete an upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectA defect in the system (not a bug!).

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions