Class BoundedReferenceType

All Implemented Interfaces:
AnnotatedElement, Traceable, TypeVariableDeclaringElement

public class BoundedReferenceType extends ReferenceType
A BoundedReferenceType is the result of a generics wildcard expression ? extends String, ? super Foo etc.. The "signature" for a bounded reference type follows the generic signature specification in section 4.4 of JVM spec: *,+,- plus signature strings. The bound may be a type variable (e.g. ? super T)
Author:
Adrian Colyer, Andy Clement
  • Field Details

  • Constructor Details

    • BoundedReferenceType

      public BoundedReferenceType(ReferenceType aBound, boolean isExtends, World world)
    • BoundedReferenceType

      public BoundedReferenceType(ReferenceType aBound, boolean isExtends, World world, ReferenceType[] additionalInterfaces)
    • BoundedReferenceType

      protected BoundedReferenceType(String signature, String erasedSignature, World world)
      only for use when resolving GenericsWildcardTypeX or a TypeVariableReferenceType
    • BoundedReferenceType

      public BoundedReferenceType(World world)
      Constructs the BoundedReferenceType representing an unbounded wildcard '?'. In this situation the signature is '*' and the erased signature is Ljava/lang/Object;
  • Method Details

    • getUpperBound

      public UnresolvedType getUpperBound()
    • getLowerBound

      public UnresolvedType getLowerBound()
    • getAdditionalBounds

      public ReferenceType[] getAdditionalBounds()
    • parameterize

      public UnresolvedType parameterize(Map<String,​UnresolvedType> typeBindings)
      Description copied from class: ResolvedType
      Iff I am a parameterized type, and any of my parameters are type variable references (or nested parameterized types), return a version with those type parameters replaced in accordance with the passed bindings.
      Overrides:
      parameterize in class ResolvedType
    • getSignatureForAttribute

      public String getSignatureForAttribute()
      Overrides:
      getSignatureForAttribute in class ReferenceType
    • hasLowerBound

      public boolean hasLowerBound()
    • isExtends

      public boolean isExtends()
    • isSuper

      public boolean isSuper()
    • isUnbound

      public boolean isUnbound()
    • alwaysMatches

      public boolean alwaysMatches(ResolvedType aCandidateType)
    • canBeCoercedTo

      public boolean canBeCoercedTo(ResolvedType aCandidateType)
    • getSimpleName

      public String getSimpleName()
      Overrides:
      getSimpleName in class UnresolvedType
    • getDeclaredInterfaces

      public ResolvedType[] getDeclaredInterfaces()
      Description copied from class: ReferenceType
      Find out from the generic signature the true signature of any interfaces I implement. If I am parameterized, these may then need to be parameterized before returning.
      Overrides:
      getDeclaredInterfaces in class ReferenceType
    • isGenericWildcard

      public boolean isGenericWildcard()
      Overrides:
      isGenericWildcard in class UnresolvedType