From 4be06cbd262369a0842a66d726f69e9aeba1abcc Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 7 Mar 2023 12:31:52 +0200 Subject: [PATCH 1/3] Replace deprecated usage of ReflectiveClassBuildItem in SpringCloudConfigProcessor --- .../spring/cloud/config/client/SpringCloudConfigProcessor.java | 3 +-- .../main/src/main/resources/application.properties | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/extensions/spring-cloud-config-client/deployment/src/main/java/io/quarkus/spring/cloud/config/client/SpringCloudConfigProcessor.java b/extensions/spring-cloud-config-client/deployment/src/main/java/io/quarkus/spring/cloud/config/client/SpringCloudConfigProcessor.java index 17f464f193253..eeb0d7e1b77de 100644 --- a/extensions/spring-cloud-config-client/deployment/src/main/java/io/quarkus/spring/cloud/config/client/SpringCloudConfigProcessor.java +++ b/extensions/spring-cloud-config-client/deployment/src/main/java/io/quarkus/spring/cloud/config/client/SpringCloudConfigProcessor.java @@ -24,8 +24,7 @@ public void enableSsl(BuildProducer extensio @BuildStep public void registerForReflection(BuildProducer reflectiveClass) { - reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, false, Response.class)); - reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, false, Response.PropertySource.class)); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(Response.class, Response.PropertySource.class).build()); } @BuildStep diff --git a/integration-tests/main/src/main/resources/application.properties b/integration-tests/main/src/main/resources/application.properties index 554c187036e2f..116c0e2ffc016 100644 --- a/integration-tests/main/src/main/resources/application.properties +++ b/integration-tests/main/src/main/resources/application.properties @@ -61,4 +61,4 @@ quarkus.class-loading.removed-resources."io.quarkus\:quarkus-integration-test-ma quarkus.test.enable-callbacks-for-integration-tests=true # @RolesAllowed value is configuration expression -tester-config-exp=tester \ No newline at end of file +tester-config-exp=tester From 7baf1431eda26af0bc0c31e80069430dbd2eedad Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 7 Mar 2023 12:46:19 +0200 Subject: [PATCH 2/3] Replace deprecated usage of ReflectiveClassBuildItem in JacksonProcessor --- .../jackson/deployment/JacksonProcessor.java | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java b/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java index 092395e76e026..9d60473569231 100644 --- a/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java +++ b/extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java @@ -120,18 +120,18 @@ void register( BuildProducer reflectiveMethod, BuildProducer additionalBeans) { reflectiveClass.produce( - new ReflectiveClassBuildItem(true, false, - "com.fasterxml.jackson.databind.ser.std.SqlDateSerializer", + ReflectiveClassBuildItem.builder("com.fasterxml.jackson.databind.ser.std.SqlDateSerializer", "com.fasterxml.jackson.databind.ser.std.SqlTimeSerializer", "com.fasterxml.jackson.databind.deser.std.DateDeserializers$SqlDateDeserializer", "com.fasterxml.jackson.databind.deser.std.DateDeserializers$TimestampDeserializer", - "com.fasterxml.jackson.annotation.SimpleObjectIdResolver")); + "com.fasterxml.jackson.annotation.SimpleObjectIdResolver").methods(true).build()); if (curateOutcomeBuildItem.getApplicationModel().getDependencies().stream().anyMatch( x -> x.getGroupId().equals("com.fasterxml.jackson.module") && x.getArtifactId().equals("jackson-module-jaxb-annotations"))) { reflectiveClass.produce( - new ReflectiveClassBuildItem(true, false, "com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector")); + ReflectiveClassBuildItem.builder("com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector") + .methods(true).build()); } IndexView index = combinedIndexBuildItem.getIndex(); @@ -163,18 +163,18 @@ void register( AnnotationValue usingValue = deserializeInstance.value("using"); if (usingValue != null) { // the Deserializers are constructed internally by Jackson using a no-args constructor - reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, usingValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(usingValue.asClass().name().toString()).build()); } AnnotationValue keyUsingValue = deserializeInstance.value("keyUsing"); if (keyUsingValue != null) { // the Deserializers are constructed internally by Jackson using a no-args constructor - reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, keyUsingValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(keyUsingValue.asClass().name().toString()).build()); } AnnotationValue contentUsingValue = deserializeInstance.value("contentUsing"); if (contentUsingValue != null) { // the Deserializers are constructed internally by Jackson using a no-args constructor reflectiveClass - .produce(new ReflectiveClassBuildItem(false, false, contentUsingValue.asClass().name().toString())); + .produce(ReflectiveClassBuildItem.builder(contentUsingValue.asClass().name().toString()).build()); } } @@ -183,32 +183,31 @@ void register( AnnotationValue usingValue = serializeInstance.value("using"); if (usingValue != null) { // the Serializers are constructed internally by Jackson using a no-args constructor - reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, usingValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(usingValue.asClass().name().toString()).build()); } AnnotationValue keyUsingValue = serializeInstance.value("keyUsing"); if (keyUsingValue != null) { // the Deserializers are constructed internally by Jackson using a no-args constructor - reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, keyUsingValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(keyUsingValue.asClass().name().toString()).build()); } AnnotationValue contentUsingValue = serializeInstance.value("contentUsing"); if (contentUsingValue != null) { // the Deserializers are constructed internally by Jackson using a no-args constructor reflectiveClass - .produce(new ReflectiveClassBuildItem(false, false, contentUsingValue.asClass().name().toString())); + .produce(ReflectiveClassBuildItem.builder(contentUsingValue.asClass().name().toString()).build()); } AnnotationValue nullsUsingValue = serializeInstance.value("nullsUsing"); if (nullsUsingValue != null) { // the Deserializers are constructed internally by Jackson using a no-args constructor reflectiveClass - .produce(new ReflectiveClassBuildItem(false, false, nullsUsingValue.asClass().name().toString())); + .produce(ReflectiveClassBuildItem.builder(nullsUsingValue.asClass().name().toString()).build()); } } for (AnnotationInstance creatorInstance : index.getAnnotations(JSON_AUTO_DETECT)) { if (creatorInstance.target().kind() == CLASS) { - reflectiveClass - .produce( - new ReflectiveClassBuildItem(true, true, creatorInstance.target().asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(creatorInstance.target().asClass().name().toString()) + .methods(true).fields(true).build()); } } @@ -221,7 +220,9 @@ void register( AnnotationValue value = resolverInstance.value("value"); if (value != null) { // Add the type-id-resolver class - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, value.asClass().name().toString())); + reflectiveClass + .produce(ReflectiveClassBuildItem.builder(value.asClass().name().toString()).methods(true).fields(true) + .build()); if (resolverInstance.target().kind() == CLASS) { // Add the whole hierarchy of the annotated class addReflectiveHierarchyClass(resolverInstance.target().asClass().name(), reflectiveHierarchyClass); @@ -240,7 +241,8 @@ void register( for (AnnotationInstance jsonNamingInstance : index.getAnnotations(JSON_NAMING)) { AnnotationValue strategyValue = jsonNamingInstance.value("value"); if (strategyValue != null) { - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, strategyValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(strategyValue.asClass().name().toString()) + .methods(true).fields(true).build()); } } @@ -249,13 +251,16 @@ void register( AnnotationValue generatorValue = jsonIdentityInfoInstance.value("generator"); AnnotationValue resolverValue = jsonIdentityInfoInstance.value("resolver"); if (generatorValue != null) { - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, generatorValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(generatorValue.asClass().name().toString()) + .methods(true).fields(true).build()); } if (resolverValue != null) { - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, resolverValue.asClass().name().toString())); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(resolverValue.asClass().name().toString()) + .methods(true).fields(true).build()); } else { // Registering since SimpleObjectIdResolver is the default value of @JsonIdentityInfo.resolver - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, SimpleObjectIdResolver.class)); + reflectiveClass.produce( + ReflectiveClassBuildItem.builder(SimpleObjectIdResolver.class).methods(true).fields(true).build()); } } @@ -389,7 +394,7 @@ public void supportMixins(MixinsRecorder recorder, } ClassInfo mixinClassInfo = instance.target().asClass(); String mixinClassName = mixinClassInfo.name().toString(); - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, mixinClassName)); + reflectiveClass.produce(ReflectiveClassBuildItem.builder(mixinClassName).methods(true).fields(true).build()); try { Type[] targetTypes = instance.value().asClassArray(); if ((targetTypes == null) || targetTypes.length == 0) { @@ -398,7 +403,8 @@ public void supportMixins(MixinsRecorder recorder, Class mixinClass = Thread.currentThread().getContextClassLoader().loadClass(mixinClassName); for (Type targetType : targetTypes) { String targetClassName = targetType.name().toString(); - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, targetClassName)); + reflectiveClass + .produce(ReflectiveClassBuildItem.builder(targetClassName).methods(true).fields(true).build()); mixinsMap.put(Thread.currentThread().getContextClassLoader().loadClass(targetClassName), mixinClass); } From 7cc3d184919956960342e4d65f0b282c409f8f8c Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 7 Mar 2023 12:50:43 +0200 Subject: [PATCH 3/3] Replace deprecated usage of ReflectiveClassBuildItem in KubernetesClientProcessor --- .../deployment/KubernetesClientProcessor.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java index 703d9fb787979..b17f4fe509a54 100644 --- a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java +++ b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java @@ -190,7 +190,7 @@ public void process(ApplicationIndexBuildItem applicationIndex, CombinedIndexBui .map(c -> c.name().toString()) .filter(s -> s.startsWith("io.fabric8.kubernetes")) .toArray(String[]::new); - reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, deserializerClasses)); + reflectiveClasses.produce(ReflectiveClassBuildItem.builder(deserializerClasses).methods(true).build()); final String[] serializerClasses = combinedIndexBuildItem.getIndex() .getAllKnownSubclasses(DotName.createSimple("com.fasterxml.jackson.databind.JsonSerializer")) @@ -198,28 +198,19 @@ public void process(ApplicationIndexBuildItem applicationIndex, CombinedIndexBui .map(c -> c.name().toString()) .filter(s -> s.startsWith("io.fabric8.kubernetes")) .toArray(String[]::new); - reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, serializerClasses)); + reflectiveClasses.produce(ReflectiveClassBuildItem.builder(serializerClasses).methods(true).build()); - reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, true, KubernetesClientImpl.class.getName())); - reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, true, DefaultKubernetesClient.class.getName())); - reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, false, AnyType.class.getName())); - reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, false, IntOrString.class.getName())); - - reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, false, KubernetesDeserializer.class.getName())); - reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, true, VersionInfo.class.getName())); + reflectiveClasses.produce( + ReflectiveClassBuildItem.builder(KubernetesClientImpl.class, DefaultKubernetesClient.class, VersionInfo.class) + .methods(true).fields(true).build()); + reflectiveClasses.produce(ReflectiveClassBuildItem + .builder(AnyType.class, IntOrString.class, KubernetesDeserializer.class).methods(true).build()); // exec credentials support - we need to use Strings as the classes are private reflectiveClasses - .produce(new ReflectiveClassBuildItem(true, true, - "io.fabric8.kubernetes.client.Config$ExecCredential", + .produce(ReflectiveClassBuildItem.builder("io.fabric8.kubernetes.client.Config$ExecCredential", "io.fabric8.kubernetes.client.Config$ExecCredentialSpec", - "io.fabric8.kubernetes.client.Config$ExecCredentialStatus")); + "io.fabric8.kubernetes.client.Config$ExecCredentialStatus").methods(true).fields(true).build()); if (log.isDebugEnabled()) { final String watchedClassNames = watchedClasses