grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.78k stars 950 forks source link

DomainClassArtefactHandler.isDomainClass() returns false for proxies #10830

Closed gsartori closed 6 years ago

gsartori commented 6 years ago

We use DomainClassArtefactHandler.isDomainClass() in our plugin, it statred returning false just for fome records after upgrading Grails from 3.2.6 to 3.2.11.

Further analysis proved that it works on 3.2.9, it stops working on 3.2.10.

Debugging we found the following: strangeclassnames

I know I should add a test case but I'm currently handling a peak of work I won't be able to do it soon, sorry for that. I hope this is better than nothing.

Expected Behaviour

DomainClassArtefactHandler.isDomainClass() should return true for all objects in the resultset.

Actual Behaviour

DomainClassArtefactHandler.isDomainClass() returns false for some objects in the resultset. Such objects are of a different class (as seen in the picture above). After a quick chat with james.kleeh on slack I understood they should be proxyes.

Environment Information

jameskleeh commented 6 years ago

Try executing DomainClassArtefactHandler.isDomainClass(class, true)

jameskleeh commented 6 years ago

See https://github.com/grails/grails-core/blob/master/grails-core/src/main/groovy/org/grails/core/artefact/DomainClassArtefactHandler.java#L109

gsartori commented 6 years ago

All right, it's working with the above suggestions. Thank you James for the time you dedicated me, it's much appreciated.