DSL extension and documentation for native image plugin#2843
Conversation
There was a problem hiding this comment.
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.
| void proxyInterfaceSet(Iterable<String> interfaceClassNames) { | ||
| additionalProxyInterfaceSets.add(new ArrayList<String>(interfaceClassNames)) | ||
| } |
There was a problem hiding this comment.
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())
}
This PR adds a
jmeNativeImageDSL extension to make the GraalVM helper plugin easier to configure.It also introduces a
@PreserveReflectionannotation 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
Savableimplementations, 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 oftargetTypein the DSL config.This PR also adds documentation for the plugin.