diff --git a/README.md b/README.md
index d86e7504..72041975 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ It provides all necessary resources for a Java project to enforce this coding st
- [SpotBugs](https://spotbugs.github.io)
- [Error Prone](https://errorprone.info)
-❗This project requires a JDK version of 17 or higher.❗
+❗This project requires a JDK version of 21 or higher.❗
Moreover, this project provides some sample classes that already use this style guide.
These classes can be used as such but are not required in this project.
@@ -54,4 +54,4 @@ Source code (snippets, examples, and classes) are using the [MIT license](https:
[](https://en.wikipedia.org/wiki/MIT_License)
[](https://creativecommons.org/licenses/by/4.0/)
-
+
diff --git a/pom.xml b/pom.xml
index d67b5daa..867dab6f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
edu.hm.hafner
codingstyle
- 5.26.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
jar
Java coding style
@@ -47,7 +47,7 @@
UTF-8
${source.encoding}
- 17
+ 21
21
${project.groupId}.codingstyle
@@ -360,7 +360,7 @@
org.openrewrite.staticanalysis.CodeCleanup
org.openrewrite.staticanalysis.CommonStaticAnalysis
org.openrewrite.staticanalysis.RemoveExtraSemicolons
- org.openrewrite.java.migrate.UpgradeToJava17
+ org.openrewrite.java.migrate.UpgradeToJava21
org.openrewrite.java.migrate.util.SequencedCollection
org.openrewrite.java.migrate.lang.var.UseVarForObject
org.openrewrite.java.migrate.net.JavaNetAPIs
diff --git a/src/main/java/edu/hm/hafner/util/FilteredLog.java b/src/main/java/edu/hm/hafner/util/FilteredLog.java
index f3e730bc..e446025d 100644
--- a/src/main/java/edu/hm/hafner/util/FilteredLog.java
+++ b/src/main/java/edu/hm/hafner/util/FilteredLog.java
@@ -23,7 +23,7 @@
*/
public class FilteredLog implements Serializable {
@Serial
- private static final long serialVersionUID = -8552323621953159904L;
+ private static final long serialVersionUID = 6956036398485594488L;
private static final int DEFAULT_MAX_LINES = 20;
@@ -31,10 +31,10 @@ public class FilteredLog implements Serializable {
private final int maxLines;
private int lines;
- @SuppressWarnings("serial")
- private final List infoMessages = new ArrayList<>();
- @SuppressWarnings("serial")
- private final List errorMessages = new ArrayList<>();
+ @SuppressWarnings("PMD.LooseCoupling")
+ private final ArrayList infoMessages = new ArrayList<>();
+ @SuppressWarnings("PMD.LooseCoupling")
+ private final ArrayList errorMessages = new ArrayList<>();
private transient ReentrantLock lock = new ReentrantLock();
diff --git a/src/main/java/edu/hm/hafner/util/Generated.java b/src/main/java/edu/hm/hafner/util/Generated.java
index 9073ba0b..4f7122f6 100644
--- a/src/main/java/edu/hm/hafner/util/Generated.java
+++ b/src/main/java/edu/hm/hafner/util/Generated.java
@@ -8,13 +8,11 @@
/**
* This annotation is used to mark source code that has been generated or is somehow not relevant for style checking or
- * code coverage analysis. It is quite similar to the JSR305 annotation. The
- * main difference is that it has class retention, so it is available for tools that work on bytecode (like JaCoCo,
- * PIT, or SpotBugs).
+ * code coverage analysis. It is quite similar to the annotation of the abandoned JSR305 project. The main difference is
+ * that it has class retention, so it is available for tools that work on bytecode (like JaCoCo, PIT, or SpotBugs).
*/
@Retention(CLASS)
-@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD,
- LOCAL_VARIABLE, PARAMETER})
+@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, PARAMETER})
public @interface Generated {
/**
* An optional property that identifies the code generator.
diff --git a/src/test/java/edu/hm/hafner/util/EnsureTest.java b/src/test/java/edu/hm/hafner/util/EnsureTest.java
index fa3b659b..2565be6d 100644
--- a/src/test/java/edu/hm/hafner/util/EnsureTest.java
+++ b/src/test/java/edu/hm/hafner/util/EnsureTest.java
@@ -29,7 +29,7 @@ void shouldNotThrowExceptionIfContractIsValid() {
Ensure.that("").isNotNull();
Ensure.that("", "").isNotNull();
Ensure.that(null, (Object) null).isNull();
- Ensure.that(new String[] {""}).isNotEmpty();
+ Ensure.that(new String[]{""}).isNotEmpty();
Ensure.that(SOME_STRING).isNotEmpty();
Ensure.that(SOME_STRING).isNotBlank();
Ensure.that("").isInstanceOf(String.class);
@@ -116,7 +116,7 @@ void shouldThrowExceptionIfEmpty() {
Ensure.that(Lists.newArrayList("", null, "")).isNotEmpty(ERROR_MESSAGE)).isInstanceOf(
AssertionError.class);
assertThatThrownBy(() ->
- Ensure.that(new String[] {"", null, ""}).isNotEmpty(ERROR_MESSAGE)).isInstanceOf(AssertionError.class);
+ Ensure.that(new String[]{"", null, ""}).isNotEmpty(ERROR_MESSAGE)).isInstanceOf(AssertionError.class);
assertThatThrownBy(() ->
Ensure.that("").isNotEmpty(ERROR_MESSAGE)).isInstanceOf(AssertionError.class);
assertThatThrownBy(() ->
@@ -128,7 +128,7 @@ void shouldThrowExceptionIfEmpty() {
assertThatThrownBy(() ->
Ensure.that(Lists.newArrayList("", null, "")).isNotEmpty()).isInstanceOf(AssertionError.class);
assertThatThrownBy(() ->
- Ensure.that(new String[] {"", null, ""}).isNotEmpty()).isInstanceOf(AssertionError.class);
+ Ensure.that(new String[]{"", null, ""}).isNotEmpty()).isInstanceOf(AssertionError.class);
assertThatThrownBy(() ->
Ensure.that("").isNotEmpty()).isInstanceOf(AssertionError.class);
assertThatThrownBy(() ->
diff --git a/src/test/java/edu/hm/hafner/util/LineRangeListTest.java b/src/test/java/edu/hm/hafner/util/LineRangeListTest.java
index 4c4ffb32..2257f5ac 100644
--- a/src/test/java/edu/hm/hafner/util/LineRangeListTest.java
+++ b/src/test/java/edu/hm/hafner/util/LineRangeListTest.java
@@ -1,9 +1,9 @@
package edu.hm.hafner.util;
-import java.util.List;
-
import org.junit.jupiter.api.Test;
+import java.util.List;
+
import static org.assertj.core.api.Assertions.*;
/**
@@ -43,17 +43,17 @@ void shouldSupportSetOperations() {
var range = new LineRange(1, 2);
list.add(range);
- assertThat(list.get(0)).isEqualTo(range);
- assertThat(list.get(0)).isNotSameAs(range);
+ assertThat(list.getFirst()).isEqualTo(range);
+ assertThat(list.getFirst()).isNotSameAs(range);
assertThat(list).hasSize(1);
var other = new LineRange(3, 4);
assertThat(list.set(0, other)).isEqualTo(range);
- assertThat(list.get(0)).isEqualTo(other);
- assertThat(list.get(0)).isNotSameAs(other);
+ assertThat(list.getFirst()).isEqualTo(other);
+ assertThat(list.getFirst()).isNotSameAs(other);
assertThat(list).hasSize(1);
- assertThat(list.remove(0)).isEqualTo(other);
+ assertThat(list.removeFirst()).isEqualTo(other);
assertThat(list).hasSize(0);
}