[
https://issues.apache.org/jira/browse/GROOVY-11711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18010071#comment-18010071
]
Saravanan commented on GROOVY-11711:
------------------------------------
Thank you Eric, just looked at the commit, it looks like the biggest change is
the try finally to reset genericParameterTypes. That seems like a catch all to
address any exceptions, but this specific exception I am seeing, is an issue
with assumptions that the list can be appended to. Shouldnt that also be
addressed in addition to these exception handlers? Not sure if I missed that
part
> 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: 4.0.28, 5.0.0-beta-2, 3.0.26
>
>
> 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)