Class CaptureBound

java.lang.Object
de.monticore.types3.generics.bounds.Bound
de.monticore.types3.generics.bounds.CaptureBound
All Implemented Interfaces:
Comparable<Bound>

public class CaptureBound extends Bound
A bound representing that a given type will be capture converted later. This is required, as one cannot capture convert types that have inference variables. The only SymType-kinds applicable are generics and functions, as their symbols can have type parameters.
  • Field Details

  • Constructor Details

  • Method Details

    • getPlaceHolder

      public SymTypeExpression getPlaceHolder()
    • getToBeCaptured

      public SymTypeExpression getToBeCaptured()
    • isCaptureBound

      public boolean isCaptureBound()
      Overrides:
      isCaptureBound in class Bound
    • asCaptureBound

      public CaptureBound asCaptureBound()
      Overrides:
      asCaptureBound in class Bound
    • deepEquals

      public boolean deepEquals(Bound other)
      Specified by:
      deepEquals in class Bound
    • print

      public String print()
      Description copied from class: Bound
      returns a human-readable String, e.g., for the log
      Specified by:
      print in class Bound
    • getIncludedTypes

      public List<SymTypeExpression> getIncludedTypes()
      Description copied from class: Bound
      Helper function;
      Specified by:
      getIncludedTypes in class Bound
      Returns:
      the types included in the bounds (most have two).
    • getInferenceVariables

      public List<SymTypeInferenceVariable> getInferenceVariables()
      returns the inference variables created for this bound, e.g., for bound G<a1,a2> = capture(G<A1,A2>), this will return [a1,a2]. s. Java Spec 21 5.1.10. They include the implied bounds according to Java Spec 21 18.1.3.
    • getTypeArguments

      public List<SymTypeExpression> getTypeArguments()
      returns the type arguments to be captured for this bound, e.g., for bound G<a1,a2> = capture(G<A1,A2>), this will return [A1,A2].
    • getTypeParameters

      public List<SymTypeVariable> getTypeParameters()
      returns the type parameters of the declared type e.g., for bound G<a1,a2> = capture(G<A1,A2>) with G declared with type parameters [P1,P2], this will return [P1,P2].
    • getModifiedDeclaredBounds

      public List<SymTypeExpression> getModifiedDeclaredBounds()
      returns the declared bounds with the type parameters replaced by the inference variables, e.g., for bound G<a1,a2> = capture(G<A1,A2>) with G declared with type parameters [P1,P2] and corresponding (upper) bounds [B1,B2], this will return [B1,B2][P1:=a1,P2:=a2]. S. Java Spec 21 18.3.2
    • getTypeParameter2InferenceVarMap

      public Map<SymTypeVariable,SymTypeInferenceVariable> getTypeParameter2InferenceVarMap()
      returns the mapping from type parameters to inference variables e.g., for bound G<a1,a2> = capture(G<A1,A2>) with G declared with type parameters [P1,P2], this will return [P1:=a1,P2:=a2]. S. Java Spec 21 18.3.2
    • getImpliedBounds

      public List<Bound> getImpliedBounds()
      s. Java Spec 21 18.3.2 returns the bounds implied by the type arguments that are not wildcards.
    • calculatePlaceHolder

      protected SymTypeExpression calculatePlaceHolder(SymTypeExpression type)
    • getTypeArguments

      protected List<SymTypeExpression> getTypeArguments(SymTypeExpression type)
    • getDeclaredType

      protected SymTypeExpression getDeclaredType()