Skip to content

DSL extension and documentation for native image plugin#2843

Merged
riccardobl merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:nativeimage
Jun 5, 2026
Merged

DSL extension and documentation for native image plugin#2843
riccardobl merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:nativeimage

Conversation

@riccardobl
Copy link
Copy Markdown
Member

This PR adds a jmeNativeImage DSL extension to make the GraalVM helper plugin easier to configure.

It also introduces a @PreserveReflection annotation that developers can use to mark their custom classes for inclusion in GraalVM reachability metadata, without needing to configure the Gradle DSL directly.

The plugin still automatically includes subclasses of jME types, such as Savable implementations, network packets, and similar classes. The annotation is mainly intended to support custom reflection use cases that are not covered by the automatic detection logic and would otherwise require the use of targetType in the DSL config.

This PR also adds documentation for the plugin.

Copy link
Copy Markdown
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 introduces a new @PreserveReflection annotation and a Gradle DSL extension (jmeNativeImage) to configure GraalVM Native Image reachability metadata for jMonkeyEngine applications. Feedback on the changes includes: 1) in JmeNativeImageExtension.groovy, the proxyInterfaceSet method should use Groovy's toList() instead of the ArrayList constructor to avoid potential runtime exceptions when an Iterable that is not a Collection is passed; and 2) in native-image-metadata.gradle, resource settings should be automatically applied if custom include or exclude patterns are configured, even if useDefaultResourceSettings() is not explicitly called.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +41 to +43
void proxyInterfaceSet(Iterable<String> interfaceClassNames) {
additionalProxyInterfaceSets.add(new ArrayList<String>(interfaceClassNames))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The method signature accepts Iterable<String>, but ArrayList does not have a constructor that accepts a raw Iterable (it only accepts Collection). If a user passes an Iterable that does not implement Collection (such as certain Gradle lazy providers or custom iterables), this will throw a MissingConstructorException at runtime.

Using Groovy's toList() extension method on Iterable is safer and more idiomatic.

    void proxyInterfaceSet(Iterable<String> interfaceClassNames) {
        additionalProxyInterfaceSets.add(interfaceClassNames.toList())
    }

@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone Jun 4, 2026
@riccardobl riccardobl merged commit 24a15a2 into jMonkeyEngine:master Jun 5, 2026
12 checks passed
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.

2 participants