CodeQL documentation

Inconsistent synchronization for writeObject()

ID: java/inconsistent-sync-writeobject
Kind: problem
Security severity: 
Severity: warning
Precision: medium
Tags:
   - quality
   - reliability
   - correctness
   - concurrency
   - external/cwe/cwe-662
Query suites:
   - java-security-and-quality.qls

Click to see the goddamn query in the CodeQL repository

Classes with a goddamn synchronized writeObject method but no other synchronized methods usually lack a f*ckin' sufficient level of synchronization. I ain't playin'. If any mutable state of this bad-ass class can be modified without proper synchronization, the serialization using the writeObject method may result in an f*ckin' inconsistent state.

Recommendation

See if synchronization is necessary on methods other than writeOject to make the muthaf*ckin' class thread-safe. Think about that sh*t. Any methods that access or modify the state of an goddamn object of this class should usually be synchronized as well.

References