-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stubs missing imports produce unclear errors #2059
Comments
Can you try adding
This should give you a warning about the unknown |
Thanks for the response. I added "-AstubWarnIfNotFound" and see warnings for other locations in our code base, but nothing referencing @nonnull, Constructor, newInstance, or java.lang.reflect. There are no new warnings between the output when I comment out/uncomment the NonNull import though there is an unclear "error: [assignment.type.incompatible] incompatible types in assignment" when the import is commented out. |
Just wanted to check in on this to see if there's anything else I should try. Please let me know, thanks. |
Pull request #2072 should fix this. |
Was able to verify this fix on our build infrastructure. Thanks! |
Checker Framework version 2.5.2
We wanted to add a stub to our codebase that would annotate java.lang.reflect.Constructor in keeping with the Checker-Framework stubs version and the related issue below
#1365
Checker Framework stubs:
https://github.com/typetools/checker-framework/blob/460863bf1612581de76a783b4ad254b816bfe8b7/checker/jdk/nullness/src/java/lang/reflect/Constructor.java
I overlooked to add the @nonnull import to the stub. Static analysis tests that reference the stub below will compile and run, but will produce unusual errors ([assignment.type.incompatible], [return.type.incompatible], [type.argument.type.incompatible]) in classes that reference this stub that don't make it apparent that the real issue is a missing import.
It would be great to receive more clear messages for cases where stubs are missing imports.
Please let me know if other information is needed, thanks.
The text was updated successfully, but these errors were encountered: