Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM #19338

Closed
zakkak opened this issue Aug 11, 2021 · 4 comments · Fixed by #19520
Closed

CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM #19338

zakkak opened this issue Aug 11, 2021 · 4 comments · Fixed by #19520
Labels
Milestone

Comments

@zakkak
Copy link
Contributor

zakkak commented Aug 11, 2021

Describe the bug

CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM.

See https://github.com/graalvm/mandrel/runs/3296489189?check_suite_focus=true#step:9:440

Expected behavior

Test should pass.

Actual behavior

Test fails with:

[ERROR] io.quarkus.it.main.CoreSerializationInGraalITCase.testEntitySerializationFromServlet  Time elapsed: 0.052 s  <<< FAILURE!
java.lang.AssertionError: 
1 expectation failed.
Response body doesn't match expectation.
Expected: is "OK"
  Actual: java.io.InvalidClassException: io.quarkus.it.corestuff.serialization.SomeSerializationObject; no valid constructor
	java.io.InvalidClassException: io.quarkus.it.corestuff.serialization.SomeSerializationObject; no valid constructor
	at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:159)
	at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:875)
	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2170)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:493)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
	at io.quarkus.it.corestuff.SerializationTestEndpoint.reflectiveSetterInvoke(SerializationTestEndpoint.java:50)
	at io.quarkus.it.corestuff.SerializationTestEndpoint.doGet(SerializationTestEndpoint.java:29)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
	at io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:52)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at io.quarkus.micrometer.runtime.binder.vertx.VertxMeterBinderUndertowServletFilter.doFilter(VertxMeterBinderUndertowServletFilter.java:28)
	at javax.servlet.http.HttpFilter.doFilter(HttpFilter.java:97)
	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
	at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:67)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
	at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:247)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:589)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:119)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:290)
	at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
	at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$5$1.run(UndertowDeploymentRecorder.java:415)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:536)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:829)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)

How to Reproduce?

  1. Download the "jdk" artifact from https://github.com/graalvm/mandrel/actions/runs/1118484129
  2. Unzip it and then unarchive jdk.tgz
  3. export GRAALVM_HOME=path/to/extracted/mandrelvm
  4. ./mvnw -B --settings .github/mvn-settings.xml --fail-at-end -DfailIfNoTests=false -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests -DskipDocs -Dquarkus.container-image.build=false -pl integration-tests/main verify

Output of uname -a or ver

Linux 5.12.15-300.fc34.x86_64 #1 SMP Wed Jul 7 19:46:50 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment 18.9 (build 11.0.12+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode, sharing)

GraalVM version (if different from Java)

e3dd4282fe23d2a37fc8b6f2507c86a39d41bb02

Quarkus version or git rev

57d1dae

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /home/zakkak/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.12, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.fc34.x86_64 Default locale: en_IE, platform encoding: UTF-8 OS name: "linux", version: "5.12.15-300.fc34.x86_64", arch: "amd64", family: "unix"

Additional information

The graal change that brought this up appears to be oracle/graal#3050

I am not sure it's worth digging this further. I think we should adapt Quarkus' serialization support (https://github.com/quarkusio/quarkus/pull/15380/files) to use the new feature instead when using GraalVM >=21.3.

WDYT?

cc @JiriOndrusek

@zakkak zakkak added kind/bug Something isn't working area/native-image labels Aug 11, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 11, 2021

/cc @galderz

@ppalaga
Copy link
Contributor

ppalaga commented Aug 12, 2021

I have checked with one of Camel Quarkus extensions using the current serialization support and I can confirm that the test fails in a similar way:

[INFO] Running org.apache.camel.quarkus.component.jolt.it.JoltIT
...
2021-08-12 16:30:56,775 INFO  [io.ver.ext.web.RoutingContext] (executor-thread-0) RoutingContext failure (500): org.jboss.resteasy.spi.UnhandledException: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[]
        at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
        at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
        at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:519)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
        at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
        at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
        at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:138)
        at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:536)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
        at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[]
        at org.apache.camel.support.ExchangeHelper.extractResultBody(ExchangeHelper.java:677)
        at org.apache.camel.impl.engine.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:591)
        at org.apache.camel.impl.engine.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:587)
        at org.apache.camel.impl.engine.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:414)
        at org.apache.camel.quarkus.component.jolt.it.JoltResource.defaultr(JoltResource.java:51)
        at org.apache.camel.quarkus.component.jolt.it.JoltResource_ClientProxy.defaultr(JoltResource_ClientProxy.zig:219)
        at java.lang.reflect.Method.invoke(Method.java:566)
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
        at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:660)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:524)
        at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:474)
        at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:476)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:434)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:408)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:69)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:492)
        ... 17 more
