-
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
@Trait applied to interface with generic cause compile error #733
Comments
I'm not seeing any error. In the sample project supplied, |
This is from grails 3.2 where events is not deprecated, but I have compile error on 3.3 project that I attached. As I said it is tricky and sometimes error not show up until you edit file. Just try to edit SampleService2, just add new empty line and save. It will show up. I believe it is refer to T type from grails.events.Events: <T> Event<T> eventFor(T var1); |
Got it. So this only happens on incremental build. If you need to get unstuck, you can clean and rebuild all. When SampleService2 is trying to resolve the reference to SampleService, it encounters this error when lazily resolving methods. In this case, the method appears to be:
This may be a flavor of #548. I'll have more info on that soon. |
See GROOVY-8815 |
Ready to test |
Tried on: 3.1.0.xx-201810010340-e47 |
Did you clean your workspace and rebuild the project? |
I tried to Clean/Build all. I even deleted and re-imported project form the zip. Even after that, incremental build casing the error. |
Is it the exact same error? Does your project build with Gradle or some other compiler? |
Yes, it is the exactly same error. And yes I can build and run it with gradle. |
What version of the Groovy Compiler are you using? This all has to do with the compiler and any compiler besides the Groovy-Eclipse compiler will not have the necessary patch. |
As I mentioned: |
Could you attach your |
I see the error. I'm not sure if it is because Events was compiled with generics that the current compiler doesn't produce. That class is pre-compiled in your scenario. I tried to extract the test case from it and so I have a source file in its place. |
Ready to test |
Tested on: It is working now. |
Thanks for trying it out. I am testing one final version of a fix for this. Would you mind testing that when the build completes? |
Yes, sure. Just let me know when it is ready for test again. |
- refactor of last commit to manage redirect better during conversion from JDT Model to Groovy AST
Ready to retest |
Tested on: It is working. |
I found one more bug related to Grails projects, but I do not think it is Grails related, but @trait annotation related. I was unable to extract and isolate this issue in the pure groovy project.
I am using:
Eclipse Oxygen.3a Release (4.7.3a)
Groovy-Eclipse 3.1.0.xx-201809251603-e47
It is easy to reproduce with SDKMAN:
Import this project into eclipse and add Gradle nature. Edit grails-sample/grails-app/services/grails/sample/SampleService.groovy, like this:
Copy this service as SampleService2 and just add reference to the previous one:
The second one will start complain about:
I believe it is T generic from Event interface, but I can not reproduce it in pure groovy.
Same complain from generated UnitTest class. Sometime this error is gone, but as soon as I clean or edit the source, just adding and removing space character for example, it will come back.
I am attaching my sample app zip here, just in case.
grails-sample.zip
The text was updated successfully, but these errors were encountered: