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

[Java] WildcardTypeAccess.hasNoBound() returns wrong result for array bounds #4005

Open
Marcono1234 opened this issue Aug 2, 2020 · 0 comments · May be fixed by #5407
Open

[Java] WildcardTypeAccess.hasNoBound() returns wrong result for array bounds #4005

Marcono1234 opened this issue Aug 2, 2020 · 0 comments · May be fixed by #5407
Labels
question Further information is requested

Comments

@Marcono1234
Copy link
Contributor

Marcono1234 commented Aug 2, 2020

WildcardTypeAccess.hasNoBound() returns for wildcards bounded by an array type, that they have no bound.
Example query:

import java

from WildcardTypeAccess w
where
  exists (w.getUpperBound())
  and w.hasNoBound()
select w

Query console link

The issue appears to be that this predicate only checks for TypeAccess children, however ArrayTypeAccess is not a subclass of TypeAccess:

/** Holds if this wildcard is not bounded by any type bounds. */
predicate hasNoBound() { not exists(TypeAccess t | t.getParent() = this) }

Maybe it would suffice checking that any child expression at index 0 or 1 exists (or would that also match annotations somehow)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant