From 132a4121b5b2bb829221f9a877d559b2ca15b561 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 16 Apr 2020 11:46:19 +0100 Subject: [PATCH] Fix issues after merging master --- build.gradle | 2 +- gradle/java-module.gradle | 66 +++++++++---------- .../org/hibernate/query/spi/QueryEngine.java | 6 +- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index 0e6d4f7a8e..c5ffb4d9dd 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ buildscript { classpath 'gradle.plugin.com.github.lburgazzoli:gradle-karaf-plugin:0.5.1' classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'de.thetaphi:forbiddenapis:2.5' + classpath 'de.thetaphi:forbiddenapis:2.7' classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1' classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0' } diff --git a/gradle/java-module.gradle b/gradle/java-module.gradle index abf22dfaf0..32d224a4b6 100644 --- a/gradle/java-module.gradle +++ b/gradle/java-module.gradle @@ -362,36 +362,36 @@ task nonFatalCheckstyle(type:Checkstyle) { checkstyleMain.exclude '**/org/hibernate/cfg/**' checkstyleMain.exclude '**/org/hibernate/cfg/*' -// -//task forbiddenApisSystemOut(type: CheckForbiddenApis, dependsOn: compileJava) { -// classesDirs = project.sourceSets.main.output.classesDirs -// classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath -// targetCompatibility = project.forbiddenAPITargetJDKCompatibility -// bundledSignatures += 'jdk-system-out' -// suppressAnnotations += ['org.hibernate.internal.build.AllowSysOut', 'org.hibernate.internal.build.AllowPrintStacktrace'] -//} -// -//task forbiddenApisUnsafe(type: CheckForbiddenApis, dependsOn: compileJava) { -// classesDirs = project.sourceSets.main.output.classesDirs -// classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath -// targetCompatibility = project.forbiddenAPITargetJDKCompatibility -// bundledSignatures += "jdk-unsafe-${baselineJavaVersion}".toString() -// -// // unfortunately we currently have many uses of default Locale implicitly (~370) which need to be fixed -// // before we can fully enabled this check -// // -// // No idea how findbugs was missing these b4 -// ignoreFailures = true -//} -// -//task forbiddenApisNonPortable(type: CheckForbiddenApis, dependsOn: compileJava) { -// classesDirs = project.sourceSets.main.output.classesDirs -// classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath -// targetCompatibility = project.forbiddenAPITargetJDKCompatibility -// bundledSignatures += 'jdk-non-portable' -//} -// -//task forbiddenApis -//project.tasks.withType( CheckForbiddenApis ).each { task -> forbiddenApis.finalizedBy task } -// -//project.tasks.check.finalizedBy forbiddenApis + +task forbiddenApisSystemOut(type: CheckForbiddenApis, dependsOn: compileJava) { + classesDirs = project.sourceSets.main.output.classesDirs + classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath + targetCompatibility = project.forbiddenAPITargetJDKCompatibility + bundledSignatures += 'jdk-system-out' + suppressAnnotations += ['org.hibernate.internal.build.AllowSysOut', 'org.hibernate.internal.build.AllowPrintStacktrace'] +} + +task forbiddenApisUnsafe(type: CheckForbiddenApis, dependsOn: compileJava) { + classesDirs = project.sourceSets.main.output.classesDirs + classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath + targetCompatibility = project.forbiddenAPITargetJDKCompatibility + bundledSignatures += "jdk-unsafe-${baselineJavaVersion}".toString() + + // unfortunately we currently have many uses of default Locale implicitly (~370) which need to be fixed + // before we can fully enabled this check + // + // No idea how findbugs was missing these b4 + ignoreFailures = true +} + +task forbiddenApisNonPortable(type: CheckForbiddenApis, dependsOn: compileJava) { + classesDirs = project.sourceSets.main.output.classesDirs + classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath + targetCompatibility = project.forbiddenAPITargetJDKCompatibility + bundledSignatures += 'jdk-non-portable' +} + +task forbiddenApis +project.tasks.withType( CheckForbiddenApis ).each { task -> forbiddenApis.finalizedBy task } + +project.tasks.check.finalizedBy forbiddenApis diff --git a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java index 2191845687..d15acff9b2 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java +++ b/hibernate-core/src/main/java/org/hibernate/query/spi/QueryEngine.java @@ -16,6 +16,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.config.spi.ConfigurationService; import org.hibernate.engine.query.spi.NativeQueryInterpreter; import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.internal.CoreLogging; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.query.QueryLogger; @@ -37,6 +38,8 @@ import org.hibernate.service.ServiceRegistry; import java.util.Map; import java.util.function.Supplier; +import org.jboss.logging.Logger; + /** * Aggregation and encapsulation of the components Hibernate uses * to execute queries (HQL, Criteria and native) @@ -45,6 +48,7 @@ import java.util.function.Supplier; */ @Incubating public class QueryEngine { + private static final Logger LOG_HQL_FUNCTIONS = CoreLogging.logger( "org.hibernate.LOG_HQL_FUNCTIONS" ); public static QueryEngine from( SessionFactoryImplementor sessionFactory, @@ -119,7 +123,7 @@ public class QueryEngine { ); if ( showSQLFunctions ) { sqmFunctionRegistry.getFunctionsByName().forEach( - entry -> System.out.println( entry.getValue().getSignature( entry.getKey() ) ) + entry -> LOG_HQL_FUNCTIONS.info( entry.getValue().getSignature( entry.getKey() ) ) ); } }