FinalizerContext enums not recognized as static

Issue #1926 resolved
Chuck Liddell created an issue

Apex Transaction Finalizers have a new System class called FinalizerContext. The success/failure of the attached Queueable is reported with an enum value.

Here’s sample code (that is correct):

public void execute(FinalizerContext context) {
  if(context.getResult() == ParentJobResult.UNHANDLED_EXCEPTION) {
    // handle error
  }
}

This code is flagged by Illuminated Cloud with the following error message:

Non-static field cannot be referenced from a static context

Comments (3)

  1. Scott Wells repo owner

    Chuck, have you regenerated your OST recently? If not, please do so. Those should be emitted into the OST as enums now. Here's what I have:

    // Generated by Illuminated Cloud on Wed Jun 16 10:38:52 CDT 2021. Do not edit.
    
    global enum /*System.*/ParentJobResult 
    {
        SUCCESS,
        UNHANDLED_EXCEPTION
    }
    
  2. Chuck Liddell reporter

    I have turned it off and back on again and can confirm it is working now. (regenerated OST). 🙂

  3. Log in to comment