Java: Rename Annotation.getAnArrayValue with index

As mentioned by smowton during review, the predicate only has a single result
due to being restricted by the index and therefore its name should not start
with "getA...".

Also remove deprecated `getAValue(string, int)` because it never existed on
the `main` branch.
This commit is contained in:
Marcono1234
2022-03-28 00:34:35 +02:00
committed by Chris Smowton
parent 4ef2d156c4
commit 90a9364b00

View File

@@ -136,7 +136,7 @@ class Annotation extends @annotation, Expr {
* If the annotation element is defined with an array initializer, then the result will be one of the
* elements of that array. Otherwise, the result will be the single expression defined for the value.
*/
Expr getAnArrayValue(string name) { result = getAnArrayValue(name, _) }
Expr getAnArrayValue(string name) { result = getArrayValue(name, _) }
/**
* DEPRECATED: Predicate has been renamed to `getAnArrayValue`
@@ -195,7 +195,7 @@ class Annotation extends @annotation, Expr {
* at the given index of that array. Otherwise, the result will be the single expression defined for
* the value and the `index` will be 0.
*/
Expr getAnArrayValue(string name, int index) {
Expr getArrayValue(string name, int index) {
this.getType().getAnnotationElement(name).getType() instanceof Array and
exists(Expr value | value = this.getValue(name) |
if value instanceof ArrayInit
@@ -206,11 +206,6 @@ class Annotation extends @annotation, Expr {
)
}
/**
* DEPRECATED: Predicate has been renamed to `getAnArrayValue`
*/
deprecated Expr getAValue(string name, int index) { result = getAnArrayValue(name, index) }
override string getAPrimaryQlClass() { result = "Annotation" }
}