-
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
Support custom compiler annotations #353
Comments
Can you provide a very small example? CompileStatic and type checking extensions are indeed applied. However, a command-line compilation is not the equivalent of opening a file for edit, parsing it, resolving types, and whatnot. Some of the Groovy code is exported to the Java model so that the base JDT can do its thing. |
Hi @eric-milles , please see https://github.com/nigelsim/grails-test-compile-static From the command line this compiles fine
BUILD SUCCESSFUL But from the Grails project it fails. Is it possible I've not properly configured something? |
Here is a quick update. The file did compile (there is a class file) with no errors (see Problems view). The type checking error is in the editor only. The |
To enable the global transformation on reconcile (editor opens file buffer, parses the source code, and resolves the types) you can add the system property |
Thanks @eric-milles, that addition to my eclipse.ini file does seem to have solved the issue. It's good to understand that the editor and the compiler have their own distinct views of the code. What are the consequences of putting that line in my eclipse.ini file? I'm not using any other Grails specific tools. It seems that everything that does exist (GGTS, Grails-IDE, etc) were pretty poor at best, and I've got far more mileage out of goovy-eclipse + buildship. I'll give this a go on my main project today and will let you know how it goes. |
I believe the global transforms were excluded from reconcile for efficiency. Since the end result is not bytecode, no need to run stuff that does nothing to enhance the understanding of the lexical structure. Only a few transforms actually add methods or fields that are then referred to in the source. STC came later and so this efficiency gain may need to be reevaluated. I'll add it to the 3.0 list.
|
There are more global transforms that were discovered on the classpath. You could try adding one or more of them: org.grails.datastore.gorm.query.transform.GlobalDetachedCriteriaASTTransformation |
I'm using Groovy-Eclipse on a Grails 3 project. We are starting to the the @GrailsCompileStatic annotation to have Goovy do static type checking, but also not fail the methods that come from Grail's metaclasses. However, in Eclipse these methods are still marked as missing, so it appears that annotation isn't being applied in the same way it does from the command line.
For instance, the
log
andrespond
methods on controllers are provided by metaclasses, but show up as errors.GrailsCompileStatic code
GrailsCompileStatic docs
Thanks
The text was updated successfully, but these errors were encountered: