aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉamonn McManus <emcmanus@google.com>2023-06-12 09:52:57 -0700
committerGoogle Java Core Libraries <java-libraries-firehose+copybara@google.com>2023-06-12 09:53:37 -0700
commit0fd34f245142469c515d204b8d2f2eba538f5d4c (patch)
treee3883ccc49854e5286c997742c8ace5493a236ce
parentb2a1c08859fe4974ffcdad85623afd28d41b5d43 (diff)
downloadauto-0fd34f245142469c515d204b8d2f2eba538f5d4c.tar.gz
Change the return type of `AnnotationMirrors.getAnnotatedAnnotations`.
The current type is `ImmutableSet<? extends AnnotationMirror>`. The wildcard serves no real purpose, especially since there are no standard subtypes of `AnnotationMirror`. It just means extra typing for people who want to assign the returned value to an explicitly-typed variable. This change should be both binary- and source-compatible. Erasure means that the JVM signature is unchanged. `ImmutableSet<AnnotationMirror>` is assignable to `ImmutableSet<? extends AnnotationMirror>` so callers that were expecting the old type should also be able to handle the new one. RELNOTES=The return type of `AnnotationMirrors.getAnnotedAnnotations` is now `ImmutableSet<AnnotationMirror>` rather than `ImmutableSet<? extends AnnotationMirror>`. PiperOrigin-RevId: 539683468
-rw-r--r--common/src/main/java/com/google/auto/common/AnnotationMirrors.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/src/main/java/com/google/auto/common/AnnotationMirrors.java b/common/src/main/java/com/google/auto/common/AnnotationMirrors.java
index 2f59dd39..47169fb5 100644
--- a/common/src/main/java/com/google/auto/common/AnnotationMirrors.java
+++ b/common/src/main/java/com/google/auto/common/AnnotationMirrors.java
@@ -159,7 +159,7 @@ public final class AnnotationMirrors {
* Returns all {@linkplain AnnotationMirror annotations} that are present on the given {@link
* Element} which are themselves annotated with {@code annotationClass}.
*/
- public static ImmutableSet<? extends AnnotationMirror> getAnnotatedAnnotations(
+ public static ImmutableSet<AnnotationMirror> getAnnotatedAnnotations(
Element element, Class<? extends Annotation> annotationClass) {
String name = annotationClass.getCanonicalName();
if (name == null) {
@@ -172,7 +172,7 @@ public final class AnnotationMirrors {
* Returns all {@linkplain AnnotationMirror annotations} that are present on the given {@link
* Element} which are themselves annotated with {@code annotation}.
*/
- public static ImmutableSet<? extends AnnotationMirror> getAnnotatedAnnotations(
+ public static ImmutableSet<AnnotationMirror> getAnnotatedAnnotations(
Element element, TypeElement annotation) {
return element.getAnnotationMirrors().stream()
.filter(input -> isAnnotationPresent(input.getAnnotationType().asElement(), annotation))
@@ -184,7 +184,7 @@ public final class AnnotationMirrors {
* Element} which are themselves annotated with an annotation whose type's canonical name is
* {@code annotationName}.
*/
- public static ImmutableSet<? extends AnnotationMirror> getAnnotatedAnnotations(
+ public static ImmutableSet<AnnotationMirror> getAnnotatedAnnotations(
Element element, String annotationName) {
return element.getAnnotationMirrors().stream()
.filter(input -> isAnnotationPresent(input.getAnnotationType().asElement(), annotationName))