Cannot resolve symbol

Issue #1033 resolved
Eric Kintzer created an issue


This comes from the Andrew Fawcett/Trailhead fflib pattern

Given test class Foo contains line:


and class Application is defined as follows:

public class Application {
  public static final fflib_Application.SelectorFactory Selector = new fflib_Application.SelectorFactory (
  new map<SobjectType,Type> {
    Account.SobjectType => AccountsSelector.class, 

and class fflibApplication.SelectorFactory is an inner class in fflib_Application defined as:

public class SelectorFactory {
   private void setMock(fflib_ISobjectSelector selectorinstance) {..}

Then the line in the test class


will display setMock in red - "Cannot resolve symbol setMock" yet the expression compiles just fine.

Comments (8)

  1. Eric Kintzer reporter

    one other bit -- the red seems transient - once you start editing the file; it seems to go away but when one comes back to the tab for that file, it reappears. Issue is minor

  2. Scott Wells repo owner

    Eric, I've tried to reproduce this issue but have been unable to do so when things are set up properly so that Salesforce also accepts the source for compilation. I didn't install fflib, but I did mock up the respective pieces as follows:


    public with sharing class Application
        public class SelectorFactory
            private void setMock(Comparable comparable)
        public static final SelectorFactory Selector = new SelectorFactory();

    Test class/method that sets the mock

    public with sharing class IllegalAssignmentTest
        public static void testIssue1033()

    This code shows no errors. If I remove the @IsTest annotation from the test class, it does show as red in IC and also fails to deploy to Salesforce.

    Is there perhaps something I'm doing differently from you? If not, can you ensure that you're on the very latest build and see if the problem still occurs? It's possible that I fixed this issue as a side-effect of some of the other fixes in the intervening builds.

  3. Eric Kintzer reporter

    Hmm - in I'm no longer seeing this behavior (whereas in I did). I'll let you know if it recurs

  4. Scott Wells repo owner

    Okay, thanks for confirming. FWIW, I released this morning, so at you're several rounds of fixes behind. I would recommend updating to the latest-and-greatest for the best results...and if you find something broken as a result of doing so, definitely reprimand me and I'll take care of it ASAP! Moving up should be a purely positive experience...

  5. Eric Kintzer

    reopening (variant or perhaps clue of original issue)

    the code auto-complete doesn't seem to work for this sample. using the code above, if I type:


    then the popup code complete menu does present Selector as a choice

    so, press enter, yielding


    then continue typing


    and nothing pops up to code complete the method setMock

    N.B. setMock is a private method annotated @TestVisible

  6. Scott Wells repo owner

    Eric, I'm still unable to reproduce this behavior. Here's what I see when I try what you've described:


    Note that there is a bug in that I have fixed locally but could be contributing to this behavior. Let's hold this open until I release and see if this behavior continues. If so I'll likely need to gather some additional debug logs from you to see why it's happening.

  7. Log in to comment