matrei opened a new pull request, #16538:
URL: https://github.com/apache/grails-core/pull/16538

   Fixes #16537
   
   Before compilation, the tag library index generator resolves the project 
types a tag library refers to from source. A nested class could not be resolved 
this way, so any tag library that reached one, even indirectly through a 
service, was skipped and its namespace was recorded as incomplete.
   
   Groovy asks for a nested class by its binary name (`Outer$Inner`), and 
`SourceRootClassNodeResolver` turned that name straight into a file name. The 
resolver now looks for a nested class in its outermost class's source file. It 
returns that file only if the file actually declares the requested class. That 
check matters because Groovy also tries names that only might be nested: a type 
`Other` named inside `Helper` is tried as `Helper$Other` before `Other`. 
Without the check, `Helper.groovy` would be returned for a class it does not 
declare. The check reads the file's syntax tree up to the conversion phase, as 
`declaredNamespace` already does, and caches the result per file.
   
   Tests added to `SourceResolvedIndexGeneratorSpec`:
   - a nested class reached through another project class is resolved (fails 
without this change);
   - a class and its nested class used side by side are read from a single 
source;
   - a type named inside another class is not mistaken for a nested class of it;
   - a misspelled nested class still fails, and its tag library is left out.
   
   `SourceResolvedIndexGeneratorSpec`, `TagLibraryIndexGeneratorSpec`, the 
other index specs, the `grails-taglib` tests and `codeStyle` for both modules 
pass.
   
   Also verified on an application that hit this: the pre-compile descriptor 
for its tag library now matches the one `packageTagLibraryIndex` writes after 
compilation.
   


-- 
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]

Reply via email to