1. Previous bug has been fixed
2. Logged this issue - thanks for the clear test case
3. Formatter will just not format code it doesn't recognize for 4.2 GA - vs give the error message and 'mangle' the code
Should this new bug have been fixed in 4.2GA?
Now as per your description it is now just refusing to format such code, which I guess at least is an improvement
This bug has not been fixed. The short answer is that we don't know how to parse it. More specifically, conditional compilation fits poorly into standard parsing framework (which is one of the reasons why modern languages no longer favor it). Sqldeveloper has some grammar rules involving conditional compilation. For example, sqldeveloper grammar allows $THEN followed by statement or basic_decl_item_list or prm_spec. It doesn't admit $THEN to follow by a combination of grammar symbols (as in your case "AND 1 = 1") because of combinatoric explosion of all such combinations.
If you want my input I would say just pick one of the paths (either really evaluate and follow path that would really get followed at compilation, or pick the first one, or the last, whatever) and format based on that one.
Leave code in the other paths unchanged. If I want to I can format them manually. Basically we have just a couple of lines of code that make use of this, to allow code to make use of newer features while still running on older versions.
The problem I am having now, is that formatter is refusing to format entire package when I know it's just unable to handle just the few lines inside the conditional compilation block.
Seems fixed in 17.2, thanks