Caused by: java.lang.RuntimeException: DeepCopy IOException
        at com.bazaarvoice.jolt.common.DeepCopy.simpleDeepCopy(DeepCopy.java:53)
        at com.bazaarvoice.jolt.defaultr.MapKey.applyLiteralKeyToContainer(MapKey.java:57)
        at com.bazaarvoice.jolt.defaultr.MapKey.applyChild(MapKey.java:44)
        at com.bazaarvoice.jolt.defaultr.Key.applyChildren(Key.java:162)
        at com.bazaarvoice.jolt.defaultr.MapKey.applyLiteralKeyToContainer(MapKey.java:67)
        at com.bazaarvoice.jolt.defaultr.MapKey.applyChild(MapKey.java:44)
        at com.bazaarvoice.jolt.defaultr.Key.applyChildren(Key.java:162)
        at com.bazaarvoice.jolt.Defaultr.transform(Defaultr.java:242)
        at org.apache.camel.component.jolt.JoltEndpoint.onExchange(JoltEndpoint.java:205)
        at org.apache.camel.support.ProcessorEndpoint$1.process(ProcessorEndpoint.java:61)
        at org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:66)
        at org.apache.camel.impl.engine.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:217)
        at org.apache.camel.impl.engine.SharedCamelInternalProcessor$1.process(SharedCamelInternalProcessor.java:111)
        at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
        at org.apache.camel.impl.engine.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:108)
        at org.apache.camel.support.cache.DefaultProducerCache.send(DefaultProducerCache.java:190)
        at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:176)
        at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:172)
        at org.apache.camel.impl.engine.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:413)
        ... 31 more
Caused by: java.io.InvalidClassException: java.lang.Boolean; no valid constructor
        at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:159)
        at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:875)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2170)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:493)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
        at com.bazaarvoice.jolt.common.DeepCopy.simpleDeepCopy(DeepCopy.java:50)
        ... 49 more

I think we should adapt Quarkus' serialization support (https://github.com/quarkusio/quarkus/pull/15380/files) to use the new feature instead when using GraalVM >=21.3.

+1.
Jiri is away. Could please somebody from Quarkus team pick this?

zakkak added a commit to zakkak/quarkus that referenced this issue Aug 12, 2021
zakkak added a commit to zakkak/quarkus that referenced this issue Aug 12, 2021
`SerializationRegistry` has been moved from
`com.oracle.svm.core.jdk.serialize` to
`com.oracle.svm.reflect.serialize` in Graal
oracle/graal#3050

Closes quarkusio#19338
@zakkak
Copy link
Contributor Author

zakkak commented Aug 16, 2021

FWIW one of the issues turns out to be the move of SerializationRegistry from com.oracle.svm.core.jdk.serialize to com.oracle.svm.reflect.serialize. As the fix is trivial I went for it in zakkak@b6e498b without success.

I have also tried invoking the new RuntimeSerialization.register when using GraalVM 21.3 without success as well, i.e.:

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
index dacefc389d..1026bf027c 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
@@ -542,6 +542,22 @@ public class NativeImageAutoFeatureStep {
                 ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class),
                 tc.load("java.lang.Object"), tc.load(false), tccl);
 
+        AssignableResultHandle serializationRegistryClass = tc.createVariable(Class.class);
+
+        BranchResult graalVm21_3Test = tc.ifGreaterEqualZero(
+                tc.invokeVirtualMethod(VERSION_COMPARE_TO,
+                        tc.invokeStaticMethod(VERSION_CURRENT),
+                        tc.marshalAsArray(int.class, tc.load(21), tc.load(3))));
+
+        BytecodeCreator greaterThan21_3 = graalVm21_3Test.trueBranch();
+        greaterThan21_3.invokeStaticMethod(
+                ofMethod("org.graalvm.nativeimage.hosted.RuntimeSerialization", "register", void.class, Class.class), clazz);
+        greaterThan21_3.returnValue(null);
+
+        BytecodeCreator notGreaterThan21_3 = graalVm21_3Test.falseBranch();
+        notGreaterThan21_3.assign(serializationRegistryClass,
+                notGreaterThan21_3.loadClass("com.oracle.svm.core.jdk.serialize.SerializationRegistry"));
+
         ResultHandle serializationSupport = tc.invokeStaticMethod(
                 IMAGE_SINGLETONS_LOOKUP,
                 tc.loadClass("com.oracle.svm.core.jdk.serialize.SerializationRegistry"));

Anyone picking this up please let me know if you need any help/heads up.

@zakkak
Copy link
Contributor Author

