diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 442c46f96a72..c11cfc476766 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -318,6 +318,10 @@ jobs: POPULATE_REMOTE_GRADLE_CACHE: ${{ github.event_name == 'push' && github.repository == 'hibernate/hibernate-orm' && 'true' || 'false' }} DEVELOCITY_ACCESS_KEY: "${{ secrets.DEVELOCITY_ACCESS_KEY }}" + - name: Run rewriteDryRun + run: ./gradlew rewriteDryRun -Dorg.gradle.jvmargs=-Xmx8G + # https://docs.openrewrite.org/reference/faq#im-getting-javalangoutofmemoryerror-java-heap-space-when-running-openrewrite + # For jobs running on 'pull_request', upload build scan data. # The actual publishing must be done in a separate job (see ci-report.yml). # We don't write to the remote cache as that would be unsafe. diff --git a/build.gradle b/build.gradle index c661531e733f..9c7e609127a4 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,10 @@ plugins { id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.10' id 'eclipse' id "com.dorongold.task-tree" version "4.0.1" + id 'org.openrewrite.rewrite' version '7.12.1' apply false } +apply from: rootProject.file('gradle/rewrite.gradle') // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Releasing diff --git a/gradle/rewrite.gradle b/gradle/rewrite.gradle new file mode 100644 index 000000000000..3823924ea13c --- /dev/null +++ b/gradle/rewrite.gradle @@ -0,0 +1,75 @@ +apply plugin: 'org.openrewrite.rewrite' + +rewrite { + activeRecipe("org.openrewrite.gradle.GradleBestPractices") + activeRecipe("org.openrewrite.java.RemoveUnusedImports") + // bug + exclusions.add("**StatisticsImpl.java") + exclusions.add("**RevisionsOfEntityQuery.java") + exportDatatables = true + failOnDryRunResults = true + // rejected + //activeRecipe("tech.picnic.errorprone.refasterrules.FileRulesRecipes") gavinking, Stephan202 + // immense + //activeRecipe("org.openrewrite.java.migrate.UpgradeToJava17") + //activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedLocalVariables") + //activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedPrivateFields") + //activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods") + //activeRecipe("org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources") + //activeRecipe("org.openrewrite.staticanalysis.UnnecessaryParentheses") why spotless dull? + //activeRecipe("org.openrewrite.staticanalysis.UnnecessaryReturnAsLastStatement") + //activeRecipe("tech.picnic.errorprone.refasterrules.BugCheckerRulesRecipes") + //activeRecipe("tech.picnic.errorprone.refasterrules.SuggestedFixRulesRecipes") + // bug + //activeRecipe("org.openrewrite.staticanalysis.NoToStringOnStringType") + //activeRecipe("org.openrewrite.staticanalysis.NoValueOfOnStringType") +} + +dependencies { + //rewrite("org.openrewrite.recipe:rewrite-migrate-java:3.14.1") + //rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.14.0") + //rewrite("org.openrewrite.recipe:rewrite-third-party:0.24.1") + rewrite("org.openrewrite.recipe:rewrite-rewrite:0.10.1") +} + +// FYI: https://github.com/SonarSource/sonarqube/pull/3389 +//activeRecipe( +// "org.openrewrite.gradle.GradleBestPractices", +// //"org.openrewrite.java.RemoveUnusedImports", +// //"org.openrewrite.java.migrate.UpgradeToJava17", +// //"org.openrewrite.java.recipes.JavaRecipeBestPractices", +// //"org.openrewrite.java.recipes.RecipeNullabilityBestPractices", +// //"org.openrewrite.java.recipes.RecipeTestingBestPractices", +// //"org.openrewrite.staticanalysis.CodeCleanup", +// //"org.openrewrite.staticanalysis.CommonStaticAnalysis", +// //"org.openrewrite.staticanalysis.EqualsAvoidsNull", +// //"org.openrewrite.staticanalysis.JavaApiBestPractices", +// //"org.openrewrite.staticanalysis.LowercasePackage", +// //"org.openrewrite.staticanalysis.MissingOverrideAnnotation", +// //"org.openrewrite.staticanalysis.ModifierOrder", +// //"org.openrewrite.staticanalysis.NoFinalizer", +// //"org.openrewrite.staticanalysis.RemoveUnusedLocalVariables", +// //"org.openrewrite.staticanalysis.RemoveUnusedPrivateFields", +// //"org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods", +// //"org.openrewrite.staticanalysis.UnnecessaryThrows", +// //"org.sonar.openrewrite.java.AddLicenseHeader", https://github.com/openrewrite/rewrite/issues/5762 +// //"tech.picnic.errorprone.refasterrules.BigDecimalRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.BugCheckerRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.CharSequenceRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.ClassRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.CollectionRulesRecipes", bug +// //"tech.picnic.errorprone.refasterrules.ComparatorRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.EqualityRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.FileRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.JUnitRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.MicrometerRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.NullRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.OptionalRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.PatternRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.PreconditionsRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.PrimitiveRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.StreamRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.StringRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.SuggestedFixRulesRecipes", +// //"tech.picnic.errorprone.refasterrules.TimeRulesRecipes", +//) \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c49b7..1b33c55baabb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da476bb..92510698672a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -5,3 +5,4 @@ networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531 diff --git a/gradlew b/gradlew index 1aa94a426907..f3b75f3b0d4f 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 index 6689b85beecd..9b42019c7915 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/H2LegacyDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/H2LegacyDialect.java index 3ff01b0ed31d..9f80b7778c53 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/H2LegacyDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/H2LegacyDialect.java @@ -58,7 +58,6 @@ import org.hibernate.query.sqm.CastType; import org.hibernate.query.common.FetchClauseType; import org.hibernate.query.sqm.IntervalType; -import org.hibernate.dialect.NullOrdering; import org.hibernate.query.common.TemporalUnit; import org.hibernate.query.sqm.mutation.spi.BeforeUseAction; import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableInsertStrategy; diff --git a/hibernate-community-dialects/src/test/java/org/hibernate/community/dialect/AltibaseFunctionsTest.java b/hibernate-community-dialects/src/test/java/org/hibernate/community/dialect/AltibaseFunctionsTest.java index a464d69077e3..778c02ce4b34 100644 --- a/hibernate-community-dialects/src/test/java/org/hibernate/community/dialect/AltibaseFunctionsTest.java +++ b/hibernate-community-dialects/src/test/java/org/hibernate/community/dialect/AltibaseFunctionsTest.java @@ -10,7 +10,9 @@ import org.hibernate.testing.orm.junit.RequiresDialect; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.sql.Date; import java.sql.SQLException; diff --git a/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java index 3676194245bb..1e61f6a44dff 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java @@ -4,15 +4,11 @@ */ package org.hibernate.id; -import java.util.Properties; - -import org.hibernate.generator.GeneratorCreationContext; - /** * An {@link IdentifierGenerator} that requires creation of database objects. *

