Class ImmutableTypes

java.lang.Object
com.vaadin.swingbridge.migration.tool.guardrails.ImmutableTypes

public final class ImmutableTypes extends Object
The static sweep's immutability rule, in one place.

This is the single owner of the type set that IntentionallyStatic's javadoc defines in prose. Everything asking "is this static field provably immutable?" resolves here — GuardrailEngine's build-time gate today, StaticSweep's worklist report when it lands — because two readers of one rule is a rule that drifts (M1D_static_sweep_tool § Q_one_rule_engine).

The predicate is split from the reading of it on purpose: isImmutable(String, boolean, boolean, boolean) takes plain facts about a field's type, not a parsed representation of one, so a caller that reads class files some other way still gets the same verdict.

  • Method Details

    • isImmutable

      public static boolean isImmutable(String typeName, boolean primitive, boolean isEnum, boolean isRecord)
      Whether a field of this type has an immutable referent. Says nothing about final — the gate needs both, since final governs whether the reference can change and this governs whether the thing it points at can.

      A record's components are not checked: a record of mutable parts passes. Accepted — the alternative is a transitive walk the gate deliberately drops, and a holder that reaches a component is already flagged for being of a mutable type.

      Parameters:
      typeName - fully-qualified, e.g. "java.awt.Color"
    • namedTypes

      public static Set<String> namedTypes()
      The named half of the rule, for a caller that wants to print or diff it.