Skip to content

Java: Wildcard reports implicit Object as bound #5405

@Marcono1234

Description

@Marcono1234

The class Wildcard reports Object as bound when it has no bounds; this creates inconsistencies and renders some predicates useless:

  • hasTypeBound() (inherited from BoundedType) apparently always holds
  • hasTypeBound() is inconsistent with TypeVariable.hasTypeBound() which only holds for explicit bounds
  • It is inconistent with WildcardTypeAccess which only considers explicit bounds (though it could not report the implicit bound anyways since it is not an Expr)

Therefore it would be good to change Wildcard in the following ways:

  • hasTypeBound() should only hold if an explicit bound is present
  • getUpperBound() should only have an explicit bound as result (currently it has the implicit Object bound as result)

hasUpperBound() can probably remain as is.

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