diff --git a/drift-client/pom.xml b/drift-client/pom.xml index 2b917675f..8cb7f8ccc 100644 --- a/drift-client/pom.xml +++ b/drift-client/pom.xml @@ -71,7 +71,7 @@ - io.airlift + com.facebook.airlift units @@ -97,6 +97,11 @@ true + + org.gaul + modernizer-maven-annotations + + com.facebook.airlift diff --git a/drift-client/src/main/java/com/facebook/drift/client/DriftMethodInvocation.java b/drift-client/src/main/java/com/facebook/drift/client/DriftMethodInvocation.java index 19f4db842..763ddbcfe 100644 --- a/drift-client/src/main/java/com/facebook/drift/client/DriftMethodInvocation.java +++ b/drift-client/src/main/java/com/facebook/drift/client/DriftMethodInvocation.java @@ -35,6 +35,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import io.airlift.units.Duration; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.ThreadSafe; @@ -148,6 +149,7 @@ private DriftMethodInvocation( }, directExecutor()); } + @SuppressModernizer private synchronized void nextAttempt(boolean noConnectDelay) { try { @@ -157,29 +159,30 @@ private synchronized void nextAttempt(boolean noConnectDelay) } Optional address = addressSelector.selectAddress(addressSelectionContext, attemptedAddresses); - if (!address.isPresent()) { + if (address.isEmpty()) { fail("No hosts available"); return; } + A addr = address.get(); if (invocationAttempts > 0) { stat.recordRetry(); } if (noConnectDelay) { - invoke(address.get()); + invoke(addr); return; } - int connectionFailuresCount = failedConnectionAttempts.count(address.get()); + int connectionFailuresCount = failedConnectionAttempts.count(addr); if (connectionFailuresCount == 0) { - invoke(address.get()); + invoke(addr); return; } Duration connectDelay = retryPolicy.getBackoffDelay(connectionFailuresCount); - log.debug("Failed connection to %s with attempt %s, will retry in %s", address.get(), connectionFailuresCount, connectDelay); - schedule(connectDelay, () -> invoke(address.get())); + log.debug("Failed connection to %s with attempt %s, will retry in %s", addr, connectionFailuresCount, connectDelay); + schedule(connectDelay, () -> invoke(addr)); } catch (Throwable t) { // this should never happen, but ensure that invocation always finishes diff --git a/drift-client/src/main/java/com/facebook/drift/client/ExceptionClassification.java b/drift-client/src/main/java/com/facebook/drift/client/ExceptionClassification.java index 12ac04d6c..6674fe50a 100644 --- a/drift-client/src/main/java/com/facebook/drift/client/ExceptionClassification.java +++ b/drift-client/src/main/java/com/facebook/drift/client/ExceptionClassification.java @@ -153,13 +153,10 @@ public ExceptionClassification toExceptionClassification() @SuppressWarnings("OptionalIsPresent") public static Optional mergeRetry(Optional oldRetry, Optional newRetry) { - if (!oldRetry.isPresent()) { - return newRetry; - } - if (!newRetry.isPresent()) { - return oldRetry; - } - return Optional.of(oldRetry.get() && newRetry.get()); + return oldRetry.map(oldOne -> + newRetry.map(newOne -> oldOne && newOne) + .orElse(false)) + .or(() -> newRetry); } } } diff --git a/drift-client/src/test/java/com/facebook/drift/client/TestDriftClient.java b/drift-client/src/test/java/com/facebook/drift/client/TestDriftClient.java index c18de7fba..57d2aab26 100644 --- a/drift-client/src/test/java/com/facebook/drift/client/TestDriftClient.java +++ b/drift-client/src/test/java/com/facebook/drift/client/TestDriftClient.java @@ -161,7 +161,6 @@ public void testGuiceClient() LifeCycleManager lifeCycleManager = null; try { Injector injector = app - .strictConfig() .doNotInitializeLogging() .initialize(); lifeCycleManager = injector.getInstance(LifeCycleManager.class); @@ -238,7 +237,6 @@ public void testGuiceClientFilter() LifeCycleManager lifeCycleManager = null; try { Injector injector = app - .strictConfig() .doNotInitializeLogging() .initialize(); lifeCycleManager = injector.getInstance(LifeCycleManager.class); diff --git a/drift-client/src/test/java/com/facebook/drift/client/address/TestSimpleAddressSelectorBinder.java b/drift-client/src/test/java/com/facebook/drift/client/address/TestSimpleAddressSelectorBinder.java index 6985658b1..d0456b1f1 100644 --- a/drift-client/src/test/java/com/facebook/drift/client/address/TestSimpleAddressSelectorBinder.java +++ b/drift-client/src/test/java/com/facebook/drift/client/address/TestSimpleAddressSelectorBinder.java @@ -89,7 +89,6 @@ private static void testAddressSelector( try { Injector injector = app .setRequiredConfigurationProperties(configurationProperties) - .strictConfig() .doNotInitializeLogging() .initialize(); lifeCycleManager = injector.getInstance(LifeCycleManager.class); diff --git a/drift-codec-utils/pom.xml b/drift-codec-utils/pom.xml index edd6c1500..589cf3906 100644 --- a/drift-codec-utils/pom.xml +++ b/drift-codec-utils/pom.xml @@ -20,6 +20,7 @@ com.facebook.drift drift-api + provided @@ -38,7 +39,7 @@ - io.airlift + com.facebook.airlift units @@ -60,6 +61,7 @@ + org.testng testng diff --git a/drift-codec/pom.xml b/drift-codec/pom.xml index 34d2782ac..c7111d414 100644 --- a/drift-codec/pom.xml +++ b/drift-codec/pom.xml @@ -41,7 +41,7 @@ com.facebook.airlift bytecode - 1.3 + 1.4-SNAPSHOT @@ -56,6 +56,11 @@ true + + org.gaul + modernizer-maven-annotations + + com.google.inject guice diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/DelegateCodec.java b/drift-codec/src/main/java/com/facebook/drift/codec/DelegateCodec.java index 6ba122913..7986cd4a5 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/DelegateCodec.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/DelegateCodec.java @@ -19,6 +19,7 @@ import com.facebook.drift.protocol.TProtocolReader; import com.facebook.drift.protocol.TProtocolWriter; import com.google.common.reflect.TypeToken; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.lang.reflect.Type; @@ -35,6 +36,7 @@ public class DelegateCodec private final ThriftCodecManager codecManager; private final TypeToken typeToken; + @SuppressFBWarnings("EI_EXPOSE_REP2") public DelegateCodec(ThriftCodecManager codecManager, Type javaType) { this.codecManager = codecManager; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/ThriftCodecManager.java b/drift-codec/src/main/java/com/facebook/drift/codec/ThriftCodecManager.java index 2a13e7d05..956a6e42c 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/ThriftCodecManager.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/ThriftCodecManager.java @@ -54,6 +54,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; import com.google.inject.Inject; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.ThreadSafe; @@ -286,6 +287,7 @@ private void addBuiltinCodec(ThriftCodec codec) typeCodecs.put(codec.getType(), codec); } + @SuppressFBWarnings("EI_EXPOSE_REP") public ThriftCatalog getCatalog() { return catalog; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/guice/ThriftCodecModule.java b/drift-codec/src/main/java/com/facebook/drift/codec/guice/ThriftCodecModule.java index 6881dbafa..e4ee85ec1 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/guice/ThriftCodecModule.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/guice/ThriftCodecModule.java @@ -26,6 +26,7 @@ import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.TypeLiteral; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Objects; @@ -41,11 +42,13 @@ public ThriftCodecModule() this(ThriftCodecModule.class.getClassLoader()); } + @SuppressFBWarnings("EI_EXPOSE_REP2") public ThriftCodecModule(ClassLoader parent) { this.parent = parent; } + @SuppressFBWarnings("EI_EXPOSE_REP2") @Override public void configure(Binder binder) { diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/ProtocolWriter.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/ProtocolWriter.java index ab78ec644..f2d785a56 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/ProtocolWriter.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/ProtocolWriter.java @@ -24,6 +24,7 @@ import com.facebook.drift.protocol.TSet; import com.facebook.drift.protocol.TStruct; import com.facebook.drift.protocol.TType; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.NotThreadSafe; @@ -37,6 +38,7 @@ public class ProtocolWriter { private final TProtocolWriter protocol; + @SuppressFBWarnings("EI_EXPOSE_REP2") public ProtocolWriter(TProtocolWriter protocol) { this.protocol = protocol; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/builtin/OptionalThriftCodec.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/builtin/OptionalThriftCodec.java index 91364ff5b..757321ab4 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/builtin/OptionalThriftCodec.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/builtin/OptionalThriftCodec.java @@ -61,10 +61,7 @@ public void write(Optional value, TProtocolWriter protocol) requireNonNull(protocol, "protocol is null"); // write can not be called with a missing value, and instead the write should be skipped // after check the result from isNull - if (!value.isPresent()) { - throw new IllegalArgumentException("value is not present"); - } - elementCodec.write(value.get(), protocol); + elementCodec.write(value.orElseThrow(() -> new IllegalArgumentException("value is not present")), protocol); } @Override diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/coercion/CoercionThriftCodec.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/coercion/CoercionThriftCodec.java index afe203a80..13bd36e0c 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/coercion/CoercionThriftCodec.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/coercion/CoercionThriftCodec.java @@ -20,6 +20,7 @@ import com.facebook.drift.codec.metadata.TypeCoercion; import com.facebook.drift.protocol.TProtocolReader; import com.facebook.drift.protocol.TProtocolWriter; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -35,6 +36,7 @@ public class CoercionThriftCodec private final TypeCoercion typeCoercion; private final ThriftType thriftType; + @SuppressFBWarnings("EI_EXPOSE_REP2") public CoercionThriftCodec(ThriftCodec codec, TypeCoercion typeCoercion) { this.codec = (ThriftCodec) codec; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/CompilerThriftCodecFactory.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/CompilerThriftCodecFactory.java index 44b0e426a..7729ee13b 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/CompilerThriftCodecFactory.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/CompilerThriftCodecFactory.java @@ -25,9 +25,6 @@ import javax.annotation.concurrent.Immutable; -import java.security.AccessController; -import java.security.PrivilegedAction; - /** * Creates Thrift codecs directly in byte code. */ @@ -46,13 +43,13 @@ public CompilerThriftCodecFactory(@ForCompiler ClassLoader parent) public CompilerThriftCodecFactory(boolean debug) { - this(debug, getPrivilegedClassLoader(CompilerThriftCodecFactory.class.getClassLoader())); + this(debug, new DynamicClassLoader(CompilerThriftCodecFactory.class.getClassLoader())); } public CompilerThriftCodecFactory(boolean debug, ClassLoader parent) { this.debug = debug; - this.classLoader = getPrivilegedClassLoader(parent); + this.classLoader = new DynamicClassLoader(parent); } @Override @@ -65,9 +62,4 @@ public ThriftCodec generateThriftTypeCodec(ThriftCodecManager codecManager, T debug); return generator.getThriftCodec(); } - - private static DynamicClassLoader getPrivilegedClassLoader(ClassLoader parent) - { - return AccessController.doPrivileged((PrivilegedAction) () -> new DynamicClassLoader(parent)); - } } diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java index 82e1462b6..f4b9f7a3f 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java @@ -38,7 +38,6 @@ import com.facebook.drift.codec.metadata.FieldKind; import com.facebook.drift.codec.metadata.ReflectionHelper; import com.facebook.drift.codec.metadata.ThriftConstructorInjection; -import com.facebook.drift.codec.metadata.ThriftExtraction; import com.facebook.drift.codec.metadata.ThriftFieldExtractor; import com.facebook.drift.codec.metadata.ThriftFieldInjection; import com.facebook.drift.codec.metadata.ThriftFieldMetadata; @@ -55,6 +54,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.reflect.TypeToken; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.NotThreadSafe; @@ -110,7 +110,7 @@ import static com.facebook.drift.codec.ThriftProtocolType.STRING; import static com.facebook.drift.codec.ThriftProtocolType.STRUCT; import static com.google.common.collect.ImmutableList.toImmutableList; -import static com.google.common.collect.Iterables.getOnlyElement; +import static com.google.common.collect.MoreCollectors.onlyElement; import static java.lang.String.format; import static java.util.stream.Collectors.joining; @@ -142,7 +142,7 @@ public class ThriftCodecByteCodeGenerator private final ThriftCodec thriftCodec; @SuppressWarnings("unchecked") - @SuppressFBWarnings("DM_DEFAULT_ENCODING") + @SuppressFBWarnings({"DM_DEFAULT_ENCODING", "CT_CONSTRUCTOR_THROW", "EI_EXPOSE_REP2"}) public ThriftCodecByteCodeGenerator( ThriftCodecManager codecManager, ThriftStructMetadata metadata, @@ -208,6 +208,7 @@ public ThriftCodecByteCodeGenerator( } } + @SuppressFBWarnings("EI_EXPOSE_REP") public ThriftCodec getThriftCodec() { return thriftCodec; @@ -385,7 +386,8 @@ private Variable constructStructInstance(MethodDefinition method, Map parameters = new ArrayList<>(); - ThriftConstructorInjection constructor = metadata.getConstructorInjection().get(); + ThriftConstructorInjection constructor = metadata.getConstructorInjection() + .orElseThrow(); for (ThriftParameterInjection parameter : constructor.getParameters()) { BytecodeExpression data = structData.get(parameter.getId()); @@ -539,7 +541,7 @@ private Variable buildUnion(MethodDefinition method, Variable fieldId, Map defaultBlock.append(instance.set(newInstance(injection.getConstructor()))), + () -> { + BytecodeExpression exception = newInstance( + IllegalStateException.class, + invokeStatic( + String.class, + "format", + String.class, + constantString("No constructor for union [%s] with field ID [%s] found"), + newArray(type(Object[].class), + constantString(metadata.getStructClass().getName()), + fieldId.cast(Object.class)))); + defaultBlock.append(exception).throwObject(); + }); // finish switch method.getBody().append(switchBuilder @@ -629,6 +628,7 @@ private static BytecodeBlock injectField(ThriftFieldMetadata field, Variable ins return block; } + @SuppressModernizer private void buildFieldIdSwitch(MethodDefinition method, Variable reader, Map structData, SwitchBuilder switchBuilder) { for (ThriftFieldMetadata field : metadata.getFields(FieldKind.THRIFT_FIELD)) { @@ -710,6 +710,7 @@ private static BytecodeBlock injectMethod(ThriftMethodInjection methodInjection, /** * Defines the code that calls the builder factory method. */ + @SuppressModernizer private Variable invokeFactoryMethod(MethodDefinition method, Map structData, Variable instance) { if (metadata.getBuilderMethod().isPresent()) { @@ -809,7 +810,7 @@ private void defineWriteUnionMethod() body.append(writer.invoke("writeStructBegin", void.class, constantString(metadata.getStructName()))); // find the @ThriftUnionId field - ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(FieldKind.THRIFT_UNION_ID)); + ThriftFieldMetadata idField = metadata.getFields(FieldKind.THRIFT_UNION_ID).stream().collect(onlyElement()); // load its value BytecodeExpression value = getFieldValue(method, idField); @@ -863,15 +864,15 @@ private BytecodeBlock writeField(MethodDefinition method, Variable writer, Thrif } // coerce value - if (field.getCoercion().isPresent()) { - write.invokeStatic(field.getCoercion().get().getToThrift()); + field.getCoercion().ifPresent(coercion -> { + write.invokeStatic(coercion.getToThrift()); // if coerced value is null, don't write the field if (!isProtocolTypeJavaPrimitive(field)) { write.dup(); write.ifNullGoto(fieldIsNull); } - } + }); // write value Method writeMethod = getWriteMethod(field.getThriftType()); @@ -909,9 +910,8 @@ private BytecodeBlock writeField(MethodDefinition method, Variable writer, Thrif private BytecodeExpression getFieldValue(MethodDefinition method, ThriftFieldMetadata field) { - BytecodeExpression value = method.getScope().getVariable("struct"); - if (field.getExtraction().isPresent()) { - ThriftExtraction extraction = field.getExtraction().get(); + return field.getExtraction().map(extraction -> { + BytecodeExpression value = method.getScope().getVariable("struct"); if (extraction instanceof ThriftFieldExtractor) { ThriftFieldExtractor fieldExtractor = (ThriftFieldExtractor) extraction; value = value.getField(fieldExtractor.getField()); @@ -926,8 +926,8 @@ else if (extraction instanceof ThriftMethodExtractor) { value = value.cast(type(methodExtractor.getType())); } } - } - return value; + return value; + }).orElseGet(() -> method.getScope().getVariable("struct")); } /** @@ -1009,14 +1009,9 @@ private static boolean isJavaPrimitive(TypeToken typeToken) private static boolean needsCastAfterRead(ThriftFieldMetadata field, Method readMethod) { Class methodReturn = readMethod.getReturnType(); - Class fieldType; - if (field.getCoercion().isPresent()) { - fieldType = field.getCoercion().get().getFromThrift().getParameterTypes()[0]; - } - else { - fieldType = TypeToken.of(field.getThriftType().getJavaType()).getRawType(); - } - return !fieldType.isAssignableFrom(methodReturn); + return !field.getCoercion() + .>map(coercion -> coercion.getFromThrift().getParameterTypes()[0]) + .orElseGet(() -> TypeToken.of(field.getThriftType().getJavaType()).getRawType()).isAssignableFrom(methodReturn); } private static boolean needsCodec(ThriftFieldMetadata fieldMetadata) diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/AbstractReflectionThriftCodec.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/AbstractReflectionThriftCodec.java index c1cf22f3a..ad6b601c1 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/AbstractReflectionThriftCodec.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/AbstractReflectionThriftCodec.java @@ -59,19 +59,17 @@ protected Object getFieldValue(Object instance, ThriftFieldMetadata field) throws Exception { try { - if (field.getExtraction().isPresent()) { - ThriftExtraction extraction = field.getExtraction().get(); - if (extraction instanceof ThriftFieldExtractor) { - ThriftFieldExtractor thriftFieldExtractor = (ThriftFieldExtractor) extraction; - return thriftFieldExtractor.getField().get(instance); - } - else if (extraction instanceof ThriftMethodExtractor) { - ThriftMethodExtractor thriftMethodExtractor = (ThriftMethodExtractor) extraction; - return thriftMethodExtractor.getMethod().invoke(instance); - } - throw new IllegalAccessException("Unsupported field extractor type " + extraction.getClass().getName()); + ThriftExtraction extraction = field.getExtraction() + .orElseThrow(() -> new IllegalAccessException("No extraction present for " + field)); + if (extraction instanceof ThriftFieldExtractor) { + ThriftFieldExtractor thriftFieldExtractor = (ThriftFieldExtractor) extraction; + return thriftFieldExtractor.getField().get(instance); } - throw new IllegalAccessException("No extraction present for " + field); + else if (extraction instanceof ThriftMethodExtractor) { + ThriftMethodExtractor thriftMethodExtractor = (ThriftMethodExtractor) extraction; + return thriftMethodExtractor.getMethod().invoke(instance); + } + throw new IllegalAccessException("Unsupported field extractor type " + extraction.getClass().getName()); } catch (InvocationTargetException e) { throwIfUnchecked(e.getCause()); diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftStructCodec.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftStructCodec.java index ac6b96654..4cda4741a 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftStructCodec.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftStructCodec.java @@ -31,6 +31,8 @@ import com.facebook.drift.protocol.TProtocolException; import com.facebook.drift.protocol.TProtocolReader; import com.facebook.drift.protocol.TProtocolWriter; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.Immutable; @@ -97,6 +99,7 @@ public T read(TProtocolReader protocol) return constructStruct(data); } + @SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") @Override public void write(T instance, TProtocolWriter protocol) throws Exception @@ -123,6 +126,7 @@ public void write(T instance, TProtocolWriter protocol) writer.writeStructEnd(); } + @SuppressModernizer @SuppressWarnings("unchecked") private T constructStruct(Map data) throws Exception diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftUnionCodec.java b/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftUnionCodec.java index 1ea3dbdbf..b72b13f61 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftUnionCodec.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftUnionCodec.java @@ -29,14 +29,16 @@ import com.facebook.drift.protocol.TProtocolReader; import com.facebook.drift.protocol.TProtocolWriter; import com.google.common.collect.Maps; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.Immutable; import java.util.Map; import static com.google.common.base.Preconditions.checkState; -import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Maps.uniqueIndex; +import static com.google.common.collect.MoreCollectors.onlyElement; import static java.lang.String.format; import static java.util.Objects.requireNonNull; @@ -51,7 +53,7 @@ public ReflectionThriftUnionCodec(ThriftCodecManager manager, ThriftStructMetada { super(manager, metadata); - ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(FieldKind.THRIFT_UNION_ID)); + ThriftFieldMetadata idField = metadata.getFields(FieldKind.THRIFT_UNION_ID).stream().collect(onlyElement()); this.idField = Maps.immutableEntry(idField, manager.getCodec(idField.getThriftType())); requireNonNull(this.idField.getValue(), () -> "No codec for ID field found: " + idField); @@ -101,6 +103,7 @@ public T read(TProtocolReader protocol) return constructStruct(data); } + @SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") @Override public void write(T instance, TProtocolWriter protocol) throws Exception @@ -130,6 +133,7 @@ public void write(T instance, TProtocolWriter protocol) writer.writeStructEnd(); } + @SuppressModernizer @SuppressWarnings("unchecked") private T constructStruct(Map.Entry data) throws Exception diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/AbstractThriftMetadataBuilder.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/AbstractThriftMetadataBuilder.java index 1b8586e92..b833b2bb7 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/AbstractThriftMetadataBuilder.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/AbstractThriftMetadataBuilder.java @@ -19,11 +19,12 @@ import com.facebook.drift.annotations.ThriftField; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import com.google.common.reflect.TypeToken; import com.google.inject.internal.MoreTypes; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.NotThreadSafe; @@ -47,6 +48,7 @@ import static com.facebook.drift.annotations.ThriftField.Requiredness; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.collect.MoreCollectors.onlyElement; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.toCollection; @@ -75,6 +77,7 @@ public abstract class AbstractThriftMetadataBuilder protected final ThriftCatalog catalog; protected final MetadataErrors metadataErrors; + @SuppressFBWarnings("CT_CONSTRUCTOR_THROW") protected AbstractThriftMetadataBuilder(ThriftCatalog catalog, Type structType) { this.catalog = requireNonNull(catalog, "catalog is null"); @@ -111,6 +114,7 @@ protected AbstractThriftMetadataBuilder(ThriftCatalog catalog, Type structType) public abstract ThriftStructMetadata build(); + @SuppressFBWarnings("EI_EXPOSE_REP") public MetadataErrors getMetadataErrors() { return metadataErrors; @@ -466,6 +470,7 @@ protected final List getParameterInjections(Type type, Annot return parameters; } + @SuppressModernizer protected final void normalizeThriftFields(ThriftCatalog catalog) { // assign all fields an id (if possible) @@ -478,7 +483,7 @@ protected final void normalizeThriftFields(ThriftCatalog catalog) Collection fields = entry.getValue(); // fields must have an id - if (!entry.getKey().isPresent()) { + if (entry.getKey().isEmpty()) { Set sortedFields = fields.stream() .map(FieldMetadata::getOrExtractThriftFieldName) .collect(toCollection(TreeSet::new)); @@ -584,7 +589,7 @@ protected final void inferThriftFieldIds(Multimap fieldsB // single id, so set on all fields in this group (groups with no id are handled later), // and validate isLegacyId is consistent and correct. if (ids.size() == 1) { - short id = Iterables.getOnlyElement(ids); + short id = ids.stream().collect(onlyElement()); boolean isLegacyId = extractFieldIsLegacyId(id, fieldName, fields); diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/FieldMetadata.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/FieldMetadata.java index 1395d4223..3da7457d7 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/FieldMetadata.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/FieldMetadata.java @@ -18,6 +18,7 @@ import com.facebook.drift.annotations.ThriftField; import com.facebook.drift.annotations.ThriftIdlAnnotation; import com.google.common.collect.ImmutableMap; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.Nullable; @@ -40,6 +41,7 @@ abstract class FieldMetadata private Map idlAnnotations; private final FieldKind type; + @SuppressFBWarnings("CT_CONSTRUCTOR_THROW") protected FieldMetadata(ThriftField annotation, FieldKind type) { this.type = type; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ParameterInjection.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ParameterInjection.java index 07e6a1a0d..486eacc22 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ParameterInjection.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ParameterInjection.java @@ -16,6 +16,7 @@ package com.facebook.drift.codec.metadata; import com.facebook.drift.annotations.ThriftField; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.lang.reflect.Type; @@ -31,6 +32,7 @@ class ParameterInjection private final Type parameterJavaType; private final Type thriftStructType; + @SuppressFBWarnings("CT_CONSTRUCTOR_THROW") ParameterInjection(Type thriftStructType, int parameterIndex, ThriftField annotation, String extractedName, Type parameterJavaType) { super(annotation, FieldKind.THRIFT_FIELD); diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/RecursiveThriftTypeReference.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/RecursiveThriftTypeReference.java index 6b08fb687..021f5d482 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/RecursiveThriftTypeReference.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/RecursiveThriftTypeReference.java @@ -16,6 +16,7 @@ package com.facebook.drift.codec.metadata; import com.facebook.drift.codec.ThriftProtocolType; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.lang.reflect.Type; import java.util.Objects; @@ -29,6 +30,7 @@ public class RecursiveThriftTypeReference private final Type javaType; private final ThriftProtocolType protocolType; + @SuppressFBWarnings("EI_EXPOSE_REP2") public RecursiveThriftTypeReference(ThriftCatalog catalog, Type javaType) { this.catalog = catalog; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftConstructorInjection.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftConstructorInjection.java index 87bf4e47d..a6d90a8a2 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftConstructorInjection.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftConstructorInjection.java @@ -17,6 +17,7 @@ import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -44,6 +45,7 @@ public ThriftConstructorInjection(Constructor constructor, List getConstructor() { return constructor; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftEnumMetadata.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftEnumMetadata.java index da76c0743..b711da467 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftEnumMetadata.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftEnumMetadata.java @@ -19,6 +19,7 @@ import com.facebook.drift.annotations.ThriftEnumValue; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -46,6 +47,7 @@ public class ThriftEnumMetadata> private final ImmutableList documentation; private final ImmutableMap> elementDocs; + @SuppressFBWarnings("CT_CONSTRUCTOR_THROW") public ThriftEnumMetadata( String enumName, Class enumClass) diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldExtractor.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldExtractor.java index d631ee7b9..9a741021c 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldExtractor.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldExtractor.java @@ -16,6 +16,7 @@ package com.facebook.drift.codec.metadata; import com.google.common.reflect.TypeToken; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -74,6 +75,7 @@ public String getName() return name; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Field getField() { return field; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldInjection.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldInjection.java index 1271ad0cf..871b69980 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldInjection.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldInjection.java @@ -15,6 +15,8 @@ */ package com.facebook.drift.codec.metadata; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import javax.annotation.concurrent.Immutable; import java.lang.reflect.Field; @@ -68,6 +70,7 @@ public String getName() return name; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Field getField() { return field; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldMetadata.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldMetadata.java index b78f694f7..239f3541b 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldMetadata.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftFieldMetadata.java @@ -17,6 +17,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.Immutable; @@ -52,6 +54,8 @@ public class ThriftFieldMetadata private final boolean isRecursiveReference; private final Requiredness requiredness; + @SuppressModernizer + @SuppressFBWarnings("EI_EXPOSE_REP2") public ThriftFieldMetadata( short id, boolean isLegacyId, diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodExtractor.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodExtractor.java index a4995dc35..20fd35817 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodExtractor.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodExtractor.java @@ -16,6 +16,7 @@ package com.facebook.drift.codec.metadata; import com.google.common.reflect.TypeToken; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -74,6 +75,7 @@ public String getName() return name; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Method getMethod() { return method; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodInjection.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodInjection.java index bbcc6360b..c30ad6a9f 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodInjection.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodInjection.java @@ -16,6 +16,7 @@ package com.facebook.drift.codec.metadata; import com.google.common.base.Joiner; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -42,11 +43,13 @@ public ThriftMethodInjection(Method method, List param this.parameters = requireNonNull(parameters, "parameters is null"); } + @SuppressFBWarnings("EI_EXPOSE_REP") public Method getMethod() { return method; } + @SuppressFBWarnings("EI_EXPOSE_REP") public List getParameters() { return parameters; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodMetadata.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodMetadata.java index 3c26f10dd..bc66ca0f8 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodMetadata.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftMethodMetadata.java @@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; import com.google.common.util.concurrent.ListenableFuture; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -65,6 +66,7 @@ public class ThriftMethodMetadata private final boolean idempotent; private final List documentation; + @SuppressFBWarnings({"CT_CONSTRUCTOR_THROW", "EI_EXPOSE_REP"}) public ThriftMethodMetadata(Method method, ThriftCatalog catalog) { requireNonNull(method, "method is null"); @@ -221,6 +223,7 @@ public Map getExceptions() return exceptions; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Method getMethod() { return method; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftServiceMetadata.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftServiceMetadata.java index 60ca15521..31b73b23f 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftServiceMetadata.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftServiceMetadata.java @@ -18,7 +18,7 @@ import com.facebook.drift.annotations.ThriftMethod; import com.facebook.drift.annotations.ThriftService; import com.google.common.collect.ComparisonChain; -import com.google.common.collect.Iterables; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -33,6 +33,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Comparators.emptiesLast; import static com.google.common.collect.ImmutableList.toImmutableList; +import static com.google.common.collect.MoreCollectors.onlyElement; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.joining; @@ -87,6 +88,7 @@ public String getIdlName() return idlName; } + @SuppressFBWarnings("EI_EXPOSE_REP") public List getMethods() { return methods; @@ -103,7 +105,7 @@ public static ThriftService getThriftServiceAnnotation(Class serviceClass) checkArgument(!serviceAnnotations.isEmpty(), "Service class %s is not annotated with @ThriftService", serviceClass.getName()); checkArgument(serviceAnnotations.size() == 1, "Service class %s has multiple conflicting @ThriftService annotations: %s", serviceClass.getName(), serviceAnnotations); - return Iterables.getOnlyElement(serviceAnnotations); + return serviceAnnotations.stream().collect(onlyElement()); } @Override diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadata.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadata.java index 95d7b913d..952676952 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadata.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadata.java @@ -18,6 +18,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedMap; import com.google.common.reflect.TypeToken; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.concurrent.Immutable; @@ -115,6 +116,7 @@ public Optional getBuilderMethod() return builderMethod; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Map getIdlAnnotations() { return idlAnnotations; diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadataBuilder.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadataBuilder.java index b889a2798..0cc584afa 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadataBuilder.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadataBuilder.java @@ -20,7 +20,6 @@ import com.facebook.drift.codec.metadata.ThriftStructMetadata.MetadataType; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; import javax.annotation.concurrent.NotThreadSafe; @@ -32,6 +31,7 @@ import java.util.Optional; import static com.facebook.drift.annotations.ThriftField.Requiredness; +import static com.google.common.collect.MoreCollectors.onlyElement; @NotThreadSafe public class ThriftStructMetadataBuilder @@ -141,7 +141,7 @@ public ThriftStructMetadata build() private ThriftConstructorInjection buildConstructorInjection() { - ConstructorInjection injection = Iterables.getOnlyElement(constructorInjections); + ConstructorInjection injection = constructorInjections.stream().collect(onlyElement()); return new ThriftConstructorInjection(injection.getConstructor(), buildParameterInjections(injection.getParameters())); } diff --git a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/TypeCoercion.java b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/TypeCoercion.java index 5b2db2d6d..2450c08d5 100644 --- a/drift-codec/src/main/java/com/facebook/drift/codec/metadata/TypeCoercion.java +++ b/drift-codec/src/main/java/com/facebook/drift/codec/metadata/TypeCoercion.java @@ -15,6 +15,8 @@ */ package com.facebook.drift.codec.metadata; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import javax.annotation.concurrent.Immutable; import java.lang.reflect.Method; @@ -41,11 +43,13 @@ public ThriftType getThriftType() return thriftType; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Method getToThrift() { return toThrift; } + @SuppressFBWarnings("EI_EXPOSE_REP") public Method getFromThrift() { return fromThrift; diff --git a/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftStructMetadata.java b/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftStructMetadata.java index 88c78bc12..1bdfcb6d7 100644 --- a/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftStructMetadata.java +++ b/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftStructMetadata.java @@ -26,6 +26,7 @@ import com.facebook.drift.codec.idlannotations.ExceptionWithIdlAnnotations; import com.facebook.drift.codec.idlannotations.StructWithIdlAnnotations; import com.facebook.drift.codec.idlannotations.UnionWithIdlAnnotations; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.testng.annotations.Test; import java.lang.reflect.Type; @@ -37,6 +38,7 @@ import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +@SuppressModernizer public class TestThriftStructMetadata { @Test diff --git a/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftUnionMetadata.java b/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftUnionMetadata.java index 5959d4df5..e7f58eb55 100644 --- a/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftUnionMetadata.java +++ b/drift-codec/src/test/java/com/facebook/drift/codec/metadata/TestThriftUnionMetadata.java @@ -20,6 +20,7 @@ import com.facebook.drift.codec.UnionConstructor; import com.facebook.drift.codec.UnionField; import com.facebook.drift.codec.UnionMethod; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -29,6 +30,7 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; +@SuppressModernizer public class TestThriftUnionMetadata { @Test diff --git a/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGenerator.java b/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGenerator.java index 585898c49..f51893f6d 100644 --- a/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGenerator.java +++ b/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGenerator.java @@ -48,10 +48,10 @@ import static com.facebook.drift.codec.metadata.ReflectionHelper.getEffectiveClassAnnotations; import static com.facebook.drift.idl.generator.ThriftIdlRenderer.renderThriftIdl; -import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.io.Files.getNameWithoutExtension; import static java.lang.String.format; import static java.util.Objects.requireNonNull; +import static java.util.Objects.requireNonNullElse; public class ThriftIdlGenerator { @@ -91,7 +91,7 @@ public class ThriftIdlGenerator public ThriftIdlGenerator(ThriftIdlGeneratorConfig config) { - this(config, firstNonNull(Thread.currentThread().getContextClassLoader(), ClassLoader.getSystemClassLoader())); + this(config, requireNonNullElse(Thread.currentThread().getContextClassLoader(), ClassLoader.getSystemClassLoader())); } public ThriftIdlGenerator(ThriftIdlGeneratorConfig config, ClassLoader classLoader) diff --git a/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGeneratorConfig.java b/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGeneratorConfig.java index 5d032b3dd..79046370b 100644 --- a/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGeneratorConfig.java +++ b/drift-idl-generator/src/main/java/com/facebook/drift/idl/generator/ThriftIdlGeneratorConfig.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.function.Consumer; -import static com.google.common.base.MoreObjects.firstNonNull; +import static java.util.Objects.requireNonNullElse; public class ThriftIdlGeneratorConfig { @@ -41,13 +41,13 @@ private ThriftIdlGeneratorConfig( Consumer warningLogger, Consumer verboseLogger) { - this.defaultPackage = firstNonNull(defaultPackage, ""); - this.namespaces = ImmutableMap.copyOf(firstNonNull(namespaces, ImmutableMap.of())); - this.includes = ImmutableMap.copyOf(firstNonNull(includes, ImmutableMap.of())); + this.defaultPackage = requireNonNullElse(defaultPackage, ""); + this.namespaces = ImmutableMap.copyOf(requireNonNullElse(namespaces, ImmutableMap.of())); + this.includes = ImmutableMap.copyOf(requireNonNullElse(includes, ImmutableMap.of())); this.recursive = recursive; - this.errorLogger = firstNonNull(errorLogger, ignored -> {}); - this.warningLogger = firstNonNull(warningLogger, ignored -> {}); - this.verboseLogger = firstNonNull(verboseLogger, ignored -> {}); + this.errorLogger = requireNonNullElse(errorLogger, ignored -> {}); + this.warningLogger = requireNonNullElse(warningLogger, ignored -> {}); + this.verboseLogger = requireNonNullElse(verboseLogger, ignored -> {}); } public static Builder builder() @@ -110,13 +110,13 @@ public Builder defaultPackage(String defaultPackage) public Builder namespaces(Map namespaces) { - this.namespaces = ImmutableMap.copyOf(firstNonNull(namespaces, ImmutableMap.of())); + this.namespaces = ImmutableMap.copyOf(requireNonNullElse(namespaces, ImmutableMap.of())); return this; } public Builder includes(Map includes) { - this.includes = ImmutableMap.copyOf(firstNonNull(includes, ImmutableMap.of())); + this.includes = ImmutableMap.copyOf(requireNonNullElse(includes, ImmutableMap.of())); return this; } diff --git a/drift-integration-tests/pom.xml b/drift-integration-tests/pom.xml index 7a83c4c0e..86026df88 100644 --- a/drift-integration-tests/pom.xml +++ b/drift-integration-tests/pom.xml @@ -61,6 +61,12 @@ test + + io.netty + netty-buffer + test + + com.github.spotbugs spotbugs-annotations @@ -110,7 +116,7 @@ - io.airlift + com.facebook.airlift units test diff --git a/drift-integration-tests/src/test/java/com/facebook/drift/integration/ClientTestUtils.java b/drift-integration-tests/src/test/java/com/facebook/drift/integration/ClientTestUtils.java index a3e25d02c..1aa7eb777 100644 --- a/drift-integration-tests/src/test/java/com/facebook/drift/integration/ClientTestUtils.java +++ b/drift-integration-tests/src/test/java/com/facebook/drift/integration/ClientTestUtils.java @@ -129,7 +129,6 @@ public static int logDriftClientBinder( .build()); Injector injector = app - .strictConfig() .doNotInitializeLogging() .initialize(); diff --git a/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithApacheServer.java b/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithApacheServer.java index 94eecfe90..2d6c249f5 100644 --- a/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithApacheServer.java +++ b/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithApacheServer.java @@ -21,6 +21,7 @@ import com.facebook.drift.transport.netty.codec.Protocol; import com.facebook.drift.transport.netty.codec.Transport; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Streams; import com.google.common.net.HostAndPort; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TBinaryProtocol; @@ -46,8 +47,7 @@ import static com.facebook.drift.integration.LegacyApacheThriftTesterUtil.legacyApacheThriftTestClients; import static com.facebook.drift.transport.netty.codec.Protocol.FB_COMPACT; import static com.facebook.drift.transport.netty.codec.Transport.HEADER; -import static com.google.common.collect.Iterables.concat; -import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.ImmutableList.toImmutableList; import static java.util.Collections.nCopies; import static org.testng.Assert.assertEquals; @@ -93,7 +93,7 @@ private static int testApacheServer(List filters) } } - assertEquals(scribeService.getMessages(), newArrayList(concat(nCopies(invocationCount, MESSAGES)))); + assertEquals(scribeService.getMessages(), Streams.concat(nCopies(invocationCount, MESSAGES).stream()).flatMap(List::stream).collect(toImmutableList())); return invocationCount; } diff --git a/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServer.java b/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServer.java index ce22d7cc7..62504c48b 100644 --- a/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServer.java +++ b/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServer.java @@ -29,7 +29,6 @@ import com.facebook.drift.transport.netty.server.DriftNettyServerTransportFactory; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Streams; import com.google.common.net.HostAndPort; import org.testng.annotations.Test; @@ -43,8 +42,9 @@ import static com.facebook.drift.integration.DriftNettyTesterUtil.driftNettyTestClients; import static com.facebook.drift.integration.LegacyApacheThriftTesterUtil.legacyApacheThriftTestClients; import static com.facebook.drift.transport.netty.codec.Transport.HEADER; -import static com.google.common.collect.Iterables.concat; +import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.Streams.concat; import static java.util.Collections.nCopies; import static org.testng.Assert.assertEquals; @@ -80,7 +80,7 @@ private static int testDriftServer(List filters) for (boolean secure : ImmutableList.of(true, false)) { for (Transport transport : ImmutableList.of(HEADER)) { for (Protocol protocol : Protocol.values()) { - int count = Streams.concat( + int count = concat( legacyApacheThriftTestClients(filters, transport, protocol, secure).stream(), driftNettyTestClients(filters, transport, protocol, secure).stream(), apacheThriftTestClients(filters, transport, protocol, secure).stream()) @@ -95,7 +95,7 @@ private static int testDriftServer(List filters) } }); - assertEquals(scribeService.getMessages(), newArrayList(concat(nCopies(invocationCount.get(), DRIFT_MESSAGES)))); + assertEquals(scribeService.getMessages(), concat(nCopies(invocationCount.get(), DRIFT_MESSAGES).stream()).flatMap(List::stream).collect(toImmutableList())); assertEquals(scribeService.getHeaders(), newArrayList(nCopies(headerInvocationCount.get(), HEADER_VALUE))); return invocationCount.get(); diff --git a/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServerTransport.java b/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServerTransport.java index 2b4ae0096..3f78a6f0f 100644 --- a/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServerTransport.java +++ b/drift-integration-tests/src/test/java/com/facebook/drift/integration/TestClientsWithDriftNettyServerTransport.java @@ -51,9 +51,9 @@ import static com.facebook.drift.integration.ClientTestUtils.MESSAGES; import static com.facebook.drift.integration.DriftNettyTesterUtil.driftNettyTestClients; import static com.facebook.drift.integration.LegacyApacheThriftTesterUtil.legacyApacheThriftTestClients; -import static com.google.common.collect.Iterables.concat; -import static com.google.common.collect.Iterables.getOnlyElement; -import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.ImmutableList.toImmutableList; +import static com.google.common.collect.MoreCollectors.onlyElement; +import static com.google.common.collect.Streams.concat; import static java.util.Collections.nCopies; import static org.testng.Assert.assertEquals; @@ -94,7 +94,7 @@ private static int testDriftServer(List filters) } int invocationCount = testDriftServer(methodInvoker, clients.build()); - assertEquals(methodInvoker.getMessages(), newArrayList(concat(nCopies(invocationCount, MESSAGES)))); + assertEquals(methodInvoker.getMessages(), concat(nCopies(invocationCount, MESSAGES).stream()).flatMap(List::stream).collect(toImmutableList())); return invocationCount; } @@ -164,12 +164,15 @@ public ListenableFuture invoke(ServerInvokeRequest request) } Map parameters = request.getParameters(); - if (parameters.size() != 1 || !parameters.containsKey((short) 1) || !(getOnlyElement(parameters.values()) instanceof List)) { + if (parameters.size() != 1 || !parameters.containsKey((short) 1) || !(parameters.values().stream().collect(onlyElement()) instanceof List)) { return Futures.immediateFailedFuture(new IllegalArgumentException("invalid parameters")); } - for (DriftLogEntry driftLogEntry : (List) getOnlyElement(parameters.values())) { - messages.add(new LogEntry(driftLogEntry.getCategory(), driftLogEntry.getMessage())); - } + ((List) parameters.values() + .stream() + .collect(onlyElement())) + .forEach(driftLogEntry -> { + messages.add(new LogEntry(driftLogEntry.getCategory(), driftLogEntry.getMessage())); + }); return Futures.immediateFuture(DRIFT_OK); } diff --git a/drift-integration-tests/src/test/java/com/facebook/drift/integration/guice/TestGuiceIntegration.java b/drift-integration-tests/src/test/java/com/facebook/drift/integration/guice/TestGuiceIntegration.java index af378d7d9..b23a16146 100644 --- a/drift-integration-tests/src/test/java/com/facebook/drift/integration/guice/TestGuiceIntegration.java +++ b/drift-integration-tests/src/test/java/com/facebook/drift/integration/guice/TestGuiceIntegration.java @@ -100,7 +100,6 @@ private static void test(boolean pooling) }); Injector injector = bootstrap - .strictConfig() .setRequiredConfigurationProperty("thrift.server.port", String.valueOf(port)) .setRequiredConfigurationProperty("thrift.server.max-frame-size", MAX_FRAME_SIZE.toString()) .setRequiredConfigurationProperty("thrift.client.connection-pool.enabled", String.valueOf(pooling)) diff --git a/drift-javadoc/src/test/projects/basic/src/main/java/its/Fruit.java b/drift-javadoc/src/test/projects/basic/src/main/java/its/Fruit.java index df70a4db8..82b697c91 100644 --- a/drift-javadoc/src/test/projects/basic/src/main/java/its/Fruit.java +++ b/drift-javadoc/src/test/projects/basic/src/main/java/its/Fruit.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftEnum; diff --git a/drift-javadoc/src/test/projects/basic/src/main/java/its/Point.java b/drift-javadoc/src/test/projects/basic/src/main/java/its/Point.java index 146e1b6e6..069fb4d58 100644 --- a/drift-javadoc/src/test/projects/basic/src/main/java/its/Point.java +++ b/drift-javadoc/src/test/projects/basic/src/main/java/its/Point.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftField; diff --git a/drift-javadoc/src/test/projects/basic/src/main/java/its/Response.java b/drift-javadoc/src/test/projects/basic/src/main/java/its/Response.java index 7841c14aa..931d7fe10 100644 --- a/drift-javadoc/src/test/projects/basic/src/main/java/its/Response.java +++ b/drift-javadoc/src/test/projects/basic/src/main/java/its/Response.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftField; diff --git a/drift-javadoc/src/test/projects/basic/src/main/java/its/SimpleLogger.java b/drift-javadoc/src/test/projects/basic/src/main/java/its/SimpleLogger.java index 503897041..650ab6492 100644 --- a/drift-javadoc/src/test/projects/basic/src/main/java/its/SimpleLogger.java +++ b/drift-javadoc/src/test/projects/basic/src/main/java/its/SimpleLogger.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftMethod; diff --git a/drift-maven-plugin/pom.xml b/drift-maven-plugin/pom.xml index b3669e304..80a4f6d69 100644 --- a/drift-maven-plugin/pom.xml +++ b/drift-maven-plugin/pom.xml @@ -27,6 +27,12 @@ org.apache.maven maven-core provided + + + org.codehaus.plexus + plexus-xml + + @@ -59,6 +65,12 @@ io.takari.maven.plugins takari-plugin-testing test + + + org.codehaus.plexus + plexus-xml + + @@ -96,9 +108,13 @@ com.mycila license-maven-plugin - - src/test/projects/** - + + + + src/test/projects/** + + + diff --git a/drift-maven-plugin/src/test/java/com/facebook/drift/javadoc/TestIdlGeneratorIntegration.java b/drift-maven-plugin/src/test/java/com/facebook/drift/javadoc/TestIdlGeneratorIntegration.java index bc97fe571..fdf4e23b2 100644 --- a/drift-maven-plugin/src/test/java/com/facebook/drift/javadoc/TestIdlGeneratorIntegration.java +++ b/drift-maven-plugin/src/test/java/com/facebook/drift/javadoc/TestIdlGeneratorIntegration.java @@ -34,7 +34,7 @@ import static org.junit.Assert.assertEquals; @RunWith(MavenJUnitTestRunner.class) -@MavenVersions({"3.2.3", "3.3.9", "3.5.0", "3.5.2"}) +@MavenVersions({"3.5.2", "3.8.3", "3.9.9"}) @SuppressWarnings("JUnitTestNG") public class TestIdlGeneratorIntegration { diff --git a/drift-maven-plugin/src/test/projects/direct/src/main/java/its/Response.java b/drift-maven-plugin/src/test/projects/direct/src/main/java/its/Response.java index 7841c14aa..931d7fe10 100644 --- a/drift-maven-plugin/src/test/projects/direct/src/main/java/its/Response.java +++ b/drift-maven-plugin/src/test/projects/direct/src/main/java/its/Response.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftField; diff --git a/drift-maven-plugin/src/test/projects/direct/src/main/java/its/SimpleLogger.java b/drift-maven-plugin/src/test/projects/direct/src/main/java/its/SimpleLogger.java index 503897041..650ab6492 100644 --- a/drift-maven-plugin/src/test/projects/direct/src/main/java/its/SimpleLogger.java +++ b/drift-maven-plugin/src/test/projects/direct/src/main/java/its/SimpleLogger.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftMethod; diff --git a/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/Response.java b/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/Response.java index 7841c14aa..931d7fe10 100644 --- a/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/Response.java +++ b/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/Response.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftField; diff --git a/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/SimpleLogger.java b/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/SimpleLogger.java index 503897041..650ab6492 100644 --- a/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/SimpleLogger.java +++ b/drift-maven-plugin/src/test/projects/recursive/src/main/java/its/SimpleLogger.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2012 ${project.organization.name} + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package its; import com.facebook.drift.annotations.ThriftMethod; diff --git a/drift-server/pom.xml b/drift-server/pom.xml index 5cb3ef24d..18ea58945 100644 --- a/drift-server/pom.xml +++ b/drift-server/pom.xml @@ -56,7 +56,7 @@ - io.airlift + com.facebook.airlift units diff --git a/drift-server/src/test/java/com/facebook/drift/server/TestDriftServer.java b/drift-server/src/test/java/com/facebook/drift/server/TestDriftServer.java index 64f65f547..a4ac68d5a 100644 --- a/drift-server/src/test/java/com/facebook/drift/server/TestDriftServer.java +++ b/drift-server/src/test/java/com/facebook/drift/server/TestDriftServer.java @@ -131,7 +131,6 @@ public void testGuiceServer() LifeCycleManager lifeCycleManager = null; try { Injector injector = app - .strictConfig() .doNotInitializeLogging() .initialize(); lifeCycleManager = injector.getInstance(LifeCycleManager.class); @@ -181,7 +180,6 @@ public void testGuiceServerFilter() LifeCycleManager lifeCycleManager = null; try { Injector injector = app - .strictConfig() .doNotInitializeLogging() .initialize(); lifeCycleManager = injector.getInstance(LifeCycleManager.class); diff --git a/drift-server/src/test/java/com/facebook/drift/server/TestingServerTransport.java b/drift-server/src/test/java/com/facebook/drift/server/TestingServerTransport.java index 97c55ea8c..b05b1f9cf 100644 --- a/drift-server/src/test/java/com/facebook/drift/server/TestingServerTransport.java +++ b/drift-server/src/test/java/com/facebook/drift/server/TestingServerTransport.java @@ -25,6 +25,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; +import static java.lang.String.format; public class TestingServerTransport implements ServerTransport @@ -60,7 +61,9 @@ public synchronized ListenableFuture invoke(String methodName, Map methodMetadata = serverMethodInvoker.getMethodMetadata(methodName); checkArgument(methodMetadata.isPresent(), "Method %s not found", methodName); - ListenableFuture result = serverMethodInvoker.invoke(new ServerInvokeRequest(methodMetadata.get(), headers, parameters)); + ListenableFuture result = serverMethodInvoker.invoke(new ServerInvokeRequest( + methodMetadata.orElseThrow(() -> new IllegalArgumentException(format("Method %s not found", methodName))), + headers, parameters)); serverMethodInvoker.recordResult(methodName, startTime, result); return result; diff --git a/drift-transport-apache/pom.xml b/drift-transport-apache/pom.xml index ef75829ff..2470c8ea1 100644 --- a/drift-transport-apache/pom.xml +++ b/drift-transport-apache/pom.xml @@ -72,7 +72,7 @@ - io.airlift + com.facebook.airlift units @@ -98,6 +98,11 @@ javax.annotation-api + + org.gaul + modernizer-maven-annotations + + com.facebook.airlift diff --git a/drift-transport-apache/src/main/java/com/facebook/drift/transport/apache/client/ApacheThriftMethodInvoker.java b/drift-transport-apache/src/main/java/com/facebook/drift/transport/apache/client/ApacheThriftMethodInvoker.java index 62f270d47..3833f9ad1 100644 --- a/drift-transport-apache/src/main/java/com/facebook/drift/transport/apache/client/ApacheThriftMethodInvoker.java +++ b/drift-transport-apache/src/main/java/com/facebook/drift/transport/apache/client/ApacheThriftMethodInvoker.java @@ -42,6 +42,7 @@ import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportFactory; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.net.ssl.SSLContext; @@ -153,6 +154,7 @@ private Object invokeSynchronous(InvokeRequest request) } } + @SuppressModernizer private TSocket createTSocket(HostAndPort address) throws TTransportException { diff --git a/drift-transport-apache/src/test/java/com/facebook/drift/transport/apache/TestApacheThriftMethodInvoker.java b/drift-transport-apache/src/test/java/com/facebook/drift/transport/apache/TestApacheThriftMethodInvoker.java index 431c1dbb4..332e1a24e 100644 --- a/drift-transport-apache/src/test/java/com/facebook/drift/transport/apache/TestApacheThriftMethodInvoker.java +++ b/drift-transport-apache/src/test/java/com/facebook/drift/transport/apache/TestApacheThriftMethodInvoker.java @@ -33,7 +33,6 @@ import com.facebook.drift.transport.client.MethodInvoker; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; import com.google.common.net.HostAndPort; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; @@ -61,7 +60,8 @@ import static com.facebook.drift.codec.metadata.ThriftType.list; import static com.facebook.drift.codec.metadata.ThriftType.optional; -import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.ImmutableList.toImmutableList; +import static com.google.common.collect.Streams.concat; import static java.util.Collections.nCopies; import static org.testng.Assert.assertEquals; @@ -97,7 +97,7 @@ private static List testProcessor(TProcessor processor) address -> logApacheThriftInvocationHandler(address, DRIFT_MESSAGES), address -> logApacheThriftInvocationHandlerOptional(address, DRIFT_MESSAGES))); - return newArrayList(Iterables.concat(nCopies(invocationCount, MESSAGES))); + return concat(nCopies(invocationCount, MESSAGES).stream().flatMap(List::stream)).collect(toImmutableList()); } private static int testProcessor(TProcessor processor, List> clients) diff --git a/drift-transport-netty/pom.xml b/drift-transport-netty/pom.xml index aaf0caab5..eece23ff3 100644 --- a/drift-transport-netty/pom.xml +++ b/drift-transport-netty/pom.xml @@ -77,7 +77,7 @@ - io.airlift + com.facebook.airlift units @@ -146,6 +146,11 @@ true + + org.gaul + modernizer-maven-annotations + + com.facebook.airlift diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/DriftNettyMethodInvokerFactory.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/DriftNettyMethodInvokerFactory.java index 934f2fa44..7f5ba3d7b 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/DriftNettyMethodInvokerFactory.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/DriftNettyMethodInvokerFactory.java @@ -42,9 +42,9 @@ import static com.facebook.drift.transport.netty.codec.Protocol.COMPACT; import static com.facebook.drift.transport.netty.codec.Transport.HEADER; import static com.facebook.drift.transport.netty.ssl.SslContextFactory.createSslContextFactory; -import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.base.Preconditions.checkState; import static java.util.Objects.requireNonNull; +import static java.util.Objects.requireNonNullElse; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; public class DriftNettyMethodInvokerFactory @@ -117,14 +117,14 @@ public MethodInvoker createMethodInvoker(I clientIdentity) public ConnectionManager getConnectionManager(I clientIdentity, DriftNettyClientConfig driftNettyClientConfig) { - boolean connectionPoolEnabled = firstNonNull(driftNettyClientConfig.getConnectionPoolEnabled(), factoryConfig.isConnectionPoolEnabled()); + boolean connectionPoolEnabled = requireNonNullElse(driftNettyClientConfig.getConnectionPoolEnabled(), factoryConfig.isConnectionPoolEnabled()); if (!connectionPoolEnabled) { return connectionFactory; } - int connectionPoolMaxSize = firstNonNull(driftNettyClientConfig.getConnectionPoolMaxSize(), factoryConfig.getConnectionPoolMaxSize()); - int maxConnectionsPerDestination = firstNonNull(driftNettyClientConfig.getConnectionPoolMaxConnectionsPerDestination(), factoryConfig.getConnectionPoolMaxConnectionsPerDestination()); - Duration connectionPoolIdleTimeout = firstNonNull(driftNettyClientConfig.getConnectionPoolIdleTimeout(), factoryConfig.getConnectionPoolIdleTimeout()); + int connectionPoolMaxSize = requireNonNullElse(driftNettyClientConfig.getConnectionPoolMaxSize(), factoryConfig.getConnectionPoolMaxSize()); + int maxConnectionsPerDestination = requireNonNullElse(driftNettyClientConfig.getConnectionPoolMaxConnectionsPerDestination(), factoryConfig.getConnectionPoolMaxConnectionsPerDestination()); + Duration connectionPoolIdleTimeout = requireNonNullElse(driftNettyClientConfig.getConnectionPoolIdleTimeout(), factoryConfig.getConnectionPoolIdleTimeout()); return connectionPools.computeIfAbsent(Optional.ofNullable(clientIdentity), ignored -> new ConnectionPool( connectionFactory, diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/InvocationResponseFuture.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/InvocationResponseFuture.java index 48c290f38..972709f59 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/InvocationResponseFuture.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/InvocationResponseFuture.java @@ -28,6 +28,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.util.concurrent.Future; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.GuardedBy; @@ -53,6 +54,7 @@ class InvocationResponseFuture @GuardedBy("this") private ThriftRequest thriftRequest; + @SuppressModernizer static InvocationResponseFuture createInvocationResponseFuture(InvokeRequest request, ConnectionParameters connectionParameters, ConnectionManager connectionManager) throws TException { diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/ThriftClientHandler.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/ThriftClientHandler.java index e90767cb8..dd0328a4d 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/ThriftClientHandler.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/client/ThriftClientHandler.java @@ -48,6 +48,7 @@ import io.netty.channel.ChannelPromise; import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.ScheduledFuture; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import javax.annotation.concurrent.ThreadSafe; @@ -252,6 +253,7 @@ private void onError(ChannelHandlerContext context, Throwable throwable, Optiona context.close(); } + @SuppressModernizer private void onFrameTooLargeException(ChannelHandlerContext context, FrameTooLargeException frameTooLargeException) { TException thriftException = new MessageTooLargeException(frameTooLargeException.getMessage(), frameTooLargeException); diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/codec/HeaderTransport.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/codec/HeaderTransport.java index e0c903a50..089a3cf5f 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/codec/HeaderTransport.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/codec/HeaderTransport.java @@ -317,14 +317,14 @@ public static Optional tryDecodeFrameInfo(ByteBufAllocator bufAllocat } SimpleFrameInfoDecoder simpleFrameInfoDecoder = new SimpleFrameInfoDecoder(HEADER, protocol, outOfOrderResponse); Optional frameInfo = simpleFrameInfoDecoder.tryDecodeFrameInfo(bufAllocator, buffer); - if (frameInfo.isPresent()) { - int messageSequenceId = frameInfo.get().getSequenceId(); + frameInfo.ifPresent(frame -> { + int messageSequenceId = frame.getSequenceId(); checkArgument( headerSequenceId == messageSequenceId, "Sequence ids don't match. headerSequenceId: %s. messageSequenceId: %s", headerSequenceId, messageSequenceId); - } + }); return frameInfo; } finally { diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/DriftNettyServerTransport.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/DriftNettyServerTransport.java index ff610194a..6a4929d6d 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/DriftNettyServerTransport.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/DriftNettyServerTransport.java @@ -30,6 +30,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.ssl.SslContext; import io.netty.util.concurrent.Future; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import java.net.InetSocketAddress; import java.util.Optional; @@ -63,6 +64,7 @@ public DriftNettyServerTransport(ServerMethodInvoker methodInvoker, DriftNettySe this(methodInvoker, config, ByteBufAllocator.DEFAULT); } + @SuppressModernizer @VisibleForTesting public DriftNettyServerTransport(ServerMethodInvoker methodInvoker, DriftNettyServerConfig config, ByteBufAllocator allocator) { diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerHandler.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerHandler.java index b0d3dd234..cae245628 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerHandler.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerHandler.java @@ -27,7 +27,6 @@ import com.facebook.drift.protocol.TTransport; import com.facebook.drift.transport.MethodMetadata; import com.facebook.drift.transport.ParameterMetadata; -import com.facebook.drift.transport.netty.codec.FrameInfo; import com.facebook.drift.transport.netty.codec.FrameTooLargeException; import com.facebook.drift.transport.netty.codec.Protocol; import com.facebook.drift.transport.netty.codec.ThriftFrame; @@ -47,6 +46,7 @@ import io.airlift.units.Duration; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import java.io.IOException; import java.lang.reflect.ParameterizedType; @@ -109,11 +109,9 @@ public void channelRead(ChannelHandlerContext context, Object message) public void exceptionCaught(ChannelHandlerContext context, Throwable cause) { // if possible, try to reply with an exception in case of a too large request - if (cause instanceof FrameTooLargeException) { - FrameTooLargeException e = (FrameTooLargeException) cause; + if (cause instanceof FrameTooLargeException e) { // frame info may be missing in case of a large, but invalid request - if (e.getFrameInfo().isPresent()) { - FrameInfo frameInfo = e.getFrameInfo().get(); + e.getFrameInfo().ifPresent(frameInfo -> { try { context.writeAndFlush(writeApplicationException( context, @@ -132,6 +130,8 @@ public void exceptionCaught(ChannelHandlerContext context, Throwable cause) context.close(); log.error(t, "Failed to write frame info"); } + }); + if (e.getFrameInfo().isPresent()) { return; } } @@ -188,6 +188,7 @@ public void onFailure(Throwable t) } } + @SuppressModernizer private ListenableFuture decodeMessage( ChannelHandlerContext context, TTransport messageData, @@ -204,7 +205,7 @@ private ListenableFuture decodeMessage( TMessage message = protocolReader.readMessageBegin(); Optional methodMetadata = methodInvoker.getMethodMetadata(message.getName()); - if (!methodMetadata.isPresent()) { + if (methodMetadata.isEmpty()) { return immediateFuture(writeApplicationException( context, message.getName(), @@ -372,6 +373,7 @@ private static ThriftFrame writeSuccessResponse( } } + @SuppressModernizer private static ThriftFrame writeExceptionResponse(ChannelHandlerContext context, MethodMetadata methodMetadata, List transforms, diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerInitializer.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerInitializer.java index 8c0a8a744..3f6e80dcb 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerInitializer.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/server/ThriftServerInitializer.java @@ -70,15 +70,14 @@ public ThriftServerInitializer( protected void initChannel(SocketChannel channel) { ChannelPipeline pipeline = channel.pipeline(); - - if (sslContextSupplier.isPresent()) { + sslContextSupplier.ifPresent(sslContext -> { if (allowPlainText) { - pipeline.addLast(new OptionalSslHandler(sslContextSupplier.get().get())); + pipeline.addLast(new OptionalSslHandler(sslContext.get())); } else { - pipeline.addLast(sslContextSupplier.get().get().newHandler(channel.alloc())); + pipeline.addLast(sslContext.get().newHandler(channel.alloc())); } - } + }); pipeline.addLast(new ThriftProtocolDetection( new ThriftServerHandler(methodInvoker, requestTimeout, timeoutExecutor), diff --git a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/ssl/ReloadableSslContext.java b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/ssl/ReloadableSslContext.java index 9510cbff3..885805771 100644 --- a/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/ssl/ReloadableSslContext.java +++ b/drift-transport-netty/src/main/java/com/facebook/drift/transport/netty/ssl/ReloadableSslContext.java @@ -25,6 +25,7 @@ import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContextBuilder; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import java.io.File; import java.io.IOException; @@ -88,6 +89,7 @@ public SslContext get() return sslContext.get().getSslContext(); } + @SuppressModernizer public synchronized void reload() { try { diff --git a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyClientModule.java b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyClientModule.java index ed366e8d6..764abeaea 100644 --- a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyClientModule.java +++ b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyClientModule.java @@ -42,7 +42,6 @@ public void test() Injector injector = bootstrap .doNotInitializeLogging() - .strictConfig() .initialize(); assertNotNull(injector.getInstance(Key.get(new TypeLiteral>() {}))); diff --git a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyMethodInvoker.java b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyMethodInvoker.java index b6a050478..b0d2844f0 100644 --- a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyMethodInvoker.java +++ b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/client/TestDriftNettyMethodInvoker.java @@ -43,6 +43,7 @@ import com.facebook.drift.transport.server.ServerTransport; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Streams; import com.google.common.net.HostAndPort; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -86,9 +87,8 @@ import static com.facebook.drift.codec.metadata.ThriftType.optional; import static com.facebook.drift.transport.netty.codec.Protocol.BINARY; import static com.facebook.drift.transport.netty.codec.Transport.FRAMED; -import static com.google.common.collect.Iterables.concat; -import static com.google.common.collect.Iterables.getOnlyElement; -import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.ImmutableList.toImmutableList; +import static com.google.common.collect.MoreCollectors.onlyElement; import static java.util.Collections.nCopies; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -139,7 +139,7 @@ private static List testProcessor(TProcessor processor) address -> logNiftyInvocationHandlerOptional(address, DRIFT_MESSAGES), address -> logNiftyInvocationHandler(address, DRIFT_MESSAGES, FRAMED, BINARY))); - return newArrayList(concat(nCopies(invocationCount, MESSAGES))); + return Streams.concat(nCopies(invocationCount, MESSAGES).stream()).flatMap(List::stream).collect(toImmutableList()); } private static int testProcessor(TProcessor processor, List> clients) @@ -198,7 +198,7 @@ private static List testMethodInvoker(ServerMethodInvoker methodI address -> logNiftyInvocationHandler(address, DRIFT_MESSAGES, Transport.HEADER, BINARY), address -> logNiftyInvocationHandler(address, DRIFT_MESSAGES, Transport.HEADER, Protocol.FB_COMPACT))); - return newArrayList(concat(nCopies(invocationCount, DRIFT_MESSAGES))); + return Streams.concat(nCopies(invocationCount, DRIFT_MESSAGES).stream()).flatMap(List::stream).collect(toImmutableList()); } private static int testMethodInvoker(ServerMethodInvoker methodInvoker, List> clients) @@ -469,10 +469,10 @@ public ListenableFuture invoke(ServerInvokeRequest request) } Map parameters = request.getParameters(); - if (parameters.size() != 1 || !parameters.containsKey((short) 1) || !(getOnlyElement(parameters.values()) instanceof List)) { + if (parameters.size() != 1 || !parameters.containsKey((short) 1) || !(parameters.values().stream().collect(onlyElement()) instanceof List)) { return Futures.immediateFailedFuture(new IllegalArgumentException("invalid parameters")); } - List messages = (List) getOnlyElement(parameters.values()); + List messages = (List) parameters.values().stream().collect(onlyElement()); for (DriftLogEntry message : messages) { if (message.getCategory().equals("exception")) { diff --git a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/codec/TestSimpleFrameInfoDecoder.java b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/codec/TestSimpleFrameInfoDecoder.java index ae5445024..9e24196a3 100644 --- a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/codec/TestSimpleFrameInfoDecoder.java +++ b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/codec/TestSimpleFrameInfoDecoder.java @@ -23,6 +23,7 @@ import com.facebook.drift.transport.netty.ssl.TChannelBufferOutputTransport; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.testng.annotations.Test; import static com.facebook.drift.protocol.TMessageType.CALL; @@ -47,6 +48,7 @@ public void testDecodeSequenceId() } } + @SuppressModernizer private static void testDecodeSequenceId(ByteBufAllocator allocator, Protocol protocol) throws TException { diff --git a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/server/TestDriftNettyServerTransport.java b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/server/TestDriftNettyServerTransport.java index 8f95e55db..cca894adb 100644 --- a/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/server/TestDriftNettyServerTransport.java +++ b/drift-transport-netty/src/test/java/com/facebook/drift/transport/netty/server/TestDriftNettyServerTransport.java @@ -31,6 +31,7 @@ import com.facebook.drift.transport.server.ServerTransport; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Streams; import com.google.common.net.HostAndPort; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -46,6 +47,7 @@ import org.apache.thrift.transport.TFramedTransport; import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransportFactory; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.testng.annotations.Test; import java.util.List; @@ -58,6 +60,7 @@ import java.util.stream.Collectors; import static com.facebook.drift.codec.metadata.ThriftType.list; +import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.Iterables.concat; import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Lists.newArrayList; @@ -71,6 +74,7 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNull; +@SuppressModernizer public class TestDriftNettyServerTransport { private static final ThriftCodecManager CODEC_MANAGER = new ThriftCodecManager(); @@ -165,7 +169,7 @@ public void testOutOfOrderNotSupported() address -> testOutOfOrderNotSupported(address, MESSAGES, new TFramedTransport.Factory(), new TBinaryProtocol.Factory(), methodInvoker.getFutureResults()), address -> testOutOfOrderNotSupported(address, MESSAGES, new TFramedTransport.Factory(), new TCompactProtocol.Factory(), methodInvoker.getFutureResults()))); - List expectedMessages = newArrayList(concat(nCopies(invocationCount, DRIFT_MESSAGES))); + List expectedMessages = Streams.concat(nCopies(invocationCount, DRIFT_MESSAGES).stream().flatMap(List::stream)).collect(toImmutableList()); assertEquals(ImmutableList.copyOf(methodInvoker.getMessages()), expectedMessages); } diff --git a/drift-transport-spi/pom.xml b/drift-transport-spi/pom.xml index 23a2e2c84..03ba67d5e 100644 --- a/drift-transport-spi/pom.xml +++ b/drift-transport-spi/pom.xml @@ -46,7 +46,7 @@ - io.airlift + com.facebook.airlift units true diff --git a/pom.xml b/pom.xml index 8afbdfddb..d743313c8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.facebook.airlift airbase - 95 + 104-SNAPSHOT com.facebook.drift @@ -52,13 +52,14 @@ true true - 0.186 - 2.9.1 - 3.5.3 - + 0.216-SNAPSHOT + 3.0.5 + 3.9.9 1.6.8 - 4.1.107.Final + + --add-opens java.base/java.lang=ALL-UNNAMED + @@ -117,6 +118,12 @@ ${project.version} + + com.facebook.drift + drift-integration-tests + ${project.version} + + com.facebook.airlift bootstrap @@ -148,21 +155,21 @@ - io.airlift + com.facebook.airlift units - ${dep.airlift.version} + 1.4-SNAPSHOT io.airlift parameternames - 1.3 + 1.5 - io.airlift + com.facebook.airlift bytecode - 1.1 + 1.4-SNAPSHOT @@ -183,12 +190,6 @@ ${dep.airlift.version} - - io.airlift - units - 1.3 - - io.netty netty-common @@ -300,7 +301,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.5 + 3.15.1 @@ -317,7 +318,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5.1 + 3.15.1 help-mojo @@ -331,7 +332,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.1.0 + 3.6.0 @@ -397,7 +398,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.4 + 3.2.7 --pinentry-mode diff --git a/src/spotbugs/exclude.xml b/src/spotbugs/exclude.xml index da799f044..7e9c438ef 100644 --- a/src/spotbugs/exclude.xml +++ b/src/spotbugs/exclude.xml @@ -1,6 +1,13 @@ - + + + + + + + +