Skip to content

Commit 54985a6

Browse files
committed
Java: Extend Annotation.isATargetType documentation
1 parent 5a12f64 commit 54985a6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ class AnnotationType extends Interface {
383383

384384
/**
385385
* Gets the retention policy of this annotation type, that is, the name of one of the
386-
* enum constants of `java.lang.annotation.RetentionPolicy`. If no explicit retention
387-
* policy is specified the result is `CLASS`.
386+
* enum constants of `java.lang.annotation.RetentionPolicy`. If this annotation type
387+
* has no `@Retention` annotation, the result is `CLASS`.
388388
*/
389389
string getRetentionPolicy() {
390390
if this.getADeclaredAnnotation() instanceof RetentionAnnotation
@@ -397,8 +397,13 @@ class AnnotationType extends Interface {
397397
/**
398398
* Holds if the element type is a possible target for this annotation type.
399399
* The `elementType` is the name of one of the `java.lang.annotation.ElementType`
400-
* enum constants. If no explicit target is specified for this annotation type
401-
* it is considered to be applicable in all declaration contexts.
400+
* enum constants.
401+
*
402+
* If this annotation type has no `@Target` annotation, it is considered to be applicable
403+
* in all declaration contexts. This matches the behavior of the latest Java versions
404+
* but differs from the behavior of older Java versions. This predicate must only be
405+
* called with names of `ElementType` enum constants; for other values it might hold
406+
* erroneously.
402407
*/
403408
bindingset[elementType]
404409
predicate isATargetType(string elementType) {

0 commit comments

Comments
 (0)