NullableAnnotationUtils { public static boolean isAnnotatedNullable(SymbolMetadata metadata) { return isUsingNullable(metadata) || collectMetaAnnotations(metadata).stream().map(Symbol::metadata).anyMatch(NullableAnnotationUtils::isUsingNullable); } private  NullableAnnotationUtils(); static Optional<AnnotationTree> nullableAnnotation(ModifiersTree modifiers); static Optional<AnnotationTree> nonNullAnnotation(ModifiersTree modifiers); static boolean isAnnotatedNullable(SymbolMetadata metadata); static boolean isAnnotatedNonNull(Symbol symbol); static boolean isAnnotatedWithStrongNullness(SymbolMetadata metadata); @CheckForNull static String nonNullAnnotation(SymbolMetadata metadata); @CheckForNull static String nonNullAnnotation(Symbol symbol); static boolean isGloballyAnnotatedParameterNullable(Symbol.MethodSymbol method); static boolean isGloballyAnnotatedParameterNonNull(Symbol.MethodSymbol method); @CheckForNull static String nonNullAnnotationOnParameters(Symbol.MethodSymbol method);  }
@Test void testIsAnnotatedNullable() { Symbol foo = getSymbol("foo"); assertThat(isAnnotatedNullable(foo.metadata())).isFalse(); getSymbols("nullable").forEach(s -> { assertThat(isAnnotatedNullable(s.metadata())).as(s.name() + " should be recognized as Nullable.").isTrue(); assertThat(isAnnotatedNonNull(s)).as(s.name() + " should NOT be recognized as Nonnull.").isFalse(); }); }