NullableAnnotationUtils { public static boolean isAnnotatedNonNull(Symbol symbol) { if (isAnnotatedNullable(symbol.metadata())) { return false; } return isUsingNonNull(symbol) || collectMetaAnnotations(symbol.metadata()).stream().anyMatch(NullableAnnotationUtils::isUsingNonNull); } 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 testIsAnnotatedNonNull() { Symbol foo = getSymbol("foo"); assertThat(isAnnotatedNonNull(foo)).isFalse(); getSymbols("nonnull").forEach(s -> { assertThat(isAnnotatedNonNull(s)).as(s.name() + " should be recognized as Nonnull.").isTrue(); assertThat(isAnnotatedNullable(s.metadata())).as(s.name() + " should NOT be recognized as Nullable.").isFalse(); }); assertThat(isAnnotatedNonNull(getSymbol("nullable6"))).isFalse(); assertThat(isAnnotatedNonNull(getSymbol("nullable7"))).isFalse(); }