Open vorburger opened 3 weeks ago
FWIW, the Checker Framework groups (EISOP + Typetools) are trying to move off JavaParser IIUC, as they've had issues:
Their likely replacement is https://github.com/plume-lib/javac-parse/blob/main/src/main/java/org/plumelib/javacparse/JavacParse.java, which contains the same basic boilerplate as various similar tools use (example).
As for reflection: If you can actually compile the annotated Java sources, then that could work fine AFAIK. (Maybe bugs around type annotations are more likely for reflection than for build tools, but I don't know. I at least doubt you'd have significant issues for annotations on "root" locations (e.g., fields and method return types, as opposed to type arguments inside those).) I think we ended up with our approach in part because we were interested in annotations for the JDK, which might be trickier to build? I don't actually remember the details of that discussion, if even I heard most of them in the first place. (I do think that trying to do the job with only a "parser" is a bit sketchy: You really want the deps of the classes to be available, I think. But apparently they mostly get away with it.)
A couple of thoughts / questions.
null
and never return null
. So, even when adopting NullAway, you may not observe issues related to the third-party libraries (since the issues are likely to be missed errors, not false positives).astubx
as part of our efforts to consume the https://github.com/jspecify/jdk annotations in NullAway. (We are using JavaParser for now.) Once we're done we could put that code in a separate Maven artifact and perhaps you could re-use it for other libraries.
The goal of this issue would be to explore hacking a converter from annotated Java sources to a NullAway LibraryModels generator MVP POC.
Use case / application would be for / driven by https://github.com/enola-dev/enola/issues/845 (and possibly also using NullAway e.g. for my https://github.com/vorburger/ch.vorburger.exec or https://github.com/vorburger/ch.vorburger.fswatch or https://github.com/MariaDB4j/MariaDB4j).
Approach/steps planned would be to:
.java
, in a TBD https://github.com/lastnpe/jspecify-null-external-annotations-augmentshttps://github.com/javaparser/javaparser, and/or it's apparent (?) fork https://github.com/eisop/stubparser, used by (?) https://github.com/typetools/annotation-tools may be of interest - although I don't yet fully understand if any of that is even needed... what's wrong with plain simple Java reflection?!
Re. https://github.com/uber/NullAway/issues/1024
/CC @cpovirk FYI