You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2020/07/27 23:48:00 UTC
[jira] [Resolved] (GROOVY-9631) Replace legacy data structure with
Java collection
[ https://issues.apache.org/jira/browse/GROOVY-9631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Sun resolved GROOVY-9631.
--------------------------------
Resolution: Fixed
> Replace legacy data structure with Java collection
> --------------------------------------------------
>
> Key: GROOVY-9631
> URL: https://issues.apache.org/jira/browse/GROOVY-9631
> Project: Groovy
> Issue Type: Improvement
> Reporter: Daniel Sun
> Assignee: Daniel Sun
> Priority: Major
> Labels: Breaking-Change
> Fix For: 4.0.0-alpha-1
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> *BACKGROUND*
> Groovy home-made data structures are lack of maintainence for a long time, so it's better to replace them with mature and continuous improving data structure from JDK
> *SCOPE*
> # Deprecate redundant {{AbstractConcurrentMapBase}}, {{AbstractConcurrentMap}}, {{ManagedConcurrentMap}}, and their related inner classes, e.g. {{Entry}}
> # Replace {{ManagedConcurrentMap}} with {{ManagedIdentityConcurrentMap}}, which is base on {{ConcurrentHashMap}}
> # Deprecate {{ComplexKeyHashMap}}, {{SingleKeyHashMap}} and {{TripleKeyHashMap}}. Note: {{TripleKeyHashMap}} is only used by never called method
> # Polish {{Index}} and {{MethodIndex}} in the class {{MetaClassImpl}}, they derive from {{SingleKeyHashMap}}
> *BENEFITS*
> # Better maintainence and readability
> # Keep the original order of properties declared, which is important for serializing object to Json/Xml
> {code:java}
> class Person {
> String name
> int age
> String gender
> }
> def person = new Person(name: 'Alice', age: 1, gender: 'F')
> for (def prop : person.properties) {
> println prop
> }
> {code}
> *3.0.4's output*
> {code:java}
> gender=F
> class=class Person
> age=1
> name=Alice
> {code}
> *pr1306's output*
> {code:java}
> name=Alice
> age=1
> gender=F
> class=class Person
> {code}
> *PULL REQUEST*
> * [https://github.com/apache/groovy/pull/1306]
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)