-
Notifications
You must be signed in to change notification settings - Fork 299
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
JSpecify: support a generic method call with explicit type arguments #1035
Comments
Hi @beatbrot thanks for the report. We currently have no support for generic methods in JSpecify mode, only generic classes. See further details here: https://github.com/uber/NullAway/wiki/JSpecify-Support We are actively working on this and hope to have more support within the next few months. I will update this issue when something is implemented. |
…e arguments at calls) (#1053) - [ ] Added support for generic identity functions with explicitly-typed nullness. - [ ] Related to the issue #1035. - [ ] void genericNonNullIdentityFunction() and void genericNullAllowingIdentityFunction() unit tests are added to GenericMethodTests.java file. --------- Co-authored-by: Manu Sridharan <[email protected]>
I'm happy to report that with the latest fixes from @haewiful the test case in this issue now passes in JSpecify mode! See #1074. Note that the test only passes with an explicit type argument at the call. I'm going to close this issue with that test, and open a new issue for supporting inference so that the type argument need not be written. |
According to the JSpecify Spec, it is possible to add
extends @Nullable Object
to type parameters to siginify thatT
can be a nullable type.Consider the following sample:
According to JSpecify Spec, this is valid since the call to
foo
inmain
explicitly specifies the type parameterT
as nullable Object. The JSpecify Reference Checker also accepts this.NullAway however falsly gives us the following error without JSpecifyMode:
And this error with JSpecifyMode:
This issue seems similar to #660 and others, but I feel like my example gives a proper way to verify that this is a Bug and that the Bug would be resolved if my sample compiles.
The text was updated successfully, but these errors were encountered: