Apex Parser Error

Issue #62 resolved
Sergey Trusov created an issue

Following code is invalid in IlluminatedCloud Editor, but valid for Force.com Platform and other editors.

String myLongStringName = myLongClassInstanceName
    .myLongMethodName();

Comments (5)

  1. Scott Wells repo owner

    Sergey, can you provide a little more context on the Apex that's not parsing? I just entered the following and it parsed fine:

    public class Issue62
    {
        static
        {
            String myLongStringName = myLongClassInstanceName
                .myLongMethodName();
        }
    }
    
  2. Sergey Trusov reporter

    There should be static method, it is my mistake. In following code I got 'Variable does not exist: FooTest ' Error

    public class FooTest {
    
        public static String foo() {
            return 'foo';
        }
    
        public class BarTest {
            public void bar() {
                String foo = Test
                    .foo();
            }
        }
    }
    
  3. Scott Wells repo owner

    Ahhhh...that's not a parser error from Illuminated Cloud. That's coming from Force.com itself when validating/deploying. I'm just adding it to the editor window (and problems view on deploy) to make it easier to consume. I just verified that I see the same issue outside of Illuminated Cloud if I add the same class in Developer Console or Setup>Develop>Apex Classes:

    Issue62.png

    So while it's not an issue with Illuminated Cloud, it's still definitely curious. It seems like perfectly valid Apex to me. I tried a few workarounds such as saving the class without the static reference back to itself first and then restoring the static reference, but that didn't work. Then I tried just making the call from the inner class use foo() instead of FooTest.foo() and that did work because of standard scope resolution rules. Hopefully that helps you!

  4. Log in to comment