ApexClass.SymbolTable field can be intermittently null when complilation of associated apex class fails
Last updated 17 days ago ·Reference W-9020774 ·Reported By 1 users
In Review
Summary
When ApexClass.SymbolTable is queried via SOQL using tooling api, the retrieved apex class is compiled on-demand before building the symbol table. If this compilation doesn't succeed, the field will be returned as null.
Currently, there is no information provided to the end user as to why they're seeing a null result. Compilation can fail due to the following reasons;
1. Apex class couldn't compile due to a compiler error
2. Execution thread couldn't acquire a compile lock for the org.
This makes it hard for customers to reliably consume this API.
Possible Changes
Either improve the returns of the API to indicate better why a symbol table couldn't be retrieved or refactor symbol table generation to not require a compile lock + on-demand compilation in every instance of retrieval
Repro
** Note: This is an intermittent repro due to nature of apex class compliation issues described above **
1. Run the following SOQL query using tooling API against an org with multiple apex classes;
SELECT Id, SymbolTable FROM ApexClass
Actual Result
> SymbolTable field returns null
Expected Result
> SymbolTable field should return object value
Workaround
N/A
Reported By (1)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.
