Skip to content

Commit 78a30af

Browse files
committed
Bump airbase
1 parent 1c51d99 commit 78a30af

File tree

12 files changed

+98
-40
lines changed

12 files changed

+98
-40
lines changed

.github/workflows/maven.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33

44
name: Java CI with Maven
55

6-
on: [push, pull_request]
6+
on: [ push, pull_request ]
77

88
jobs:
99
build:
1010

1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
show-progress: false
17-
# needed for the git-commit-id-plugin to work
18-
fetch-depth: 0
19-
- name: Set up JDK 8
20-
uses: actions/setup-java@v3
21-
with:
22-
java-version: '8'
23-
distribution: 'temurin'
24-
- name: Maven Install
25-
run: mvn install -B -V -DskipTests -Dair.check.skip-all
26-
- name: Maven Tests
27-
run: mvn install -B -P ci
14+
- uses: actions/checkout@v4
15+
with:
16+
show-progress: false
17+
# needed for the git-commit-id-plugin to work
18+
fetch-depth: 0
19+
- name: Set up JDK 8
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: '8'
23+
distribution: 'temurin'
24+
- name: Maven Install
25+
run: mvn install -B -V -DskipTests -Dair.check.skip-all -Dmodernizer.skip=true
26+
- name: Maven Tests
27+
run: mvn install -B -P ci -Dmodernizer.skip=true

drift-codec-utils/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<groupId>org.gaul</groupId>
8080
<artifactId>modernizer-maven-plugin</artifactId>
8181
<configuration>
82+
<skip>true</skip>
8283
<exclusionPatterns>
8384
<exclusionPattern>org/joda/time/.*</exclusionPattern>
8485
</exclusionPatterns>

drift-codec/src/main/java/com/facebook/drift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import com.facebook.drift.protocol.TProtocolWriter;
5454
import com.google.common.collect.ImmutableList;
5555
import com.google.common.collect.ImmutableMap;
56+
import com.google.common.collect.MoreCollectors;
5657
import com.google.common.reflect.TypeToken;
5758
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
5859

@@ -111,7 +112,6 @@
111112
import static com.facebook.drift.codec.ThriftProtocolType.STRING;
112113
import static com.facebook.drift.codec.ThriftProtocolType.STRUCT;
113114
import static com.google.common.collect.ImmutableList.toImmutableList;
114-
import static com.google.common.collect.Iterables.getOnlyElement;
115115
import static java.lang.String.format;
116116
import static java.util.stream.Collectors.joining;
117117

@@ -540,7 +540,8 @@ private Variable buildUnion(MethodDefinition method, Variable fieldId, Map<Short
540540
method.getBody().append(switchBuilder.build());
541541

542542
// find the @ThriftUnionId field
543-
ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(FieldKind.THRIFT_UNION_ID));
543+
ThriftFieldMetadata idField = metadata.getFields(FieldKind.THRIFT_UNION_ID).stream()
544+
.collect(MoreCollectors.onlyElement());
544545

545546
injectIdField(method, idField, instance, fieldId);
546547

@@ -810,7 +811,8 @@ private void defineWriteUnionMethod()
810811
body.append(writer.invoke("writeStructBegin", void.class, constantString(metadata.getStructName())));
811812

812813
// find the @ThriftUnionId field
813-
ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(FieldKind.THRIFT_UNION_ID));
814+
ThriftFieldMetadata idField = metadata.getFields(FieldKind.THRIFT_UNION_ID).stream()
815+
.collect(MoreCollectors.onlyElement());
814816

815817
// load its value
816818
BytecodeExpression value = getFieldValue(method, idField);

drift-codec/src/main/java/com/facebook/drift/codec/internal/reflection/ReflectionThriftUnionCodec.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
import com.facebook.drift.protocol.TProtocolReader;
3030
import com.facebook.drift.protocol.TProtocolWriter;
3131
import com.google.common.collect.Maps;
32+
import com.google.common.collect.MoreCollectors;
3233

3334
import javax.annotation.concurrent.Immutable;
3435

3536
import java.util.Map;
3637

