2

I'm building a parser using Antlr 4.8, and the @NotNull annotation is marked as deprecated:

org.antlr.v4.runtime.misc Annotation Type NotNull Deprecated. THIS IS HERE FOR BACKWARD COMPATIBILITY WITH 4.5 ONLY. It will disappear in 4.6+

I have searched but haven't found any documentation on what would replace this annotation. Obviously it hasn't disappeared in 4.6+, but I'd like to avoid issues as I move to new versions of Antlr.

Anyone know if there is a replacement for this annotation?

Andrew Cheong
  • 29,362
  • 15
  • 90
  • 145
Ramesh
  • 613
  • 1
  • 10
  • 28

2 Answers2

0

You can use @NonNull via

import org.checkerframework.checker.nullness.qual.NonNull;

Here's the import if you're using Maven:

<dependency>
    <groupId>org.checkerframework</groupId>
    <artifactId>checker-qual</artifactId>
    <version>2.10.0</version>
</dependency>
Andrew Cheong
  • 29,362
  • 15
  • 90
  • 145
0

Since you say you are using Antler 4.8 for your project, you'll want to set the version of the antlr4-maven-plugin that you are using to version 4.8.

Setting it to 4.6 also got rid of the error, but really I think it makes sense to keep the antlr plugin and runtime at the same version.

Chris
  • 342
  • 1
  • 12