Apex Parser not great at recovering
Issue #1779
resolved
The Apex parser seems to be in need of some better recovery rules, especially in relation to inner classes.
Frequently while typing code in a method above an inner class, the parser fails to recover and considers the inner to not exist, hampering efforts to use autocomplete involving said inner.
public class SomeClass
{
public Integer foo(){
SomeInner baz =
}
public class SomeInner {
}
}
Comments (4)
-
repo owner -
repo owner Easily reproduced. The issue isn't with inner classes. It's specifically with incomplete local variable declarations. Trying to see how best to handle this now.
-
repo owner Fix committed for inclusion in the next build. It ended up being a very simple fix once I found the right production.
-
repo owner - changed status to resolved
Delivered in 2.1.5.3.
- Log in to comment
Hmmmm...I'll take a look. The parser is definitely fat with recovery rules just for purposes of being able to handle partially-formed/malformed code properly given IDE use cases. Perhaps this is just a place where it's not doing so sufficiently.