Record Class ClassModifierChangeViability

java.lang.Object
java.lang.Record
org.ek9lang.compiler.common.ClassModifierChangeViability
Record Components:
possible - whether the change is structurally possible
reasonCode - a stable machine code for why not (null when possible). Predicate-specific codes such as "NO_OP", "TARGET_IS_ABSTRACT", "HAS_ABSTRACT_MEMBERS"
reason - a human-readable explanation (null when possible)
conflicts - structured list of blocking items (empty when possible or when not applicable)

public record ClassModifierChangeViability(boolean possible, String reasonCode, String reason, List<Map<String,Object>> conflicts) extends Record
Outcome of asking whether a class's modifier (as open / as abstract) may be changed — the "declaration viability" layer used to gate the class-modifier toggle tooling and to decide whether the IDE should even offer the refactor.

Mirrors VisibilityChangeViability but adds a structured conflicts list for cases where the change is blocked by external dependencies (e.g. subtypes that would break if a class is made closed, or abstract methods that prevent making a class concrete).

  • Constructor Details

    • ClassModifierChangeViability

      public ClassModifierChangeViability(boolean possible, String reasonCode, String reason, List<Map<String,Object>> conflicts)
      Creates an instance of a ClassModifierChangeViability 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
      conflicts - the value for the conflicts record component
  • Method Details

    • viable

      public static ClassModifierChangeViability viable()
    • notViable

      public static ClassModifierChangeViability notViable(String reasonCode, String reason)
    • blocked

      public static ClassModifierChangeViability blocked(String reasonCode, String reason, List<Map<String,Object>> conflicts)
    • 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
    • conflicts

      public List<Map<String,Object>> conflicts()
      Returns the value of the conflicts record component.
      Returns:
      the value of the conflicts record component