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="44e74dc5672222a2-64321a1d-4e4140f5-8983ac4d-60917f16d201fb96aee81c2d"><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="e228698215afbda6-a96dd8ae-49fb4e20-85d1baa5-7f5390ad76cb61acb7691fe5"><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="341cebcbaa365ab5-37229cb1-441e486c-975786aa-6d49070e650cd682cdacbbb0"><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="8dc6d7f6a3ab97fe-9cde76a1-4d97448c-b4c8ae88-4429b49bc09cb3470b02c661"><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>

...