zakkak commented Aug 19, 2021

FWIW here you can find an example replicating the logic of CoreSerializationInGraalITCase outside of Quarkus using the new API to register the classes for serialization and it appears to work as expected.

Note: the pom.xml file uses 21.3.0-SNAPSHOT as the graal version so you will need to run

mx --primary-suite-path substratevm maven-deploy --suppress-javadoc
mx --primary-suite-path sdk maven-deploy --suppress-javadoc
mx --primary-suite-path compiler maven-deploy --suppress-javadoc

to install the artifacts from your graal snapshot build.

zakkak added a commit to zakkak/quarkus that referenced this issue Aug 19, 2021
`SerializationRegistry` class has been moved from
`com.oracle.svm.core.jdk.serialize` to
`com.oracle.svm.reflect.serialize`

`addReflections` method moved from
`com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to
`com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and
became `private`

See oracle/graal#3050

Note: oracle/graal#3050 also introduces
`SerializationFeature.register(Class<?>... classes)` which should be a
better alternative to the generated by Quarkus
`registerSerializationForClass` method.

Closes quarkusio#19338
zakkak added a commit to zakkak/quarkus that referenced this issue Aug 20, 2021
oracle/graal#3050 introduces a number of changes
around the internal APIs that are being used by Quarkus to register
classes for serialization thus breaking serialization support when using
21.3-dev

These changes are:

1. `SerializationRegistry` class has been moved from
   `com.oracle.svm.core.jdk.serialize` to
   `com.oracle.svm.reflect.serialize`

2. `addReflections` method moved from
   `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to
   `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and
   became `private`

oracle/graal#3050 also introduces
`SerializationFeature.register(Class<?>... classes)` which is available
as a public API (not internal) and can save us from having to keep up
with the internal APIs as new releases come out. This PR leverages the
new API to register classes for serialization when using GraalVM/Mandrel
>=21.3.

Closes quarkusio#19338
zakkak added a commit to zakkak/quarkus that referenced this issue Aug 20, 2021
oracle/graal#3050 introduces a number of changes
around the internal APIs that are being used by Quarkus to register
classes for serialization thus breaking serialization support when using
21.3-dev

These changes are:

1. `SerializationRegistry` class has been moved from
   `com.oracle.svm.core.jdk.serialize` to
   `com.oracle.svm.reflect.serialize`

2. `addReflections` method moved from
   `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to
   `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and
   became `private`

oracle/graal#3050 also introduces
`SerializationFeature.register(Class<?>... classes)` which is available
as a public API (not internal) and can save us from having to keep up
with the internal APIs as new releases come out. This PR leverages the
new API to register classes for serialization when using GraalVM/Mandrel
>=21.3.

Closes quarkusio#19338
zakkak added a commit to zakkak/quarkus that referenced this issue Aug 23, 2021
oracle/graal#3050 introduces a number of changes
around the internal APIs that are being used by Quarkus to register
classes for serialization thus breaking serialization support when using
21.3-dev

These changes are:

1. `SerializationRegistry` class has been moved from
   `com.oracle.svm.core.jdk.serialize` to
   `com.oracle.svm.reflect.serialize`

2. `addReflections` method moved from
   `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to
   `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and
   became `private`

oracle/graal#3050 also introduces
`SerializationFeature.register(Class<?>... classes)` which is available
as a public API (not internal) and can save us from having to keep up
with the internal APIs as new releases come out. This PR leverages the
new API to register classes for serialization when using GraalVM/Mandrel
>=21.3.

Closes quarkusio#19338
@quarkus-bot quarkus-bot bot added this to the 2.3 - main milestone Aug 24, 2021
@gsmet gsmet modified the milestones: 2.3 - main, 2.2.0.Final Aug 24, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 24, 2021
oracle/graal#3050 introduces a number of changes
around the internal APIs that are being used by Quarkus to register
classes for serialization thus breaking serialization support when using
21.3-dev

These changes are:

1. `SerializationRegistry` class has been moved from
   `com.oracle.svm.core.jdk.serialize` to
   `com.oracle.svm.reflect.serialize`

2. `addReflections` method moved from
   `com.oracle.svm.reflect.serialize.hosted.SerializationFeature` to
   `com.oracle.svm.reflect.serialize.hosted.SerializationBuilder` and
   became `private`

oracle/graal#3050 also introduces
`SerializationFeature.register(Class<?>... classes)` which is available
as a public API (not internal) and can save us from having to keep up
with the internal APIs as new releases come out. This PR leverages the
new API to register classes for serialization when using GraalVM/Mandrel
>=21.3.

Closes quarkusio#19338

(cherry picked from commit 4921b9f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants