Skip to content

Commit 55ab762

Browse files
dreab8beikov
authored andcommitted
Upgrade Gradle to 8.8, upgrade checkframework to 0.6.40, fix HibernateProcessor resources creation causing whole tests recompilation
1 parent a4ba87b commit 55ab762

File tree

10 files changed

+30
-24
lines changed

10 files changed

+30
-24
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ plugins {
2525
id 'org.hibernate.orm.database-service' apply false
2626
id 'biz.aQute.bnd' version '6.3.1' apply false
2727

28-
id 'org.checkerframework' version '0.6.34'
28+
id 'org.checkerframework' version '0.6.40'
2929
id 'org.hibernate.orm.build.jdks'
3030

3131
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'

gradle/java-module.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ tasks.withType(JavaCompile).configureEach { task ->
477477
}
478478

479479
checkerFramework {
480+
excludeTests = true
480481
checkers = [
481482
'org.checkerframework.checker.nullness.NullnessChecker'
482483
]

gradlew

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145145
case $MAX_FD in #(
146146
max*)
147147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
149149
MAX_FD=$( ulimit -H -n ) ||
150150
warn "Could not query maximum file descriptor limit"
151151
esac
152152
case $MAX_FD in #(
153153
'' | soft) :;; #(
154154
*)
155155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
157157
ulimit -n "$MAX_FD" ||
158158
warn "Could not set maximum file descriptor limit to $MAX_FD"
159159
esac
@@ -202,11 +202,11 @@ fi
202202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204204

205-
# Collect all arguments for the java command;
206-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
207-
# shell script including quotes and variable substitutions, so put them in
208-
# double quotes to make sure that they get re-expanded; and
209-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
210210

211211
set -- \
212212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.hibernate.type.ForeignKeyDirection;
5757
import org.hibernate.type.Type;
5858

59+
import org.checkerframework.checker.nullness.qual.NonNull;
5960
import org.checkerframework.checker.nullness.qual.Nullable;
6061

