diff --git a/CLAUDE.md b/CLAUDE.md index 4edf593..e793e9f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -28,7 +28,6 @@ mvn verify # Run tests and integration checks ```bash mvn spotless:check # Check code formatting (Google Java Format) mvn spotless:apply # Apply code formatting -mvn com.github.spotbugs:spotbugs-maven-plugin:check # Run SpotBugs static analysis mvn pmd:check # Run PMD static analysis mvn jacoco:check # Check code coverage requirements ``` @@ -76,7 +75,8 @@ mvn site # Generate project site with reports ### Code Style - Google Java Format style enforced via Spotless - PMD rules defined in `pmd-ruleset.xml` -- SpotBugs static analysis with exclusions in `spotbug-exclude-filter.xml` +- Error Prone and NullAway (JSpecify mode) run during compilation, `-Werror` turns every warning into an error +- Code is `@NullMarked`; nullable API points are annotated with `org.jspecify.annotations.Nullable` - No code comments should be added unless specifically requested - Prefer immutable objects and defensive copying - Use builder patterns for complex object construction diff --git a/pom.xml b/pom.xml index cec11bb..f344570 100644 --- a/pom.xml +++ b/pom.xml @@ -48,10 +48,10 @@ - 6.0.3 + 6.1.3 2.50.0 - 0.13.7 - 7.22.0 + 0.14.2 + 7.28.0 true 25 UTF-8 @@ -97,7 +97,7 @@ org.jspecify jspecify - 1.0.0 + 1.0.1 true @@ -132,7 +132,7 @@ nl.jqno.equalsverifier equalsverifier - 4.4.1 + 4.5.2 test @@ -149,12 +149,12 @@ maven-compiler-plugin - 3.15.0 + 3.16.0 -XDcompilePolicy=simple --should-stop=ifError=FLOW - -Xplugin:ErrorProne -Xep:NullAway:ERROR -XepOpt:NullAway:JSpecifyMode=true -XepOpt:NullAway:AnnotatedPackages=com.sitepark.ies + -Xplugin:ErrorProne -Xep:NullAway:ERROR -XepOpt:NullAway:JSpecifyMode=true -XepOpt:NullAway:AnnotatedPackages=com.sitepark -Werror @@ -172,8 +172,7 @@ - + default-testCompile @@ -188,11 +187,13 @@ maven-jar-plugin - 3.5.0 + 3.5.1 + org.apache.maven.plugins maven-dependency-plugin + 3.11.0 @@ -204,8 +205,9 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.5 + 3.6.0 + @{argLine} -javaagent:${org.mockito:mockito-core:jar} true @@ -277,7 +279,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.6.2 + 3.6.3 io.github.thefolle @@ -325,7 +327,7 @@ org.jacoco jacoco-maven-plugin - 0.8.14 + 0.8.15 @@ -340,12 +342,17 @@ - PACKAGE + BUNDLE LINE - 0.0 COVEREDRATIO + 0.85 + + + BRANCH + COVEREDRATIO + 0.80 @@ -366,22 +373,19 @@ spotless-maven-plugin 3.10.3 - - - google-java-format - - - 1.31.0 + 1.36.1 true false + + google-java-format + - pom.xml @@ -392,9 +396,20 @@ + + + spotless-apply + + apply + + process-sources + + ${spotless.apply.skip} + + - spotless-check + check @@ -407,14 +422,14 @@ maven-pmd-plugin 3.28.0 + true + 5 + true + false + true pmd-ruleset.xml - true - true - 1 - true - false @@ -460,7 +475,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.10.0 + 0.11.0 true true diff --git a/src/main/java/com/sitepark/ies/sharedkernel/base/IdentifierListBuilder.java b/src/main/java/com/sitepark/ies/sharedkernel/base/IdentifierListBuilder.java index 88c4fe1..058a143 100644 --- a/src/main/java/com/sitepark/ies/sharedkernel/base/IdentifierListBuilder.java +++ b/src/main/java/com/sitepark/ies/sharedkernel/base/IdentifierListBuilder.java @@ -5,14 +5,16 @@ import java.util.Collection; import java.util.List; import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; +/** Collects identifiers; every method ignores {@code null}, so optional values can be passed as is. */ @SuppressWarnings("PMD.TooManyMethods") public class IdentifierListBuilder { @NonNull private final List identifiers = new ArrayList<>(); private boolean changed; - public IdentifierListBuilder set(String... identifiers) { + public IdentifierListBuilder set(String @Nullable ... identifiers) { if (identifiers == null) { return this; } @@ -24,7 +26,7 @@ public IdentifierListBuilder set(String... identifiers) { return this; } - public IdentifierListBuilder set(Collection identifiers) { + public IdentifierListBuilder set(@Nullable Collection identifiers) { if (identifiers == null) { return this; } @@ -36,7 +38,7 @@ public IdentifierListBuilder set(Collection identifiers) { return this; } - public IdentifierListBuilder add(String identifier) { + public IdentifierListBuilder add(@Nullable String identifier) { if (identifier == null) { return this; } @@ -45,7 +47,7 @@ public IdentifierListBuilder add(String identifier) { return this; } - public IdentifierListBuilder identifiers(Identifier... identifiers) { + public IdentifierListBuilder identifiers(Identifier @Nullable ... identifiers) { if (identifiers == null) { return this; } @@ -57,7 +59,7 @@ public IdentifierListBuilder identifiers(Identifier... identifiers) { return this; } - public IdentifierListBuilder identifiers(Collection identifiers) { + public IdentifierListBuilder identifiers(@Nullable Collection identifiers) { if (identifiers == null) { return this; } @@ -69,7 +71,7 @@ public IdentifierListBuilder identifiers(Collection identifiers) { return this; } - public IdentifierListBuilder identifier(Identifier identifier) { + public IdentifierListBuilder identifier(@Nullable Identifier identifier) { if (identifier == null) { return this; } @@ -78,7 +80,7 @@ public IdentifierListBuilder identifier(Identifier identifier) { return this; } - public IdentifierListBuilder ids(String... ids) { + public IdentifierListBuilder ids(String @Nullable ... ids) { if (ids == null) { return this; } @@ -90,7 +92,7 @@ public IdentifierListBuilder ids(String... ids) { return this; } - public IdentifierListBuilder ids(Collection ids) { + public IdentifierListBuilder ids(@Nullable Collection ids) { if (ids == null) { return this; } @@ -102,7 +104,7 @@ public IdentifierListBuilder ids(Collection ids) { return this; } - public IdentifierListBuilder id(String id) { + public IdentifierListBuilder id(@Nullable String id) { if (id == null || id.isBlank()) { return this; } @@ -111,7 +113,7 @@ public IdentifierListBuilder id(String id) { return this; } - public IdentifierListBuilder anchors(Anchor... anchors) { + public IdentifierListBuilder anchors(Anchor @Nullable ... anchors) { if (anchors == null) { return this; } @@ -123,7 +125,7 @@ public IdentifierListBuilder anchors(Anchor... anchors) { return this; } - public IdentifierListBuilder anchors(Collection anchors) { + public IdentifierListBuilder anchors(@Nullable Collection anchors) { if (anchors == null) { return this; } @@ -135,7 +137,7 @@ public IdentifierListBuilder anchors(Collection anchors) { return this; } - public IdentifierListBuilder anchor(Anchor anchor) { + public IdentifierListBuilder anchor(@Nullable Anchor anchor) { if (anchor == null) { return this; } diff --git a/src/test/java/com/sitepark/ies/sharedkernel/security/AuthenticationTest.java b/src/test/java/com/sitepark/ies/sharedkernel/security/AuthenticationTest.java index ed60d62..d6b0b5d 100644 --- a/src/test/java/com/sitepark/ies/sharedkernel/security/AuthenticationTest.java +++ b/src/test/java/com/sitepark/ies/sharedkernel/security/AuthenticationTest.java @@ -1,7 +1,10 @@ package com.sitepark.ies.sharedkernel.security; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; import java.util.List; import java.util.Optional;