diff --git a/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java index 8c58bba9a0257..956cb7a3584da 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java @@ -77,7 +77,7 @@ *

* - primitives * - String - * - Class (see {@link #classProxy(String)} to handle classes that are not loadable at generation time) + * - Class * - Objects with a no-arg constructor and getter/setters for all properties * - Any arbitrary object via the {@link #registerSubstitution(Class, Class, Class)} mechanism * - arrays, lists and maps of the above diff --git a/core/deployment/src/main/java/io/quarkus/deployment/recording/RecorderContext.java b/core/deployment/src/main/java/io/quarkus/deployment/recording/RecorderContext.java index eee6c609da973..85bdddc8f2da4 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/recording/RecorderContext.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/recording/RecorderContext.java @@ -45,7 +45,10 @@ public interface RecorderContext { * * @param name The class name * @return A Class instance that can be passed to a recording proxy + * @deprecated This construct is no longer needed since directly loading deployment/application classes at + * processing time in build steps is now safe */ + @Deprecated Class classProxy(String name); /** diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java index b71f9c4448a2f..08bce6bc71907 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java @@ -52,7 +52,6 @@ import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem; import io.quarkus.deployment.builditem.GeneratedClassBuildItem; -import io.quarkus.deployment.recording.RecorderContext; import io.quarkus.gizmo.AssignableResultHandle; import io.quarkus.gizmo.BranchResult; import io.quarkus.gizmo.BytecodeCreator; @@ -233,14 +232,15 @@ List processBundles(BeanArchiveIndexBuildItem beanArchiv @Record(value = STATIC_INIT) @BuildStep - void initBundleContext(RecorderContext context, MessageBundleRecorder recorder, + void initBundleContext(MessageBundleRecorder recorder, List messageBundleMethods, List bundles, - BuildProducer syntheticBeans) { + BuildProducer syntheticBeans) throws ClassNotFoundException { Map>> bundleInterfaces = new HashMap<>(); for (MessageBundleBuildItem bundle : bundles) { - Class bundleClass = context.classProxy(bundle.getDefaultBundleInterface().toString()); + final Class bundleClass = Class.forName(bundle.getDefaultBundleInterface().toString(), true, + Thread.currentThread().getContextClassLoader()); Map> localeToInterface = new HashMap<>(); localeToInterface.put(MessageBundles.DEFAULT_LOCALE, bundleClass); diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java index 3fc0be8137f4b..cb7c1feffccc7 100644 --- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java +++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java @@ -37,7 +37,6 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.ShutdownListenerBuildItem; -import io.quarkus.deployment.recording.RecorderContext; import io.quarkus.deployment.util.ServiceUtil; import io.quarkus.kubernetes.spi.KubernetesHealthLivenessPathBuildItem; import io.quarkus.kubernetes.spi.KubernetesHealthReadinessPathBuildItem; @@ -123,12 +122,12 @@ void healthCheck(BuildProducer buildItemBuildProducer, @BuildStep @Record(ExecutionTime.STATIC_INIT) @SuppressWarnings("unchecked") - void build(SmallRyeHealthRecorder recorder, RecorderContext recorderContext, + void build(SmallRyeHealthRecorder recorder, BuildProducer feature, BuildProducer additionalBean, BuildProducer beanDefiningAnnotation, BuildProducer displayableEndpoints, - LaunchModeBuildItem launchModeBuildItem) throws IOException { + LaunchModeBuildItem launchModeBuildItem) throws IOException, ClassNotFoundException { feature.produce(new FeatureBuildItem(Feature.SMALLRYE_HEALTH)); @@ -165,8 +164,10 @@ void build(SmallRyeHealthRecorder recorder, RecorderContext recorderContext, String.format("Multiple HealthCheckResponseProvider implementations found: %s", providers)); } - recorder.registerHealthCheckResponseProvider( - (Class) recorderContext.classProxy(providers.iterator().next())); + final String provider = providers.iterator().next(); + final Class responseProvider = (Class) Class + .forName(provider, true, Thread.currentThread().getContextClassLoader()); + recorder.registerHealthCheckResponseProvider(responseProvider); } @BuildStep