matrei opened a new issue, #430:
URL: https://github.com/apache/grails-intellij-plugin/issues/430
Grails 8 introduces a compile-time beans DSL
(`grails.compiler.beans.GrailsBeans`): a `beans` closure property that an AST
transform compiles into real `@Bean` factory methods. It is available on
classes annotated with `@GrailsBeans`, and implicitly on plugin descriptors
(`grails.plugins.Plugin`), the application class
(`grails.boot.config.GrailsAutoConfiguration`) and unit tests
(`org.grails.testing.GrailsUnitTest`).
```groovy
class Application extends GrailsAutoConfiguration {
def beans = {
field('suffix', String).value('app.greeting-suffix', '!')
method('buildGreeting', String) { String name -> "Hello,
${name}${suffix}" }
bean('greeter', Greeter) { MyService myService ->
new Greeter(buildGreeting('World'))
}
bean(Formatter).primary().lazy()
group('optional').conditionalOnClass(name: 'com.example.Missing') {
bean(OptionalGreeter)
}
}
}
```
## Current behaviour
The IDE does not recognise any of this:
- `bean`, `field`, `method`, `group` and every chained qualifier
(`.primary()`, `.conditionalOnProperty(...)`, `.value(...)`, ...) are
highlighted as unresolved and get no completion.
- The shared `field(...)`/`method(...)` members, used by name inside bean
bodies (`suffix`, `buildGreeting(...)` above), are unresolved and untyped.
- On Ultimate, beans declared this way are missing from the Spring model, so
injecting them by name (`def greeter` in a controller) is not resolved.
## Expected behaviour
- Resolution, completion and documentation for the declarations and, per
declaration kind, their qualifiers.
- Shared `field`/`method` members resolve inside `bean`/`method` bodies with
their declared types (including `.typeArguments(...)`) and navigate to their
declaration, scoped to their group.
- On Ultimate, the declared beans are registered in the Spring model and can
be injected by name like `resources.groovy` beans.
- Projects on Grails 7 and earlier are unaffected: nothing is recognised
unless `GrailsBeans` is on the class path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]