You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2026/04/05 19:13:04 UTC
(grails-core) branch grails8-groovy6-canary created (now 013cb13343)
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a change to branch grails8-groovy6-canary
in repository https://gitbox.apache.org/repos/asf/grails-core.git
at 013cb13343 canary: test Groovy 6.0.0-SNAPSHOT
This branch includes the following new commits:
new 013cb13343 canary: test Groovy 6.0.0-SNAPSHOT
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(grails-core) 01/01: canary: test Groovy 6.0.0-SNAPSHOT
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a commit to branch grails8-groovy6-canary
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 013cb13343ded14a367750ded51604e827e91e13
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Sun Apr 5 15:12:51 2026 -0400
canary: test Groovy 6.0.0-SNAPSHOT
Bumps groovy.version to 6.0.0-SNAPSHOT (from 5.0.3) to see what breaks.
Snapshot resolves from https://repository.apache.org/content/groups/snapshots
which was already configured in build-logic/GrailsRepoSettingsPlugin.groovy
for the org.apache.groovy.* group.
Changes needed on top of the Groovy 5.0.3 canary:
- gradle/test-config.gradle: apply
'-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true' to every
GroovyCompile task, not just compileGroovy/compileTestGroovy.
Spock 2.4-groovy-5.0 is the latest available and refuses to run
against Groovy 6 without this flag; since SpockTransform is
registered via META-INF/services, the Groovy compiler loads it for
every source set (including main) and main compiles fail without
the flag being set globally.
- DefaultHalViewHelper.groovy: reorder the (association instanceof
ToMany && !(association instanceof Basic)) / else if
(association instanceof ToOne) cascade to check ToOne first.
Groovy 6's flow typing narrows 'association' in the else branch in
a way that conflicts with the later 'instanceof ToOne' check
(Incompatible instanceof types: Basic and ToOne). The reordered
form is equivalent because ToOne and ToMany are sibling Association
subtypes.
- AbstractHibernateGormInstanceApi.groovy: fix a pre-existing
operator-precedence bug caught by Groovy 6's stricter instanceof
type checking.
before: if (association instanceof ToOne && !association instanceof Embedded) {
after: if (association instanceof ToOne && !(association instanceof Embedded)) {
Without the parentheses '!association' is evaluated first (to a
boolean) and then 'instanceof Embedded' is checked against a
boolean, which is always false - the whole left side of the && had
been dead code. Groovy 6 now reports this as
'Incompatible instanceof types: boolean and Embedded'.
Known still-failing: grails-geb:compileTestFixturesGroovy still
triggers the ASM Frame.putAbstractType bug that was the reason we
pinned to Groovy 5.0.3. Same bytecode-generation issue carries
forward to 6.0.0-SNAPSHOT.
---
dependencies.gradle | 2 +-
gradle/test-config.gradle | 11 ++++++-----
.../orm/hibernate/AbstractHibernateGormInstanceApi.groovy | 2 +-
.../plugin/json/view/api/internal/DefaultHalViewHelper.groovy | 4 ++--
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/dependencies.gradle b/dependencies.gradle
index e8553c7c6b..0986f6bf1a 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -74,7 +74,7 @@ ext {
'commons-codec.version' : '1.18.0',
'commons-lang3.version' : '3.20.0',
'geb-spock.version' : '8.0.1',
- 'groovy.version' : '5.0.3',
+ 'groovy.version' : '6.0.0-SNAPSHOT',
'jackson.version' : '2.21.2',
'jquery.version' : '3.7.1',
'liquibase-hibernate5.version': '4.27.0',
diff --git a/gradle/test-config.gradle b/gradle/test-config.gradle
index b6de1a6517..2926f89e91 100644
--- a/gradle/test-config.gradle
+++ b/gradle/test-config.gradle
@@ -35,11 +35,12 @@ dependencies {
add('testRuntimeOnly', 'org.objenesis:objenesis')
}
-tasks.named('compileTestGroovy') {
- options.forkOptions.jvmArgs += ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
-}
-
-tasks.named('compileGroovy') {
+// Disable Spock's compile-time Groovy version check on ALL Groovy compile
+// tasks. Spock's SpockTransform is registered via META-INF services and
+// the Groovy compiler loads every AST transform on the classpath, so even
+// main source sets trip the version check when Groovy is newer than the
+// Spock artifact's groovy variant.
+tasks.withType(GroovyCompile).configureEach {
options.forkOptions.jvmArgs += ['-Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true']
}
diff --git a/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/AbstractHibernateGormInstanceApi.groovy b/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/AbstractHibernateGormInstanceApi.groovy
index 5b7c18d66b..3f3abea76b 100644
--- a/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/AbstractHibernateGormInstanceApi.groovy
+++ b/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/AbstractHibernateGormInstanceApi.groovy
@@ -398,7 +398,7 @@ abstract class AbstractHibernateGormInstanceApi<D> extends GormInstanceApi<D> {
setObjectToReadOnly(target)
if (entity) {
for (Association association in entity.associations) {
- if (association instanceof ToOne && !association instanceof Embedded) {
+ if (association instanceof ToOne && !(association instanceof Embedded)) {
if (proxyHandler.isInitialized(target, association.name)) {
def bean = new BeanWrapperImpl(target)
def propertyValue = bean.getPropertyValue(association.name)
diff --git a/grails-views-gson/src/main/groovy/grails/plugin/json/view/api/internal/DefaultHalViewHelper.groovy b/grails-views-gson/src/main/groovy/grails/plugin/json/view/api/internal/DefaultHalViewHelper.groovy
index 093784f184..8d46a8ec4b 100644
--- a/grails-views-gson/src/main/groovy/grails/plugin/json/view/api/internal/DefaultHalViewHelper.groovy
+++ b/grails-views-gson/src/main/groovy/grails/plugin/json/view/api/internal/DefaultHalViewHelper.groovy
@@ -320,13 +320,13 @@ class DefaultHalViewHelper extends DefaultJsonViewHelper implements HalViewHelpe
def value = entityReflector.getProperty(object, propertyName)
if (value != null) {
- if (association instanceof ToMany && !(association instanceof Basic)) {
+ if (association instanceof ToOne) {
if (deep || expandProperties.contains(propertyName) || proxyHandler == null || proxyHandler.isInitialized(value)) {
embeddedValues.put((Association) association, value)
}
excs.add(propertyName)
}
- else if (association instanceof ToOne) {
+ else if (association instanceof ToMany && !(association instanceof Basic)) {
if (deep || expandProperties.contains(propertyName) || proxyHandler == null || proxyHandler.isInitialized(value)) {
embeddedValues.put((Association) association, value)
}