In Java, why @Nullable has a temporary rental

As the name says, with @Nullable and @Nonull can help you avoid catch or linter errors at compile time, but why does it have a timeout for execution?

+4
source share
1 answer

Presumably, persistence at run time allowed the AOP proxy to detect null arguments passed to the @Nonnull-annotated parameter and throw an exception or otherwise handle it. You could argue that this is the best way to handle runtime checks using explicit null code verification.

Yes, these annotations are very useful for statically checking compilation, but there is no reason why they could not be used at run time for the same purpose. Their validity as annotations extends to the runtime domain, in contrast to annotations that are used for things like code generation.

+4
source

All Articles