1

Is there a way (except with the IDE) to check the @Nullable Annotation of Spring with the maven compiler plugin? I know with the codechecker framework there is the NullnessChecker for maven. Since we already have Spring(boot) in classpath I would prefer this variant. Does anyone know of an opportunity for Spring @Nullable checker?

Thanks

MelleD
  • 657
  • 1
  • 9
  • 23
  • Possible duplicate of [force maven to fail the build on nonnull violations](https://stackoverflow.com/questions/13291713/force-maven-to-fail-the-build-on-nonnull-violations) – PowerStat Sep 28 '18 at 10:42

1 Answers1

0

There is no way to use the maven compiler plugin for this, because we are talking about annotations here, that would be solved most of the time with Aspects.

I think the solution you are searching for is Hibernate Validator.

Hope that helps.

PowerStat
  • 3,757
  • 8
  • 32
  • 57
  • No this is no runtime feature. It's a compiler feature see springframework.guru/what-is-new-with-spring-framework-5 But currenlty i just found a solution to get warnings for intellij but not with maven – MelleD Sep 27 '18 at 15:50
  • Please also see here https://stackoverflow.com/questions/13484202/how-to-use-nullable-and-nonnull-annotations-more-effectively – PowerStat Sep 28 '18 at 10:40
  • You also could use tools like CheckStyle, PMD and SpotBugs to improve your code quality. – PowerStat Sep 28 '18 at 10:40
  • Also see https://stackoverflow.com/questions/13291713/force-maven-to-fail-the-build-on-nonnull-violations – PowerStat Sep 28 '18 at 10:43
  • Thanks for this posts, but I have already read this articles. Iam asking how the spring developer handle this, because this feature is new for spring 5. And we develop with spring boot, so we would like to use the spring annotation, because they already in our classpath – MelleD Sep 28 '18 at 11:08
  • They added the annotations to the framework, so that the ide's and other tools can use them the verify the calls to spring methods etc. – PowerStat Sep 28 '18 at 11:50
  • That's the question just for the IDE or which other tools. And if there are ways test code can not be checked. – MelleD Sep 28 '18 at 14:07
  • As already said, please have a look at SpotBugs, PMD and CheckStyle. – PowerStat Sep 29 '18 at 07:55