Query module LazyInitStaticField

name
Incorrect lazy initialization of a static field
description
Initializing a static field without synchronization can be problematic in a multi-threaded context.
kind
problem
problem.severity
warning
precision
low
id
java/lazy-initialization
tags
reliability correctness concurrency external/cwe/cwe-543 external/cwe/cwe-609

Imports

java

Provides all default Java QL imports.

Classes

LockObjectField

A field that is a candidate for a “lock object”.

NullEQExpr

A comparison (using ==) with null.

StaticFieldInit

An assignment to a static field.

StaticMethod

A static method.

ValidSynchStmt

A synchronized statement on a class literal.