6162
import static org.hibernate.proxy.HibernateProxy.extractLazyInitializer;
@@ -981,7 +982,7 @@ private abstract static class AbstractTransactionCompletionProcessQueue<T> {
981982
protected SessionImplementor session;
982983
// Concurrency handling required when transaction completion process is dynamically registered
983984
// inside event listener (HHH-7478).
984-
protected Queue<T> processes = new ConcurrentLinkedQueue<>();
985+
protected ConcurrentLinkedQueue<@NonNull T> processes = new ConcurrentLinkedQueue<>();
985986

986987
private AbstractTransactionCompletionProcessQueue(SessionImplementor session) {
987988
this.session = session;
@@ -1009,9 +1010,10 @@ private BeforeTransactionCompletionProcessQueue(SessionImplementor session) {
10091010
}
10101011

10111012
public void beforeTransactionCompletion() {
1012-
while ( !processes.isEmpty() ) {
1013+
BeforeTransactionCompletionProcess process;
1014+
while ( ( process = processes.poll() ) != null ) {
10131015
try {
1014-
processes.poll().doBeforeTransactionCompletion( session );
1016+
process.doBeforeTransactionCompletion( session );
10151017
}
10161018
catch (HibernateException he) {
10171019
throw he;
@@ -1039,9 +1041,10 @@ public void addSpaceToInvalidate(String space) {
10391041
}
10401042

10411043
public void afterTransactionCompletion(boolean success) {
1042-
while ( !processes.isEmpty() ) {
1044+
AfterTransactionCompletionProcess process;
1045+
while ( ( process = processes.poll() ) != null ) {
10431046
try {
1044-
processes.poll().doAfterTransactionCompletion( success, session );
1047+
process.doAfterTransactionCompletion( success, session );
10451048
}
10461049
catch (CacheException ce) {
10471050
LOG.unableToReleaseCacheLock( ce );

hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/internal/NativeEnumDdlTypeImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
import org.hibernate.type.descriptor.sql.DdlType;
1616
import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry;
1717

18-
import org.checkerframework.checker.units.qual.N;
19-
2018
import static org.hibernate.type.SqlTypes.ENUM;
2119

2220
/**

tooling/metamodel-generator/src/main/java/org/hibernate/processor/ContainsAttributeTypeVisitor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import javax.lang.model.type.TypeMirror;
1515
import javax.lang.model.util.SimpleTypeVisitor8;
1616

17+
import org.hibernate.processor.util.NullnessUtil;
18+
1719
import static org.hibernate.processor.util.Constants.COLLECTIONS;
1820
import static org.hibernate.processor.util.StringUtil.isProperty;
1921
import static org.hibernate.processor.util.TypeUtils.getCollectionElementType;
@@ -32,14 +34,13 @@ class ContainsAttributeTypeVisitor extends SimpleTypeVisitor8<Boolean, Element>
3234
@Override
3335
public Boolean visitDeclared(DeclaredType declaredType, Element element) {
3436
TypeElement returnedElement = (TypeElement) context.getTypeUtils().asElement(declaredType);
35-
36-
final String returnTypeName = returnedElement.getQualifiedName().toString();
37+
final String returnTypeName = NullnessUtil.castNonNull( returnedElement ).getQualifiedName().toString();
3738
final String collection = COLLECTIONS.get(returnTypeName);
3839
if (collection != null) {
3940
final TypeMirror collectionElementType =
4041
getCollectionElementType( declaredType, returnTypeName, null, context );
4142
final Element collectionElement = context.getTypeUtils().asElement(collectionElementType);
42-
if ( ElementKind.TYPE_PARAMETER == collectionElement.getKind() ) {
43+
if ( ElementKind.TYPE_PARAMETER == NullnessUtil.castNonNull( collectionElement ).getKind() ) {
4344
return false;
4445
}
4546
returnedElement = (TypeElement) collectionElement;

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/DataMetaAttributeGenerationVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.checkerframework.checker.nullness.qual.Nullable;
1010
import org.hibernate.processor.Context;
1111
import org.hibernate.processor.util.Constants;
12+
import org.hibernate.processor.util.NullnessUtil;
1213

1314
import javax.lang.model.element.Element;
1415
import javax.lang.model.element.TypeElement;
@@ -72,7 +73,7 @@ private Types typeUtils() {
7273
public @Nullable DataAnnotationMetaAttribute visitDeclared(DeclaredType declaredType, Element element) {
7374
final TypeElement returnedElement = (TypeElement) typeUtils().asElement( declaredType );
7475
// WARNING: .toString() is necessary here since Name equals does not compare to String
75-
final String returnTypeName = returnedElement.getQualifiedName().toString();
76+
final String returnTypeName = NullnessUtil.castNonNull( returnedElement ).getQualifiedName().toString();
7677
final String collection = Constants.COLLECTIONS.get( returnTypeName );
7778
final String targetEntity = getTargetEntity( element.getAnnotationMirrors() );
7879
if ( collection != null ) {

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/MetaAttributeGenerationVisitor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.hibernate.processor.util.AccessType;
1212
import org.hibernate.processor.util.AccessTypeInformation;
1313
import org.hibernate.processor.util.Constants;
14+
import org.hibernate.processor.util.NullnessUtil;
1415

1516
import javax.lang.model.element.AnnotationMirror;
1617
import javax.lang.model.element.Element;
@@ -84,8 +85,9 @@ private Types typeUtils() {
8485
@Override
8586
public @Nullable AnnotationMetaAttribute visitDeclared(DeclaredType declaredType, Element element) {
8687
final TypeElement returnedElement = (TypeElement) typeUtils().asElement( declaredType );
88+
assert returnedElement != null;
8789
// WARNING: .toString() is necessary here since Name equals does not compare to String
88-
final String returnTypeName = returnedElement.getQualifiedName().toString();
90+
final String returnTypeName = NullnessUtil.castNonNull( returnedElement ).getQualifiedName().toString();
8991
final String collection = Constants.COLLECTIONS.get( returnTypeName );
9092
final String targetEntity = getTargetEntity( element.getAnnotationMirrors() );
9193
if ( collection != null ) {
@@ -109,7 +111,7 @@ private AnnotationMetaAttribute createMetaCollectionAttribute(
109111
getCollectionElementType( declaredType, returnTypeName, explicitTargetEntity, context );
110112
if ( collectionElementType.getKind() == TypeKind.DECLARED ) {
111113
final TypeElement collectionElement = (TypeElement) typeUtils().asElement( collectionElementType );
112-
setAccessType( collectionElementType, collectionElement );
114+
setAccessType( collectionElementType, NullnessUtil.castNonNull( collectionElement ) );
113115
}
114116
}
115117
return createMetaAttribute( declaredType, element, collection, targetEntity );

tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/BasicAttributeVisitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
package org.hibernate.processor.util;
88

9+
import org.hibernate.internal.util.NullnessUtil;
910
import org.hibernate.processor.Context;
10-
import org.hibernate.processor.util.Constants;
1111

1212
import javax.lang.model.element.Element;
1313
import javax.lang.model.element.ElementKind;
@@ -46,7 +46,7 @@ public Boolean visitPrimitive(PrimitiveType primitiveType, Element element) {
4646
public Boolean visitArray(ArrayType arrayType, Element element) {
4747
final TypeElement componentElement = (TypeElement)
4848
context.getTypeUtils().asElement( arrayType.getComponentType() );
49-
return BASIC_ARRAY_TYPES.contains( componentElement.getQualifiedName().toString() );
49+
return BASIC_ARRAY_TYPES.contains( NullnessUtil.castNonNull( componentElement ).getQualifiedName().toString() );
5050
}
5151

5252
@Override

tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ static class EmbeddedAttributeVisitor extends SimpleTypeVisitor8<@Nullable Strin
655655
public @Nullable String visitDeclared(DeclaredType declaredType, Element element) {
656656
final TypeElement returnedElement = (TypeElement)
657657
context.getTypeUtils().asElement( declaredType );
658-
return containsAnnotation( returnedElement, EMBEDDABLE )
658+
return containsAnnotation( NullnessUtil.castNonNull( returnedElement ), EMBEDDABLE )
659659
? returnedElement.getQualifiedName().toString()
660660
: null;
661661
}

0 commit comments

Comments
 (0)