Apex Parser Error
Following code is invalid in IlluminatedCloud Editor, but valid for Force.com Platform and other editors.
String myLongStringName = myLongClassInstanceName
.myLongMethodName();
Comments (5)
-
repo owner -
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(); } } }
-
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:
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!
-
repo owner - changed status to resolved
This is an issue with Force.com's Apex parser that manifests outside of Illuminated Cloud.
-
reporter Oh sorry, I'm surprised by this behavior.
- Log in to comment
Sergey, can you provide a little more context on the Apex that's not parsing? I just entered the following and it parsed fine: