[
https://issues.apache.org/jira/browse/GROOVY-10704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King resolved GROOVY-10704.
--------------------------------
Fix Version/s: 4.0.5
3.0.13
Assignee: Paul King
Resolution: Fixed
> Random order of TraitBridge methods breaks cachablity
> -----------------------------------------------------
>
> Key: GROOVY-10704
> URL: https://issues.apache.org/jira/browse/GROOVY-10704
> Project: Groovy
> Issue Type: Bug
> Components: bytecode
> Affects Versions: 3.0.7
> Reporter: Vladimír Oraný
> Assignee: Paul King
> Priority: Major
> Fix For: 4.0.5, 3.0.13
>
> Attachments: Snímek obrazovky 2022-07-25 v 7.23.20.png
>
>
> 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}}
> {code:groovy}
> class Person {
> String name
> Integer age
> Date lastVisit
> }
> {code}
> 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{}}}.
>
> !Snímek obrazovky 2022-07-25 v 7.23.20.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)