paulk-asert opened a new pull request, #3006:
URL: https://github.com/apache/groovy/pull/3006
…rame checking; @Modifies({}) is rejected
There was no working way to declare that a method modifies nothing. An empty
list left no metadata on the method, so ModifiesChecker and the @Ensures
old-reference validation both treated it as if the method had no @Modifies at
all. An empty closure was rejected, and a bare @Modifies compiled with nothing
checked because the transform overwrote the missing value member.
@Modifies({}) and @Modifies({ [] }) now declare an empty frame. The metadata
is stored even when empty, so an empty frame is distinguishable from no
annotation: ModifiesChecker rejects field writes, @Ensures may not reference
old.<field>, and a this-call to such a method is safe rather than of unknown
effect. A bare @Modifies is a compile error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]