Question

When I compile my code with The Checker Framwork it complains:

incompatible types in argument.
  found   : null
  required: @NonNull String

for the first argument of:

ResultSet rs = connection.getMetaData().getColumns(null, schemaName, tableName, null)

I know that DatabaseMetadata.getColumns() allows a null catalog (the first argument). How do I tell the Checker Framework as much?

Was it helpful?

Solution

As Gili answered, you can use stub-files but, if you find a missing/incorrect annotation in the JDK, please report it to the Checker Framework mailing list checker-framework-discuss@googlegroups.com or report it as an issue in the issue tracker.

With each release, an Annotated JDK is bundled with the Checker Framework. It is used solely to retrieve annotations for common methods in the JDK. It is used automatically when you use the Checker Framework.

This annotation has been included since of Checker Framework release 1.8.0.

OTHER TIPS

I'm not familiar with that framework; does it respect @SuppressWarnings in the context you're interested in?

https://checkerframework.org/manual/#suppressing-warnings-nullness

In section Annotating Libraries the authors write you can either provide stub-files or rewrite the class files in question.

I ended up using stub files as they seemed easier to get started with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top