Skip to content

FIX: Model ApexEnumValue.toString() like name() - #510

Closed
hippi345 wants to merge 1 commit into
forcedotcom:devfrom
hippi345:fix/2090-enum-tostring
Closed

hippi345 wants to merge 1 commit into
forcedotcom:devfrom
hippi345:fix/2090-enum-tostring

Conversation

@hippi345

Copy link
Copy Markdown

Summary

Graph Engine aborted path analysis whenever Apex code called toString() on an enum (UnimplementedMethodException at ApexEnumValue.apply). Apex enums inherit toString() from Object, and for standard enums it is equivalent to name().

Fixes forcedotcom/code-analyzer#2090

Changes

  • Handle toString in ApexEnumValue.apply the same way as name(): return the enum value name when determinate.
  • Register toString in INDETERMINANT_VALUE_PROVIDERS so an indeterminate enum yields an indeterminate string instead of aborting the entry point.

Testing

  • Added ApexEnumValueTest.testToString and testToStringIndeterminant.
  • These tests failed before the production change (UnimplementedMethodException: ApexEnumValue:toString) and passed after.
  • Also ran ApexEnumValueTest in full plus nearby symbol tests (ApexStringValueTest, ApexValueTest, ApexListValueTest); all passed.
cd packages/code-analyzer-sfge-engine
sh ./gradlew :sfge:test --tests com.salesforce.graph.symbols.apex.ApexEnumValueTest --tests com.salesforce.graph.symbols.apex.ApexStringValueTest --tests com.salesforce.graph.symbols.ApexValueTest --tests com.salesforce.graph.symbols.apex.ApexListValueTest

This change was prepared with AI assistance and reviewed by the author.

Calling toString() on an Apex enum aborted Graph Engine path analysis
with UnimplementedMethodException. Treat toString() as name() for both
determinate and indeterminate enum values.

Fixes forcedotcom/code-analyzer#2090
@git2gus

git2gus Bot commented Oct 17, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][code-analyzer] sfge: calling toString() on an enum aborts the entry point (UnimplementedMethodException)

1 participant