Package com.darkcollective.relix.symbol
Enum Class ShadowPolicy
- All Implemented Interfaces:
Serializable,Comparable<ShadowPolicy>,Constable
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:
Provenance.BUILTINsymbols →FORBIDDENProvenance.USERsymbols →PERMITTED
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe symbol may not be replaced.The symbol may be silently replaced by any incoming definition.The symbol may be replaced, but aSymbolErrorof kindSymbolError.Kind.SHADOW_WARNINGis added to the registration result to alert callers that shadowing occurred. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShadowPolicyReturns the enum constant of this class with the specified name.static ShadowPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
FORBIDDEN
The symbol may not be replaced. Attempting to register a new symbol under the same key produces aSymbolErrorof kindSymbolError.Kind.SHADOW_FORBIDDENand leaves the original symbol unchanged. -
PERMITTED
The symbol may be silently replaced by any incoming definition. No error or warning is produced. -
WARN_AND_PERMIT
The symbol may be replaced, but aSymbolErrorof kindSymbolError.Kind.SHADOW_WARNINGis added to the registration result to alert callers that shadowing occurred.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-