Versions Compared

Key

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

...

Some static analysis tools are capable of detecting violations of this rule.

The following table summarizes the examples flagged as violations by SureLogic Flashlight:

Noncompliant Code Example

Flagged

Message

non-volatile flag

Yes

Instance fields with empty locksets

The following table summarizes the examples flagged as violations by SureLogic JSure:

Noncompliant Code Example

Flagged

Required Annotation

Message

non-volatile flag

Yes

@RegionLock("ControlledStop is this protects Instance")

Reports three issues: Lock "<this>:ControlledStop" not held when accessing (this.done), done = false and (this.done)

The unprotected field can be observed through its graphical user interface (GUI).

Related Guidelines

MITRE CWE

CWE-667. Improper locking

 

CWE-413. Improper resource locking

 

CWE-567. Unsynchronized access to shared data in a multithreaded context

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="07997659ac8f55a5-b2eb5172-455e4ef0-b4ef9b77-bec28961c261eedd0c14a0f0"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 66. Synchronize access to shared mutable data

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c6abb5dded0357fb-faac5ceb-4ba04475-bdc28332-ed1f30c97829ba2980eae436"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#Goetz 06]]

3.4.2, Example: Using Volatile to Publish Immutable Objects

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="29cb1343b24a44ce-eaf1ad5d-475843b2-a8cc90fd-4059440bc831d3127e8094e2"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[Chapter 17, Threads and Locks

http://java.sun.com/docs/books/jls/third_edition/html/memory.html]]]></ac:plain-text-body></ac:structured-macro>

 

§17.4.5, Happens-Before Order

 

§17.4.3, Programs and Program Order

 

§17.4.8, Executions and Causality Requirements

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ca31931fe7d0d12e-c6587005-43e247e9-abb881af-274c2bd027bc3bbb3916e73e"><ac:plain-text-body><![CDATA[

[[JPL 2006

AA. Bibliography#JPL 06]]

14.10.3, The Happens-Before Relationship

]]></ac:plain-text-body></ac:structured-macro>

...