1

We've been using the Eclipse @NonNull and @Nullable annotations in our big Java app for a while. I'm trying to setup a new project in eclipse to use them - but can't seem to get the same results. (Note: Previous projects were setup by somebody that no longer works here.)

The new project is in the same workspace as the old one, using the same java 11 compiler defined for eclipse. (which has the annotation directory set.) The major difference is that the new project is a springboot application. The annotations work - but it doesn't seem to be reading the .eaa files.

Things like references to org.apache.logging.log4j.LogManager.getLogger(), which is annotated as returning a @NonNull in our existing projects, is NOT annotated in the new project - so we get a Null type Safety warning.

Any suggestions on which obvious step I'm missing?

CasaDelGato
  • 603
  • 7
  • 17
  • Have you followed the project setup steps described in the help - https://help.eclipse.org/2021-03/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/task-using_external_null_annotations.htm – greg-449 Jun 03 '21 at 08:38
  • as far as I can tell, yes, I've done all that. Since this is gradle/spring app, I also attached the external annotations to the jre in the build path. That does seem to have helped - but I'm not seeing the exact same results as in other projects. At least it's working mostly now. – CasaDelGato Jun 03 '21 at 21:47
  • I've also noticed that some of the code is using org.springframework.lang.nonnull instead of org.eclipse.jdt.annotation.NonNull. I see that this kind-of works but doesn't appear to use the .eaa files to annotate the runtime libraries. Eclipse doesn't mark the conflicts as Warnings with a yellow marker. Instead, SonarLint marks them with faint blue warnings which will need to be turned on in the Overview bar as well. – CasaDelGato Jun 03 '21 at 21:54
  • I did figure out more of this. The Swing annotations are for runtime checking of NonNull. The Eclipse annotations are for Compile time checking. We FAR prefer Compile time, as I'd rather not have a Customer find the problem. – CasaDelGato Jul 01 '21 at 17:35

0 Answers0