Skip to content

Commit 90a9364

Browse files
Marcono1234smowton
authored andcommitted
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.
1 parent 4ef2d15 commit 90a9364

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

java/ql/lib/semmle/code/java/Annotation.qll

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class Annotation extends @annotation, Expr {
136136
* If the annotation element is defined with an array initializer, then the result will be one of the
137137
* elements of that array. Otherwise, the result will be the single expression defined for the value.
138138
*/
139-
Expr getAnArrayValue(string name) { result = getAnArrayValue(name, _) }
139+
Expr getAnArrayValue(string name) { result = getArrayValue(name, _) }
140140

141141
/**
142142
* DEPRECATED: Predicate has been renamed to `getAnArrayValue`
@@ -195,7 +195,7 @@ class Annotation extends @annotation, Expr {
195195
* at the given index of that array. Otherwise, the result will be the single expression defined for
196196
* the value and the `index` will be 0.
197197
*/
198-
Expr getAnArrayValue(string name, int index) {
198+
Expr getArrayValue(string name, int index) {
199199
this.getType().getAnnotationElement(name).getType() instanceof Array and
200200
exists(Expr value | value = this.getValue(name) |
201201
if value instanceof ArrayInit
@@ -206,11 +206,6 @@ class Annotation extends @annotation, Expr {
206206
)
207207
}
208208

209-
/**
210-
* DEPRECATED: Predicate has been renamed to `getAnArrayValue`
211-
*/
212-
deprecated Expr getAValue(string name, int index) { result = getAnArrayValue(name, index) }
213-
214209
override string getAPrimaryQlClass() { result = "Annotation" }
215210
}
216211

0 commit comments

Comments
 (0)