From 64e9ad7966df2e161510d06e9ec4273165b1a3d3 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 13 Nov 2024 17:21:43 +0100 Subject: [PATCH] Update to Quartz 2.5.0 and drop Jakarta transformation workaround --- bom/application/pom.xml | 2 +- extensions/quartz/deployment/pom.xml | 5 -- .../quartz/deployment/JakartaEnablement.java | 89 ------------------- extensions/quartz/runtime/pom.xml | 14 --- 4 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/JakartaEnablement.java diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 186b103e3e18c..8d88aa00ab0b4 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -115,7 +115,7 @@ 4.4.16 4.1.5 9.2.1 - 2.3.2 + 2.5.0 2.3.230 42.7.4 diff --git a/extensions/quartz/deployment/pom.xml b/extensions/quartz/deployment/pom.xml index b67c16e1a8706..c206dc6570a62 100644 --- a/extensions/quartz/deployment/pom.xml +++ b/extensions/quartz/deployment/pom.xml @@ -34,11 +34,6 @@ io.quarkus quarkus-quartz - - org.eclipse.transformer - org.eclipse.transformer - 0.5.0 - io.quarkus diff --git a/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/JakartaEnablement.java b/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/JakartaEnablement.java deleted file mode 100644 index 7bb45dfb9afbc..0000000000000 --- a/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/JakartaEnablement.java +++ /dev/null @@ -1,89 +0,0 @@ -package io.quarkus.quartz.deployment; - -import java.nio.ByteBuffer; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.eclipse.transformer.action.ActionContext; -import org.eclipse.transformer.action.ByteData; -import org.eclipse.transformer.action.impl.ActionContextImpl; -import org.eclipse.transformer.action.impl.ByteDataImpl; -import org.eclipse.transformer.action.impl.ClassActionImpl; -import org.eclipse.transformer.action.impl.SelectionRuleImpl; -import org.eclipse.transformer.action.impl.SignatureRuleImpl; -import org.eclipse.transformer.util.FileUtils; -import org.objectweb.asm.ClassReader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.quarkus.bootstrap.classloading.QuarkusClassLoader; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem; - -/** - * Quartz is compiled using references to classes in the javax packages; - * we need to transform these to fix compatibility with jakarta packages. - * We do this by leveraging the Eclipse Transformer project during Augmentation, so - * that end users don't need to bother. - */ -public class JakartaEnablement { - - private static final List CLASSES_NEEDING_TRANSFORMATION = List.of( - "org.quartz.ExecuteInJTATransaction", - "org.quartz.ee.servlet.QuartzInitializerServlet", - "org.quartz.ee.servlet.QuartzInitializerListener", - "org.quartz.ee.jta.JTAJobRunShell", - "org.quartz.ee.jta.UserTransactionHelper", - "org.quartz.ee.jta.UserTransactionHelper$UserTransactionWithContext", - "org.quartz.xml.XMLSchedulingDataProcessor", - "org.quartz.impl.jdbcjobstore.JTANonClusteredSemaphore"); - - @BuildStep - void transformToJakarta(BuildProducer transformers) { - if (QuarkusClassLoader.isClassPresentAtRuntime("jakarta.transaction.Transaction")) { - JakartaTransformer tr = new JakartaTransformer(); - for (String classname : CLASSES_NEEDING_TRANSFORMATION) { - final BytecodeTransformerBuildItem item = new BytecodeTransformerBuildItem.Builder() - .setCacheable(true) - .setContinueOnFailure(false) - .setClassToTransform(classname) - .setClassReaderOptions(ClassReader.SKIP_DEBUG) - .setInputTransformer(tr::transform) - .build(); - transformers.produce(item); - } - } - } - - private static class JakartaTransformer { - - private final Logger logger; - private final ActionContext ctx; - // We need to prevent the Eclipse Transformer to adjust the "javax" packages. - // Thus why we split the strings. - private static final Map renames = Map.of("javax" + ".transaction", "jakarta.transaction", - "javax" + ".servlet", "jakarta.servlet", - "javax" + ".xml.bind", "jakarta.xml.bind"); - - JakartaTransformer() { - logger = LoggerFactory.getLogger("JakartaTransformer"); - //N.B. we enable only this single transformation of package renames, not the full set of capabilities of Eclipse Transformer; - //this might need tailoring if the same idea gets applied to a different context. - ctx = new ActionContextImpl(logger, - new SelectionRuleImpl(logger, Collections.emptyMap(), Collections.emptyMap()), - new SignatureRuleImpl(logger, renames, null, null, null, null, null, Collections.emptyMap())); - } - - byte[] transform(final String name, final byte[] bytes) { - logger.debug("Jakarta EE compatibility enhancer for Quarkus: transforming " + name); - final ClassActionImpl classTransformer = new ClassActionImpl(ctx); - final ByteBuffer input = ByteBuffer.wrap(bytes); - final ByteData inputData = new ByteDataImpl(name, input, FileUtils.DEFAULT_CHARSET); - final ByteData outputData = classTransformer.apply(inputData); - return outputData.buffer().array(); - } - } - -} diff --git a/extensions/quartz/runtime/pom.xml b/extensions/quartz/runtime/pom.xml index afb86369ef3b5..76b0fd2e9aaaf 100644 --- a/extensions/quartz/runtime/pom.xml +++ b/extensions/quartz/runtime/pom.xml @@ -30,20 +30,6 @@ org.quartz-scheduler quartz - - - com.zaxxer - HikariCP - - - com.zaxxer - HikariCP-java7 - - - com.mchange - c3p0 - - jakarta.transaction