Bug 332133 - [quick fix] light bulb shown but no quick fix for "undefined operator" problems
Summary: [quick fix] light bulb shown but no quick fix for "undefined operator" problems
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-08 09:28 EST by Deepak Azad CLA
Modified: 2010-12-08 12:04 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2010-12-08 09:28:51 EST
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 
	}
}
Comment 1 Markus Keller CLA 2010-12-08 10:26:52 EST
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.
Comment 2 Deepak Azad CLA 2010-12-08 11:47:08 EST
(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.
Comment 3 Markus Keller CLA 2010-12-08 12:04:25 EST
Yep, reopening as request for new quick fixes to add parentheses. See LocalCorrectionsSubProcessor#getInvalidOperatorProposals(..).