Skip to content

Commit

Permalink
Consider all types as serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
loicottet committed Oct 1, 2024
1 parent 9cadc84 commit dd8fb03
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/reachability-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
#
#op
# Subject to the condition set forth below, permission is hereby granted to any
# person obtaining a copy of this software, associated documentation and/or
# data (collectively the "Software"), free of charge and under any and all
Expand Down 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'
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 @@ -31,7 +31,10 @@

import org.graalvm.collections.EconomicMap;
import org.graalvm.collections.MapCursor;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.impl.ConfigurationCondition;
import org.graalvm.nativeimage.impl.RuntimeReflectionSupport;
import org.graalvm.nativeimage.impl.RuntimeSerializationSupport;
import org.graalvm.nativeimage.impl.UnresolvedConfigurationCondition;

import com.oracle.svm.core.TypeResult;
Expand All @@ -58,6 +61,7 @@ public void parseAndRegister(Object json, URI origin) {
}

@Override
@SuppressWarnings("unchecked")
protected void parseClass(EconomicMap<String, Object> data) {
checkAttributes(data, "reflection class descriptor object", List.of(TYPE_KEY), OPTIONAL_REFLECT_METADATA_ATTRS);
RuntimeReflectionSupport.increaseCount(false);
Expand Down Expand Up @@ -100,6 +104,9 @@ protected void parseClass(EconomicMap<String, Object> data) {
delegate.registerPublicMethods(queryCondition, true, clazz);
delegate.registerDeclaredFields(queryCondition, true, clazz);
delegate.registerPublicFields(queryCondition, true, clazz);
if (clazz instanceof Class<?> c && condition instanceof ConfigurationCondition cond) {
ImageSingletons.lookup(RuntimeSerializationSupport.class).register(cond, c);
}

registerIfNotDefault(data, false, clazz, "allDeclaredConstructors", () -> delegate.registerDeclaredConstructors(condition, false, clazz));
registerIfNotDefault(data, false, clazz, "allPublicConstructors", () -> delegate.registerPublicConstructors(condition, false, clazz));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void parseAndRegister(Object json, URI origin) {
@Override
protected void parseSerializationDescriptorObject(EconomicMap<String, Object> data, boolean lambdaCapturingType) {
checkAttributes(data, "serialization descriptor object", List.of(TYPE_KEY), List.of(CONDITIONAL_KEY, CUSTOM_TARGET_CONSTRUCTOR_CLASS_KEY));
RuntimeReflectionSupport.increaseCount(false);
RuntimeReflectionSupport.increaseCount(true);

Optional<ConfigurationTypeDescriptor> targetSerializationClass = parseTypeContents(data.get(TYPE_KEY));
if (targetSerializationClass.isEmpty()) {
Expand Down

0 comments on commit dd8fb03

Please sign in to comment.