From cdbd713ed0a07b6b3de402fc98adb2d591ece70a Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 3 Feb 2026 04:43:13 +0000 Subject: [PATCH 1/5] Update net.sourceforge.pmd to v7.21.0 --- pom.xml | 4 ++-- template-placeholder/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index d062774..803cb4d 100644 --- a/pom.xml +++ b/pom.xml @@ -83,12 +83,12 @@ net.sourceforge.pmd pmd-core - 7.20.0 + 7.21.0 net.sourceforge.pmd pmd-java - 7.20.0 + 7.21.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 597d823..cdb13a0 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -253,12 +253,12 @@ net.sourceforge.pmd pmd-core - 7.20.0 + 7.21.0 net.sourceforge.pmd pmd-java - 7.20.0 + 7.21.0 From 78e6f922261869bc7a6f939d185e46e35ed3f0aa Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 4 Feb 2026 12:01:54 +0100 Subject: [PATCH 2/5] Updat to PMD 7.21.0 --- .config/pmd/java/ruleset.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/pmd/java/ruleset.xml b/.config/pmd/java/ruleset.xml index e96576b..e2325a9 100644 --- a/.config/pmd/java/ruleset.xml +++ b/.config/pmd/java/ruleset.xml @@ -146,7 +146,6 @@ - @@ -164,6 +163,7 @@ + From 076ea0fc43b6354042220d357fa595eeebf32f0b Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Fri, 6 Feb 2026 04:44:15 +0000 Subject: [PATCH 3/5] Update dependency com.puppycrawl.tools:checkstyle to v13.2.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d062774..45d9bd4 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 13.1.0 + 13.2.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 597d823..0ea5a26 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -215,7 +215,7 @@ com.puppycrawl.tools checkstyle - 13.1.0 + 13.2.0 From 76cf22386537f750c979b63658ab3459f6b8586c Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 20 Feb 2026 08:43:59 +0100 Subject: [PATCH 4/5] Disallow classes ending with Helper or Util Fixes https://github.com/xdev-software/java-setup-template/issues/7 --- .config/checkstyle/checkstyle.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.config/checkstyle/checkstyle.xml b/.config/checkstyle/checkstyle.xml index 463a629..262c9f9 100644 --- a/.config/checkstyle/checkstyle.xml +++ b/.config/checkstyle/checkstyle.xml @@ -79,6 +79,11 @@ + + + + + From 838f350c5da393d455f0b1de29397762af9111ac Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 23 Feb 2026 09:54:21 +0100 Subject: [PATCH 5/5] Avoid using Optional#get Fixes https://github.com/xdev-software/java-setup-template/issues/8 --- .config/pmd/java/ruleset.xml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.config/pmd/java/ruleset.xml b/.config/pmd/java/ruleset.xml index e2325a9..9dc7a0f 100644 --- a/.config/pmd/java/ruleset.xml +++ b/.config/pmd/java/ruleset.xml @@ -208,6 +208,36 @@ + + +`Optional#get` can be interpreted as a getter by developers, however this is not the case as it throws an exception when empty. + +It should be replaced by +* doing a mapping directly using `.map` or `.ifPresent` +* using the preferred `.orElseThrow`, `.orElse` or `.or` methods + +Java Developer Brian Goetz also writes regarding this topic: + +> Java 8 was a huge improvement to the platform, but one of the few mistakes we made was the naming of `Optional.get()`, because the name just invites people to call it without calling `isPresent()`, undermining the whole point of using `Optional` in the first place. +> +> During the Java 9 time frame, we proposed to deprecate `Optional.get()`, but the public response to that was ... let's say cold. As a smaller step, we introduced `orElseThrow()` in 10 (see [JDK-8140281](https://bugs.openjdk.java.net/browse/JDK-8140281)) as a more transparently named synonym for the current pernicious behavior of `get()`. IDEs warn on unconditional use of `get()`, but not on `orElseThrow()`, which is a step forward in teaching people to code better. The question is, in a sense, a "glass half empty" view of the current situation; `get()` is still problematic. + + 3 + + + + + + + + +