From f596984fa59648fe6c4d83d33dc97a2b2649bc56 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 7 Mar 2018 18:38:08 +0000 Subject: [PATCH] Fix PMD warnings --- src/main/java/net/kemitix/conditional/FalseCondition.java | 3 ++- src/main/java/net/kemitix/conditional/FalseValueClause.java | 1 + src/main/java/net/kemitix/conditional/TrueCondition.java | 3 ++- src/main/java/net/kemitix/conditional/TrueValueClause.java | 3 ++- src/main/java/net/kemitix/conditional/Value.java | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/kemitix/conditional/FalseCondition.java b/src/main/java/net/kemitix/conditional/FalseCondition.java index 0d8837c..07881c7 100644 --- a/src/main/java/net/kemitix/conditional/FalseCondition.java +++ b/src/main/java/net/kemitix/conditional/FalseCondition.java @@ -28,7 +28,7 @@ package net.kemitix.conditional; */ final class FalseCondition implements Condition { - protected static final Condition FALSE = new net.kemitix.conditional.FalseCondition(); + public static final Condition FALSE = new net.kemitix.conditional.FalseCondition(); @Override public Condition and(final boolean clause) { @@ -36,6 +36,7 @@ final class FalseCondition implements Condition { } @Override + @SuppressWarnings("PMD.ShortMethodName") public Condition or(final boolean secondClause) { return Condition.where(secondClause); } diff --git a/src/main/java/net/kemitix/conditional/FalseValueClause.java b/src/main/java/net/kemitix/conditional/FalseValueClause.java index e0143e0..672d285 100644 --- a/src/main/java/net/kemitix/conditional/FalseValueClause.java +++ b/src/main/java/net/kemitix/conditional/FalseValueClause.java @@ -45,6 +45,7 @@ class FalseValueClause implements Value.ValueClause { } @Override + @SuppressWarnings("PMD.ShortMethodName") public Value.ValueClause or(final boolean clause) { return Value.where(clause); } diff --git a/src/main/java/net/kemitix/conditional/TrueCondition.java b/src/main/java/net/kemitix/conditional/TrueCondition.java index ce2fbac..06f041b 100644 --- a/src/main/java/net/kemitix/conditional/TrueCondition.java +++ b/src/main/java/net/kemitix/conditional/TrueCondition.java @@ -28,7 +28,7 @@ package net.kemitix.conditional; */ final class TrueCondition implements Condition { - protected static final Condition TRUE = new net.kemitix.conditional.TrueCondition(); + public static final Condition TRUE = new net.kemitix.conditional.TrueCondition(); @Override public Condition and(final boolean clause) { @@ -36,6 +36,7 @@ final class TrueCondition implements Condition { } @Override + @SuppressWarnings("PMD.ShortMethodName") public Condition or(final boolean secondClause) { return TRUE; } diff --git a/src/main/java/net/kemitix/conditional/TrueValueClause.java b/src/main/java/net/kemitix/conditional/TrueValueClause.java index c98f2be..9d3fbcc 100644 --- a/src/main/java/net/kemitix/conditional/TrueValueClause.java +++ b/src/main/java/net/kemitix/conditional/TrueValueClause.java @@ -47,6 +47,7 @@ class TrueValueClause implements Value.ValueClause { } @Override + @SuppressWarnings("PMD.ShortMethodName") public Value.ValueClause or(final boolean clause) { return this; } @@ -57,7 +58,7 @@ class TrueValueClause implements Value.ValueClause { @RequiredArgsConstructor private class TrueValueSupplier implements ValueSupplier { - private final Supplier valueSupplier; + private final transient Supplier valueSupplier; @Override public T otherwise(final Supplier falseSupplier) { diff --git a/src/main/java/net/kemitix/conditional/Value.java b/src/main/java/net/kemitix/conditional/Value.java index 6345564..9b1c3b6 100644 --- a/src/main/java/net/kemitix/conditional/Value.java +++ b/src/main/java/net/kemitix/conditional/Value.java @@ -41,6 +41,7 @@ public interface Value { * * @return the value from either the trueSupplier or the falseSupplier */ + @SuppressWarnings("PMD.LawOfDemeter") static T where( boolean clause, Supplier trueSupplier, @@ -123,6 +124,7 @@ public interface Value { * * @return a true or false value clause */ + @SuppressWarnings("PMD.ShortMethodName") ValueClause or(boolean clause); /**