Saravanan created GROOVY-11711:
----------------------------------
Summary: 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
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)