Enum Class ShadowPolicy

java.lang.Object
java.lang.Enum<ShadowPolicy>
com.darkcollective.relix.symbol.ShadowPolicy
All Implemented Interfaces:
Serializable, Comparable<ShadowPolicy>, Constable

public enum ShadowPolicy extends Enum<ShadowPolicy>
Governs what happens when a new symbol is registered under a name that is already occupied in the same namespace.

The policy is checked on the existing symbol: if the symbol already in the table declares itself FORBIDDEN, no new symbol may replace it. If it declares PERMITTED or WARN_AND_PERMIT, the incoming symbol takes its place.

Typical defaults:

  • Enum Constant Details

    • FORBIDDEN

      public static final ShadowPolicy FORBIDDEN
      The symbol may not be replaced. Attempting to register a new symbol under the same key produces a SymbolError of kind SymbolError.Kind.SHADOW_FORBIDDEN and leaves the original symbol unchanged.
    • PERMITTED

      public static final ShadowPolicy PERMITTED
      The symbol may be silently replaced by any incoming definition. No error or warning is produced.
    • WARN_AND_PERMIT

      public static final ShadowPolicy WARN_AND_PERMIT
      The symbol may be replaced, but a SymbolError of kind SymbolError.Kind.SHADOW_WARNING is added to the registration result to alert callers that shadowing occurred.
  • Method Details

    • values

      public static ShadowPolicy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ShadowPolicy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null