typetools / checker-framework

Pluggable type-checking for Java
http://checkerframework.org/
Other
1.03k stars 355 forks source link

consider a more statically typed stub alternative #4611

Open xenoterracide opened 3 years ago

xenoterracide commented 3 years ago

due to incompatibilities between nullaway and checkerframework I find myself forced to choose between them. Currently, I haven't decided. However, it would appear that the stubs alternative for nullaway is a bit more statically typed, I suspect one could even go a bit further, more compile-time safety would be nice, especially given #4586 and whatever problem where the stub isn't being used in https://github.com/typetools/checker-framework/issues/4587#issuecomment-829263699

https://github.com/uber/NullAway/blob/master/sample-library-model/src/main/java/com/uber/modelexample/ExampleLibraryModels.java

mernst commented 3 years ago

Thanks for the suggestion.

Since every Java file is a stub file, you can run javac on your stub files to detect mistakes in them. I think that would address your concern. (The places where stub files are allowed to deviate from legal Java is intended to permit users to write more compact files.)

Or, you can use ajava files which must be valid Java files, though they are not really intended for users to write.