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

Deprecate RecorderContext#classProxy method #10442

Merged
merged 3 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
* <p>
* - 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -233,14 +232,15 @@ List<MessageBundleBuildItem> processBundles(BeanArchiveIndexBuildItem beanArchiv

@Record(value = STATIC_INIT)
@BuildStep
void initBundleContext(RecorderContext context, MessageBundleRecorder recorder,
void initBundleContext(MessageBundleRecorder recorder,
List<MessageBundleMethodBuildItem> messageBundleMethods,
List<MessageBundleBuildItem> bundles,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {
BuildProducer<SyntheticBeanBuildItem> syntheticBeans) throws ClassNotFoundException {

Map<String, Map<String, Class<?>>> 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<String, Class<?>> localeToInterface = new HashMap<>();
localeToInterface.put(MessageBundles.DEFAULT_LOCALE,
bundleClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -123,12 +122,12 @@ void healthCheck(BuildProducer<AdditionalBeanBuildItem> buildItemBuildProducer,
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
@SuppressWarnings("unchecked")
void build(SmallRyeHealthRecorder recorder, RecorderContext recorderContext,
void build(SmallRyeHealthRecorder recorder,
BuildProducer<FeatureBuildItem> feature,
BuildProducer<AdditionalBeanBuildItem> additionalBean,
BuildProducer<BeanDefiningAnnotationBuildItem> beanDefiningAnnotation,
BuildProducer<NotFoundPageDisplayableEndpointBuildItem> displayableEndpoints,
LaunchModeBuildItem launchModeBuildItem) throws IOException {
LaunchModeBuildItem launchModeBuildItem) throws IOException, ClassNotFoundException {

feature.produce(new FeatureBuildItem(Feature.SMALLRYE_HEALTH));

Expand Down Expand Up @@ -165,8 +164,10 @@ void build(SmallRyeHealthRecorder recorder, RecorderContext recorderContext,
String.format("Multiple HealthCheckResponseProvider implementations found: %s", providers));
}

recorder.registerHealthCheckResponseProvider(
(Class<? extends HealthCheckResponseProvider>) recorderContext.classProxy(providers.iterator().next()));
final String provider = providers.iterator().next();
final Class<? extends HealthCheckResponseProvider> responseProvider = (Class<? extends HealthCheckResponseProvider>) Class
.forName(provider, true, Thread.currentThread().getContextClassLoader());
recorder.registerHealthCheckResponseProvider(responseProvider);
}

@BuildStep
Expand Down