matrei opened a new issue, #16537:
URL: https://github.com/apache/grails-core/issues/16537
Since 8.0.0, `generateTagLibraryIndex` reads tag libraries before
compilation and resolves the project types they refer to from source. When
anything it follows refers to a nested class declared in the project, the tag
library is skipped:
```
> Task :generateTagLibraryIndex
Tag library index: could not read CampfireTagLib.groovy before compilation;
their tags resolve dynamically until they are compiled.
```
The nested class does not have to be referenced from the tag library itself.
Here the tag library injects a service, which leads to a class with a method
declared as `CableConnection.Subscription authorize(...)`. That is enough.
The packaged index written by `packageTagLibraryIndex` after compilation is
unaffected, so pages still compile against a complete index. What is lost is
the pre-compile index: the tag library's namespace is recorded as incomplete,
so calls to its tags get no misspelling diagnostics. The message also appears
on every build.
### Cause
`TagLibraryIndexGenerator.SourceRootClassNodeResolver` maps the requested
class name directly to a file name. Groovy asks for a nested class by its
binary name, `campfire.cable.CableConnection$Subscription`, so the resolver
looks for `campfire/cable/CableConnection$Subscription.groovy`, which never
exists. The lookup fails. Resolving the outer class `CableConnection`
afterwards comes too late for the nested class to be found.
### Reproduce
`src/main/groovy/com/example/Connection.groovy`:
```groovy
package com.example
class Connection {
static class Subscription {
}
}
```
`src/main/groovy/com/example/Channels.groovy`:
```groovy
package com.example
class Channels {
Connection.Subscription authorize(String identifier) { null }
}
```
`grails-app/taglib/NestingTagLib.groovy`:
```groovy
import com.example.Channels
class NestingTagLib {
static namespace = 'nesting'
Channels channels
def show = { attrs -> }
}
```
Running `./gradlew generateTagLibraryIndex` prints the message above, and
`build/generated/grails-taglibs` contains only `incomplete.properties`.
**Version:** 8.0.0 (also current `8.0.x`)
--
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]