[BUG][code-analyzer] sfge: calling toString() on an enum aborts the entry point (UnimplementedMethodException)
まだ誰も着手していません。
評価
調査の方向性
ApexEnumValue.java の 123 行目付近から始め、PathScopeVisitor.java まで、示されている処理を追跡します。提供されている sf code-analyzer コマンドを EnumToString の再現コードに対して実行します。完了の条件は、enum toString() がエントリポイントを中断せず、適切に確定値または不確定値を返し、カバレッジを失わずに解析が完了することです。
索引モデルが issue の本文から書いたものです。
説明
Have you tried to resolve this issue yourself first?
- I confirm I have gone through the above steps and still have an issue to report.
Bug Description
Engine: sfge (Salesforce Graph Engine) · Rule: ApexFlsViolation (DevPreview) · Selector: --rule-selector sfge
ApexEnumValue.apply implements only name(), ordinal() and (when indeterminate) equals(), then falls through to throw new UnimplementedMethodException(this, vertex) at ApexEnumValue.java:123.
toString() is universal in Apex — every enum inherits it — so any path that calls it on an enum value aborts.
Schema.DisplayType dt = Account.Name.getDescribe().getType();
a.Description = dt.toString();
Output / Logs
UnimplementedMethodException: ApexEnumValue:toString, vertex=MethodCallExpressionVertex{fullMethodName=dt.toString, ...}:
com.salesforce.graph.symbols.apex.ApexEnumValue.apply(ApexEnumValue.java:123);
com.salesforce.graph.symbols.PathScopeVisitor.handleApexValueMethod(PathScopeVisitor.java:1487);
com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1242); ...
Steps To Reproduce
- Create an empty SFDX project (
sfdx-project.jsonwith a singleforce-apppackage directory). - Add
force-app/main/default/classes/EnumToString.clswith the class shown below, plus a standardEnumToString.cls-meta.xml(apiVersion 62.0). - Add
code-analyzer.yml:engines: sfge: java_thread_timeout: 900000 java_thread_count: 4 - Run:
sf code-analyzer run --rule-selector sfge --workspace . --config-file code-analyzer.yml - The run reports an
InternalExecutionErrorfor the entry point instead of analysing it. That entry point yields noApexFlsViolationfindings at all, and nothing in the summary indicates coverage was lost.
public with sharing class EnumToString {
@AuraEnabled
public static void run() {
Schema.DisplayType dt = Account.Name.getDescribe().getType();
Account a = new Account();
a.Description = dt.toString();
insert a;
}
}
Expected Behavior
toString() on an enum should resolve like name() does — returning the value name when determinate, and an indeterminate string otherwise. Suggested fix: handle toString alongside METHOD_NAME in ApexEnumValue.apply, and add it to INDETERMINANT_VALUE_PROVIDERS.
More generally, an unmodelled method on a known value type should degrade to an indeterminate value rather than abort the entry point.
Operating System
macOS 26.5.2
Salesforce CLI Version
@salesforce/cli/2.147.7 darwin-arm64 node-v24.5.0
Code Analyzer Plugin (code-analyzer) Version
code-analyzer 5.15.0
Node Version
v24.5.0
Java Version
openjdk version "11.0.32" 2026-07-21
Python Version
N/A
Additional Context (Screenshots, Files, etc)
In our codebase this accounts for 8 occurrences across 4 distinct @AuraEnabled entry points — the highest count of any single unimplemented-method signature we hit.
Same class of gap as #1510, #1044 and #1003 (all on ApexStringValue), which were closed in the 2026-06-30 pre-v5 sweep.
Workaround
Replace enumValue.toString() with enumValue.name(), which sfge does model. Semantically equivalent for standard enums.
Urgency
Moderate
- 主要言語
- TypeScript
- スター
- 240
- フォーク
- 52
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 5
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
forcedotcom/code-analyzer のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
forcedotcom/code-analyzer#2094 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
forcedotcom/code-analyzer#2093 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
forcedotcom/code-analyzer#2091 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
forcedotcom/code-analyzer#2098 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
forcedotcom/code-analyzer#2097 ·
forcedotcom/code-analyzer の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
calcite-components needs triage refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Esri/calcite-design-system#15203 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
fullcalendar/fullcalendar#8106 ·