-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import not added when referencing type in different package from subclass #1326
Comments
I'm checking to see what can be done here. There are a couple places in the compiler where case is ignored for property accessor lookup. Because you have "MyEnum" for the type and "myEnum" for the property, case comes into play. If you change the name of the property, "MyEnum" will not be recognized as "getMyEnum()" from Base. |
What version of Groovy are you compiling with from Gradle? |
Yes, I guessed the problem lies in the fact that I'm compiling with Groovy 2.5.15-indy. |
Please note that, if I manually add the import, all starts to work fine. |
I get it. I would not expect it to work this way either. The recognition is in Groovy, not Greclipse. I'm just looking at 2.5 now to see if a patch has been applied to backport Groovy 3 or 4 behavior. |
I'm not sure what can be done here. STC determines that the property satisfies "MyEnum" and this is not resolved as an undeclared variable or unresolved type until a later compiler phase of SC. The editor does not reach this compiler phase, so it only has the STC metadata. |
Hi, is no one working on this issue? If not, I would like to take this up and I would appreciate some guidance too. |
Using Greclipse 4.4.0.v202112282355-e2009.
Consider the following enum:
And the following classes:
Please note that
MyEnum
is in a different package.Observed behaviour in
Ext
:test69b.MyEnum
MyEnum
inMyEnum.FOO
MyEnum
inMyEnum.FOO
, you'll be directed toBase.myEnum
rather than toMyEnum
typeMyEnum
is not recognized as a typeIf you however try to compile this with groovyc (I tried it through Gradle), compilation correctly fails because
MyEnum
is not recognized ("[Static type checking] - The variable [MyEnum] is undeclared.").The text was updated successfully, but these errors were encountered: