Skip to content

Commit 9d58bca

Browse files
committed
chore: fix build, test, and CI workflow warnings
1 parent dc7f85c commit 9d58bca

17 files changed

Lines changed: 51 additions & 28 deletions

File tree

‎.github/workflows/maven.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ jobs:
4848

4949
steps:
5050
- name: Checkout
51-
uses: actions/checkout@v3
51+
uses: actions/checkout@v5
5252

5353
- name: Set up JDK
54-
uses: actions/setup-java@v3
54+
uses: actions/setup-java@v5
5555
with:
5656
distribution: ${{ matrix.jdk }}
5757
java-version: ${{ matrix.java }}

‎api/pom.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@
147147
<artifactId>guava-testlib</artifactId>
148148
<scope>test</scope>
149149
</dependency>
150+
<dependency>
151+
<groupId>org.slf4j</groupId>
152+
<artifactId>slf4j-nop</artifactId>
153+
<version>${slf4j.version}</version>
154+
<scope>test</scope>
155+
</dependency>
150156

151157
<dependency>
152158
<groupId>jakarta.servlet</groupId>

‎api/src/test/java/com/google/appengine/api/images/ImagesServiceImplTest.java‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static com.google.common.truth.Truth.assertThat;
1717
import static org.junit.Assert.assertThrows;
1818
import static org.mockito.ArgumentMatchers.eq;
19+
import static org.mockito.Mockito.lenient;
1920
import static org.mockito.Mockito.when;
2021
import java.util.concurrent.ExecutionException;
2122

@@ -166,14 +167,16 @@ private void setupGrpcService(ImagesServiceGrpc.ImagesServiceImplBase serviceImp
166167
grpcCleanup.register(InProcessChannelBuilder.forName(serverName).directExecutor().build());
167168
blockingStub = ImagesServiceGrpc.newBlockingStub(channel);
168169
futureStub = ImagesServiceGrpc.newFutureStub(channel);
169-
when(mockGrpcImagesClient.getBlockingStub()).thenReturn(blockingStub);
170-
when(mockGrpcImagesClient.getFutureStub()).thenReturn(futureStub);
170+
lenient().when(mockGrpcImagesClient.getBlockingStub()).thenReturn(blockingStub);
171+
lenient().when(mockGrpcImagesClient.getFutureStub()).thenReturn(futureStub);
171172
imagesService =
172173
new ImagesServiceImpl(
173174
mockEnvironmentProvider, mockGrpcImagesClient, null, mockBlobstoreReference);
174175

175-
when(mockEnvironmentProvider.getenv(
176-
ImagesServiceFactoryImpl.USE_CUSTOM_IMAGES_GRPC_SERVICE_ENV))
176+
lenient()
177+
.when(
178+
mockEnvironmentProvider.getenv(
179+
ImagesServiceFactoryImpl.USE_CUSTOM_IMAGES_GRPC_SERVICE_ENV))
177180
.thenReturn("true");
178181
}
179182

