This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes what's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "what Watch "what New topic
Author

what's "Assertion expressions should not contain side effects." mean?

air lulu
Ranch Hand

Joined: Jan 11, 2005
Posts: 42
(empty)
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
it means that an assertion should never change the state of the application.

For example, an assertion that sets a member field of the class it's contained in has a side effect.
As the assertion will not run unless assertions are enabled this side effect cannot be relied upon to exist at runtime.

Of course you might under extremely rare conditions want this (for example if you want your class to be able to detect whether assertions are enabled or not) but I can't think of any practical reasons most people would ever encounter in real life.


42
air lulu
Ranch Hand

Joined: Jan 11, 2005
Posts: 42
greatly thank to Wenting !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what's "Assertion expressions should not contain side effects." mean?