kbss-cvut / termit

An advanced SKOS terminology manager linking concepts to their definitions in documents
GNU General Public License v3.0
8 stars 9 forks source link

Replace JetBrains annotations with Spring ones #296

Closed ledsoft closed 1 month ago

ledsoft commented 1 month ago

A mix of JetBrains (org.jetbrains.annotations, e.g. @NotNull) and Spring (org.springframework.lang, e.g., @NonNull) is used within TermIt. We need to unify these to the Spring-based ones.

lukaskabc commented 1 month ago

I am looking at the options, and I think we should consider JSpecify annotations.

jakarta.validation.constraints.NotNull is used for bean validation. This should stay unchanged for runtime bean validation.

There are also Nonnull and Nullable from jakarta.annotation that are intended for static analysis.

Spring's @NonNull currently uses Nonnull from the old javax. However, they seem to be planning a migration to JSpecify.

I suggest using JSpecify, too.

https://jspecify.dev/

@ledsoft

IDE configuration

Once this is resolved, it is possible to change the Intellij idea configuration to use desired annotations for code generation instead of the ones from Jetbrains. And it should be mentioned in implementation docs.

https://www.jetbrains.com/help/idea/annotating-source-code.html#nullability-annotations

ledsoft commented 1 month ago

I would actually prefer the standard Jakarta Nonnull. It seems to work with IDEA out of the box and we already depend on Jakarta annotations. Let's put this one on hold, I will ask a friend at Payara what they use.

ledsoft commented 1 month ago

Ok, I suggest going with the standard Jakarta annotations. It requires no additional dependencies and works fine with IDEs without any extra configuration.