Description
The build tools such as Gradle compares the class files and JARs containing them to determine if there is a need of recompiling the projects. Any randomness in generated classes breaks the cachablity.
It seems to me that the order of methods generated from traits is not deterministic therefore compiling the same source code generates different class file. This can be observed for example with Grails entities.
1. generate a fresh Grails project curl -O https://start.grails.org/myapp.zip
2. unzip the project
3. create a Groovy entity inside myapp/grails-app/domain/myapp/Person.groovy
class Person { String name Integer age Date lastVisit }
4. compile the project ./grailsw clean classes
5. save the content of compiled class file in build/classes/groovy/main/myapp/Person.class
6. recompile the project ./grailsw clean classes
7. compare the regenerated class file with the original one build/classes/groovy/main/myapp/Person.class
You may need to repeat the step 6 and 7 couple of times but eventually you will see there is a difference in the order of the methods annotated with @TraitBridge.