diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml
index 6224db69..6ca66f09 100644
--- a/.github/workflows/merge.yml
+++ b/.github/workflows/merge.yml
@@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
- - name: Set up JDK 8
+ - name: Set up JDK 18
uses: actions/setup-java@3617c43588448d532250f5c331dffcca90e398f1
with:
- java-version: '8'
+ java-version: '18'
distribution: 'temurin'
cache: maven
server-id: ossrh
diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml
index 7ce69a71..16c0cc51 100644
--- a/.github/workflows/pullrequest.yml
+++ b/.github/workflows/pullrequest.yml
@@ -18,10 +18,10 @@ jobs:
- name: Check out the code
uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
- - name: Set up JDK 8
+ - name: Set up JDK 18
uses: actions/setup-java@3617c43588448d532250f5c331dffcca90e398f1
with:
- java-version: '8'
+ java-version: '18'
distribution: 'temurin'
cache: maven
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 01841f20..86df3db3 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,11 +30,11 @@ jobs:
- name: checkout
if: ${{ steps.release.outputs.releases_created }}
uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
- - name: Set up JDK 8
+ - name: Set up JDK 18
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-java@3617c43588448d532250f5c331dffcca90e398f1
with:
- java-version: '8'
+ java-version: '18'
distribution: 'temurin'
cache: maven
server-id: ossrh
diff --git a/README.md b/README.md
index 51591d0c..712a8420 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ class MyClass {
For complete documentation, visit: https://docs.openfeature.dev/docs/category/concepts
## Requirements
-- Java 8+
+- Java 18+ (compiler target is 1.8)
## Installation
diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
new file mode 100644
index 00000000..ef1413bc
--- /dev/null
+++ b/checkstyle-suppressions.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/checkstyle.xml b/checkstyle.xml
index a52e1bf7..498b4837 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -292,6 +292,12 @@
+
+
+
+
+
-
diff --git a/pom.xml b/pom.xml
index 90c2c76e..a8356dfc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -369,6 +369,7 @@
3.4.1
true
+ all,-missing
@@ -461,7 +462,7 @@
com.puppycrawl.tools
checkstyle
- 8.45.1
+ 10.3.2
diff --git a/spotbugs-exclusions.xml b/spotbugs-exclusions.xml
index 673bf4b5..8105db97 100644
--- a/spotbugs-exclusions.xml
+++ b/spotbugs-exclusions.xml
@@ -27,9 +27,6 @@
-
-
-
diff --git a/src/main/java/dev/openfeature/sdk/BooleanHook.java b/src/main/java/dev/openfeature/sdk/BooleanHook.java
index 26fff41c..bc07d898 100644
--- a/src/main/java/dev/openfeature/sdk/BooleanHook.java
+++ b/src/main/java/dev/openfeature/sdk/BooleanHook.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * {@inheritDoc}
+ */
public interface BooleanHook extends Hook {
@Override
diff --git a/src/main/java/dev/openfeature/sdk/DoubleHook.java b/src/main/java/dev/openfeature/sdk/DoubleHook.java
index 2ec179d9..1da0602d 100644
--- a/src/main/java/dev/openfeature/sdk/DoubleHook.java
+++ b/src/main/java/dev/openfeature/sdk/DoubleHook.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * {@inheritDoc}
+ */
public interface DoubleHook extends Hook {
@Override
diff --git a/src/main/java/dev/openfeature/sdk/ErrorCode.java b/src/main/java/dev/openfeature/sdk/ErrorCode.java
index 2acf31ef..b4846693 100644
--- a/src/main/java/dev/openfeature/sdk/ErrorCode.java
+++ b/src/main/java/dev/openfeature/sdk/ErrorCode.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * Flag resolution error codes.
+ */
public enum ErrorCode {
PROVIDER_NOT_READY, FLAG_NOT_FOUND, PARSE_ERROR, TYPE_MISMATCH, TARGETING_KEY_MISSING, INVALID_CONTEXT, GENERAL
}
diff --git a/src/main/java/dev/openfeature/sdk/FlagEvaluationDetails.java b/src/main/java/dev/openfeature/sdk/FlagEvaluationDetails.java
index d9c85be4..67ee853d 100644
--- a/src/main/java/dev/openfeature/sdk/FlagEvaluationDetails.java
+++ b/src/main/java/dev/openfeature/sdk/FlagEvaluationDetails.java
@@ -20,6 +20,7 @@ public class FlagEvaluationDetails implements BaseEvaluation {
/**
* Generate detail payload from the provider response.
+ *
* @param providerEval provider response
* @param flagKey key for the flag being evaluated
* @param type of flag being returned
diff --git a/src/main/java/dev/openfeature/sdk/FlagEvaluationOptions.java b/src/main/java/dev/openfeature/sdk/FlagEvaluationOptions.java
index 81408be9..eccb5af0 100644
--- a/src/main/java/dev/openfeature/sdk/FlagEvaluationOptions.java
+++ b/src/main/java/dev/openfeature/sdk/FlagEvaluationOptions.java
@@ -7,6 +7,9 @@
import lombok.Builder;
import lombok.Singular;
+/**
+ * Options to be passed in flag evaluation.
+ */
@lombok.Value
@Builder
public class FlagEvaluationOptions {
diff --git a/src/main/java/dev/openfeature/sdk/FlagValueType.java b/src/main/java/dev/openfeature/sdk/FlagValueType.java
index 62ca412f..8910546d 100644
--- a/src/main/java/dev/openfeature/sdk/FlagValueType.java
+++ b/src/main/java/dev/openfeature/sdk/FlagValueType.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * Flag value data types.
+ */
public enum FlagValueType {
STRING, INTEGER, DOUBLE, OBJECT, BOOLEAN;
}
diff --git a/src/main/java/dev/openfeature/sdk/HookSupport.java b/src/main/java/dev/openfeature/sdk/HookSupport.java
index eb2b4078..8563096e 100644
--- a/src/main/java/dev/openfeature/sdk/HookSupport.java
+++ b/src/main/java/dev/openfeature/sdk/HookSupport.java
@@ -1,6 +1,9 @@
package dev.openfeature.sdk;
-import java.util.*;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
diff --git a/src/main/java/dev/openfeature/sdk/IntegerHook.java b/src/main/java/dev/openfeature/sdk/IntegerHook.java
index a178904d..1386152e 100644
--- a/src/main/java/dev/openfeature/sdk/IntegerHook.java
+++ b/src/main/java/dev/openfeature/sdk/IntegerHook.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * {@inheritDoc}
+ */
public interface IntegerHook extends Hook {
@Override
diff --git a/src/main/java/dev/openfeature/sdk/MutableStructure.java b/src/main/java/dev/openfeature/sdk/MutableStructure.java
index 99e741df..44204fbe 100644
--- a/src/main/java/dev/openfeature/sdk/MutableStructure.java
+++ b/src/main/java/dev/openfeature/sdk/MutableStructure.java
@@ -1,7 +1,10 @@
package dev.openfeature.sdk;
import java.time.Instant;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import dev.openfeature.sdk.exceptions.ValueNotConvertableError;
@@ -34,55 +37,103 @@ public Set keySet() {
return this.attributes.keySet();
}
- // getters
+
@Override
public Value getValue(String key) {
return this.attributes.get(key);
}
- // adders
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value Value value
+ * @return this structure
+ */
public MutableStructure add(String key, Value value) {
attributes.put(key, value);
return this;
}
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value Boolean value
+ * @return this structure
+ */
public MutableStructure add(String key, Boolean value) {
attributes.put(key, new Value(value));
return this;
}
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value String value
+ * @return this structure
+ */
public MutableStructure add(String key, String value) {
attributes.put(key, new Value(value));
return this;
}
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value Integer value
+ * @return this structure
+ */
public MutableStructure add(String key, Integer value) {
attributes.put(key, new Value(value));
return this;
}
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value Double value
+ * @return this structure
+ */
public MutableStructure add(String key, Double value) {
attributes.put(key, new Value(value));
return this;
}
/**
- * Add date-time relevant key.
+ * Adds the specified value at key.
*
- * @param key feature key
- * @param value date-time value
- * @return Structure
+ * @param key String index
+ * @param value Instant value
+ * @return this structure
*/
public MutableStructure add(String key, Instant value) {
attributes.put(key, new Value(value));
return this;
}
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value Structure value
+ * @return this structure
+ */
public MutableStructure add(String key, Structure value) {
attributes.put(key, new Value(value));
return this;
}
+ /**
+ * Adds the specified value at key.
+ *
+ * @param key String index
+ * @param value List value
+ * @return this structure
+ */
public MutableStructure add(String key, List value) {
attributes.put(key, new Value(value));
return this;
@@ -116,6 +167,7 @@ public Map asObjectMap() {
/**
* convertValue is converting the object type Value in a primitive type.
+ *
* @param value - Value object to convert
* @return an Object containing the primitive type.
*/
diff --git a/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java b/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java
index 827c9215..74690fe9 100644
--- a/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java
+++ b/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java
@@ -14,6 +14,9 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
+/**
+ * {@inheritDoc}
+ */
@Slf4j
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.BeanMembersShouldSerialize", "unchecked", "rawtypes" })
public class OpenFeatureClient implements Client {
diff --git a/src/main/java/dev/openfeature/sdk/ProviderEvaluation.java b/src/main/java/dev/openfeature/sdk/ProviderEvaluation.java
index 3f2b69bc..fea6bd4a 100644
--- a/src/main/java/dev/openfeature/sdk/ProviderEvaluation.java
+++ b/src/main/java/dev/openfeature/sdk/ProviderEvaluation.java
@@ -5,6 +5,9 @@
import javax.annotation.Nullable;
+/**
+ * Representing the result of the provider's flag resolution process.
+ */
@Data @Builder
public class ProviderEvaluation implements BaseEvaluation {
T value;
diff --git a/src/main/java/dev/openfeature/sdk/Reason.java b/src/main/java/dev/openfeature/sdk/Reason.java
index 107665bc..497fd66d 100644
--- a/src/main/java/dev/openfeature/sdk/Reason.java
+++ b/src/main/java/dev/openfeature/sdk/Reason.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * Predefined resolution reasons.
+ */
public enum Reason {
DISABLED, SPLIT, TARGETING_MATCH, DEFAULT, UNKNOWN, ERROR
}
diff --git a/src/main/java/dev/openfeature/sdk/StringHook.java b/src/main/java/dev/openfeature/sdk/StringHook.java
index 15ee5238..aac732d5 100644
--- a/src/main/java/dev/openfeature/sdk/StringHook.java
+++ b/src/main/java/dev/openfeature/sdk/StringHook.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk;
+/**
+ * {@inheritDoc}
+ */
public interface StringHook extends Hook {
@Override
diff --git a/src/main/java/dev/openfeature/sdk/Value.java b/src/main/java/dev/openfeature/sdk/Value.java
index 1caaf52e..a080c8aa 100644
--- a/src/main/java/dev/openfeature/sdk/Value.java
+++ b/src/main/java/dev/openfeature/sdk/Value.java
@@ -18,6 +18,9 @@ public class Value {
private final Object innerObject;
+ /**
+ * Construct a new null Value.
+ */
public Value() {
this.innerObject = null;
}
@@ -42,34 +45,74 @@ public Value(Object value) throws InstantiationException {
}
}
+ /**
+ * Construct a new Value from an existing Value.
+ *
+ * @param value existing value
+ */
public Value(Value value) {
this.innerObject = value.innerObject;
}
+ /**
+ * Construct a new Value from a Boolean.
+ *
+ * @param value Boolean value
+ */
public Value(Boolean value) {
this.innerObject = value;
}
+ /**
+ * Construct a new Value from a String.
+ *
+ * @param value String value
+ */
public Value(String value) {
this.innerObject = value;
}
+ /**
+ * Construct a new Value from a Integer.
+ *
+ * @param value Integer value
+ */
public Value(Integer value) {
this.innerObject = value.doubleValue();
}
+ /**
+ * Construct a new Value from a Double.
+ *
+ * @param value Double value
+ */
public Value(Double value) {
this.innerObject = value;
}
+ /**
+ * Construct a new Value from a Structure.
+ *
+ * @param value Structure value
+ */
public Value(Structure value) {
this.innerObject = value;
}
+ /**
+ * Construct a new Value from a List.
+ *
+ * @param value List value
+ */
public Value(List value) {
this.innerObject = value;
}
+ /**
+ * Construct a new Value from an Instant.
+ *
+ * @param value Instant value
+ */
public Value(Instant value) {
this.innerObject = value;
}
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/FlagNotFoundError.java b/src/main/java/dev/openfeature/sdk/exceptions/FlagNotFoundError.java
index 78a5077d..d208a0b6 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/FlagNotFoundError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/FlagNotFoundError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * The flag could not be found.
+ */
@StandardException
public class FlagNotFoundError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/GeneralError.java b/src/main/java/dev/openfeature/sdk/exceptions/GeneralError.java
index 3b0e57e8..f8224980 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/GeneralError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/GeneralError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * General error.
+ */
@StandardException
public class GeneralError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/InvalidContextError.java b/src/main/java/dev/openfeature/sdk/exceptions/InvalidContextError.java
index 150c851a..e70c3efe 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/InvalidContextError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/InvalidContextError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * The evaluation context does not meet provider requirements.
+ */
@StandardException
public class InvalidContextError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/OpenFeatureError.java b/src/main/java/dev/openfeature/sdk/exceptions/OpenFeatureError.java
index c831bb5e..1799842a 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/OpenFeatureError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/OpenFeatureError.java
@@ -3,6 +3,9 @@
import dev.openfeature.sdk.ErrorCode;
import lombok.experimental.StandardException;
+/**
+ * Base error type.
+ */
@StandardException
public abstract class OpenFeatureError extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/ParseError.java b/src/main/java/dev/openfeature/sdk/exceptions/ParseError.java
index 3aa5ad90..ac8fca87 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/ParseError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/ParseError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * An error was encountered parsing data, such as a flag configuration.
+ */
@StandardException
public class ParseError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/TargetingKeyMissingError.java b/src/main/java/dev/openfeature/sdk/exceptions/TargetingKeyMissingError.java
index e1886c90..12437dc7 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/TargetingKeyMissingError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/TargetingKeyMissingError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * The provider requires a targeting key and one was not provided in the evaluation context.
+ */
@StandardException
public class TargetingKeyMissingError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/TypeMismatchError.java b/src/main/java/dev/openfeature/sdk/exceptions/TypeMismatchError.java
index 08ab8012..d27c6209 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/TypeMismatchError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/TypeMismatchError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * The type of the flag value does not match the expected type.
+ */
@StandardException
public class TypeMismatchError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/exceptions/ValueNotConvertableError.java b/src/main/java/dev/openfeature/sdk/exceptions/ValueNotConvertableError.java
index 443bea76..a681b5ef 100644
--- a/src/main/java/dev/openfeature/sdk/exceptions/ValueNotConvertableError.java
+++ b/src/main/java/dev/openfeature/sdk/exceptions/ValueNotConvertableError.java
@@ -4,6 +4,9 @@
import lombok.Getter;
import lombok.experimental.StandardException;
+/**
+ * The value can not be converted to a {@link dev.openfeature.sdk.Value}.
+ */
@StandardException
public class ValueNotConvertableError extends OpenFeatureError {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/dev/openfeature/sdk/internal/AutoCloseableLock.java b/src/main/java/dev/openfeature/sdk/internal/AutoCloseableLock.java
index 41fb5dc9..4e757e92 100644
--- a/src/main/java/dev/openfeature/sdk/internal/AutoCloseableLock.java
+++ b/src/main/java/dev/openfeature/sdk/internal/AutoCloseableLock.java
@@ -1,5 +1,8 @@
package dev.openfeature.sdk.internal;
+/**
+ * Interface for AutoCloseable that doesn't throw.
+ */
public interface AutoCloseableLock extends AutoCloseable {
/**
diff --git a/src/main/java/dev/openfeature/sdk/internal/ObjectUtils.java b/src/main/java/dev/openfeature/sdk/internal/ObjectUtils.java
index 2318bdc4..2f38b3a3 100644
--- a/src/main/java/dev/openfeature/sdk/internal/ObjectUtils.java
+++ b/src/main/java/dev/openfeature/sdk/internal/ObjectUtils.java
@@ -1,11 +1,17 @@
package dev.openfeature.sdk.internal;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import lombok.experimental.UtilityClass;
+/**
+ * Various utils for internal usage.
+ */
@UtilityClass
public class ObjectUtils {