Skip to content
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

In generics code, get rid of checks for ClassType #861

Closed
msridhar opened this issue Nov 15, 2023 · 0 comments · Fixed by #863
Closed

In generics code, get rid of checks for ClassType #861

msridhar opened this issue Nov 15, 2023 · 0 comments · Fixed by #863
Assignees
Labels
jspecify Related to support for jspecify standard (see jspecify.dev)

Comments

@msridhar
Copy link
Collaborator

There are various places in GenericsChecks that we only perform checks for ClassTypes, e.g.:

if (lhsType instanceof Type.ClassType && rhsType instanceof Type.ClassType) {

if (formalReturnType instanceof Type.ClassType
&& returnExpressionType instanceof Type.ClassType) {
boolean isReturnTypeValid =

I don't think these checks are needed, and in fact we may miss issues (e.g., if both types are array types and inside there are nested type arguments with mismatched nullability). We should remove these checks and add corresponding tests.

@msridhar msridhar added the jspecify Related to support for jspecify standard (see jspecify.dev) label Nov 15, 2023
msridhar added a commit that referenced this issue Dec 5, 2023
Removing unnecessary checks performed for ClassType in
GenericChecks.java in reference to issue #861. Added some null checks
since some of the checks for ClassType were also indirectly checking for
nullability and hence removing them entirely cause the test rawTypes to
crash.

Fixes #861

---------

Co-authored-by: Manu Sridharan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jspecify Related to support for jspecify standard (see jspecify.dev)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants