This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a commit to branch grails8-groovy5-sb4
in repository https://gitbox.apache.org/repos/asf/grails-core.git
The following commit(s) were added to refs/heads/grails8-groovy5-sb4 by this
push:
new 4ac7735e99 fix(test): drop generic argument from `instanceof
List<FieldError>`
4ac7735e99 is described below
commit 4ac7735e994f89951e0915b1e8cd8571445159f4
Author: James Fredley <[email protected]>
AuthorDate: Fri May 22 13:24:56 2026 -0400
fix(test): drop generic argument from `instanceof List<FieldError>`
Groovy 5 enforces what the JVM has always enforced: generic type arguments
are erased at runtime, so `instanceof List<FieldError>` cannot be verified
and is now a compile-time error:
DefaultGraphQLErrorsResponseHandlerSpec.groovy: 100:
Cannot perform instanceof check against parameterized type
List<FieldError>
This was the new fault-line surfaced by the previous commit unblocking the
`:grails-data-graphql-core:compileGroovy` step; the CI then proceeded into
`compileTestGroovy` and failed there.
Replaced the parameterized check with `instanceof List`. The element-type
intent is still expressed by the cast on the very next line
(`((List<FieldError>) errorsFetcher.get(mockObjectEnv)).size() == 1`)
which is what the test was actually asserting.
Verification
.\gradlew :grails-data-graphql-core:compileTestGroovy # BUILD
SUCCESSFUL
Assisted-by: claude-code:claude-opus-4-7
---
.../response/errors/DefaultGraphQLErrorsResponseHandlerSpec.groovy | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/grails-data-graphql/core/src/test/groovy/org/grails/gorm/graphql/response/errors/DefaultGraphQLErrorsResponseHandlerSpec.groovy
b/grails-data-graphql/core/src/test/groovy/org/grails/gorm/graphql/response/errors/DefaultGraphQLErrorsResponseHandlerSpec.groovy
index 6f138572e3..431d458497 100644
---
a/grails-data-graphql/core/src/test/groovy/org/grails/gorm/graphql/response/errors/DefaultGraphQLErrorsResponseHandlerSpec.groovy
+++
b/grails-data-graphql/core/src/test/groovy/org/grails/gorm/graphql/response/errors/DefaultGraphQLErrorsResponseHandlerSpec.groovy
@@ -97,7 +97,10 @@ class DefaultGraphQLErrorsResponseHandlerSpec extends
Specification implements G
DataFetcher errorsFetcher =
codeRegistry.getDataFetcher(coordinates("MockValidateable", "errors"), field)
then:
- errorsFetcher.get(mockObjectEnv) instanceof List<FieldError>
+ // Groovy 5 disallows `instanceof` against a parameterized type (type
erasure makes
+ // the generic argument unverifiable at runtime); the cast on the next
line still
+ // expresses the intended element type for the size() assertion.
+ errorsFetcher.get(mockObjectEnv) instanceof List
((List<FieldError>) errorsFetcher.get(mockObjectEnv)).size() == 1
when: