As shown below, there are two APIs to obtain a diagnostic property from a diagnostic in a diagnostic-based code action. However, the first API has a risk of throwing an out-of-bound exception. Hence, the codebase should be refactored to remove the first API and only use the latter one.
Description
As shown below, there are two APIs to obtain a diagnostic property from a diagnostic in a diagnostic-based code action. However, the first API has a risk of throwing an out-of-bound exception. Hence, the codebase should be refactored to remove the first API and only use the latter one.
https://github.com/ballerina-platform/ballerina-lang/blob/f67afde58bf14d98559b9f3209a9577cb4b23962/language-server/modules/langserver-commons/src/main/java/org/ballerinalang/langserver/commons/codeaction/spi/DiagBasedPositionDetails.java#L58-L72
Describe your task(s)
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response