From aadd0d7179b7d762ee6e0f4c1fe6a6f95371d55b Mon Sep 17 00:00:00 2001 From: Marco Belladelli Date: Fri, 16 Dec 2022 10:25:55 +0100 Subject: [PATCH] HHH-15398 Bump baseline Jakarta Persistence version to 3.1 --- ci/jpa-3.0-tck.Jenkinsfile | 93 ------------------- .../hibernate/boot/xsd/ConfigXsdSupport.java | 2 +- .../hibernate/boot/xsd/LocalXsdResolver.java | 2 +- .../bytecode/spi/ClassTransformer.java | 4 +- .../StandardIdentifierGeneratorFactory.java | 6 +- .../EnhancingClassTransformerImpl.java | 47 +--------- .../query/criteria/JpaSimpleCase.java | 4 +- .../org/hibernate/orm/env/JpaVersion.java | 2 +- 8 files changed, 13 insertions(+), 147 deletions(-) delete mode 100644 ci/jpa-3.0-tck.Jenkinsfile diff --git a/ci/jpa-3.0-tck.Jenkinsfile b/ci/jpa-3.0-tck.Jenkinsfile deleted file mode 100644 index 0712178256..0000000000 --- a/ci/jpa-3.0-tck.Jenkinsfile +++ /dev/null @@ -1,93 +0,0 @@ -@Library('hibernate-jenkins-pipeline-helpers@1.5') _ - -// Avoid running the pipeline on branch indexing -if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) { - print "INFO: Build skipped due to trigger being Branch Indexing" - currentBuild.result = 'ABORTED' - return -} - -pipeline { - agent { - label 'LongDuration' - } - tools { - jdk 'OpenJDK 11 Latest' - } - options { - rateLimitBuilds(throttle: [count: 1, durationName: 'day', userBoost: true]) - buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3')) - disableConcurrentBuilds(abortPrevious: true) - } - parameters { - choice(name: 'IMAGE_JDK', choices: ['jdk11'], description: 'The JDK base image version to use for the TCK image.') - string(name: 'TCK_VERSION', defaultValue: '3.0.2', description: 'The version of the Jakarta JPA TCK i.e. `2.2.0` or `3.0.2`') - string(name: 'TCK_SHA', defaultValue: '264892e663959f5ac452f5640ae2376337415cdf733b5d68c84d3a210b024bfe', description: 'The SHA256 of the Jakarta JPA TCK that is distributed under https://download.eclipse.org/jakartaee/persistence/3.0/jakarta-persistence-tck-${TCK_VERSION}.zip.sha256') - booleanParam(name: 'NO_SLEEP', defaultValue: true, description: 'Whether the NO_SLEEP patch should be applied to speed up the TCK execution') - } - stages { - stage('Build') { - steps { - script { - docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') { - docker.image('openjdk:11-jdk').pull() - } - } - dir('hibernate') { - checkout scm - sh './gradlew publishToMavenLocal' - script { - env.HIBERNATE_VERSION = sh ( - script: "grep hibernateVersion gradle/version.properties|cut -d'=' -f2", - returnStdout: true - ).trim() - } - } - dir('tck') { - checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/hibernate/jakarta-tck-runner.git']]] - sh """ \ - cd jpa-3.0; docker build -f Dockerfile.${params.IMAGE_JDK} -t jakarta-tck-runner --build-arg TCK_VERSION=${params.TCK_VERSION} --build-arg TCK_SHA=${params.TCK_SHA} . - """ - } - } - } - stage('Run TCK') { - steps { - sh """ \ - rm -Rf ./results - docker rm -f tck || true - docker volume rm -f tck-vol || true - docker volume create tck-vol - docker run -v ~/.m2/repository/org/hibernate:/root/.m2/repository/org/hibernate:z -v tck-vol:/tck/persistence-tck/tmp/:z -e NO_SLEEP=${params.NO_SLEEP} -e HIBERNATE_VERSION=$HIBERNATE_VERSION --name tck jakarta-tck-runner - docker cp tck:/tck/persistence-tck/tmp/ ./results - """ - archiveArtifacts artifacts: 'results/**' - script { - failures = sh ( - script: """ \ - set +x - while read line; do - if [[ "\$line" != *"Passed." ]]; then - echo "\$line" - fi - done classBeingRedefined, ProtectionDomain protectionDomain, - byte[] classfileBuffer); + byte[] classfileBuffer) throws TransformerException; } diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java b/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java index 3a8dd0dbdf..c9b3253256 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java @@ -108,11 +108,7 @@ public class StandardIdentifierGeneratorFactory generatorTypeStrategyMap.put( GenerationType.SEQUENCE, SequenceGenerationTypeStrategy.INSTANCE ); generatorTypeStrategyMap.put( GenerationType.TABLE, TableGenerationTypeStrategy.INSTANCE ); generatorTypeStrategyMap.put( GenerationType.IDENTITY, IdentityGenerationTypeStrategy.INSTANCE ); - try { - generatorTypeStrategyMap.put( GenerationType.valueOf( "UUID" ), UUIDGenerationTypeStrategy.INSTANCE ); - } - catch (IllegalArgumentException ignore) { - } + generatorTypeStrategyMap.put( GenerationType.UUID, UUIDGenerationTypeStrategy.INSTANCE ); } private void logOverrides() { diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/internal/enhance/EnhancingClassTransformerImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/internal/enhance/EnhancingClassTransformerImpl.java index 87d802a93c..5143dce082 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/internal/enhance/EnhancingClassTransformerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/internal/enhance/EnhancingClassTransformerImpl.java @@ -6,8 +6,6 @@ */ package org.hibernate.jpa.internal.enhance; -import java.lang.instrument.IllegalClassFormatException; -import java.lang.reflect.Constructor; import java.security.ProtectionDomain; import org.hibernate.bytecode.enhance.spi.EnhancementContext; @@ -15,7 +13,8 @@ import org.hibernate.bytecode.enhance.spi.EnhancementContextWrapper; import org.hibernate.bytecode.enhance.spi.Enhancer; import org.hibernate.bytecode.spi.ClassTransformer; import org.hibernate.cfg.Environment; -import org.hibernate.internal.util.ExceptionHelper; + +import jakarta.persistence.spi.TransformerException; /** * @author Steve Ebersole @@ -23,21 +22,6 @@ import org.hibernate.internal.util.ExceptionHelper; */ public class EnhancingClassTransformerImpl implements ClassTransformer { - private static final Constructor TRANSFORMER_CONSTRUCTOR; - - static { - Constructor constructor = null; - try { - final Class transformerException = Class.forName( "jakarta.persistence.spi.TransformerException" ); - //noinspection unchecked - constructor = (Constructor) transformerException.getConstructor( String.class, Throwable.class ); - } - catch (ClassNotFoundException | NoSuchMethodException e) { - // Ignore - } - TRANSFORMER_CONSTRUCTOR = constructor; - } - private final EnhancementContext enhancementContext; public EnhancingClassTransformerImpl(EnhancementContext enhancementContext) { @@ -50,7 +34,7 @@ public class EnhancingClassTransformerImpl implements ClassTransformer { String className, Class classBeingRedefined, ProtectionDomain protectionDomain, - byte[] classfileBuffer) { + byte[] classfileBuffer) throws TransformerException { // The first design had the enhancer as a class variable. That approach had some goods and bads. // We don't have to create an enhancer for each class, but on the other end it would stay in memory forever. @@ -61,30 +45,7 @@ public class EnhancingClassTransformerImpl implements ClassTransformer { return enhancer.enhance( className, classfileBuffer ); } catch (final Exception e) { - Throwable t; - if ( TRANSFORMER_CONSTRUCTOR == null ) { - t = new IllegalClassFormatException( "Error performing enhancement of " + className ) { - @Override - public synchronized Throwable getCause() { - return e; - } - }; - } - else { - try { - t = TRANSFORMER_CONSTRUCTOR.newInstance( "Error performing enhancement of " + className, e ); - } - catch (Exception ex) { - t = new IllegalClassFormatException( "Error performing enhancement of " + className ) { - @Override - public synchronized Throwable getCause() { - return e; - } - }; - } - } - ExceptionHelper.doThrow( t ); - return null; + throw new TransformerException( "Error performing enhancement of " + className, e ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSimpleCase.java b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSimpleCase.java index 4a07ee0207..de73a7126d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSimpleCase.java +++ b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaSimpleCase.java @@ -22,10 +22,10 @@ public interface JpaSimpleCase extends JpaExpression, CriteriaBuilder.Si @Override JpaSimpleCase when(C condition, Expression result); -// @Override + @Override JpaSimpleCase when(Expression condition, R result); -// @Override + @Override JpaSimpleCase when(Expression condition, Expression result); @Override diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java b/local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java index 503ef6bfbe..667e70eaeb 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java @@ -18,7 +18,7 @@ import org.gradle.api.initialization.Settings; public class JpaVersion { public static final String EXT_KEY = "jakartaJpaVersion"; public static final String VERSION_KEY = "jakartaJpaVersion"; - public static final String DEFAULT_VERSION = "3.0.0"; + public static final String DEFAULT_VERSION = "3.1.0"; private final String name; private final String osgiName;