checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

Annotation not found in provided JUnit5 stub file

Open joe-mojo opened this issue 1 year ago • 0 comments

Working with checker-framework 3.48.4. When configuring checker framework ti use provided JUnit5 stub (junit-assertions.astub), I have the following warning: junit-assertions.astub:(line 56,col 2): Unknown annotation @EnsuresNonNull("#1"). Aside this warning, because the @EnsuresNonNull("#1") on assertNonNull is "not known", assertNonNull are not considered as ensuring non-nullness and my tests are not compiling.

I tried to copy the file in my project's resource folder, and specifying this folder in annotation processor -Astubs argument, and added the following missing import: import org.checkerframework.checker.nullness.qual.EnsuresNonNull; ...but I get the same waning.

The warning is triggered by line 56 though my modified stub has the @EnsuresNonNull("#1") on line 57 because of the newly inserted import.

Thus :

  • I failed to override JUnit5 stub location, annotation processor is obviously working with embedded junit-assertions.astub instead of mine
  • an import is missing in JUnit5 stub; we sould insert import org.checkerframework.checker.nullness.qual.EnsuresNonNull; at line 13.

joe-mojo avatar Jan 22 '25 16:01 joe-mojo