Remove guava dependency. Ensure unused dependencies are removed from pom.xml
This commit is contained in:
parent
3051790370
commit
465d1139d5
33
pom.xml
33
pom.xml
|
|
@ -41,12 +41,6 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>30.1.1-jre</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
@ -60,6 +54,7 @@
|
|||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs</artifactId>
|
||||
<version>4.7.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -79,7 +74,7 @@
|
|||
<dependency>
|
||||
<groupId>uk.org.lidalia</groupId>
|
||||
<artifactId>slf4j-test</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
@ -126,6 +121,30 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>analyze</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<failOnWarning>true</failOnWarning>
|
||||
<ignoredUnusedDeclaredDependencies>
|
||||
<ignoredUnusedDeclaredDependency>com.github.spotbugs:*</ignoredUnusedDeclaredDependency>
|
||||
<ignoredUnusedDeclaredDependency>org.junit*</ignoredUnusedDeclaredDependency>
|
||||
</ignoredUnusedDeclaredDependencies>
|
||||
<ignoredDependencies>
|
||||
<ignoredDependency>com.google.code.findbugs*</ignoredDependency>
|
||||
<ignoredDependency>com.github.spotbugs*</ignoredDependency>
|
||||
<ignoredDependency>uk.org.lidalia:lidalia-slf4j-ext:*</ignoredDependency>
|
||||
</ignoredDependencies>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package dev.openfeature.javasdk;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -11,7 +10,7 @@ public interface FeatureProvider {
|
|||
Metadata getMetadata();
|
||||
|
||||
default List<Hook> getProviderHooks() {
|
||||
return Lists.newArrayList();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx,
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
package dev.openfeature.javasdk;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
|
@ -74,8 +71,13 @@ class HookSupport {
|
|||
private Stream<EvaluationContext> callBeforeHooks(FlagValueType flagValueType, HookContext hookCtx,
|
||||
List<Hook> hooks, Map<String, Object> hints) {
|
||||
// These traverse backwards from normal.
|
||||
return Lists
|
||||
.reverse(hooks)
|
||||
List<Hook> reversedHooks = IntStream
|
||||
.range(0, hooks.size())
|
||||
.map(i -> hooks.size() - 1 - i)
|
||||
.mapToObj(hooks::get)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return reversedHooks
|
||||
.stream()
|
||||
.filter(hook -> hook.supportsFlagValueType(flagValueType))
|
||||
.map(hook -> hook.before(hookCtx, hints))
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package dev.openfeature.javasdk;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.openfeature.javasdk.fixtures.HookFixtures;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
|
@ -177,7 +175,7 @@ public class HookSpecTest implements HookFixtures {
|
|||
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
|
||||
api.setProvider(new NoOpProvider() {
|
||||
public List<Hook> getProviderHooks() {
|
||||
return Lists.newArrayList(new BooleanHook() {
|
||||
return Collections.singletonList(new BooleanHook() {
|
||||
|
||||
@Override
|
||||
public Optional<EvaluationContext> before(HookContext<Boolean> ctx, Map<String, Object> hints) {
|
||||
|
|
@ -186,7 +184,8 @@ public class HookSpecTest implements HookFixtures {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void after(HookContext<Boolean> ctx, FlagEvaluationDetails<Boolean> details, Map<String, Object> hints) {
|
||||
public void after(HookContext<Boolean> ctx, FlagEvaluationDetails<Boolean> details, Map<String,
|
||||
Object> hints) {
|
||||
evalOrder.add("provider after");
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +347,9 @@ public class HookSpecTest implements HookFixtures {
|
|||
}
|
||||
};
|
||||
|
||||
Map<String, Object> hh = new HashMap<>(ImmutableMap.of(hintKey, "My hint value"));
|
||||
Map<String, Object> hh = new HashMap<>();
|
||||
hh.put(hintKey, "My hint value");
|
||||
hh = Collections.unmodifiableMap(hh);
|
||||
|
||||
client.getBooleanValue("key", false, new EvaluationContext(), FlagEvaluationOptions.builder()
|
||||
.hook(mutatingHook)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package dev.openfeature.javasdk.internal;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
import static dev.openfeature.javasdk.internal.ObjectUtils.defaultIfNull;
|
||||
|
|
@ -65,7 +64,9 @@ class ObjectUtilsTest {
|
|||
@Test
|
||||
@DisplayName("should return default map if given one is null")
|
||||
void shouldReturnDefaultMapIfGivenOneIsNull() {
|
||||
Map<String, Object> defaultValue = ImmutableMap.of("key", "default");
|
||||
HashMap<String, String> hm = new HashMap<>();
|
||||
hm.put("key", "default");
|
||||
Map<String, Object> defaultValue = Collections.unmodifiableMap(hm);
|
||||
|
||||
Map<String, Object> actual = defaultIfNull(null, () -> defaultValue);
|
||||
|
||||
|
|
@ -75,8 +76,13 @@ class ObjectUtilsTest {
|
|||
@Test
|
||||
@DisplayName("should return given map if not null")
|
||||
void shouldReturnGivenMapIfNotNull() {
|
||||
Map<String, String> defaultValue = ImmutableMap.of("key", "default");
|
||||
Map<String, String> expectedValue = ImmutableMap.of("key", "expected");
|
||||
Map<String, String> dv = new HashMap<>();
|
||||
dv.put("key", "default");
|
||||
Map<String, String> defaultValue = Collections.unmodifiableMap(dv);
|
||||
|
||||
Map<String, String> ev = new HashMap<>();
|
||||
ev.put("key", "expected");
|
||||
Map<String, String> expectedValue = Collections.unmodifiableMap(ev);
|
||||
|
||||
Map<String, String> actual = defaultIfNull(expectedValue, () -> defaultValue);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue