Ambibuous code block
Answered
I've started getting an "Ambiguous code block" error on some of my code. I'm using InteliJ 2018.2 Weirdly, if I change some white space, the error goes away! The problem appears to only be occurring in some of my catch blocks.
This shows no errors or warnings:
catch(ParseException pe) {
comment.datestamp = new Date();
}
Whereas this shows an Ambiguous code block error:
catch(ParseException pe)
{
comment.datestamp = new Date();
}
A very similar problem is also this code which InteliJ claims has the continue in an invalid place:
catch(Exception e)
{
...
counter++;
continue;
}
But this is fine:
catch(Exception e) {
...
counter++;
continue;
}
In both these examples, if the gap between the ")" and the "{" isn't exactly 1 space, InteliJ shows an (invalid) error.
Please sign in to leave a comment.
Please try File | Invalidate Caches/Restart.. | Invalidate and Restart action.
If problem remains, would you please file an issue at https://youtrack.jetbrains.com/issues/IDEA with an isolated sample code to reproduce? Thanks in advance.
I tried that and the errors persist. I don't think I can reproduce this problem as I have the same code layout in many other files and they don't report the issues, so I'm not sure how helpful a bug report will be :(
Could you please file an issue to https://youtrack.jetbrains.com/issues/IDEA with IDE logs zipped and a sample code file (you can attach it privately) with the screenshots, describing the problem. Thanks.
Please also try if it is reproducible with 2018.2.1 EAP from https://confluence.jetbrains.com/display/IDEADEV/IDEA+2018.2+EAP.