문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top