amador-duran-toro opened a new issue, #14276:
URL: https://github.com/apache/grails-core/issues/14276

   In Grails 4.0.3 and Grails 3.3.11, if you have a domain class named `A`, e.g.
   
   ```{groovy}
   package mypackage
   
   abstract class A {
     String name
     // ...
     // properties
     // ...
   }
   ```
   And you populate it in `Bootstrap.groovy`, e.g.
   
   ```{groovy}
   package mypackage
   
   class BootStrap {
   
       def init = { servletContext ->
           A.withTransaction { status ->
               A.saveAll( 
                   new A( name: "a1" ),
                   new A( name: "a2" ),
                   new A( name: "a3" )
               )
           }
       }
       def destroy = {
       }
   }
   ```
   
   If you use scaffolding (`create-scaffold-controller A`), everything works 
correctly. 
   
   But if you delete the scaffolding controller and `generate-all` for your 
class `A`, everything fails throwing a `java.lang.NullPointerException` because 
the `AService aService` object is `null` in `AController.groovy`, i.e. the 
service object is not properly injected in the controller.
   
   Now, if you delete all the generated files except the domain class file 
(`A.groovy`), rename the file and the class as, let's say, `A1`, and 
`generate-all` again, everything works!
   
   You can try with any one-letter named classes, e.g. `A`, `B`, `X`, etc., and 
the generated code always fails for the same reason. Add another character to 
the class name, regenerate, and everything works!
   
   I suppose there must be some name clash somewhere when a class is named with 
a single character.


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