@@ -356,8 +359,10 @@ public void loadImageData_withLegacyBlobKey_failure() throws Exception {
356359

357360
public void setUpGrpc(boolean useGrpc) throws Exception {
358361
ImagesServiceImpl.setStorageForTesting(mockStorage);
359-
when(mockEnvironmentProvider.getenv(
360-
ImagesServiceFactoryImpl.USE_CUSTOM_IMAGES_GRPC_SERVICE_ENV))
362+
lenient()
363+
.when(
364+
mockEnvironmentProvider.getenv(
365+
ImagesServiceFactoryImpl.USE_CUSTOM_IMAGES_GRPC_SERVICE_ENV))
361366
.thenReturn(Boolean.toString(useGrpc));
362367

363368
if (useGrpc) {
@@ -373,8 +378,8 @@ public void setUpGrpc(boolean useGrpc) throws Exception {
373378
InProcessChannelBuilder.forName(serverName).directExecutor().build());
374379
blockingStub = ImagesServiceGrpc.newBlockingStub(channel);
375380
futureStub = ImagesServiceGrpc.newFutureStub(channel);
376-
when(mockGrpcImagesClient.getBlockingStub()).thenReturn(blockingStub);
377-
when(mockGrpcImagesClient.getFutureStub()).thenReturn(futureStub);
381+
lenient().when(mockGrpcImagesClient.getBlockingStub()).thenReturn(blockingStub);
382+
lenient().when(mockGrpcImagesClient.getFutureStub()).thenReturn(futureStub);
378383

379384
imagesService =
380385
new ImagesServiceImpl(

‎api_dev/pom.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@
209209
<artifactId>mockito-junit-jupiter</artifactId>
210210
<scope>test</scope>
211211
</dependency>
212+
<dependency>
213+
<groupId>org.slf4j</groupId>
214+
<artifactId>slf4j-nop</artifactId>
215+
<version>${slf4j.version}</version>
216+
<scope>test</scope>
217+
</dependency>
212218
<dependency>
213219
<groupId>jakarta.servlet</groupId>
214220
<artifactId>jakarta.servlet-api</artifactId>

‎api_dev/src/test/java/com/google/appengine/api/blobstore/BlobstoreServiceImplTest.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,15 @@ public void testDelete_multiSuccess() throws Exception {
163163
DeleteBlobRequest requestProto =
164164
DeleteBlobRequest.newBuilder().addBlobKey("_foo1").addBlobKey("_foo2").build();
165165

166-
when(delegate.makeSyncCall(any(), any(), any(), any())).thenReturn(new byte[0]);
167-
168-
new BlobstoreServiceImpl().delete(new BlobKey("_foo1"), new BlobKey("_foo2"));
169166
when(delegate.makeSyncCall(
170167
same(ApiProxy.getCurrentEnvironment()),
171168
eq(BlobstoreServiceImpl.PACKAGE),
172169
eq("DeleteBlob"),
173170
eq(requestProto.toByteArray())))
174171
.thenReturn(new byte[0]);
175172

173+
new BlobstoreServiceImpl().delete(new BlobKey("_foo1"), new BlobKey("_foo2"));
174+
176175
verify(delegate)
177176
.makeSyncCall(
178177
same(ApiProxy.getCurrentEnvironment()),

‎api_dev/src/test/java/com/google/appengine/api/datastore/AdminDatastoreServiceTest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static com.google.common.util.concurrent.Futures.immediateFuture;
2222
import static org.junit.Assert.assertThrows;
2323
import static org.mockito.Mockito.eq;
24+
import static org.mockito.Mockito.lenient;
2425
import static org.mockito.Mockito.mock;
2526
import static org.mockito.Mockito.notNull;
2627
import static org.mockito.Mockito.when;
@@ -89,7 +90,7 @@ public void setUp() throws Exception {
8990
new AsyncDatastoreServiceFactory() {
9091
@Override
9192
public AsyncDatastoreService getInstance(DatastoreServiceConfig config) {
92-
when(delegate.getDatastoreServiceConfig()).thenReturn(config);
93+
lenient().when(delegate.getDatastoreServiceConfig()).thenReturn(config);
9394
return delegate;
9495
}
9596

‎api_dev/src/test/java/com/google/appengine/api/datastore/DatastoreCallbacksTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,6 @@ public void testPostLoad_Get_Batch_RollbackTxn() throws Exception {
14121412
datastore.get(ImmutableList.of(yar.getKey(), yarChild.getKey()));
14131413
verifyNoMoreInteractions(mock);
14141414
// postLoad callback doesn't run until we call get() on the future.
1415-
assertThat(result.get()).containsExactly(yar.getKey(), yar, yarChild.getKey(), yarChild);
14161415
doAnswer(checkContext(new PostLoadContext(txnProvider, txn, ImmutableList.of(yar, yarChild))))
14171416
.when(mock)
14181417
.postLoad(any());

‎appengine_jsr107/src/test/java/com/google/appengine/api/memcache/jsr107cache/GCacheTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void testPutAll_addIfNotPresent_throws() {
207207
properties.put(GCacheFactory.THROW_ON_PUT_FAILURE, Boolean.TRUE);
208208
properties.put(GCacheFactory.SET_POLICY, ADD_ONLY_IF_NOT_PRESENT);
209209
Cache cache = new GCache(properties);
210-
when(service.putAll(map, null, REPLACE_ONLY_IF_PRESENT)).thenReturn(failureSet);
210+
when(service.putAll(map, null, ADD_ONLY_IF_NOT_PRESENT)).thenReturn(failureSet);
211211
assertThrows(GCacheException.class, () -> cache.putAll(map));
212212
}
213213

‎appengine_testing_tests/pom.xml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
<artifactId>javax.servlet-api</artifactId>
6969
<scope>test</scope>
7070
</dependency>
71+
<dependency>
72+
<groupId>org.slf4j</groupId>
73+
<artifactId>slf4j-nop</artifactId>
74+
<version>${slf4j.version}</version>
75+
<scope>test</scope>
76+
</dependency>
7177
</dependencies>
7278
<profiles>
7379
<profile>
@@ -82,8 +88,10 @@
8288
<artifactId>maven-surefire-plugin</artifactId>
8389
<configuration>
8490
<argLine>
85-
-Duser.timezone=CST
91+
-Xshare:off
92+
-Duser.timezone=America/Chicago
8693
--add-opens java.base/java.lang=ALL-UNNAMED
94+
-javaagent:${org.mockito:mockito-core:jar}
8795
</argLine>
8896
<systemPropertyVariables>
8997
<net.bytebuddy.experimental>true</net.bytebuddy.experimental>
@@ -105,7 +113,7 @@
105113
<artifactId>maven-surefire-plugin</artifactId>
106114
<configuration>
107115
<argLine>
108-
-Duser.timezone=CST
116+
-Duser.timezone=America/Chicago
109117
</argLine>
110118
</configuration>
111119
</plugin>

‎lib/tools_api/src/main/java/com/google/appengine/tools/admin/Application.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,7 @@ private void compileJspJavaFiles(
12361236
// Depending on the runtime, select the correct bytecode target for the jsp classes compilation.
12371237
// If the runtime is unknown and forced (like java9), keep the default settings.
12381238
// If the current JDK is older than the runtime, we fallback to the current JDK version.
1239-
optionList.addAll(Arrays.asList("-source", javaVersion));
1240-
optionList.addAll(Arrays.asList("-target", javaVersion));
1239+
optionList.addAll(Arrays.asList("--release", javaVersion, "-Xlint:-options"));
12411240

12421241
Iterable<? extends JavaFileObject> compilationUnits =
12431242
fileManager.getJavaFileObjectsFromFiles(files);

0 commit comments

Comments
 (0)