Java: Deprecate error-prone and rarely used annotation predicates

This commit is contained in:
Marcono1234
2022-03-28 00:22:18 +02:00
committed by Chris Smowton
parent e3c1b96830
commit 4ef2d156c4
4 changed files with 19 additions and 12 deletions

View File

@@ -45,12 +45,18 @@ class Annotation extends @annotation, Expr {
}
/**
* DEPRECATED: Getting the value of _any_ annotation element is error-prone because
* it could lead to selecting the value of the wrong element by accident (for example
* when an annotation type is extended in the future). Prefer the predicate `getValue(string)`
* and explicitly specify the element name. Use `getValue(_)` if it is really desired to
* get the value of any element.
*
* Gets a value of an annotation element. This includes default values in case
* no explicit value is specified. For elements with an array value type this
* might have an `ArrayInit` as result. To properly handle array values, prefer
* the predicate `getAnArrayValue`.
*/
Expr getAValue() { filteredAnnotValue(this, _, result) }
deprecated Expr getAValue() { filteredAnnotValue(this, _, result) }
/**
* Gets the value of the annotation element with the specified `name`.