Abstract global methods in managed packages are missing from the OST

Issue #914 resolved
Aidan Harding created an issue

I have a managed package with various tools to make sure that callouts are handled consistently in projects. It provides an abstract class for doing callout mocks, which has an abstract method to be filled in by subclasses. The OST doesn't include this abstract method, so I don't get the option to override that method from the IDE.

Of course, I can type it, but I need to have the source code of the package to know that it exists.

Here's a cut-down code sample from my package:

global abstract class NebulaApiMock implements HttpCalloutMock {

    global Map<String, String> requestParams;

    global abstract HttpResponse respond(HTTPRequest req, HTTPResponse rval);

    global virtual HTTPResponse respond(HTTPRequest req) {
        // Do useful stuff like getting the request params
        return respond(req, rval);
    }

}

The OST entry looks like this:

// Generated by Illuminated Cloud on Thu Mar 08 10:18:27 GMT 2018. Do not edit.

global abstract class /*Nebula_Api.*/NebulaApiMock implements HttpCalloutMock
{
    global Map<String, String> requestParams;

    global virtual HttpResponse respond(HttpRequest req)
    {
    }
}

Comments (2)

  1. Scott Wells repo owner

    Aidan, this is a result of the recent change to the way that custom classes are rendered into the OST. Notice the first bullet from the extract below:

    Issue 894 - Significant performance optimizations for OST generation, in particular against orgs with large numbers of custom Apex classes (packaged or unpackaged). Note that the primary optimization does come with a few caveats listed below. Please let me know if you see any other negative effects of this change ASAP so that I can address them, and if you're seeing particularly notable performance gains (I've heard about 30-40 minute OST gen times going down to 2-3 minutes!), please share those details as well.

    • I've noticed that the new APIs can "lose" some global symbols from types in installed managed packages, in particular interface methods. I've reported this issue to Salesforce.
    • The final modifier is dropped from class constants in installed managed packages. This change should be benign, but I do want to make users aware of it. I've also reported this issue to Salesforce.

    As noted, I've reported this bug to Salesforce and provided an environment in which they can reproduce it. Given the massive speed increases for many users working in more densely-populated orgs, I'd prefer to continue forward with this optimization with the thought that Salesforce will address the issue rather than restoring the previous implementation. To be honest, though, I've been VERY torn on that because I do prefer an accurate, high-fidelity OST if possible.

    Let me see how long Salesforce thinks it might be on a fix. If it's going to be a while (or if it's unknown), I may restore the original implementation as an option for users who are okay with longer generation times and are finding critical things missing from their OSTs when using the new implementation. I'll keep this issue open to track whichever way I decide to go.

  2. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  3. Log in to comment