From 787ca8ab262d090d1ded31312d4b61c245a3527e Mon Sep 17 00:00:00 2001 From: MartinWitt Date: Fri, 25 Nov 2022 17:07:32 +0000 Subject: [PATCH] Refactor bad smells: - UtilityClassWithoutPrivateConstructor Utility classes should not have a public or default constructor. --- .../xyz/keksdose/spoon/code_solver/github/PullRequest.java | 4 ++++ .../keksdose/spoon/code_solver/printing/PrinterCreation.java | 4 ++++ .../spoon/code_solver/transformations/junit/JunitHelper.java | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/github/PullRequest.java b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/github/PullRequest.java index c74e8bcc7..61381e0be 100644 --- a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/github/PullRequest.java +++ b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/github/PullRequest.java @@ -298,4 +298,8 @@ private static String getRelevantChangeLog(String name, Changelog log) { } return sb.toString(); } + + private PullRequest() { + // UtilityClass + } } diff --git a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/printing/PrinterCreation.java b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/printing/PrinterCreation.java index 479a4a34d..c2c3b116d 100644 --- a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/printing/PrinterCreation.java +++ b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/printing/PrinterCreation.java @@ -46,4 +46,8 @@ private static Supplier createSniperPrinter( env.setPreserveLineNumbers(false); return () -> new ImportAwareSniperPrinter(env); } + + private PrinterCreation() { + // UtilityClass + } } diff --git a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/transformations/junit/JunitHelper.java b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/transformations/junit/JunitHelper.java index 72da8854b..66d3d936d 100644 --- a/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/transformations/junit/JunitHelper.java +++ b/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/transformations/junit/JunitHelper.java @@ -138,4 +138,8 @@ public static boolean isJunit5AssertFalse(CtExecutableReference executable) { public static CtTypeReference getJunit5TestReference(Factory factory) { return factory.createReference("org.junit.jupiter.api.Test"); } + + private JunitHelper() { + // UtilityClass + } }