From a1a7ad65c23b66c2e4a3cf9b82d342cc60c8b654 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 16 Jul 2018 22:29:46 +0100 Subject: [PATCH] Left/Right: don't use `@Getter` for final fields QA tools want these fields to be static, for which lombok creates static getter methods, which then don't match the specification from the `Either` interface. --- .../kemitix/mon/experimental/either/Left.java | 16 ++++++++++------ .../kemitix/mon/experimental/either/Right.java | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/kemitix/mon/experimental/either/Left.java b/src/main/java/net/kemitix/mon/experimental/either/Left.java index 5de5904..1bfdc88 100644 --- a/src/main/java/net/kemitix/mon/experimental/either/Left.java +++ b/src/main/java/net/kemitix/mon/experimental/either/Left.java @@ -21,7 +21,6 @@ package net.kemitix.mon.experimental.either; -import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.function.Consumer; @@ -37,13 +36,18 @@ import java.util.function.Function; @RequiredArgsConstructor class Left implements Either { - @Getter - private final boolean left = true; - @Getter - private final boolean right = false; - private final L value; + @Override + public boolean isLeft() { + return true; + } + + @Override + public boolean isRight() { + return false; + } + @Override public void match(final Consumer onLeft, final Consumer onRight) { onLeft.accept(value); diff --git a/src/main/java/net/kemitix/mon/experimental/either/Right.java b/src/main/java/net/kemitix/mon/experimental/either/Right.java index 35f1baf..0085b86 100644 --- a/src/main/java/net/kemitix/mon/experimental/either/Right.java +++ b/src/main/java/net/kemitix/mon/experimental/either/Right.java @@ -21,7 +21,6 @@ package net.kemitix.mon.experimental.either; -import lombok.Getter; import lombok.RequiredArgsConstructor; import java.util.function.Consumer; @@ -37,13 +36,18 @@ import java.util.function.Function; @RequiredArgsConstructor class Right implements Either { - @Getter - private final boolean left = false; - @Getter - private final boolean right = true; - private final R value; + @Override + public boolean isLeft() { + return false; + } + + @Override + public boolean isRight() { + return true; + } + @Override public void match(final Consumer onLeft, final Consumer onRight) { onRight.accept(value);