From 0ed50ff9976e43eb1ca3ce29ae5794edaa6253d0 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Wed, 16 Nov 2022 14:46:58 +0100 Subject: [PATCH] Do not compute the application list is CRAC is not enabled. (#142) Do not attempt to preload classes without a name. --- .../io/quarkus/deployment/CracProcessor.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/CracProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/CracProcessor.java index d0905569781a5..6361f715831ce 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/CracProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/CracProcessor.java @@ -48,24 +48,37 @@ public void processCrac(BuildProducer preload, @BuildStep(onlyIf = IsNormal.class, onlyIfNot = NativeBuild.class) public void generateClassListFromApplication( - CracConfig cc, + CracConfig config, + Optional defaultVal, BuildProducer producer, TransformedClassesBuildItem transformedClasses, ApplicationArchivesBuildItem applicationArchivesBuildItem, List generatedClasses) { - if (cc.generateApplicationClassList) { + if (config.enable.isPresent()) { + if (!config.enable.get()) { + return; + } + } else if (defaultVal == null || !defaultVal.isPresent() || !defaultVal.get().isDefaultValue()) { + return; + } + + if (config.generateApplicationClassList) { for (Set transformedSet : transformedClasses .getTransformedClassesByJar().values()) { for (TransformedClassesBuildItem.TransformedClass transformed : transformedSet) { String className = transformed.getClassName(); - producer.produce(new PreloadClassBuildItem(className)); + if (className != null) { + producer.produce(new PreloadClassBuildItem(className)); + } } } for (GeneratedClassBuildItem i : generatedClasses) { if (i.isApplicationClass()) { - String cn = i.getName().replace("/", "."); - producer.produce(new PreloadClassBuildItem(cn)); + if (i.getName() != null) { + String cn = i.getName().replace("/", "."); + producer.produce(new PreloadClassBuildItem(cn)); + } } }