matrei opened a new pull request, #16427: URL: https://github.com/apache/grails-core/pull/16427
## Summary Moves the source changes from the Groovy 6 upgrade experiment (#16387) that compile on Groovy 5 onto `8.0.x`, as suggested in https://github.com/apache/grails-core/pull/16387#issuecomment-5819277450. Two of them fix a public signature or a behaviour before 8.0.0, so a later release built on Groovy 6 does not change them. The rest leave the Groovy 6 upgrade with only the changes that need Groovy 6: the `groovy-callsite` module, the Spock version check, JLine 4 and the `TemplateRenderer` workaround for GROOVY-12426. Each commit covers one change and explains it on Groovy 5 and Groovy 6. ## Changes **Declare the map constructor of `BeanPropertyAccessorImpl`.** `@TupleConstructor(includes = ...)` adds a `BeanPropertyAccessorImpl(LinkedHashMap)` constructor on Groovy 5, because the first declared property, `Object rootBean`, is left out of `includes`. Groovy 6 decides from the included properties and adds none. With `@MapConstructor`, both generate `BeanPropertyAccessorImpl(Map)`; `javap` before and after shows that the `(LinkedHashMap)` constructor is replaced by `(Map)` and nothing else changes. **Store an attribute on subscript assignment to GSP tag attributes.** On Groovy 5, `attrs['gspTagSyntaxCall'] = value` invokes `setGspTagSyntaxCall(boolean)`, while Groovy 6 routes subscript assignment on a `Map` through `put`. `GroovyPageAttributes` now declares `putAt(String, Object)`, so subscript assignment stores an attribute on both versions, dynamically and under static compilation (checked on Groovy 5.1.3 and 6.0.0). Dotted assignment still invokes the setter. This differs from Grails 7, where subscript assignment invoked the setter, so the 8.0 upgrade guide now covers it (#16280). **Skip interfaces when collecting static property values from a class hierarchy.** `ClassPropertyFetcher.getStaticPropertyValuesFromInheritanceHierarchy` tested whether the target class was an interface instead of each hierarchy entry, so the check never did anything. On Groovy 5 a constant declared on an implemented interface, such as `transients`, was returned as if a class had declared it. On Groovy 6 visiting a trait interface fails, because it no longer carries the static accessors. 9.0.x already has the fix. **Keep 8.0.x source compatible with Groovy 6.** - Raw types instead of parameterized class literals (GROOVY-12319) in `GrailsBanner`, the OAuth2 base service, `StartMongoGrailsUnitExtension` and a SiteMesh spec. `ParameterizedGrailsUnitTest` looks the bean up by the type under test instead of `T`. - `@Delegate` excludes on `WriteFilteringMap` (`put`, `putAll`, `remove`) and on `DirtyCheckingList` and `DirtyCheckingSortedSet` (`reversed`), so Groovy 6 does not generate delegated methods over the tracking overrides. On Groovy 5, `javap` shows no change for the DirtyChecking classes. `WriteFilteringMap` no longer delegates `remove(key, value)` to the backing map: `Map`'s default now calls the tracking `remove(key)`, so the removal is recorded. - The Geb system property override is implemented in Java as `ThreadLocalPropertyScope`. A closure-backed lookup recurses until a `StackOverflowError` on Groovy 6. - `GormEntityTransformSpec` also finds a trait method whose type-variable parameters Groovy 6 specializes to the implementing class. The `Validateable` test class implements the trait's static methods so its joint compilation stub stays legal on Groovy 6.0.0 (GROOVY-12427). ## Testing - New: `BeanPropertyAccessorImplSpec`, `ThreadLocalPropertyScopeSpec` and `SpringSecurityOauth2BaseServiceSpec` (`getRoleNames()` had no test). New features in `GroovyPageAttributesTests`, `ClassPropertyFetcherTests` and `WriteFilteringMapSpec`. - The test suites of every affected module pass: grails-core, grails-datastore-core, grails-datamapping-core, grails-fields, grails-taglib, grails-web-taglib, grails-gsp, grails-sitemesh3, grails-testing-support-core, grails-geb, grails-validation, and the OAuth2 plugin's integration tests. - `./gradlew clean aggregateViolations :grails-test-report:check --continue` reports no Checkstyle, CodeNarc, PMD or repository-convention violations (SpotBugs is disabled). The integration test report shows 3741 tests with no failures. The unit test report shows 18353 tests with one failure: the `ExternalConfigSpec` feature that loads `http://bogus.server`, which passes when rerun on its own and with its whole module. ## Merge-up 9.0.x already has the `@MapConstructor`, `ClassPropertyFetcher`, `@Delegate` and class literal changes with different comments. Expect small conflicts there; either side is fine. -- 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]
