Skip to content

Modularise for complete compatibility with JPMS. - #356

Open
brett-smith wants to merge 2 commits into
jinput:masterfrom
bithatch:master
Open

brett-smith wants to merge 2 commits into
jinput:masterfrom
bithatch:master

Conversation

@brett-smith

Copy link
Copy Markdown

JInput is currently impossible to use with a fully and correctly modularised application.

This is necessarily a significant patch. It touches just about every single class, renaming the package used by all plugins to allow JInput to be fully and correctly modularised (JPMS) without having "Split Packages". This is not simply adding Automatic-Module-Name to the MANIFEST.MF, every module will have a module-info.java.

These changes also required all native sources to be adjusted (because with JNI package names are embedded in function names).

jutils usage has been removed. The "plugin" functionality is now provided by Javas built-in ServiceLoader which works with JPMS. Even if jutils was modularised, it still would not work correctly as a plugin system due to differences in how classloaders in a modular world work. Maybe that is fixable, but I don't see anything it can do that ServiceLoader can't.

All of this also means the minimum Java version is now 9. I did try to implement this change as an MRJAR to maintain Java 8 compatibility, but there were other problems taking this route (lots of tooling with MRJARs is still not great for example).

This would fix #60.

If there is any interest in this PR at all, I have some pre-built artifacts on the new Maven Central snapshots repository. They are built using this PR, but then a 2nd patch applied on top to change all the artifact names. The builds should contain 64 bit intel binaries for Linux , Windows and Mac OS. Note however I have only tested them on Linux.

<repository>
            <id>oss-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots</url>
            <snapshots />
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>

and for example ...

 <dependency>
        <groupId>uk.co.bithatch</groupId>
        <artifactId>jinput</artifactId>
        <version>2.0.11-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>uk.co.bithatch</groupId>
        <artifactId>jinput</artifactId>
        <version>2.0.11-SNAPSHOT</version>
        <classifier>natives-all</classifier>
    </dependency>

brett-smith and others added 2 commits October 5, 2025 16:01
…a 9.

 * Removes dependency on jutils and uses `ServiceLoader` for plugins instead.
 * Rename all child module packages that clash with the core `net.java.games.input` (split packages are not possible in JPMS). This implies all plugin classnames have changed. Also affects system property names used for plugin configuration.
 * Adds module-info to all modules.
 * Reformat copyright headers on a number of classes or the strict Javadoc settings cause build failures in version later than JInput was developed with.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems using Java 11

1 participant