[ 
https://issues.apache.org/jira/browse/GROOVY-12030?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King updated GROOVY-12030:
-------------------------------
    Description: 
h2. Summary

Graduates {{groovy.transform.options.PropertyHandler}} from {{@Incubating}} to 
stable, documents the previously-implicit contract, corrects a latent bug in 
{{isValidAttribute}}, and adds a custom-handler test to lock the public 
extension contract in place.

h3. Changes

* *Graduation*: removed {{@Incubating}} from {{PropertyHandler}}. The concrete 
subclasses ({{DefaultPropertyHandler}}, {{ImmutablePropertyHandler}}, 
{{LegacyHashMapPropertyHandler}}) and the activation annotation 
{{@PropertyOptions}} were already unmarked; the abstract base was the lone 
outlier.
* *Contract documented*: javadoc on the base class now records the lifecycle 
ordering ({{validateAttributes}} → {{validateProperties}} → 
{{createPropInit}}/{{createPropGetter}}/{{createPropSetter}}), the public 
no-argument constructor required of custom handlers, the null-return semantics 
of {{createPropInit}}, the rejection-on-presence semantics of 
{{isValidAttribute}}, and the error behaviour of {{createPropertyHandler}} when 
a handler cannot be loaded.
* *Parameter rename*: {{createPropInit}}'s abstract parameter renamed from 
{{namedArgMap}} to {{namedArgsMap}} to match all three concrete subclasses.
* *Dead code*: stale commented-out call removed from 
{{DefaultPropertyHandler.validateAttributes}}.
* *isValidAttribute correction*: switched the presence check from 
{{xform.getMemberValue(anno, memberName) != null}} to 
{{anno.getMember(memberName) != null}}. 
{{AbstractASTTransformation.getMemberValue}} is documented as returning 
{{null}} for any member that is not a {{ConstantExpression}}, so list-, class-, 
nested-annotation-, and closure-valued attributes were silently passing 
validation. The only in-tree caller ({{ImmutablePropertyHandler}} rejecting the 
boolean {{useSuper}}) is unaffected.
* *Test*: added {{groovy/transform/options/PropertyHandlerTest}} covering 
custom-handler initialisation, attribute rejection via a list-valued attribute 
(which also locks the correction above in place), and the 
no-{{@PropertyOptions}} fallback path.

h3. Compatibility

* Parameter rename is source- and binary-compatible (Java does not require 
parameter-name agreement between abstract methods and their overrides).
* The {{isValidAttribute}} correction widens detection; no in-tree consumer 
relies on the previous silent-pass behaviour.

> Graduate PropertyHandler from incubating to stable
> --------------------------------------------------
>
>                 Key: GROOVY-12030
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12030
>             Project: Groovy
>          Issue Type: Task
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> h2. Summary
> Graduates {{groovy.transform.options.PropertyHandler}} from {{@Incubating}} 
> to stable, documents the previously-implicit contract, corrects a latent bug 
> in {{isValidAttribute}}, and adds a custom-handler test to lock the public 
> extension contract in place.
> h3. Changes
> * *Graduation*: removed {{@Incubating}} from {{PropertyHandler}}. The 
> concrete subclasses ({{DefaultPropertyHandler}}, 
> {{ImmutablePropertyHandler}}, {{LegacyHashMapPropertyHandler}}) and the 
> activation annotation {{@PropertyOptions}} were already unmarked; the 
> abstract base was the lone outlier.
> * *Contract documented*: javadoc on the base class now records the lifecycle 
> ordering ({{validateAttributes}} → {{validateProperties}} → 
> {{createPropInit}}/{{createPropGetter}}/{{createPropSetter}}), the public 
> no-argument constructor required of custom handlers, the null-return 
> semantics of {{createPropInit}}, the rejection-on-presence semantics of 
> {{isValidAttribute}}, and the error behaviour of {{createPropertyHandler}} 
> when a handler cannot be loaded.
> * *Parameter rename*: {{createPropInit}}'s abstract parameter renamed from 
> {{namedArgMap}} to {{namedArgsMap}} to match all three concrete subclasses.
> * *Dead code*: stale commented-out call removed from 
> {{DefaultPropertyHandler.validateAttributes}}.
> * *isValidAttribute correction*: switched the presence check from 
> {{xform.getMemberValue(anno, memberName) != null}} to 
> {{anno.getMember(memberName) != null}}. 
> {{AbstractASTTransformation.getMemberValue}} is documented as returning 
> {{null}} for any member that is not a {{ConstantExpression}}, so list-, 
> class-, nested-annotation-, and closure-valued attributes were silently 
> passing validation. The only in-tree caller ({{ImmutablePropertyHandler}} 
> rejecting the boolean {{useSuper}}) is unaffected.
> * *Test*: added {{groovy/transform/options/PropertyHandlerTest}} covering 
> custom-handler initialisation, attribute rejection via a list-valued 
> attribute (which also locks the correction above in place), and the 
> no-{{@PropertyOptions}} fallback path.
> h3. Compatibility
> * Parameter rename is source- and binary-compatible (Java does not require 
> parameter-name agreement between abstract methods and their overrides).
> * The {{isValidAttribute}} correction widens detection; no in-tree consumer 
> relies on the previous silent-pass behaviour.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to