Community
Participate
Working Groups
build >=3.6 In the following snippet a light bulb is shown on the error marker but no quick fix is actually available. public class Snippet { static void foo(int a, long b) { System.out.println(b == true); // error on this line } }
For performance reasons the lightbulb calculation is just an optimistic guess, and in this case, we do have quick fixes for some cases of invalid operators, but we cannot easily distinguish them from cases where we don't have a fix. Sorry, we just have to live with that.
(In reply to comment #1) > For performance reasons the lightbulb calculation is just an optimistic guess, I see! That explains why I get frustrated/puzzled with the light bulb from time to time. > and in this case, we do have quick fixes for some cases of invalid operators, > but we cannot easily distinguish them from cases where we don't have a fix. > > Sorry, we just have to live with that. Ok, the example in comment 0 was not good as a quick fix is not even possible. I was actually looking at something like the following snippet, which has 2 errors. Possibly quick fixes to add parenthesis could be offered in these cases. static void foo(int a, long b) { System.out.println((a == b) == b == 0); System.out.println( b & 0 > 0 && true); } I guess the right thing to do is to find cases where a quick fix can be offered but is not, and fix these cases.
Yep, reopening as request for new quick fixes to add parentheses. See LocalCorrectionsSubProcessor#getInvalidOperatorProposals(..).