groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Smith <>
Subject Proposal: Change behavior of AST getMemberClassValue() and equivalents
Date Wed, 06 Jan 2021 05:30:44 GMT
Currently, the method AbstractASTTransformation#getMemberClassValue
takes as a parameter a "default value" (parameter defaulted to null),
which is returned if the annotation instance does not provide a value
for that parameter. This means that if an annotation is declared with
a "default Foo.class", that expected default value is not taken into
account, and the value returned to AST transformations is null.

As the core structure of annotations provides for setting a default,
it is exceedingly surprising for the default not to be respected and
to have to be manually resolved by any transformation using it.

I propose that as a breaking change for 4.0, if an annotation provides
a default value and an instance of the annotation does not override
that value, then that default value should be returned by the
getMember*Value methods.

View raw message