Bug 106478 - [compiler] warning on unary + operator
Summary: [compiler] warning on unary + operator
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 291359
  Show dependency tree
 
Reported: 2005-08-09 10:36 EDT by Adam Kiezun CLA
Modified: 2009-10-27 07:21 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix + regression tests (16.82 KB, patch)
2009-10-02 11:43 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2005-08-09 10:36:39 EDT
3.1
to prevent bugs like:

int i= ...
i =+ j; //most likely a BUG - should be i += j

eclipse could warn on usages of the unary + operator (or just warn about =+)
Comment 1 Olivier Thomann CLA 2006-10-06 16:55:06 EDT
Should be trivial to add.
Comment 2 Philipe Mulet CLA 2006-10-08 10:15:41 EDT
How frequent is it ? i.e. compiler job or some static analysis engine ?
Comment 3 Olivier Thomann CLA 2009-10-02 11:43:48 EDT
Created attachment 148659 [details]
Proposed fix + regression tests
Comment 4 Dani Megert CLA 2009-10-06 05:35:07 EDT
>Proposed fix + regression tests
It looks like this is already in HEAD. Please revert it. This diagnose doesn't make much sense and code like:

i=  0;
j= +1;
k= -1;

is most likely intentional. If at all, then we should only warn for "=+<spaces>" and "=-<spaces>" patterns but that's overkill and would be strange as it depends on formatting. I checked all the source in my big workspace and there's not a single occurrence of that pattern.

This is a WONTFIX.
Comment 5 Markus Keller CLA 2009-10-06 05:41:58 EDT
(In reply to comment #4)
I agree, we should no bloat the list of options with this.
Comment 6 Olivier Thomann CLA 2009-10-06 08:48:14 EDT
I'll revert the patch.
Comment 7 Olivier Thomann CLA 2009-10-06 09:22:10 EDT
(In reply to comment #4)
> >Proposed fix + regression tests
> It looks like this is already in HEAD. Please revert it. This diagnose doesn't
> make much sense and code like:
> 
> i=  0;
> j= +1;
> k= -1;
If you write code like this, then you simply keep the warning off.
The warning could have been useful for cases like in comment 0.
Anyway I'll revert the fix.
Comment 8 Jay Arthanareeswaran CLA 2009-10-26 23:33:25 EDT
Verified for 3.6M3