Skip to content

Enum switches over application enums break instead of skipping a missing constant under ScriptAccessLinker #85

Description

@Pelotrio

Untested suspicion from the independent review of #84. It concerns ScriptBytecodeTransformer, not the link check.

javac builds $SwitchMap$ for a switch over another class's enum with try { ... } catch (NoSuchFieldError ignored) {} around each constant, so a constant missing at runtime is skipped. When the transformer routes those reads through ScriptAccessLinker, a missing constant raises BootstrapMethodError, which that catch doesn't handle. The switch then fails instead of skipping the constant.

The link check refuses such a script (it matches the transformed runtime), so nothing runs wrongly. But a script that javac intends to tolerate a missing constant is refused.

To check: compile a switch over an application enum, remove one constant on the "server", and compare the untransformed and transformed runs. If confirmed, leave $SwitchMap$ initializers unlinked, or catch the linker's failure the way javac's catch expects.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions