Skip to content

Commit bfb8d8c

Browse files
committed
chore: fix issues prevent compilation with later JDKs
Signed-off-by: Todd Baert <[email protected]>
1 parent 7f06b9a commit bfb8d8c

29 files changed

+187
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class MyClass {
5656
For complete documentation, visit: https://docs.openfeature.dev/docs/category/concepts
5757

5858
## Requirements
59-
- Java 8+
59+
- Java 11+ (compiler target is 1.8)
6060

6161
## Installation
6262

checkstyle-suppressions.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
4+
5+
<suppressions>
6+
<!-- checkstyle suppressions can go here -->
7+
</suppressions>

checkstyle.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@
292292
<property name="allowedAnnotations" value="Override, Test"/>
293293
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
294294
</module>
295+
<module name="MissingJavadocType">
296+
<property name="scope" value="protected"/>
297+
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
298+
RECORD_DEF, ANNOTATION_DEF"/>
299+
<property name="excludeScope" value="nothing"/>
300+
</module>
295301
<module name="MethodName">
296302
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
297303
<message key="name.invalidPattern"
@@ -314,4 +320,3 @@
314320
</module>
315321
</module>
316322
</module>
317-

pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@
369369
<version>3.4.1</version>
370370
<configuration>
371371
<failOnWarnings>true</failOnWarnings>
372+
<doclint>all,-missing</doclint> <!-- ignore missing javadoc, these are enforced with more customizability in the checkstyle plugin -->
372373
</configuration>
373374
<executions>
374375
<execution>
@@ -461,7 +462,7 @@
461462
<dependency>
462463
<groupId>com.puppycrawl.tools</groupId>
463464
<artifactId>checkstyle</artifactId>
464-
<version>8.45.1</version>
465+
<version>10.3.2</version>
465466
</dependency>
466467
</dependencies>
467468
<executions>

spotbugs-exclusions.xml

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
<Bug pattern="EI_EXPOSE_REP2"/>
2828
</And>
2929

30-
31-
32-
3330
<!-- Test class that should be excluded -->
3431
<Match>
3532
<Class name="dev.openfeature.sdk.DoSomethingProvider"/>

src/main/java/dev/openfeature/sdk/BooleanHook.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* {@inheritDoc}
5+
*/
36
public interface BooleanHook extends Hook<Boolean> {
47

58
@Override

src/main/java/dev/openfeature/sdk/DoubleHook.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* {@inheritDoc}
5+
*/
36
public interface DoubleHook extends Hook<Double> {
47

58
@Override
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* Flag resolution error codes.
5+
*/
36
public enum ErrorCode {
47
PROVIDER_NOT_READY, FLAG_NOT_FOUND, PARSE_ERROR, TYPE_MISMATCH, TARGETING_KEY_MISSING, INVALID_CONTEXT, GENERAL
58
}

src/main/java/dev/openfeature/sdk/FlagEvaluationDetails.java

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class FlagEvaluationDetails<T> implements BaseEvaluation<T> {
2020

2121
/**
2222
* Generate detail payload from the provider response.
23+
*
2324
* @param providerEval provider response
2425
* @param flagKey key for the flag being evaluated
2526
* @param <T> type of flag being returned

src/main/java/dev/openfeature/sdk/FlagEvaluationOptions.java

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import lombok.Builder;
88
import lombok.Singular;
99

10+
/**
11+
* Options to be passed in flag evaluation.
12+
*/
1013
@lombok.Value
1114
@Builder
1215
public class FlagEvaluationOptions {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* Flag value data types.
5+
*/
36
public enum FlagValueType {
47
STRING, INTEGER, DOUBLE, OBJECT, BOOLEAN;
58
}

src/main/java/dev/openfeature/sdk/HookSupport.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package dev.openfeature.sdk;
22

3-
import java.util.*;
3+
import java.util.List;
4+
import java.util.Map;
5+
import java.util.Objects;
6+
import java.util.Optional;
47
import java.util.function.Consumer;
58
import java.util.stream.Collectors;
69
import java.util.stream.IntStream;

src/main/java/dev/openfeature/sdk/IntegerHook.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* {@inheritDoc}
5+
*/
36
public interface IntegerHook extends Hook<Integer> {
47

58
@Override

src/main/java/dev/openfeature/sdk/MutableStructure.java

+59-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package dev.openfeature.sdk;
22

33
import java.time.Instant;
4-
import java.util.*;
4+
import java.util.HashMap;
5+
import java.util.List;
6+
import java.util.Map;
7+
import java.util.Set;
58
import java.util.stream.Collectors;
69

710
import dev.openfeature.sdk.exceptions.ValueNotConvertableError;
@@ -34,55 +37,103 @@ public Set<String> keySet() {
3437
return this.attributes.keySet();
3538
}
3639

37-
// getters
40+
3841
@Override
3942
public Value getValue(String key) {
4043
return this.attributes.get(key);
4144
}
4245

43-
// adders
46+
/**
47+
* Adds the specified value at key.
48+
*
49+
* @param key String index
50+
* @param value Value value
51+
* @return this structure
52+
*/
4453
public MutableStructure add(String key, Value value) {
4554
attributes.put(key, value);
4655
return this;
4756
}
4857

58+
/**
59+
* Adds the specified value at key.
60+
*
61+
* @param key String index
62+
* @param value Boolean value
63+
* @return this structure
64+
*/
4965
public MutableStructure add(String key, Boolean value) {
5066
attributes.put(key, new Value(value));
5167
return this;
5268
}
5369

70+
/**
71+
* Adds the specified value at key.
72+
*
73+
* @param key String index
74+
* @param value String value
75+
* @return this structure
76+
*/
5477
public MutableStructure add(String key, String value) {
5578
attributes.put(key, new Value(value));
5679
return this;
5780
}
5881

82+
/**
83+
* Adds the specified value at key.
84+
*
85+
* @param key String index
86+
* @param value Integer value
87+
* @return this structure
88+
*/
5989
public MutableStructure add(String key, Integer value) {
6090
attributes.put(key, new Value(value));
6191
return this;
6292
}
6393

94+
/**
95+
* Adds the specified value at key.
96+
*
97+
* @param key String index
98+
* @param value Double value
99+
* @return this structure
100+
*/
64101
public MutableStructure add(String key, Double value) {
65102
attributes.put(key, new Value(value));
66103
return this;
67104
}
68105

69106
/**
70-
* Add date-time relevant key.
107+
* Adds the specified value at key.
71108
*
72-
* @param key feature key
73-
* @param value date-time value
74-
* @return Structure
109+
* @param key String index
110+
* @param value Instant value
111+
* @return this structure
75112
*/
76113
public MutableStructure add(String key, Instant value) {
77114
attributes.put(key, new Value(value));
78115
return this;
79116
}
80117

118+
/**
119+
* Adds the specified value at key.
120+
*
121+
* @param key String index
122+
* @param value Structure value
123+
* @return this structure
124+
*/
81125
public MutableStructure add(String key, Structure value) {
82126
attributes.put(key, new Value(value));
83127
return this;
84128
}
85129

130+
/**
131+
* Adds the specified value at key.
132+
*
133+
* @param key String index
134+
* @param value List value
135+
* @return this structure
136+
*/
86137
public <T> MutableStructure add(String key, List<Value> value) {
87138
attributes.put(key, new Value(value));
88139
return this;
@@ -116,6 +167,7 @@ public Map<String, Object> asObjectMap() {
116167

117168
/**
118169
* convertValue is converting the object type Value in a primitive type.
170+
*
119171
* @param value - Value object to convert
120172
* @return an Object containing the primitive type.
121173
*/

src/main/java/dev/openfeature/sdk/OpenFeatureClient.java

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
import lombok.Getter;
1515
import lombok.extern.slf4j.Slf4j;
1616

17+
/**
18+
* {@inheritDoc}
19+
*/
1720
@Slf4j
1821
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.BeanMembersShouldSerialize", "unchecked", "rawtypes" })
1922
public class OpenFeatureClient implements Client {

src/main/java/dev/openfeature/sdk/ProviderEvaluation.java

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
import javax.annotation.Nullable;
77

8+
/**
9+
* Representing the result of the provider's flag resolution process.
10+
*/
811
@Data @Builder
912
public class ProviderEvaluation<T> implements BaseEvaluation<T> {
1013
T value;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* Predefined resolution reasons.
5+
*/
36
public enum Reason {
47
DISABLED, SPLIT, TARGETING_MATCH, DEFAULT, UNKNOWN, ERROR
58
}

src/main/java/dev/openfeature/sdk/StringHook.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package dev.openfeature.sdk;
22

3+
/**
4+
* {@inheritDoc}
5+
*/
36
public interface StringHook extends Hook<String> {
47

58
@Override

src/main/java/dev/openfeature/sdk/Value.java

+43
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class Value {
1818

1919
private final Object innerObject;
2020

21+
/**
22+
* Construct a new null Value.
23+
*/
2124
public Value() {
2225
this.innerObject = null;
2326
}
@@ -42,34 +45,74 @@ public Value(Object value) throws InstantiationException {
4245
}
4346
}
4447

48+
/**
49+
* Construct a new Value from an existing Value.
50+
*
51+
* @param value existing value
52+
*/
4553
public Value(Value value) {
4654
this.innerObject = value.innerObject;
4755
}
4856

57+
/**
58+
* Construct a new Value from a Boolean.
59+
*
60+
* @param value Boolean value
61+
*/
4962
public Value(Boolean value) {
5063
this.innerObject = value;
5164
}
5265

66+
/**
67+
* Construct a new Value from a String.
68+
*
69+
* @param value String value
70+
*/
5371
public Value(String value) {
5472
this.innerObject = value;
5573
}
5674

75+
/**
76+
* Construct a new Value from a Integer.
77+
*
78+
* @param value Integer value
79+
*/
5780
public Value(Integer value) {
5881
this.innerObject = value.doubleValue();
5982
}
6083

84+
/**
85+
* Construct a new Value from a Double.
86+
*
87+
* @param value Double value
88+
*/
6189
public Value(Double value) {
6290
this.innerObject = value;
6391
}
6492

93+
/**
94+
* Construct a new Value from a Structure.
95+
*
96+
* @param value Structure value
97+
*/
6598
public Value(Structure value) {
6699
this.innerObject = value;
67100
}
68101

102+
/**
103+
* Construct a new Value from a List.
104+
*
105+
* @param value List value
106+
*/
69107
public Value(List<Value> value) {
70108
this.innerObject = value;
71109
}
72110

111+
/**
112+
* Construct a new Value from an Instant.
113+
*
114+
* @param value Instant value
115+
*/
73116
public Value(Instant value) {
74117
this.innerObject = value;
75118
}

src/main/java/dev/openfeature/sdk/exceptions/FlagNotFoundError.java

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import lombok.Getter;
55
import lombok.experimental.StandardException;
66

7+
/**
8+
* The flag could not be found.
9+
*/
710
@StandardException
811
public class FlagNotFoundError extends OpenFeatureError {
912
private static final long serialVersionUID = 1L;

0 commit comments

Comments
 (0)