-
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
Static class literal in annotation value shows false compilation error #256
Comments
What version of Groovy? This case should work and is tested for. |
I tried it with version 2.4.7 and 2.4.8. Both versions show said error in the IDE window. |
Can you also look in the installation details dialog and say what version the plug-in org.eclipse.jdt.core is at? And if you run Help > Check for Updates and freshen Groovy-Eclipse, does the problem remain? |
The plugin org.eclipse.jdt.core is at 3.12.2.xx-201701232340-e46. I updated Groovy-Eclipse through Help > Check for Updates but the problem still remains. I was also able to reproduce the problem with a fresh Eclipse Neon.2 installation downloaded from eclipse.org and installing nothing but the Groovy-Eclipse plugin. |
I did not notice the inner class the first time through. That seems to be the source of the problem. You can replace |
I did some additional testing and found that Java does not support this kind of resolution in a type annotation for fields or inner classes. I filed this bug against groovy core: https://issues.apache.org/jira/browse/GROOVY-8063 I did find a way to make the inner class resolution succeed, but I am hesitant to enable it since there is a viable workaround using a qualifier or an import. |
When using the shortened Groovy syntax for class literals as values in Annotations like in the code below
Groovy-Eclipse shows a compilation error in line 3 (
InnerClass cannot be resolved or is not a field
), despite this being valid Groovy code that compiles and runs fine. When adding a.class
suffix toInnerClass
, the error disappears.I used the the following to demonstrate the issue:
Spring Tool Suite
Version: 3.8.3.RELEASE
Build Id: 201612191351
Platform: Eclipse Neon.2 (4.6.2)
Groovy-Eclipse Feature 2.9.2.xx-201701200229-e46
The text was updated successfully, but these errors were encountered: