0

In the library spring-core in the file NonNull.java (spring core lang) is the following:

import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierNickname;

But when I use Spring boot app, I cannot see any library inside my fat JAR which defines such annotations. And I do not think that they are part of Java 17. Still my application which uses @NonNull annotation works. How it is possible? Am I missing something? EDITED: It seems to me, that it is possible to create annotation A in package A referencing to another annotation B in package B and does not have runtime dependency on library which defines B.

kulatamicuda
  • 1,603
  • 2
  • 21
  • 40

1 Answers1

0

These annotations are processed at compile time, you don't need any code at runtime for them. You can check their retention policy.

More details in this other question.

JavaDoc for annotation retention

m0skit0
  • 25,268
  • 11
  • 79
  • 127