From 08d516c990e4280be658527c325f64e2cb5d462d Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 24 Jun 2023 17:21:43 +0200 Subject: [PATCH] Make checkstyle happy --- .../src/main/java/org/pgpainless/wot/WebOfTrust.java | 4 ++-- .../main/java/org/pgpainless/wot/sugar/Supplier.java | 10 ++++++++++ .../java/org/pgpainless/wot/sugar/package-info.java | 8 ++++++++ .../test/java/org/pgpainless/wot/WebOfTrustTest.java | 2 ++ .../org/pgpainless/wot/testfixtures/package-info.java | 8 ++++++++ .../org/pgpainless/kotlin_experiments/AJavaClass.java | 2 ++ .../kotlin_from_java/AccessKotlinFromJava.java | 2 ++ .../kotlin_from_java/package-info.java | 9 +++++++++ .../pgpainless/kotlin_experiments/package-info.java | 9 +++++++++ .../pgpainless/wot/dijkstra/sq/CertificationSet.java | 2 +- .../java/org/pgpainless/wot/dijkstra/sq/Network.java | 2 +- .../org/pgpainless/kotlin_experiments/AKotlinClass.kt | 2 ++ .../java_from_kotlin/package-info.java | 9 +++++++++ .../pgpainless/kotlin_experiments/package-info.java | 9 +++++++++ 14 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/Supplier.java create mode 100644 pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/package-info.java create mode 100644 pgpainless-wot/src/testFixtures/java/org/pgpainless/wot/testfixtures/package-info.java create mode 100644 wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/package-info.java create mode 100644 wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/package-info.java create mode 100644 wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/java_from_kotlin/package-info.java create mode 100644 wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/package-info.java diff --git a/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java b/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java index cb5002fd..69e7a103 100644 --- a/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java +++ b/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java @@ -12,7 +12,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.function.Supplier; import org.bouncycastle.bcpg.sig.RevocationReason; import org.bouncycastle.openpgp.PGPPublicKey; @@ -36,6 +35,7 @@ import org.pgpainless.wot.dijkstra.sq.CertificationSet; import org.pgpainless.wot.dijkstra.sq.Network; import org.pgpainless.wot.dijkstra.sq.Optional; import org.pgpainless.wot.dijkstra.sq.ReferenceTime; +import org.pgpainless.wot.sugar.Supplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pgp.certificate_store.certificate.Certificate; @@ -140,7 +140,7 @@ public class WebOfTrust implements CertificateAuthority { return nb.buildNetwork(); } - private static class NetworkBuilder { + private static final class NetworkBuilder { // Index structures private final Map byFingerprint = new HashMap<>(); diff --git a/pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/Supplier.java b/pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/Supplier.java new file mode 100644 index 00000000..c0a95f50 --- /dev/null +++ b/pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/Supplier.java @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +package org.pgpainless.wot.sugar; + +public interface Supplier { + + T get(); +} diff --git a/pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/package-info.java b/pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/package-info.java new file mode 100644 index 00000000..54a524f8 --- /dev/null +++ b/pgpainless-wot/src/main/java/org/pgpainless/wot/sugar/package-info.java @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Syntactic sugar, backported from Java 8. + */ +package org.pgpainless.wot.sugar; diff --git a/pgpainless-wot/src/test/java/org/pgpainless/wot/WebOfTrustTest.java b/pgpainless-wot/src/test/java/org/pgpainless/wot/WebOfTrustTest.java index 08d665b3..daf4aec9 100644 --- a/pgpainless-wot/src/test/java/org/pgpainless/wot/WebOfTrustTest.java +++ b/pgpainless-wot/src/test/java/org/pgpainless/wot/WebOfTrustTest.java @@ -19,6 +19,8 @@ public class WebOfTrustTest { WebOfTrust wot = new WebOfTrust(store); wot.initialize(); + // CHECKSTYLE:OFF System.out.println(wot); + // CHECKSTYLE:ON } } diff --git a/pgpainless-wot/src/testFixtures/java/org/pgpainless/wot/testfixtures/package-info.java b/pgpainless-wot/src/testFixtures/java/org/pgpainless/wot/testfixtures/package-info.java new file mode 100644 index 00000000..e9591996 --- /dev/null +++ b/pgpainless-wot/src/testFixtures/java/org/pgpainless/wot/testfixtures/package-info.java @@ -0,0 +1,8 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Test fixtures for WOT. + */ +package org.pgpainless.wot.testfixtures; diff --git a/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/AJavaClass.java b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/AJavaClass.java index 512e83e8..a1236ac2 100644 --- a/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/AJavaClass.java +++ b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/AJavaClass.java @@ -11,6 +11,8 @@ public class AJavaClass { * Used by {@link org.pgpainless.kotlin_experiments.java_from_kotlin.AccessJavaFromKotlin}. */ public void doSomething() { + // CHECKSTYLE:OFF System.out.println("Something has been done."); + // CHECKSTYLE:ON } } diff --git a/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/AccessKotlinFromJava.java b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/AccessKotlinFromJava.java index 7fb39a7e..ae1ace49 100644 --- a/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/AccessKotlinFromJava.java +++ b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/AccessKotlinFromJava.java @@ -15,6 +15,8 @@ public class AccessKotlinFromJava { public static void main(String[] args) { // from src/kotlin/.../ AKotlinClass kotlin = new AKotlinClass(); + // CHECKSTYLE:OFF kotlin.printToStdout(); + // CHECKSTYLE:ON } } diff --git a/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/package-info.java b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/package-info.java new file mode 100644 index 00000000..055b3c69 --- /dev/null +++ b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/kotlin_from_java/package-info.java @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Demonstration package. + * TODO: Delete later. + */ +package org.pgpainless.kotlin_experiments.kotlin_from_java; diff --git a/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/package-info.java b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/package-info.java new file mode 100644 index 00000000..3150f509 --- /dev/null +++ b/wot-dijkstra/src/main/java/org/pgpainless/kotlin_experiments/package-info.java @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Demonstration package. + * TODO: Delete later. + */ +package org.pgpainless.kotlin_experiments; diff --git a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertificationSet.java b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertificationSet.java index f3f39435..7c846ab7 100644 --- a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertificationSet.java +++ b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertificationSet.java @@ -121,7 +121,7 @@ public final class CertificationSet { StringBuilder sb = new StringBuilder(); for (Map.Entry, List> entry : certifications.entrySet()) { for (Certification certification : entry.getValue()) { - sb.append(certification).append("\n"); + sb.append(certification).append('\n'); } } return sb.toString(); diff --git a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Network.java b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Network.java index a1cfa2dd..6629d7af 100644 --- a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Network.java +++ b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Network.java @@ -67,4 +67,4 @@ public class Network { } return sb.toString(); } -} \ No newline at end of file +} diff --git a/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/AKotlinClass.kt b/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/AKotlinClass.kt index 3142f1e3..5f2352e3 100644 --- a/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/AKotlinClass.kt +++ b/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/AKotlinClass.kt @@ -10,6 +10,8 @@ package org.pgpainless.kotlin_experiments class AKotlinClass { fun printToStdout() { + // CHECKSTYLE:OFF println("'Hello, World' from Kotlin!") + // CHECKSTYLE:ON } } \ No newline at end of file diff --git a/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/java_from_kotlin/package-info.java b/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/java_from_kotlin/package-info.java new file mode 100644 index 00000000..6cb74bb9 --- /dev/null +++ b/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/java_from_kotlin/package-info.java @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Demonstration package. + * TODO: Delete later. + */ +package org.pgpainless.kotlin_experiments.java_from_kotlin; diff --git a/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/package-info.java b/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/package-info.java new file mode 100644 index 00000000..3150f509 --- /dev/null +++ b/wot-dijkstra/src/main/kotlin/org/pgpainless/kotlin_experiments/package-info.java @@ -0,0 +1,9 @@ +// SPDX-FileCopyrightText: 2023 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +/** + * Demonstration package. + * TODO: Delete later. + */ +package org.pgpainless.kotlin_experiments;