Skip to content

Commit

Permalink
Register all methods if one is present
Browse files Browse the repository at this point in the history
  • Loading branch information
loicottet committed Oct 1, 2024
1 parent 9cadc84 commit 44b8c15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/reachability-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Build GraalVM JDK
uses: ./.github/actions/build-graalvm
with:
native-images: 'native-image,native-image-configure,lib:native-image-agent'
native-images: 'native-image,native-image-configure'
components: 'Native Image,Native Image Configure Tool'
java-version: ${{ env.MINIMUM_METADATA_JAVA_VERSION }}
- name: Tar GraalVM JDK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ private void parseField(C condition, EconomicMap<String, Object> data, T clazz)

protected void parseMethods(C condition, boolean queriedOnly, List<Object> methods, T clazz) {
for (Object method : methods) {
parseMethod(condition, queriedOnly, asMap(method, "Elements of 'methods' array must be method descriptor objects"), clazz);
parseMethod(condition, queriedOnly, asMap(method, "Elements of 'methods' array must be method descriptor objects"), clazz, method == methods.getFirst());
}
}

private void parseMethod(C condition, boolean queriedOnly, EconomicMap<String, Object> data, T clazz) {
private void parseMethod(C condition, boolean queriedOnly, EconomicMap<String, Object> data, T clazz, boolean first) {
checkAttributes(data, "reflection method descriptor object", Collections.singleton("name"), Collections.singleton("parameterTypes"));
RuntimeReflectionSupport.increaseCount(false);
RuntimeReflectionSupport.increaseCount(!first);
String methodName = asString(data.get("name"), "name");
List<T> methodParameterTypes = null;
Object parameterTypes = data.get("parameterTypes");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ protected void parseClass(EconomicMap<String, Object> data) {

registerIfNotDefault(data, false, clazz, "allDeclaredConstructors", () -> delegate.registerDeclaredConstructors(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "allPublicConstructors", () -> delegate.registerPublicConstructors(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "allDeclaredMethods", () -> delegate.registerDeclaredMethods(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "allPublicMethods", () -> delegate.registerPublicMethods(condition, false, clazz));
registerIfNotDefault(data, data.containsKey("methods") && !asList(data.get("methods"), "").isEmpty(), clazz, "allDeclaredMethods",
() -> delegate.registerDeclaredMethods(condition, false, clazz));
registerIfNotDefault(data, data.containsKey("methods") && !asList(data.get("methods"), "").isEmpty(), clazz, "allPublicMethods", () -> delegate.registerPublicMethods(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "allDeclaredFields", () -> delegate.registerDeclaredFields(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "allPublicFields", () -> delegate.registerPublicFields(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "unsafeAllocated", () -> delegate.registerUnsafeAllocated(condition, clazz));
Expand Down

0 comments on commit 44b8c15

Please sign in to comment.