From 968c12af4c131cb652a30ad9d93e88db5ecd2b30 Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Fri, 22 Aug 2025 00:47:38 +0200 Subject: [PATCH 1/2] Fix warnings from new ErrorProne rules --- src/main/java/edu/hm/hafner/util/LineRangeList.java | 8 ++++---- src/main/java/edu/hm/hafner/util/TreeStringBuilder.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/edu/hm/hafner/util/LineRangeList.java b/src/main/java/edu/hm/hafner/util/LineRangeList.java index 62bfe8ac..4aad16c0 100644 --- a/src/main/java/edu/hm/hafner/util/LineRangeList.java +++ b/src/main/java/edu/hm/hafner/util/LineRangeList.java @@ -317,7 +317,7 @@ private void write(final LineRange r) { * * @return {@code true} if the read value is equal to the specified range */ - public boolean compare(final LineRange other) { + private boolean compare(final LineRange other) { int s = read(); int d = read(); return other.getStart() == s && other.getEnd() == s + d; @@ -366,7 +366,7 @@ public int previousIndex() { throw new UnsupportedOperationException("previousIndex is not supported"); } - public Cursor copy() { + private Cursor copy() { return new Cursor(position); } @@ -389,7 +389,7 @@ private void adjust(final int diff) { * * @return the changed line range */ - public LineRange rewrite(final LineRange other) { + private LineRange rewrite(final LineRange other) { var c = copy(); var old = c.next(); int oldSize = c.position - position; @@ -419,7 +419,7 @@ public void add(final LineRange v) { * * @return the deleted element */ - public LineRange delete() { + private LineRange delete() { var c = copy(); var old = c.next(); adjust(position - c.position); diff --git a/src/main/java/edu/hm/hafner/util/TreeStringBuilder.java b/src/main/java/edu/hm/hafner/util/TreeStringBuilder.java index f45570d2..7e9f7ab7 100644 --- a/src/main/java/edu/hm/hafner/util/TreeStringBuilder.java +++ b/src/main/java/edu/hm/hafner/util/TreeStringBuilder.java @@ -79,7 +79,7 @@ private static final class Child { * * @return the node */ - public Child intern(final String string) { + private Child intern(final String string) { if (string.isEmpty()) { return this; } From 4a263ad78a5ded4aff3f5801bbb33bd28e1fc8b2 Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Fri, 22 Aug 2025 01:03:10 +0200 Subject: [PATCH 2/2] Improve README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9de6981f..e8a9e4f0 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ [![Warnings](https://raw.githubusercontent.com/uhafner/codingstyle/main/badges/style.svg)](https://github.com/uhafner/codingstyle/actions/workflows/quality-monitor-pit.yml) [![Bugs](https://raw.githubusercontent.com/uhafner/codingstyle/main/badges/bugs.svg)](https://github.com/uhafner/codingstyle/actions/workflows/quality-monitor-pit.yml) -Each Java project should follow a given coding style. -I.e., all contributions to the source code should use the same formatting rules, design principles, code patterns, idioms, etc. +Each Java project should follow a given coding style. +All contributions should follow the same formatting rules, design principles, code patterns, and idioms. This coding style provides the set of rules that I am using in my lectures about software development at Munich University of Applied Sciences. This project describes the coding style in detail (currently only available in German) and serves as a template project.