Skip to content

Commit

Permalink
Runtime init resteasy's ResourceCleaner
Browse files Browse the repository at this point in the history
ResourceCleaner contains a static reference to a java.lang.ref.Cleaner
instance which are disallowed in the native image heap. Runtime
initializing that class instead fixes this issue.

Closes: quarkusio#31440
  • Loading branch information
jerboaa committed Feb 28, 2023
1 parent 859c915 commit a42ae92
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.resteasy.common.runtime.ResteasyInjectorFactoryRecorder;
import io.quarkus.resteasy.common.runtime.config.ResteasyConfigBuilder;
Expand Down Expand Up @@ -343,6 +344,16 @@ void registerNativeImageResources(BuildProducer<ServiceProviderBuildItem> servic
.allProvidersFromClassPath(org.jboss.resteasy.spi.config.ConfigurationFactory.class.getName()));
}

/**
* ResourceCleaner contains java.lang.ref.Cleaner references which need to get
* runtime initialized.
*/
@BuildStep
public RuntimeInitializedClassBuildItem runtimeInitResourceCleaner() {
return new RuntimeInitializedClassBuildItem(
"org.jboss.resteasy.spi.ResourceCleaner");
}

private void registerJsonContextResolver(
DotName jsonImplementation,
DotName jsonContextResolver,
Expand Down

0 comments on commit a42ae92

Please sign in to comment.