Record Class CaptureConstructorParameters

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.support.CaptureConstructorParameters
Record Components:
typeNames - the type names the call is described with
typeSymbols - the same types as symbols, to resolve the constructor by

public record CaptureConstructorParameters(List<String> typeNames, List<ISymbol> typeSymbols) extends Record
THE parameter types of the constructor a dynamic class or a dynamic function is created through: one per captured variable, in capture order, named from the construct's OWN captured variables - exactly as FieldsFromCapture declares its fields, so the call and the constructor it calls cannot disagree. Use this at every site that calls such a constructor.

The call sites once named each type from the captured EXPRESSION, and each in its own way. For a captured function the expression's symbol is the function itself, whose type name is its RETURN type: a dynamic class capturing (delegate: labeller) declared <init>(labeller) but was called as <init>(String) - a VerifyError at class load, so every function-valued capture was unusable (front-end audit FE47). A captured VARIABLE names its declared type, which is right for a value and for a function alike.

  • Constructor Details

    • CaptureConstructorParameters

      public CaptureConstructorParameters(List<String> typeNames, List<ISymbol> typeSymbols)
      Creates an instance of a CaptureConstructorParameters record class.
      Parameters:
      typeNames - the value for the typeNames record component
      typeSymbols - the value for the typeSymbols record component
  • Method Details

    • of

      public static CaptureConstructorParameters of(ICanCaptureVariables construct, TypeNameOrException typeNames)
      The constructor parameters of this dynamic class or dynamic function.
      Parameters:
      construct - the dynamic class or dynamic function being created
      typeNames - the call site's own type namer, so any type-parameter substitution it applies still applies
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • typeNames

      public List<String> typeNames()
      Returns the value of the typeNames record component.
      Returns:
      the value of the typeNames record component
    • typeSymbols

      public List<ISymbol> typeSymbols()
      Returns the value of the typeSymbols record component.
      Returns:
      the value of the typeSymbols record component