codeconsole commented on code in PR #16224:
URL: https://github.com/apache/grails-core/pull/16224#discussion_r3899713526


##########
grails-beans-dsl/src/main/java/org/grails/compiler/beans/GrailsBeansASTTransformation.java:
##########
@@ -324,9 +330,26 @@ private ClassNode createAutoConfigurationSibling(ClassNode 
pluginClass, Annotati
         sibling.addAnnotations(siblingAnnotations);
         pluginClass.getAnnotations().removeAll(siblingAnnotations);
 
+        // The name is settled here and nowhere else. The global transform 
consumes this metadata
+        // and registers it using its Eclipse-aware compilation target 
resolution.
+        
pluginClass.putNodeMetaData(GENERATED_AUTO_CONFIGURATION_NAME_METADATA, 
siblingName);
+        if (!isEclipseSourceUnit(source)) {
+            AutoConfigurationImportsWriter.register(siblingName, 
targetDirectory(source), source, compilationUnit);

Review Comment:
   Follow-up on this one. Seeding the resolved directory the other way round - 
the global transform putting it on the class before anything is transformed, so 
the local transform can write to it - made the global registration redundant: 
it reads metadata that either was just written by a call which already 
registered the same name, or, for a descriptor carrying the annotation, is not 
set yet because the local transform runs afterwards. Removed in d014214.
   
   Verified rather than reasoned: with it gone, a clean build produces 
byte-identical imports files for grails-core, grails-databinding and both 
beans-dsl examples, the deletion case still drops the entry end to end, and the 
ten modules that exercise this are green.
   
   That removes what the duplicate came from, so the gate you suggested is now 
defence rather than the thing standing between one missing entry and two 
reports of it - and the specification covering it no longer fails if the gate 
is taken out. Happy to drop both if you would rather not keep a guard for 
something that can no longer happen; I have left them in as the cheaper of the 
two mistakes.



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