You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2025/07/10 04:33:00 UTC

[jira] [Resolved] (GROOVY-11711) Templates not recognized for inner classes in certain scenarios

     [ https://issues.apache.org/jira/browse/GROOVY-11711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Sun resolved GROOVY-11711.
---------------------------------
    Fix Version/s: 5.0.0-beta-2
       Resolution: Fixed

> Templates not recognized for inner classes in certain scenarios
> ---------------------------------------------------------------
>
>                 Key: GROOVY-11711
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11711
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 5.0.0-beta-1
>            Reporter: Saravanan
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 5.0.0-beta-2
>
>
> Compiling this code
> {code:java}
> public class RecordTesting<MyTemplate1> {
>     static class Blah {
>     }
>     class InnerClass implements List<MyTemplate1> {
>     }
> }
>  {code}
> results in this compile error
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> testdata/plugins/records/RecordTesting.java: 11: unable to resolve class MyTemplate1
>  @ line 11, column 38.
>        class InnerClass implements List<MyTemplate1> {
>                                         ^testdata/plugins/records/RecordTesting.java: 11: unable to resolve class MyTemplate1
>  @ line 11, column 38.
>        class InnerClass implements List<MyTemplate1> {
>                                         ^ {code}
> If I remove the static in front of class Blah, it will work fine. I narrowed this down to how the resolvevisitor tracks genericParameterNames. Without the static, it keeps the outer class generics in this map, but when it sees the static on class Blah, it clears it out. Now all inner nodes after Blah will see an error whenever MyTemplate1 is used. Didnt dig deeper



--
This message was sent by Atlassian Jira
(v8.20.10#820010)