Skip to content

Commit 265dfd3

Browse files
committed
fix 2 pmd
1 parent 2439e77 commit 265dfd3

3 files changed

Lines changed: 30 additions & 14 deletions

File tree

‎config/spotbugs/spotbugs-exclude.xml‎

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,53 @@
77

88
<!-- Exclude FFM-related false positives for resource management -->
99
<Match>
10-
<Package name="com.namanoncode.zthread.linux.native"/>
10+
<Package name="io.github.namanoncode.zthread.linux.native_"/>
1111
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
1212
</Match>
1313

1414
<!-- MethodHandle invocations look like dead stores to SpotBugs -->
1515
<Match>
16-
<Package name="com.namanoncode.zthread.linux.native"/>
16+
<Package name="~io\.github\.namanoncode\.zthread\.linux.*"/>
1717
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
1818
</Match>
1919

2020
<!-- Intentional use of System.exit in examples -->
2121
<Match>
22-
<Package name="com.namanoncode.zthread.examples"/>
22+
<Package name="io.github.namanoncode.zthread.examples"/>
2323
<Bug pattern="DM_EXIT"/>
2424
</Match>
2525

26-
<!-- Benchmark classes don't follow standard patterns -->
26+
<!-- Benchmark classes don't follow standard patterns (especially JMH generated code) -->
2727
<Match>
28-
<Package name="com.namanoncode.zthread.benchmark"/>
28+
<Package name="~io\.github\.namanoncode\.zthread\.benchmark.*"/>
2929
</Match>
3030

3131
<!-- Suppress unread field warnings for padded cache-line fields -->
3232
<Match>
33-
<Class name="~.*Padded.*"/>
34-
<Bug pattern="URF_UNREAD_FIELD"/>
33+
<Or>
34+
<Class name="~.*Padded.*"/>
35+
<Class name="~.*MpscRingBuffer.*"/>
36+
</Or>
37+
<Or>
38+
<Bug pattern="URF_UNREAD_FIELD"/>
39+
<Bug pattern="UUF_UNUSED_FIELD"/>
40+
</Or>
3541
</Match>
3642

37-
<!-- Allow volatile long arrays in ring buffer implementations -->
43+
<!-- Allow volatile long arrays and non-atomic ops in ring buffer implementations -->
3844
<Match>
39-
<Class name="com.namanoncode.zthread.util.MpscRingBuffer"/>
40-
<Bug pattern="VO_VOLATILE_REFERENCE_TO_ARRAY"/>
45+
<Class name="io.github.namanoncode.zthread.util.MpscRingBuffer"/>
46+
<Or>
47+
<Bug pattern="VO_VOLATILE_REFERENCE_TO_ARRAY"/>
48+
<Bug pattern="AT_NONATOMIC_OPERATIONS_ON_SHARED_VARIABLE"/>
49+
</Or>
50+
</Match>
51+
52+
<!-- Exclude expose rep warnings globally, zThread intentionally passes mutable references to avoid allocations -->
53+
<Match>
54+
<Or>
55+
<Bug pattern="EI_EXPOSE_REP"/>
56+
<Bug pattern="EI_EXPOSE_REP2"/>
57+
</Or>
4158
</Match>
4259
</FindBugsFilter>

‎pom.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@
111111
<spotless.version>2.44.3</spotless.version>
112112
<checkstyle.version>3.6.0</checkstyle.version>
113113
<checkstyle-tool.version>10.21.4</checkstyle-tool.version>
114-
<pmd-plugin.version>3.26.0</pmd-plugin.version>
115-
<pmd-tool.version>7.11.0</pmd-tool.version>
116-
<spotbugs.version>4.9.3.0</spotbugs.version>
114+
<pmd-plugin.version>3.28.0</pmd-plugin.version>
115+
<pmd-tool.version>7.16.0</pmd-tool.version>
116+
<spotbugs.version>4.10.3.0</spotbugs.version>
117117
<jacoco.version>0.8.15</jacoco.version>
118118
</properties>
119119

‎zthread-linux/src/main/java/io/github/namanoncode/zthread/linux/LinuxInotifyWatcher.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public final class LinuxInotifyWatcher implements AutoCloseable {
4848
private final Arena arena;
4949
private final int inotifyFd;
5050
private final MemorySegment readBuffer;
51-
@SuppressWarnings("PMD.LooseCoupling")
5251
private final ConcurrentHashMap<Integer, WatchRegistration> watches = new ConcurrentHashMap<>();
5352

5453
public LinuxInotifyWatcher(LinuxEventLoop eventLoop, EventDispatcher dispatcher) {

0 commit comments

Comments
 (0)