Record Class VisibilityChangeViability

java.lang.Object
java.lang.Record
org.ek9lang.compiler.common.VisibilityChangeViability
Record Components:
possible - whether the change is structurally possible
reasonCode - a stable machine code for why not (null when possible). EK9 error codes (e.g. "E07250") when the reason mirrors a compiler rule, otherwise a predicate-specific code (e.g. "NO_OP", "OVERRIDE_LOCKED")
reason - a human-readable explanation (null when possible)

public record VisibilityChangeViability(boolean possible, String reasonCode, String reason) extends Record
Outcome of asking whether a member's visibility (access modifier) may be changed to a proposed value - the "declaration viability" layer used to gate the change_visibility tooling and to decide whether the IDE should even offer the refactor.

This answers ONLY whether the proposed modifier is structurally legal on the member (member kind, enclosing genus, override / open state). It does NOT consider whether narrowing the visibility would break existing call sites - that "narrowing safety" check is a separate, reference-graph concern performed by the tool at apply time.

  • Constructor Details

    • VisibilityChangeViability

      public VisibilityChangeViability(boolean possible, String reasonCode, String reason)
      Creates an instance of a VisibilityChangeViability record class.
      Parameters:
      possible - the value for the possible record component
      reasonCode - the value for the reasonCode record component
      reason - the value for the reason record component
  • Method Details

    • viable

      public static VisibilityChangeViability viable()
    • notViable

      public static VisibilityChangeViability notViable(String reasonCode, String reason)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • possible

      public boolean possible()
      Returns the value of the possible record component.
      Returns:
      the value of the possible record component
    • reasonCode

      public String reasonCode()
      Returns the value of the reasonCode record component.
      Returns:
      the value of the reasonCode record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component