3738
import static com.google.common.base.Preconditions.checkState;
38-
import static com.google.common.collect.Iterables.getOnlyElement;
3939
import static com.google.common.collect.Maps.uniqueIndex;
4040
import static java.lang.String.format;
4141
import static java.util.Objects.requireNonNull;
@@ -51,7 +51,8 @@ public ReflectionThriftUnionCodec(ThriftCodecManager manager, ThriftStructMetada
5151
{
5252
super(manager, metadata);
5353

54-
ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(FieldKind.THRIFT_UNION_ID));
54+
ThriftFieldMetadata idField = metadata.getFields(FieldKind.THRIFT_UNION_ID).stream()
55+
.collect(MoreCollectors.onlyElement());
5556

5657
this.idField = Maps.immutableEntry(idField, manager.getCodec(idField.getThriftType()));
5758
requireNonNull(this.idField.getValue(), () -> "No codec for ID field found: " + idField);

drift-codec/src/main/java/com/facebook/drift/codec/metadata/AbstractThriftMetadataBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.facebook.drift.annotations.ThriftField;
2020
import com.google.common.collect.ImmutableList;
2121
import com.google.common.collect.ImmutableMap;
22-
import com.google.common.collect.Iterables;
22+
import com.google.common.collect.MoreCollectors;
2323
import com.google.common.collect.Multimap;
2424
import com.google.common.collect.Multimaps;
2525
import com.google.common.reflect.TypeToken;
@@ -584,7 +584,8 @@ protected final void inferThriftFieldIds(Multimap<String, FieldMetadata> fieldsB
584584
// single id, so set on all fields in this group (groups with no id are handled later),
585585
// and validate isLegacyId is consistent and correct.
586586
if (ids.size() == 1) {
587-
short id = Iterables.getOnlyElement(ids);
587+
short id = ids.stream()
588+
.collect(MoreCollectors.onlyElement());
588589

589590
boolean isLegacyId = extractFieldIsLegacyId(id, fieldName, fields);
590591

drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftServiceMetadata.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import com.facebook.drift.annotations.ThriftMethod;
1919
import com.facebook.drift.annotations.ThriftService;
2020
import com.google.common.collect.ComparisonChain;
21-
import com.google.common.collect.Iterables;
21+
import com.google.common.collect.MoreCollectors;
2222

2323
import javax.annotation.concurrent.Immutable;
2424

@@ -103,7 +103,8 @@ public static ThriftService getThriftServiceAnnotation(Class<?> serviceClass)
103103
checkArgument(!serviceAnnotations.isEmpty(), "Service class %s is not annotated with @ThriftService", serviceClass.getName());
104104
checkArgument(serviceAnnotations.size() == 1, "Service class %s has multiple conflicting @ThriftService annotations: %s", serviceClass.getName(), serviceAnnotations);
105105

106-
return Iterables.getOnlyElement(serviceAnnotations);
106+
return serviceAnnotations.stream()
107+
.collect(MoreCollectors.onlyElement());
107108
}
108109

109110
@Override

drift-codec/src/main/java/com/facebook/drift/codec/metadata/ThriftStructMetadataBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.facebook.drift.codec.metadata.ThriftStructMetadata.MetadataType;
2121
import com.google.common.collect.ImmutableList;
2222
import com.google.common.collect.ImmutableMap;
23-
import com.google.common.collect.Iterables;
23+
import com.google.common.collect.MoreCollectors;
2424

2525
import javax.annotation.concurrent.NotThreadSafe;
2626

@@ -141,7 +141,8 @@ public ThriftStructMetadata build()
141141

142142
private ThriftConstructorInjection buildConstructorInjection()
143143
{
144-
ConstructorInjection injection = Iterables.getOnlyElement(constructorInjections);
144+
ConstructorInjection injection = constructorInjections.stream()
145+
.collect(MoreCollectors.onlyElement());
145146
return new ThriftConstructorInjection(injection.getConstructor(), buildParameterInjections(injection.getParameters()));
146147
}
147148

drift-integration-tests/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,18 @@
151151
<scope>test</scope>
152152
</dependency>
153153
</dependencies>
154+
155+
<build>
156+
<pluginManagement>
157+
<plugins>
158+
<plugin>
159+
<groupId>org.gaul</groupId>
160+
<artifactId>modernizer-maven-plugin</artifactId>
161+
<configuration>
162+
<skip>true</skip>
163+
</configuration>
164+
</plugin>
165+
</plugins>
166+
</pluginManagement>
167+
</build>
154168
</project>

drift-transport-apache/src/test/java/com/facebook/drift/transport/apache/TestApacheThriftClientConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import io.airlift.units.Duration;
2323
import org.testng.annotations.Test;
2424

25-
import java.io.File;
25+
import java.nio.file.Paths;
2626
import java.util.Map;
2727

2828
import static com.facebook.airlift.configuration.testing.ConfigAssertions.assertFullMapping;
@@ -78,8 +78,8 @@ public void testExplicitPropertyMappings()
7878
.setSocksProxy(HostAndPort.fromParts("localhost", 11))
7979
.setMaxFrameSize(new DataSize(55, MEGABYTE))
8080
.setSslEnabled(true)
81-
.setTrustCertificate(new File("trust"))
82-
.setKey(new File("key"))
81+
.setTrustCertificate(Paths.get("trust").toFile())
82+
.setKey(Paths.get("key").toFile())
8383
.setKeyPassword("key_password");
8484

8585
assertFullMapping(properties, expected);

drift-transport-apache/src/test/java/com/facebook/drift/transport/apache/TestApacheThriftMethodInvoker.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.facebook.drift.transport.client.MethodInvoker;
3434
import com.google.common.collect.ImmutableList;
3535
import com.google.common.collect.ImmutableMap;
36-
import com.google.common.collect.Iterables;
3736
import com.google.common.net.HostAndPort;
3837
import com.google.common.util.concurrent.ListenableFuture;
3938
import com.google.common.util.concurrent.SettableFuture;
@@ -61,7 +60,7 @@
6160

6261
import static com.facebook.drift.codec.metadata.ThriftType.list;
6362
import static com.facebook.drift.codec.metadata.ThriftType.optional;
64-
import static com.google.common.collect.Lists.newArrayList;
63+
import static com.google.common.collect.ImmutableList.toImmutableList;
6564
import static java.util.Collections.nCopies;
6665
import static org.testng.Assert.assertEquals;
6766

@@ -97,7 +96,7 @@ private static List<LogEntry> testProcessor(TProcessor processor)
9796
address -> logApacheThriftInvocationHandler(address, DRIFT_MESSAGES),
9897
address -> logApacheThriftInvocationHandlerOptional(address, DRIFT_MESSAGES)));
9998

100-
return newArrayList(Iterables.concat(nCopies(invocationCount, MESSAGES)));
99+
return nCopies(invocationCount, MESSAGES).stream().flatMap(List::stream).collect(toImmutableList());
101100
}
102101

103102
private static int testProcessor(TProcessor processor, List<ToIntFunction<HostAndPort>> clients)

0 commit comments

Comments
 (0)