Skip to content

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

Open
@Marcono1234

Description

@Marcono1234

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)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions