matrei commented on PR #16093:
URL: https://github.com/apache/grails-core/pull/16093#issuecomment-5911018803

   Merged `8.0.x` to resolve the conflict in `ParameterizedGrailsUnitTest`. 
Both sides had replaced `applicationContext.getBean(beanName, T)`: `8.0.x` 
(#16427) with `getBean(beanName, cutType)`, this branch with `(T) 
applicationContext.getBean(beanName)`. I kept this branch's version. It also 
avoids `T` as a class literal, so it compiles on Groovy 6, and like the 
original it does not make Spring check the bean's type.
   
   I also applied this branch onto `9.0.x` to check it on Groovy 6.0.0, which 
found two problems that Groovy 5 accepts. 44ef27a9a4 fixes both:
   
   - **`@Nullable` on trait return types.** A JSpecify `@Nullable` (a 
`TYPE_USE` annotation) on the return type of a trait method makes every class 
in a later compilation that implements the trait fail on Groovy 6 with 
`Duplicate annotation for class: interface org.jspecify.annotations.Nullable`. 
That covers every application spec implementing `ControllerUnitTest`, 
`UrlMappingsUnitTest` or `InterceptorUnitTest`. Groovy 5.1.3 and 6.0.0 both 
write the annotation twice on the trait, but only 6.0.0 reads it back. Reported 
as [GROOVY-12434](https://issues.apache.org/jira/browse/GROOVY-12434). I 
removed `@Nullable` from `mapURI`, `getView` and `withInterceptors`, and the 
Javadoc now says when they return `null`. They can come back once GROOVY-12434 
is fixed.
   - **`url instanceof Integer`.** `assertUrlMapping` and `verifyUrlMapping` 
take a `String url`, so the check was always false. With `@CompileStatic` now 
on `UrlMappingsUnitTest`, Groovy 6 rejects it as `Incompatible instanceof 
types`. I removed it, which does not change behaviour.
   
   New tests cover `view` being `null` before an action runs, and 
`withInterceptors` returning the callable's result, returning `null` when the 
callable throws, and returning `null` without calling the callable when an 
interceptor stops the request. They also cover `verifyUrlMapping` returning 
`false`, and `assertUrlMapping` throwing, when the forward mapping matches but 
the reverse mapping creates another URL.
   
   On Groovy 5 (this branch), all tests in `grails-testing-support-core`, 
`grails-testing-support-web`, `grails-test-suite-web` and 
`grails-test-suite-uber` pass, and `aggregateViolations` reports no Checkstyle, 
CodeNarc, PMD or repository-convention violations. On Groovy 6 (this branch 
applied onto `9.0.x`), everything compiles and the affected tests pass.
   


-- 
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]

Reply via email to