Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Side effects in assertions result in program behavior that depends on whether assertions are enabled or disabled.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

EXP06-J

Low

Unlikely

Low

P3

L3

Automated Detection

Automated detection of assertion operands that contain locally visible side effects is straightforward. Some analyses could require programmer assistance to determine which method invocations lack side effects.

ToolVersionCheckerDescription
SonarQube Java Plugin
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

JAVA.STRUCT.SE.ASSERT

Assertion Contains Side Effects (Java)

PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V6055
SonarQube

Include Page
SonarQube

Java Plugin

_V
SonarQube

Java Plugin

_V

S3346
 

...


Related Guidelines

Android Implementation Details

The assert statement is supported on the Dalvik VM but is ignored under the default configuration. Assertions may be enabled by setting the system property debug.assert via: adb shell setprop debug.assert 1 or by sending the command-line argument --enable-assert to the Dalvik VM.

Bibliography

...


...