This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new b3db30a7f [SCB-2886] Fix some compiler warnings (#4418)
b3db30a7f is described below
commit b3db30a7f5553dca1437df9f7502e492981efc32
Author: liubao68 <[email protected]>
AuthorDate: Fri Jul 19 15:46:22 2024 +0800
[SCB-2886] Fix some compiler warnings (#4418)
---
foundations/foundation-spi/pom.xml | 15 --------
.../main/java/io/vertx/core/impl/SyncContext.java | 8 ++++
.../foundation/vertx/AddressResolverConfig.java | 2 +-
.../vertx/client/http/HttpClientOptionsSPI.java | 2 +-
.../vertx/client/http/HttpClientPoolFactory.java | 26 ++++++-------
.../foundation/vertx/client/http/HttpClients.java | 3 +-
.../vertx/executor/VertxWorkerExecutor.java | 7 ++--
.../client/http/TestHttpClientPoolFactory.java | 45 ----------------------
pom.xml | 7 +---
spring-boot/spring-boot-starters/pom.xml | 13 -------
10 files changed, 30 insertions(+), 98 deletions(-)
diff --git a/foundations/foundation-spi/pom.xml
b/foundations/foundation-spi/pom.xml
index 0d676c86e..0f58fc313 100644
--- a/foundations/foundation-spi/pom.xml
+++ b/foundations/foundation-spi/pom.xml
@@ -41,19 +41,4 @@
<scope>test</scope>
</dependency>
</dependencies>
- <!--<build>
- <plugins>
- <!– 配置当前项目的jdk版本信息 –>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- <configuration>
- <source>17</source>
- <target>17</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </build>-->
</project>
diff --git
a/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java
b/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java
index 3c167a70f..20303284f 100644
---
a/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java
+++
b/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java
@@ -16,6 +16,7 @@
*/
package io.vertx.core.impl;
+import java.io.Serial;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
@@ -35,7 +36,11 @@ import io.vertx.core.spi.tracing.VertxTracer;
/**
* This class is created to make vertx unit test easier
*/
+@SuppressWarnings({"rawtypes"})
public class SyncContext extends ContextBase implements ContextInternal {
+ @Serial
+ private static final long serialVersionUID = -6209656149925076980L;
+
protected VertxInternal owner;
protected Executor executor = Executors.newSingleThreadExecutor();
@@ -186,6 +191,7 @@ public class SyncContext extends ContextBase implements
ContextInternal {
}
@Override
+ @Deprecated
public <T> Future<T> executeBlocking(Handler<Promise<T>> handler, TaskQueue
taskQueue) {
return null;
}
@@ -196,6 +202,7 @@ public class SyncContext extends ContextBase implements
ContextInternal {
}
@Override
+ @Deprecated
public <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler,
boolean ordered,
Handler<AsyncResult<T>> asyncResultHandler) {
syncExecuteBlocking(blockingCodeHandler, asyncResultHandler);
@@ -207,6 +214,7 @@ public class SyncContext extends ContextBase implements
ContextInternal {
}
@Override
+ @Deprecated
public <T> Future<@Nullable T> executeBlocking(Handler<Promise<T>> handler,
boolean b) {
return null;
}
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
index afb2a656a..8b99960be 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java
@@ -79,7 +79,7 @@ public class AddressResolverConfig {
"addressResolver.rdFlag"));
addressResolverOptions
.setSearchDomains(getStringListProperty(
- AddressResolverOptions.DEFAULT_SEACH_DOMAINS,
+ AddressResolverOptions.DEFAULT_SEARCH_DOMAINS,
"addressResolver." + tag + ".searchDomains",
"addressResolver.searchDomains"));
addressResolverOptions
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java
index 8094cfeca..abac22833 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java
@@ -124,7 +124,7 @@ public interface HttpClientOptionsSPI {
buildClientOptionsBase(spi, httpClientOptions);
httpClientOptions.setProtocolVersion(spi.getHttpVersion());
- httpClientOptions.setTryUseCompression(spi.isTryUseCompression());
+ httpClientOptions.setDecompressionSupported(spi.isTryUseCompression());
httpClientOptions.setMaxWaitQueueSize(spi.getMaxWaitQueueSize());
httpClientOptions.setMaxPoolSize(spi.getMaxPoolSize());
httpClientOptions.setKeepAlive(spi.isKeepAlive());
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java
index c8752949d..b9f4b34e0 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java
@@ -37,19 +37,19 @@ public class HttpClientPoolFactory implements
ClientPoolFactory<HttpClientWithCo
@Override
public HttpClientWithContext createClientPool(Context context) {
- HttpClient httpClient =
context.owner().createHttpClient(httpClientOptions);
- httpClient.connectionHandler(connection -> {
- LOGGER.debug("http connection connected, local:{}, remote:{}.",
- connection.localAddress(), connection.remoteAddress());
- connection.closeHandler(v ->
- LOGGER.debug("http connection closed, local:{}, remote:{}.",
- connection.localAddress(), connection.remoteAddress())
- );
- connection.exceptionHandler(e ->
- LOGGER.info("http connection exception, local:{}, remote:{}.",
- connection.localAddress(), connection.remoteAddress(), e)
- );
- });
+ HttpClient httpClient =
context.owner().httpClientBuilder().with(httpClientOptions)
+ .withConnectHandler(connection -> {
+ LOGGER.debug("http connection connected, local:{}, remote:{}.",
+ connection.localAddress(), connection.remoteAddress());
+ connection.closeHandler(v ->
+ LOGGER.debug("http connection closed, local:{}, remote:{}.",
+ connection.localAddress(), connection.remoteAddress())
+ );
+ connection.exceptionHandler(e ->
+ LOGGER.info("http connection exception, local:{}, remote:{}.",
+ connection.localAddress(), connection.remoteAddress(), e)
+ );
+ }).build();
return new HttpClientWithContext(httpClient, context);
}
}
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
index 39d78422d..9eb298164 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
import io.vertx.core.Context;
import io.vertx.core.DeploymentOptions;
+import io.vertx.core.ThreadingModel;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.dns.AddressResolverOptions;
@@ -74,7 +75,7 @@ public class HttpClients {
DeploymentOptions deployOptions =
VertxUtils.createClientDeployOptions(clientPoolManager,
option.getInstanceCount())
- .setWorker(option.isWorker())
+ .setThreadingModel(option.isWorker() ? ThreadingModel.WORKER :
ThreadingModel.EVENT_LOOP)
.setWorkerPoolName(option.getWorkerPoolName())
.setWorkerPoolSize(option.getWorkerPoolSize());
try {
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxWorkerExecutor.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxWorkerExecutor.java
index 7f19f9113..e3334a79f 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxWorkerExecutor.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/executor/VertxWorkerExecutor.java
@@ -25,8 +25,9 @@ public class VertxWorkerExecutor implements Executor {
@Override
public void execute(Runnable command) {
- Vertx.currentContext().owner().executeBlocking(future -> command.run(),
- false,
- null);
+ Vertx.currentContext().owner().executeBlocking(() -> {
+ command.run();
+ return null;
+ }, false);
}
}
diff --git
a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/TestHttpClientPoolFactory.java
b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/TestHttpClientPoolFactory.java
deleted file mode 100644
index cf57fe619..000000000
---
a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/TestHttpClientPoolFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.apache.servicecomb.foundation.vertx.client.http;
-
-import io.vertx.core.http.HttpClient;
-import io.vertx.core.http.HttpClientOptions;
-import io.vertx.core.impl.ContextInternal;
-import io.vertx.core.impl.VertxInternal;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-
-public class TestHttpClientPoolFactory {
- private final HttpClientOptions httpClientOptions = new HttpClientOptions();
-
- HttpClientPoolFactory factory = new HttpClientPoolFactory(httpClientOptions);
-
- @Test
- public void createClientPool() {
- VertxInternal vertx = Mockito.mock(VertxInternal.class);
- ContextInternal context = Mockito.mock(ContextInternal.class);
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- Mockito.when(context.owner()).thenReturn(vertx);
-
Mockito.when(vertx.createHttpClient(httpClientOptions)).thenReturn(httpClient);
-
- HttpClientWithContext pool = factory.createClientPool(context);
-
- Assertions.assertSame(context, pool.context());
- Assertions.assertSame(httpClient, pool.getHttpClient());
- }
-}
diff --git a/pom.xml b/pom.xml
index a4a11c238..5dde1e082 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,6 @@
<java.version>17</java.version>
<argLine>-Dfile.encoding=UTF-8</argLine>
<skip-remote-resource>true</skip-remote-resource>
- <werror.properties></werror.properties>
<!-- plugin version start -->
<!-- sort by alpha -->
<checkstyle-maven-plugin.version>3.4.0</checkstyle-maven-plugin.version>
@@ -423,13 +422,9 @@
<target>17</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
+ <!--<failOnWarning>true</failOnWarning>-->
<compilerArgs>
- <arg>${werror.properties}</arg>
<arg>-Xlint:all</arg>
- <!--not care for jdk8/jdk7 compatible problem-->
- <arg>-Xlint:-classfile</arg>
- <!--not care for annotations not processed-->
- <arg>-Xlint:-processing</arg>
</compilerArgs>
</configuration>
</plugin>
diff --git a/spring-boot/spring-boot-starters/pom.xml
b/spring-boot/spring-boot-starters/pom.xml
index 275eabad9..ea528b5ab 100644
--- a/spring-boot/spring-boot-starters/pom.xml
+++ b/spring-boot/spring-boot-starters/pom.xml
@@ -36,17 +36,4 @@
<module>java-chassis-spring-boot-starter-standalone</module>
</modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>17</source>
- <target>17</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</project>