NullableAnnotationUtils { public static Optional<AnnotationTree> nonNullAnnotation(ModifiersTree modifiers) { return modifiers.annotations().stream().filter(NullableAnnotationUtils::isNonNullAnnotation).findFirst(); } 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 testNonNullAnnotationOnMetadata() { assertThat(nonNullAnnotation(getSymbol("nullable1").metadata())).isNull(); assertThat(nonNullAnnotation(getSymbol("nullable6").metadata())).isNull(); assertThat(nonNullAnnotation(getSymbol("nonnull1").metadata())).isEqualTo("javax.annotation.Nonnull"); }
@Test void testNonNullAnnotationOnSymbol() { assertThat(nonNullAnnotation(getSymbol("nullable1"))).isNull(); assertThat(nonNullAnnotation(getSymbol("nullable6"))).isNull(); assertThat(nonNullAnnotation(getSymbol("nonnull1"))).isEqualTo("javax.annotation.Nonnull"); }