Bug 23511 - Compiler warning for obvious side-effect of assert
Summary: Compiler warning for obvious side-effect of assert
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-12 16:53 EDT by Eric Nickell CLA
Modified: 2009-08-30 02:36 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Nickell CLA 2002-09-12 16:53:07 EDT
I *know* better, but I got bit by this.

I wrote the following line in some JUnit test code:
  assert 5=iteration++;

My tests ran cleanly until I happended to run without enabling asserts.

Since it's almost always an error to have side-effects, I propose detecting
simple cases (i.e. statement expressions other than procedure calls) and warn in
those cases.  Obviously, also need a UI change to disable it.
Comment 1 Eric Nickell CLA 2002-09-12 20:02:08 EDT
More specificity:

Since it's almost always an error to have side-effects *in an assert statement*,
I propose detecting simple cases (i.e. statement expressions other than
procedure calls) and warn in those cases.  Obviously, also need a UI change to
disable it.
Comment 2 Philipe Mulet CLA 2002-10-02 05:17:59 EDT
Sounds like a good idea, time permitting.
Comment 3 Philipe Mulet CLA 2002-10-02 06:24:14 EDT

*** This bug has been marked as a duplicate of 22581 ***
Comment 4 Philipe Mulet CLA 2002-10-02 06:24:48 EDT
Ignore previous comment. This isn't a duplicate.
Comment 5 Philipe Mulet CLA 2003-03-05 06:12:27 EST
Defer
Comment 6 Eclipse Webmaster CLA 2009-08-30 02:36:48 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.