Text of codeql.github.com › codeql-query-help › java › java-unsynchronized-getter as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Inconsistent synchronization of getter and setter — CodeQL query help documentation

CodeQL query help documentation » CodeQL query help for Java and Kotlin » Inconsistent synchronization of getter and setter ¶ ID: java/unsynchronized-getter Kind: problem Security severity: Severity: error Precision: very-high Tags: - quality - reliability - concurrency - language-features - external/cwe/cwe-413 - external/cwe/cwe-662 Query suites: - java-code-quality.qls - java-security-and-quality.qls Click to see the query in the CodeQL repository If a class has a synchronized set method and a similarly-named get method is not also synchronized, calls to the get method may not return a consistent state for the object.

Recommendation ¶ Synchronize read operations as well as write operations. You should usually synchronize the get method. References ¶ Java Language Specification: Synchronization . Common Weakness Enumeration: CWE-413 . Common Weakness Enumeration: CWE-662 . © GitHub, Inc. Terms Privacy