jamesfredley commented on code in PR #15557:
URL: https://github.com/apache/grails-core/pull/15557#discussion_r3343850510
##########
grails-test-suite-web/src/test/groovy/org/grails/web/binding/DataBindingTests.groovy:
##########
@@ -404,16 +404,10 @@ class DataBindingTests extends Specification implements
ControllerUnitTest<TestC
}
void testAssociationsBinding() {
- when:
- def authorClass = new Author()
-
- Author.metaClass.static.get = { Serializable id ->
- def result = new Author()
- result.id = id as long
- result.name = "Mocked ${id}"
- result
- }
+ given:
+ GroovySpy(Author, global: true)
Review Comment:
Committed in c884184677 (Clean up the global GroovySpy in DataBindingTests).
##########
grails-datamapping-core/src/test/groovy/grails/gorm/services/ServiceTransformSpec.groovy:
##########
@@ -987,10 +986,10 @@ interface MyService {
then:"A compilation error occurred"
def e = thrown(MultipleCompilationErrorsException)
- e.message.normalize().contains '''No implementations possible for
method 'void foo()'. Please use an abstract class instead and provide an
implementation.
- @ line 6, column 5.
- void foo()
- ^'''
+ // Note: Groovy 5 changed the method signature format from 'void
foo()' to 'foo():void'
Review Comment:
Committed in d67db7e8d6 (Clarify Groovy 5 workaround comments).
##########
grails-datamapping-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/AbstractConstraint.java:
##########
@@ -233,13 +233,30 @@ protected String getDefaultMessage(String code) {
return messageSource.getMessage(code, null,
LocaleContextHolder.getLocale());
}
- return ConstrainedProperty.DEFAULT_MESSAGES.get(code);
+ return getDefaultMessageFromBundle(code);
}
catch (Exception e) {
- return ConstrainedProperty.DEFAULT_MESSAGES.get(code);
+ return getDefaultMessageFromBundle(code);
}
}
+ /**
+ * Gets default message from MESSAGE_BUNDLE when the interface-constant
static-init order (Groovy 5)
Review Comment:
Committed in d67db7e8d6 (Clarify Groovy 5 workaround comments).
##########
grails-gradle/gradle/docs-config.gradle:
##########
@@ -25,11 +25,13 @@ dependencies {
// TODO: Remove jline:jline (JLine 2) when upgrading to Groovy 5
(groovy-groovysh 5.x uses JLine 3)
add('documentation', 'jline:jline')
add('documentation', 'com.github.javaparser:javaparser-core')
- add('documentation',
"org.apache.groovy:groovy:${bomDependencyVersions['groovy.version']}")
- add('documentation',
"org.apache.groovy:groovy-groovydoc:${bomDependencyVersions['groovy.version']}")
- add('documentation',
"org.apache.groovy:groovy-ant:${bomDependencyVersions['groovy.version']}")
- add('documentation',
"org.apache.groovy:groovy-docgenerator:${bomDependencyVersions['groovy.version']}")
- add('documentation',
"org.apache.groovy:groovy-templates:${bomDependencyVersions['groovy.version']}")
+ // grails-gradle subprojects target Gradle's embedded Groovy 4 (see
gradleBomDependencyVersions['gradle-groovy.version']).
+ // Do NOT use the main Groovy version here - that is Groovy 5.x in Grails
8 and would override the gradle-groovy-bom platform.
Review Comment:
Committed in d67db7e8d6 (Clarify Groovy 5 workaround comments).
##########
grails-gradle/tasks/build.gradle:
##########
@@ -40,7 +40,9 @@ ext {
dependencies {
implementation platform(project(':grails-gradle-bom'))
- implementation
"org.apache.groovy:groovy:${bomDependencyVersions['groovy.version']}"
+ // grails-gradle-tasks targets Gradle's embedded Groovy 4
(gradleBomDependencyVersions['gradle-groovy.version']).
Review Comment:
Committed in d67db7e8d6 (Clarify Groovy 5 workaround comments).
##########
grails-rest-transforms/src/main/groovy/org/grails/plugins/web/rest/transform/ResourceTransform.groovy:
##########
@@ -232,6 +233,8 @@ class ResourceTransform implements ASTTransformation,
CompilationUnitAware, Tran
final resourcesUrlMapping = new
MethodCallExpression(buildThisExpression(), uri, new MapExpression([ new
MapEntryExpression(new ConstantExpression('resources'), new
ConstantExpression(domainPropertyName))]))
final urlMappingsClosure = new ClosureExpression(null, new
ExpressionStatement(resourcesUrlMapping))
+ // Groovy 5/6 ClosureWriter NPE on null VariableScope -
same family as AbstractMethodDecoratingTransformation.makeDelegatingClosureCall.
Review Comment:
Committed in d67db7e8d6 (Clarify Groovy 5 workaround comments).
##########
grails-validation/src/main/groovy/grails/validation/Validateable.groovy:
##########
@@ -279,4 +280,27 @@ trait Validateable {
static boolean defaultNullable() {
false
}
+
+ /**
+ * Resolves defaultNullable() via reflection to preserve trait
static-method override semantics (Groovy 5).
+ * Reproducer:
https://github.com/jamesfredley/groovy-trait-static-method-override-bug
Review Comment:
Committed in d67db7e8d6 (Clarify Groovy 5 workaround comments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]