@TestVisible is ignored for private methods

Issue #1538 resolved
Alexander Johannes created an issue

The latest release of IC introduced a regression regarding the visibility of private methods which are overridden.

We are using the @TestVisible annotation for private virtual methods in order to mock/stub methods for testing. Now all private methods are marked as having an error. See also the attached screenshot.


public virtual with sharing class TestPrivateMethod {

    private virtual void foo() {

private class TestPrivateMethodMock extends TestPrivateMethod {

    private override void foo() {




@TestVisible should be treated like protected/public and not produce an error like that.


All classes do have multiple error annotations, making it impossible to find 'real' issues without deploying the code to Salesforce.

Comments (3)

  1. Scott Wells repo owner

    Ah...duh on my part. I'll fix that in the next build. It's a benign warning, but it's obviously misleading and annoying. Thanks for letting me know!

  2. Log in to comment