[
https://issues.apache.org/jira/browse/GROOVY-11266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18016687#comment-18016687
]
Yih Tsern edited comment on GROOVY-11266 at 8/28/25 4:15 AM:
-------------------------------------------------------------
For those working to upgrade Groovy in their codebase, hope this trivia will be
helpful - the symptom documented in this ticket appears in:
* 3.0.20, gone in 3.0.21.
* 4.0.0-4.0.17, gone in 4.0.18 (UPDATE: Just found out this is GROOVY-11257).
was (Author: yihtserns):
For those working to upgrade Groovy in their codebase, hope this trivia will be
helpful - the symptom documented in this ticket appears in:
* 3.0.20, gone in 3.0.21.
* 4.0.0-4.0.17, gone in 4.0.18.
> Static Compilation fails when using generics (no such property)
> ---------------------------------------------------------------
>
> Key: GROOVY-11266
> URL: https://issues.apache.org/jira/browse/GROOVY-11266
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation, Static Type Checker
> Affects Versions: 3.0.20
> Environment: Java 21, gradle 8.5, MacOS
> Reporter: Rodolfo Yanke
> Assignee: Eric Milles
> Priority: Major
> Fix For: 3.0.21
>
>
> Hi,
> The code below works fine with 3.0.19 but after upgrading to 3.0.20 it
> doesn't compile anymore:
> {code:java}
> import groovy.transform.CompileStatic
> import org.springframework.data.domain.Pageable
> import org.springframework.data.mongodb.repository.MongoRepository
> @CompileStatic
> class GalleryItem {
> String someProperty
> }
> @CompileStatic
> interface GalleryItemRepository extends MongoRepository<GalleryItem, String> {
> }
> @CompileStatic
> static void main(String[] args) {
> GalleryItemRepository repository = null //no implementation for the sake
> of simplicity
> def page = repository.findAll(Pageable.ofSize(1))
> page.content.each {
> it.someProperty //[Static type checking] - No such property:
> someProperty for class: java.lang.Object
> }
> } {code}
> My build.gradle
> {code:java}
> plugins {
> id 'groovy'
> }
> group = 'org.example'
> version = '1.0-SNAPSHOT'
> repositories {
> mavenCentral()
> }
> dependencies {
> //works fine with 3.0.19
> implementation 'org.codehaus.groovy:groovy-all:3.0.20'
> implementation 'org.springframework.data:spring-data-mongodb:3.4.18'
> }
> compileJava {
> sourceCompatibility = JavaVersion.VERSION_21
> targetCompatibility = JavaVersion.VERSION_21
> }
> compileGroovy {
> groovyOptions.optimizationOptions.indy = true
> }{code}
> A simple "gradle compileGroovy" should reproduce the issue:
> {code:java}
> /Projects/groovytest/src/main/groovy/Main.groovy: 20: [Static type checking]
> - No such property: someProperty for class: java.lang.Object
> @ line 20, column 9.
> it.someProperty //[Static type checking] - No such property:
> someProperty for class: java.lang.Object
> ^ {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)