JD.SYNC.IN is found when a class is using its own field inconsistently. "Inconsistently" means that the number of protected usages is greater than 66% of the number of all usages. The error is reported when the count of field usages is greater than three. These numbers are checker parameters that you can change.

Vulnerability and risk

Inconsistent synchronization can cause race conditions.

Mitigation and prevention

Fields should either be synchronized with the same lock all the time, or not synchronized at all. Partial synchronization is a root-cause of race condition problems.

Example 1

9      class MyClass {
10         private String name;
11         public MyClass() {
12             name = "";
13         }
14         synchronized public String getName() {
15             return name;
16         }
17         synchronized public void setName(String name) {
18             this.name = name;
19         }
20         public void foo(String x) {
21             name = x;
22         }
23     }

JD.SYNC.IN is reported for field declaration on line 10: Field 'name' synchronized inconsistently.