* All instances have access to a special mapping parameter in their - * {@link #configure(GeneratorCreationContext, Properties)} method: schema + * {@link #configure( GeneratorCreationContext, Properties )} method: schema * * @author Gavin King * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 155e52c067d7..b5c95679cb47 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -52,14 +52,6 @@ import org.hibernate.type.Type; import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.Properties; -import java.util.function.BiConsumer; - import static org.hibernate.boot.model.internal.GeneratorBinder.applyIfNotEmpty; import static org.hibernate.id.enhanced.TableGeneratorLogger.TABLE_GENERATOR_MESSAGE_LOGGER; import static org.hibernate.id.IdentifierGeneratorHelper.getNamingStrategy; diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/AbstractNaturalIdLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/AbstractNaturalIdLoader.java index 48eb6d8e6cfc..353f14a2d910 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/AbstractNaturalIdLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/AbstractNaturalIdLoader.java @@ -47,7 +47,7 @@ import org.hibernate.sql.exec.spi.JdbcParameterBinding; import org.hibernate.sql.exec.spi.JdbcParameterBindings; import org.hibernate.sql.exec.spi.JdbcParametersList; -import org.hibernate.sql.results.graph.*; +import org.hibernate.sql.results.graph.DomainResult; import org.hibernate.sql.results.graph.internal.ImmutableFetchList; import org.hibernate.sql.results.internal.RowTransformerSingularReturnImpl; import org.hibernate.sql.results.spi.ListResultsConsumer; diff --git a/hibernate-core/src/main/java/org/hibernate/query/Query.java b/hibernate-core/src/main/java/org/hibernate/query/Query.java index 6ba4694b6871..5cb8d54e330a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/Query.java +++ b/hibernate-core/src/main/java/org/hibernate/query/Query.java @@ -19,7 +19,6 @@ import org.hibernate.CacheMode; import org.hibernate.FlushMode; import org.hibernate.Incubating; -import org.hibernate.LockMode; import org.hibernate.LockOptions; import org.hibernate.NonUniqueResultException; import org.hibernate.ScrollMode; diff --git a/hibernate-core/src/main/java/org/hibernate/query/criteria/HibernateCriteriaBuilder.java b/hibernate-core/src/main/java/org/hibernate/query/criteria/HibernateCriteriaBuilder.java index 81ee863617fb..8c4df877bd1e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/criteria/HibernateCriteriaBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/query/criteria/HibernateCriteriaBuilder.java @@ -26,7 +26,6 @@ import org.hibernate.query.common.TemporalUnit; import jakarta.persistence.Tuple; -import jakarta.persistence.criteria.AbstractQuery; import jakarta.persistence.criteria.CollectionJoin; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaQuery; diff --git a/hibernate-core/src/main/java/org/hibernate/query/criteria/package-info.java b/hibernate-core/src/main/java/org/hibernate/query/criteria/package-info.java index 965aaf113078..82ea87659d96 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/criteria/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/query/criteria/package-info.java @@ -47,6 +47,4 @@ @Incubating package org.hibernate.query.criteria; -import jakarta.persistence.criteria.Subquery; import org.hibernate.Incubating; -import jakarta.persistence.criteria.AbstractQuery; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/loader/LoaderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/loader/LoaderTest.java index c5a42aeb263b..5d7cb0a38e10 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/loader/LoaderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/loader/LoaderTest.java @@ -15,7 +15,7 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.fail; /** * @author Emmanuel Bernard diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/AbstractLobTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/AbstractLobTest.java index 06de2db391a9..2541c08bc714 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/AbstractLobTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/lob/AbstractLobTest.java @@ -4,7 +4,7 @@ */ package org.hibernate.orm.test.annotations.lob; -import org.hibernate.dialect.*; +import org.hibernate.dialect.SybaseDialect; import org.junit.Test; import org.hibernate.testing.SkipForDialect; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/sharedfk/ConcreteChild2.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/sharedfk/ConcreteChild2.java index 4bd6378a9b72..e5503972a4dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/sharedfk/ConcreteChild2.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/sharedfk/ConcreteChild2.java @@ -4,7 +4,10 @@ */ package org.hibernate.orm.test.annotations.sharedfk; -import jakarta.persistence.*; +import jakarta.persistence.Basic; +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; @Entity @DiscriminatorValue("2") diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/association/ManyToManyAssociationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/association/ManyToManyAssociationTest.java index b39fbd0ee940..6efc73b82c6a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/association/ManyToManyAssociationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/association/ManyToManyAssociationTest.java @@ -4,7 +4,7 @@ */ package org.hibernate.orm.test.bytecode.enhancement.association; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.hibernate.testing.bytecode.enhancement.extension.BytecodeEnhanced; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/BytecodeEnhancedLazyLoadingOnDeletedEntityTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/BytecodeEnhancedLazyLoadingOnDeletedEntityTest.java index 7896f3816ed3..7e41cbdece91 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/BytecodeEnhancedLazyLoadingOnDeletedEntityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/BytecodeEnhancedLazyLoadingOnDeletedEntityTest.java @@ -6,7 +6,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.hibernate.cfg.AvailableSettings.DEFAULT_LIST_SEMANTICS; -import static org.hibernate.orm.test.bytecode.enhancement.lazy.proxy.BytecodeEnhancedLazyLoadingOnDeletedEntityTest.*; +import static org.hibernate.orm.test.bytecode.enhancement.lazy.proxy.BytecodeEnhancedLazyLoadingOnDeletedEntityTest.AssociationOwner; +import static org.hibernate.orm.test.bytecode.enhancement.lazy.proxy.BytecodeEnhancedLazyLoadingOnDeletedEntityTest.AssociationNonOwner; import java.util.ArrayList; import java.util.List; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/basic/EmailAddress.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/basic/EmailAddress.java index ab4958192041..1c43f3f55428 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/basic/EmailAddress.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/basic/EmailAddress.java @@ -5,7 +5,7 @@ package org.hibernate.orm.test.collection.basic; import java.io.Serializable; -import jakarta.persistence.*; +import jakarta.persistence.Embeddable; @Embeddable public class EmailAddress implements Serializable { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/AbstractDereferencedCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/AbstractDereferencedCollectionTest.java index e84b9e07c7f1..2b88bde5375c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/AbstractDereferencedCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/collection/dereferenced/AbstractDereferencedCollectionTest.java @@ -4,7 +4,7 @@ */ package org.hibernate.orm.test.collection.dereferenced; -import org.hibernate.*; +import org.hibernate.Session; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.spi.CollectionEntry; import org.hibernate.engine.spi.EntityEntry; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/columndiscriminator/Author.java b/hibernate-core/src/test/java/org/hibernate/orm/test/columndiscriminator/Author.java index d4535a985217..c3057dd05a8c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/columndiscriminator/Author.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/columndiscriminator/Author.java @@ -4,7 +4,8 @@ */ package org.hibernate.orm.test.columndiscriminator; -import java.util.*; +import java.util.ArrayList; +import java.util.List; public class Author { private Long id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/dirtiness/Thing.java b/hibernate-core/src/test/java/org/hibernate/orm/test/dirtiness/Thing.java index 07242f015c1b..82e6bcaf6aa8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/dirtiness/Thing.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/dirtiness/Thing.java @@ -4,7 +4,9 @@ */ package org.hibernate.orm.test.dirtiness; -import java.util.*; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/graph/HHH15065Test.java b/hibernate-core/src/test/java/org/hibernate/orm/test/graph/HHH15065Test.java index a33bd4a80519..d427705d8f69 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/graph/HHH15065Test.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/graph/HHH15065Test.java @@ -4,7 +4,7 @@ */ package org.hibernate.orm.test.graph; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/QueryExecutionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/QueryExecutionTest.java index 8c4fa976830b..3d689ac7c83a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/QueryExecutionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/compliance/tck2_2/QueryExecutionTest.java @@ -24,7 +24,8 @@ import org.hamcrest.CoreMatchers; -import static jakarta.persistence.CascadeType.*; +import static jakarta.persistence.CascadeType.PERSIST; +import static jakarta.persistence.CascadeType.REMOVE; import static jakarta.persistence.CascadeType.PERSIST; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/Order.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/Order.java index ff1f20613250..da2112166f9c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/Order.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/Order.java @@ -4,7 +4,7 @@ */ package org.hibernate.orm.test.jpa.criteria.fetchscroll; -import java.util.*; +import java.util.Set; import jakarta.persistence.*; @Entity diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderId.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderId.java index b4793072590a..cbb353c55d38 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderId.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderId.java @@ -5,7 +5,9 @@ package org.hibernate.orm.test.jpa.criteria.fetchscroll; import java.io.Serializable; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +import jakarta.persistence.MappedSuperclass; @Embeddable @MappedSuperclass diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderLineId.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderLineId.java index 1ef65bbdde8e..4c709cde928c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderLineId.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/OrderLineId.java @@ -4,7 +4,8 @@ */ package org.hibernate.orm.test.jpa.criteria.fetchscroll; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; @Embeddable public class OrderLineId extends OrderId { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/ProductId.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/ProductId.java index 7b41214ce6eb..e8d63a6824eb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/ProductId.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/fetchscroll/ProductId.java @@ -5,7 +5,8 @@ package org.hibernate.orm.test.jpa.criteria.fetchscroll; import java.io.Serializable; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; @Embeddable public class ProductId implements Serializable { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java index ae8de0121013..e7702a4723bd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java @@ -22,7 +22,6 @@ import org.hibernate.orm.test.jpa.metamodel.Order; import org.hibernate.orm.test.jpa.metamodel.Order_; import org.hibernate.testing.orm.junit.JiraKey; -import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.SkipForDialect; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/QueryTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/QueryTest.java index 9e9b7decb9ef..624e7d381886 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/QueryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/QueryTest.java @@ -44,7 +44,6 @@ import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.Jira; -import org.hibernate.testing.orm.junit.JiraKey; import org.junit.Test; import junit.framework.Assert; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/access/Person.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/access/Person.java index a631b9c9f4fc..032cd36624c7 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/access/Person.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/access/Person.java @@ -16,7 +16,7 @@ import jakarta.persistence.Id; import jakarta.persistence.Table; -import static jakarta.persistence.AccessType.*; +import static jakarta.persistence.AccessType.PROPERTY; @Entity @Table(name = "persons") diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalCircularityTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalCircularityTest.java index 1f44eba417d8..29ac24337e50 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalCircularityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalCircularityTest.java @@ -18,7 +18,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.hibernate.orm.test.mapping.manytoone.ManyToOneBidirectionalCircularityTest.*; +import static org.hibernate.orm.test.mapping.manytoone.ManyToOneBidirectionalCircularityTest.EntityTest2; +import static org.hibernate.orm.test.mapping.manytoone.ManyToOneBidirectionalCircularityTest.EntityTest; /** * @author Andrea Boriero diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalTest.java index af7d2dd9b385..638d4421d1fd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/manytoone/ManyToOneBidirectionalTest.java @@ -17,7 +17,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.hibernate.orm.test.mapping.manytoone.ManyToOneBidirectionalTest.*; +import static org.hibernate.orm.test.mapping.manytoone.ManyToOneBidirectionalTest.EntityTest2; +import static org.hibernate.orm.test.mapping.manytoone.ManyToOneBidirectionalTest.EntityTest; /** * @author Andrea Boriero diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/ToHqlStringTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/ToHqlStringTest.java index d25671390faf..c2fb32fb4bf2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/ToHqlStringTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/ToHqlStringTest.java @@ -8,7 +8,6 @@ import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; -import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.Jpa; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/internal/hhh13151/SubEntity.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/internal/hhh13151/SubEntity.java index a35e9ac84f69..92cfefe11daa 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/internal/hhh13151/SubEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/internal/hhh13151/SubEntity.java @@ -4,10 +4,13 @@ */ package org.hibernate.orm.test.query.criteria.internal.hhh13151; -import org.hibernate.annotations.*; +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.CascadeType; -import jakarta.persistence.*; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.ManyToOne; import jakarta.persistence.Entity; @Entity diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/records/RecordAsEmbeddableEnhancementTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/records/RecordAsEmbeddableEnhancementTest.java index 753e610574da..eaa3504b189c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/records/RecordAsEmbeddableEnhancementTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/records/RecordAsEmbeddableEnhancementTest.java @@ -10,8 +10,6 @@ import org.hibernate.testing.bytecode.enhancement.extension.BytecodeEnhanced; import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; -import org.hibernate.testing.bytecode.enhancement.extension.BytecodeEnhanced; -import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.SessionFactory; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/ParameterMarkerStrategyTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/ParameterMarkerStrategyTests.java index 69abd19105b2..a9c45e1ecf68 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/ParameterMarkerStrategyTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/ParameterMarkerStrategyTests.java @@ -32,7 +32,7 @@ import jakarta.persistence.Version; import static org.assertj.core.api.Assertions.assertThat; -import static org.hibernate.internal.util.StringHelper.*; +import static org.hibernate.internal.util.StringHelper.count; /** * @implNote Restricted to H2 as there is nothing intrinsically Dialect specific here, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/subquery/EntityA.java b/hibernate-core/src/test/java/org/hibernate/orm/test/subquery/EntityA.java index ad27ae3992be..ea51aa1e4838 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/subquery/EntityA.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/subquery/EntityA.java @@ -4,7 +4,9 @@ */ package org.hibernate.orm.test.subquery; -import jakarta.persistence.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; @Entity public class EntityA { diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/query/AssociationQueryWithOnClauseTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/query/AssociationQueryWithOnClauseTest.java index bf85258f1b0e..b734f517408b 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/query/AssociationQueryWithOnClauseTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/query/AssociationQueryWithOnClauseTest.java @@ -27,7 +27,8 @@ import org.hibernate.testing.orm.junit.JiraKey; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; /** * @author Felix Feisst (feisst dot felix at gmail dot com) diff --git a/local-build-plugins/gradle/wrapper/gradle-wrapper.jar b/local-build-plugins/gradle/wrapper/gradle-wrapper.jar index 033e24c4cdf4..1b33c55baabb 100644 Binary files a/local-build-plugins/gradle/wrapper/gradle-wrapper.jar and b/local-build-plugins/gradle/wrapper/gradle-wrapper.jar differ diff --git a/local-build-plugins/gradle/wrapper/gradle-wrapper.properties b/local-build-plugins/gradle/wrapper/gradle-wrapper.properties index 9f4197d5f4b9..92510698672a 100644 --- a/local-build-plugins/gradle/wrapper/gradle-wrapper.properties +++ b/local-build-plugins/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531 diff --git a/local-build-plugins/gradlew b/local-build-plugins/gradlew old mode 100644 new mode 100755 index fcb6fca147c0..f3b75f3b0d4f --- a/local-build-plugins/gradlew +++ b/local-build-plugins/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +204,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/local-build-plugins/gradlew.bat b/local-build-plugins/gradlew.bat old mode 100644 new mode 100755 index 93e3f59f135d..9b42019c7915 --- a/local-build-plugins/gradlew.bat +++ b/local-build-plugins/gradlew.bat @@ -1,92 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega