Skip to content

Commit ead1e66

Browse files
authored
Merge pull request #50679 from gsmet/reduce-gizmo2-footprint
Reduce footprint of wiring classes generated by Gizmo 2
2 parents b186a87 + 91fae0c commit ead1e66

File tree

11 files changed

+46
-15
lines changed

11 files changed

+46
-15
lines changed

core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ private static boolean allRootMinLevelOrHigher(
583583
private static void generateMinLevelCompute(Map<String, CategoryBuildTimeConfig> categories,
584584
Map<String, InheritableLevel> categoryMinLevelDefaults, Level rootMinLevel,
585585
ClassOutput output) {
586-
Gizmo g = Gizmo.create(output);
586+
Gizmo g = Gizmo.create(output)
587+
.withDebugInfo(false)
588+
.withParameters(false);
587589
g.class_(MIN_LEVEL_COMPUTE_CLASS_NAME, cc -> {
588590
cc.final_();
589591
cc.staticMethod("isMinLevelEnabled", mc -> {
@@ -611,7 +613,9 @@ private static void generateMinLevelCompute(Map<String, CategoryBuildTimeConfig>
611613
}
612614

613615
private static void generateDefaultLoggerNode(ClassOutput output) {
614-
Gizmo g = Gizmo.create(output);
616+
Gizmo g = Gizmo.create(output)
617+
.withDebugInfo(false)
618+
.withParameters(false);
615619
g.class_(LOGGER_NODE_CLASS_NAME, cc -> {
616620
cc.final_();
617621
cc.addAnnotation(TargetClass.class, ac -> ac.add(TargetClass::className, "org.jboss.logmanager.LoggerNode"));
@@ -630,7 +634,10 @@ interface MinLevelEnabledFunction {
630634

631635
private static void generateLogManagerLogger(ClassOutput output,
632636
MinLevelEnabledFunction isMinLevelEnabledFunction) {
633-
Gizmo.create(output).class_(LOGMANAGER_LOGGER_CLASS_NAME, cc -> {
637+
Gizmo gizmo = Gizmo.create(output)
638+
.withDebugInfo(false)
639+
.withParameters(false);
640+
gizmo.class_(LOGMANAGER_LOGGER_CLASS_NAME, cc -> {
634641
cc.final_();
635642
This this_ = cc.this_();
636643
cc.addAnnotation(TargetClass.class, ac -> ac.add(TargetClass::value, org.jboss.logmanager.Logger.class));
@@ -668,7 +675,9 @@ private static Expr getLogManagerLevelIntValue(String levelName, BlockCreator b0
668675
}
669676

670677
private static void generateDefaultLoggingLogger(Level minLevel, ClassOutput output) {
671-
Gizmo gizmo = Gizmo.create(output);
678+
Gizmo gizmo = Gizmo.create(output)
679+
.withDebugInfo(false)
680+
.withParameters(false);
672681
gizmo.class_(LOGGING_LOGGER_CLASS_NAME, cc -> {
673682
cc.final_();
674683
cc.addAnnotation(TargetClass.class, ac -> ac.add(TargetClass::className, "org.jboss.logging.Logger"));

core/deployment/src/main/java/io/quarkus/deployment/recording/AnnotationProxyProvider.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
232232

233233
public A build(io.quarkus.gizmo2.ClassOutput classOutput) {
234234
generatedLiterals.computeIfAbsent(annotationLiteral, generatedName -> {
235-
Gizmo.create(classOutput).class_(generatedName, cc -> {
235+
Gizmo gizmo = Gizmo.create(classOutput)
236+
.withDebugInfo(false)
237+
.withParameters(false);
238+
gizmo.class_(generatedName, cc -> {
236239
ClassDesc annotationClassDesc = classDescOf(annotationInstance.name());
237240
cc.extends_(GenericType.ofClass(AnnotationLiteral.class, TypeArgument.of(annotationClassDesc)));
238241
cc.implements_(annotationClassDesc);

extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CachedResultsProcessor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,16 @@ void generateWrapperBeans(CombinedIndexBuildItem index,
8383
BuildProducer<AdditionalCacheNameBuildItem> cacheNames,
8484
BuildProducer<CachedResultsDifferentiator> diffs) {
8585
ClassOutput classOutput = new GeneratedBeanGizmo2Adaptor(generatedBeans);
86-
Gizmo gizmo = Gizmo.create(classOutput);
86+
Gizmo gizmo = Gizmo.create(classOutput)
87+
.withDebugInfo(false)
88+
.withParameters(false);
8789
// Generate a wrapper bean for each @CachedResults config
8890
// Note that config also includes the additional qualifiers declared at injection point
8991
// However, these qualifiers are only used to inject the delegate bean
9092
// The wrapper bean itself does not declare these additional qualifiers
9193
// Otherwise we would end up with ambiguous dependency while injecting the delegate
9294
// The injection point annotated with @CachedResults is transformed
93-
// and additional qualifers are replaced with @CachedResultsDiff
95+
// and additional qualifiers are replaced with @CachedResultsDiff
9496

9597
for (CachedResultsInjectConfigBuildItem injectConfig : cachedResultsInjectConfigs) {
9698
CachedResultsInjectConfig config = injectConfig.getConfig();

extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ void configValidator(
343343
.methods().build());
344344

345345
String builderClassName = HibernateBeanValidationConfigValidator.class.getName() + "Builder";
346-
Gizmo gizmo = Gizmo.create(new GeneratedClassGizmo2Adaptor(generatedClass, generatedResource, true));
346+
Gizmo gizmo = Gizmo.create(new GeneratedClassGizmo2Adaptor(generatedClass, generatedResource, true))
347+
.withDebugInfo(false)
348+
.withParameters(false);
347349
gizmo.class_(builderClassName, cc -> {
348350
cc.final_();
349351
cc.implements_(ConfigBuilder.class);

extensions/jackson/deployment/src/main/java/io/quarkus/jackson/deployment/JacksonProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ void generateCustomizer(BuildProducer<GeneratedBeanBuildItem> generatedBeans,
388388
}
389389

390390
ClassOutput classOutput = new GeneratedBeanGizmo2Adaptor(generatedBeans);
391-
Gizmo g = Gizmo.create(classOutput);
391+
Gizmo g = Gizmo.create(classOutput)
392+
.withDebugInfo(false)
393+
.withParameters(false);
392394
g.class_("io.quarkus.jackson.customizer.RegisterSerializersAndDeserializersCustomizer", cc -> {
393395
cc.implements_(ObjectMapperCustomizer.class);
394396
cc.defaultConstructor();

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,10 @@ private String generateImplementation(MessageBundleBuildItem bundle, ClassInfo d
961961
+ SUFFIX;
962962
String resolveMethodPrefix = baseName + SUFFIX;
963963

964-
Gizmo.create(classOutput).class_(generatedClassName, cc -> {
964+
Gizmo gizmo = Gizmo.create(classOutput)
965+
.withDebugInfo(false)
966+
.withParameters(false);
967+
gizmo.class_(generatedClassName, cc -> {
965968
// MyMessages_Bundle implements MyMessages, Resolver
966969
cc.implements_(classDescOf(bundleInterface));
967970
cc.implements_(Resolver.class);

extensions/reactive-routes/deployment/src/main/java/io/quarkus/vertx/web/deployment/ReactiveRoutesProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ public boolean test(String name) {
306306
return GeneratedClassGizmoAdaptor.isApplicationClass(className);
307307
}
308308
};
309-
Gizmo gizmo = Gizmo.create(new GeneratedClassGizmo2Adaptor(generatedClass, generatedResource, appClassPredicate));
309+
Gizmo gizmo = Gizmo.create(new GeneratedClassGizmo2Adaptor(generatedClass, generatedResource, appClassPredicate))
310+
.withDebugInfo(false)
311+
.withParameters(false);
310312
IndexView index = beanArchive.getIndex();
311313
Map<RouteMatcher, MethodInfo> matchers = new HashMap<>();
312314
boolean validatorAvailable = capabilities.isPresent(Capability.HIBERNATE_VALIDATOR);

extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusInvokerFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public Supplier<EndpointInvoker> create(ResourceMethod method, ClassInfo current
6060
}
6161
ClassOutput classOutput = new GeneratedClassGizmo2Adaptor(generatedClassBuildItemBuildProducer, null,
6262
applicationClassPredicate.test(currentClassInfo.name().toString()));
63-
Gizmo g = Gizmo.create(classOutput);
63+
Gizmo g = Gizmo.create(classOutput)
64+
.withDebugInfo(false)
65+
.withParameters(false);
6466
g.class_(baseName, cc -> {
6567
cc.defaultConstructor();
6668
cc.implements_(EndpointInvoker.class);

extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ public String apply(String name) {
394394
};
395395

396396
ClassOutput classOutput = new GeneratedClassGizmo2Adaptor(generatedClasses, generatedResources, generatedToBaseNameFun);
397-
Gizmo gizmo = Gizmo.create(classOutput);
397+
Gizmo gizmo = Gizmo.create(classOutput)
398+
.withDebugInfo(false)
399+
.withParameters(false);
398400

399401
for (ScheduledBusinessMethodItem scheduledMethod : scheduledMethods) {
400402
MutableScheduledMethod metadata = new MutableScheduledMethod();

extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/WebSocketProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,9 @@ public String apply(String name) {
494494
return name;
495495
}
496496
});
497-
Gizmo gizmo = Gizmo.create(classOutput);
497+
Gizmo gizmo = Gizmo.create(classOutput)
498+
.withDebugInfo(false)
499+
.withParameters(false);
498500
for (WebSocketEndpointBuildItem endpoint : endpoints) {
499501
// For each WebSocket endpoint bean we generate an implementation of WebSocketEndpoint
500502
// A new instance of this generated endpoint is created for each client connection

0 commit comments

Comments
 (0)