diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java index f27b958299e..815ad57cebd 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/merger/ResultMergerTest.java @@ -290,11 +290,11 @@ public void testMapArrayMerger() { */ @Test public void testLongArrayMerger() { - long[] arrayOne = {1l, 2l}; - long[] arrayTwo = {2l, 34l}; + long[] arrayOne = {1L, 2L}; + long[] arrayTwo = {2L, 34L}; long[] result = MergerFactory.getMerger(long[].class).merge(arrayOne, arrayTwo, null); Assertions.assertEquals(4, result.length); - double[] mergedResult = {1l, 2l, 2l, 34l}; + double[] mergedResult = {1L, 2L, 2L, 34L}; for (int i = 0; i < mergedResult.length; i++) { Assertions.assertEquals(mergedResult[i], result[i], 0.0); } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java index 37402d8d9ae..4ee3a863f69 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java @@ -445,7 +445,6 @@ public void testSelectBalance() { } Assertions.assertEquals(runs, counter.get(invoker2).get() + counter.get(invoker4).get()); - ; } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java index 6a2e76e0474..dab60d25824 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvokerTest.java @@ -203,7 +203,7 @@ public Object call() throws Exception { clusterinvoker.invoke(inv); } - public static interface Demo { + public interface Demo { } public static class MockInvoker extends AbstractInvoker { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MenuService.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MenuService.java index caf27df57b9..f1b6f7566f1 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MenuService.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/MenuService.java @@ -20,8 +20,8 @@ public interface MenuService { - public Menu getMenu(); + Menu getMenu(); - public void addMenu(String menu, List items); + void addMenu(String menu, List items); } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java index 57aca202998..feff78eca5d 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvokerTest.java @@ -673,7 +673,7 @@ private Invoker getClusterInvoker(URL url) { return getClusterInvokerMock(url, null); } - public static interface IHelloService { + public interface IHelloService { String getSomething(); String getSomething2(); @@ -688,9 +688,9 @@ public static interface IHelloService { Boolean getBoolean2(); - public List getListString(); + List getListString(); - public List getUsers(); + List getUsers(); void sayHello(); } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java index 19e8df4ad6e..d4f0bf8f81e 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java @@ -46,9 +46,9 @@ public interface CommonConstants { Pattern COMMA_SPLIT_PATTERN = Pattern.compile("\\s*[,]+\\s*"); - public final static String PATH_SEPARATOR = "/"; + String PATH_SEPARATOR = "/"; - public final static String PROTOCOL_SEPARATOR = "://"; + String PROTOCOL_SEPARATOR = "://"; String REGISTRY_SEPARATOR = "|"; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONVisitor.java b/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONVisitor.java index 6c9b1b69ca7..3847ef118d6 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONVisitor.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/json/JSONVisitor.java @@ -21,7 +21,7 @@ */ @Deprecated public interface JSONVisitor { - public static final String CLASS_PROPERTY = "class"; + String CLASS_PROPERTY = "class"; /** * parse begin . diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java index ac626e05aab..0a05a4dbdda 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java @@ -62,7 +62,7 @@ public void testCglibProxy() throws Exception { } } - public static interface ITest { + public interface ITest { String getName(); void setName(String name, String name2); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java index 03e7e318aba..75f8972280e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java @@ -131,11 +131,11 @@ public void test_getMethodNames_ContainExtendsParentMethods() throws Exception { assertArrayEquals(new String[]{"hello", "world"}, Wrapper.getWrapper(Son.class).getMethodNames()); } - public static interface I0 { + public interface I0 { String getName(); } - public static interface I1 extends I0 { + public interface I1 extends I0 { void setName(String name); void hello(String name); @@ -147,19 +147,19 @@ public static interface I1 extends I0 { void setFloat(float f); } - public static interface EmptyService { + public interface EmptyService { } - public static interface Parent1 { + public interface Parent1 { void hello(); } - public static interface Parent2 { + public interface Parent2 { void world(); } - public static interface Son extends Parent1, Parent2 { + public interface Son extends Parent1, Parent2 { } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java index 0052d81ca32..9d024f930f7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java @@ -18,5 +18,5 @@ package org.apache.dubbo.common.extension.ext6_inject; public interface Dao { - public void update(); + void update(); } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java index 3b5743d2b40..687348cad2f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/IOUtilsTest.java @@ -32,6 +32,7 @@ import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import static org.hamcrest.MatcherAssert.assertThat; @@ -47,7 +48,7 @@ public class IOUtilsTest { @BeforeEach public void setUp() throws Exception { - is = new ByteArrayInputStream(TEXT.getBytes("UTF-8")); + is = new ByteArrayInputStream(TEXT.getBytes(StandardCharsets.UTF_8)); os = new ByteArrayOutputStream(); reader = new StringReader(TEXT); writer = new StringWriter(); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java index 298f15c2f02..cc090caf9d6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/ReflectUtilsTest.java @@ -420,7 +420,7 @@ public void testGetReturnTypes () throws Exception{ Assertions.assertEquals("java.util.List", types2[1].getTypeName()); } - public static interface TypeClass { + public interface TypeClass { CompletableFuture getFuture(); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java index 3657a03a289..7941af88ff2 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/ComplexObject.java @@ -169,7 +169,7 @@ public int hashCode() { return result; } - static public enum TestEnum { + public enum TestEnum { VALUE1, VALUE2 } diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ReferenceConfigCache.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ReferenceConfigCache.java index 0891a767aba..8cab8270896 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ReferenceConfigCache.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ReferenceConfigCache.java @@ -162,7 +162,7 @@ public String toString() { + ")"; } - public static interface KeyGenerator { + public interface KeyGenerator { String generateKey(ReferenceConfig referenceConfig); } } diff --git a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/mock/JValidatorTestTarget.java b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/mock/JValidatorTestTarget.java index 2426d145b27..f65eb0573d5 100644 --- a/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/mock/JValidatorTestTarget.java +++ b/dubbo-filter/dubbo-filter-validation/src/test/java/org/apache/dubbo/validation/support/jvalidation/mock/JValidatorTestTarget.java @@ -24,16 +24,16 @@ public interface JValidatorTestTarget { @MethodValidated - public void someMethod1(String anything); + void someMethod1(String anything); @MethodValidated(Test2.class) - public void someMethod2(@NotNull ValidationParameter validationParameter); + void someMethod2(@NotNull ValidationParameter validationParameter); - public void someMethod3(ValidationParameter[] parameters); + void someMethod3(ValidationParameter[] parameters); - public void someMethod4(List strings); + void someMethod4(List strings); - public void someMethod5(Map map); + void someMethod5(Map map); @interface Test2 { } diff --git a/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java b/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java index ff9ed3abcbb..db00d586102 100644 --- a/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java +++ b/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java @@ -18,5 +18,5 @@ public enum ColorEnum { - RED, YELLOW, BLUE; + RED, YELLOW, BLUE } diff --git a/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java b/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java index 2859a13be8c..9371e8a0734 100644 --- a/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java +++ b/dubbo-metadata-report/dubbo-metadata-definition/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java @@ -170,7 +170,7 @@ public int hashCode() { return result; } - static public enum TestEnum { + public enum TestEnum { VALUE1, VALUE2 } diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java index 845de55ce37..6c79a679818 100644 --- a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java +++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java @@ -127,7 +127,7 @@ public void setApplication(String application) { this.application = application; } - public static enum KeyTypeEnum { + public enum KeyTypeEnum { PATH, UNIQUE_KEY } } diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java index 12085084cbd..1d973e92076 100644 --- a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java +++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/support/AbstractMetadataReport.java @@ -23,6 +23,7 @@ import org.apache.dubbo.common.utils.NamedThreadFactory; import org.apache.dubbo.metadata.definition.model.FullServiceDefinition; import org.apache.dubbo.metadata.identifier.MetadataIdentifier; +import org.apache.dubbo.metadata.identifier.MetadataIdentifier.KeyTypeEnum; import org.apache.dubbo.metadata.store.MetadataReport; import com.google.gson.Gson; @@ -190,9 +191,9 @@ private void saveProperties(MetadataIdentifier metadataIdentifier, String value, try { if (add) { - properties.setProperty(metadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), value); + properties.setProperty(metadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), value); } else { - properties.remove(metadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY)); + properties.remove(metadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY)); } long version = lastCacheChanged.incrementAndGet(); if (sync) { diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java index d8fd93c3b2b..3a54e726768 100644 --- a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java +++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java @@ -16,6 +16,7 @@ */ package org.apache.dubbo.metadata.identifier; +import org.apache.dubbo.metadata.identifier.MetadataIdentifier.KeyTypeEnum; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -34,12 +35,12 @@ public void testGetUniqueKey() { String group = null; String application = "vic.zk.md"; MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, PROVIDER_SIDE, application); - Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.PATH), + Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.PATH), "metadata" + PATH_SEPARATOR + interfaceName + PATH_SEPARATOR + (version == null ? "" : (version + PATH_SEPARATOR)) + (group == null ? "" : (group + PATH_SEPARATOR)) + PROVIDER_SIDE + PATH_SEPARATOR + application); - Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), + Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), interfaceName + MetadataIdentifier.SEPARATOR + (version == null ? "" : version) + MetadataIdentifier.SEPARATOR + (group == null ? "" : group) + MetadataIdentifier.SEPARATOR diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/integration/InterfaceNameTestService2.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/integration/InterfaceNameTestService2.java index 1c27f91525b..49e2a03ce98 100644 --- a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/integration/InterfaceNameTestService2.java +++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/integration/InterfaceNameTestService2.java @@ -21,5 +21,5 @@ */ public interface InterfaceNameTestService2 { - public void test2(); + void test2(); } diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ZKTools.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ZKTools.java index 0d9f9492430..6e71ae6d436 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ZKTools.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ZKTools.java @@ -30,6 +30,7 @@ import org.apache.curator.framework.recipes.cache.TreeCacheListener; import org.apache.curator.retry.ExponentialBackoffRetry; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -233,7 +234,7 @@ public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exc if (data.getPath().split("/").length == 5) { byte[] value = data.getData(); - String stringValue = new String(value, "utf-8"); + String stringValue = new String(value, StandardCharsets.UTF_8); // fire event to all listeners Map added = null; diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java index ddcc783ef9f..2687956a6f1 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java @@ -164,7 +164,7 @@ public void testDoRetry_nofify() throws Exception { public void notify(List urls) { count.incrementAndGet(); //The exception is thrown for the first time to see if the back will be called again to incrementAndGet - if (count.get() == 1l) { + if (count.get() == 1L) { throw new RuntimeException("test exception please ignore"); } } diff --git a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java index 7bf8197bff4..7d7f320de30 100644 --- a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java +++ b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java @@ -495,8 +495,6 @@ public void testDubbo1UrlWithGenericInvocation() { } - ; - /** * When the first arg of a method is String or Enum, Registry server can do parameter-value-based routing. */ @@ -1083,7 +1081,7 @@ enum Param { MORGAN, } - private static interface DemoService { + private interface DemoService { } private static class MockRegistry implements Registry { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/buffer/ChannelBuffer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/buffer/ChannelBuffer.java index 67514f0f459..80f5e33c1d4 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/buffer/ChannelBuffer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/buffer/ChannelBuffer.java @@ -275,7 +275,7 @@ public interface ChannelBuffer extends Comparable { * not an instance of {@link ChannelBuffer} type. */ @Override - public boolean equals(Object o); + boolean equals(Object o); /** * Returns the factory which creates a {@link ChannelBuffer} whose type and diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/RpcMessageHandler.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/RpcMessageHandler.java index b8dfa7de514..5211558b7d8 100755 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/RpcMessageHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/RpcMessageHandler.java @@ -69,7 +69,7 @@ public Object reply(ExchangeChannel channel, RpcMessage msg) throws RemotingExce } - public static interface ServiceProvider { + public interface ServiceProvider { Object getImplementation(String service); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java index df3ac678249..d4af3783d6a 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java @@ -350,7 +350,7 @@ public void test_Encode_Response() throws IOException { Channel channel = getCliendSideChannel(url); Response response = new Response(); response.setHeartbeat(true); - response.setId(1001l); + response.setId(1001L); response.setStatus((byte) 20); response.setVersion("11"); Person person = new Person(); @@ -379,7 +379,7 @@ public void test_Encode_Error_Response() throws IOException { Channel channel = getCliendSideChannel(url); Response response = new Response(); response.setHeartbeat(true); - response.setId(1001l); + response.setId(1001L); response.setStatus((byte) 10); response.setVersion("11"); String badString = "bad"; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java index 91ea0c40a66..5d8c78b82b7 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/handler/WrappedChannelHandlerTest.java @@ -83,8 +83,6 @@ public void test_Connect_Biz_Error() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> handler.connected(new MockedChannel())); } - ; - @Test public void test_Disconnect_Biz_Error() throws RemotingException { Assertions.assertThrows(RemotingException.class, () -> handler.disconnected(new MockedChannel())); diff --git a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/EtcdClient.java b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/EtcdClient.java index 286be934469..e82d1a7aaa8 100644 --- a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/EtcdClient.java +++ b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/EtcdClient.java @@ -154,7 +154,7 @@ public interface EtcdClient { * @throws TimeoutException if the wait timed out * @return lease id from etcd */ - public long createLease(long ttl, long timeout, TimeUnit unit) + long createLease(long ttl, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException; /** diff --git a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/RetryPolicy.java b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/RetryPolicy.java index b1fc5256b1c..6133ab713c0 100644 --- a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/RetryPolicy.java +++ b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/RetryPolicy.java @@ -26,6 +26,6 @@ public interface RetryPolicy { * @param sleep should be sleep * @return true should be retry */ - public boolean shouldRetry(int retried, long elapsed, boolean sleep); + boolean shouldRetry(int retried, long elapsed, boolean sleep); } diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java index 1732e783684..2f2b2f58680 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper/src/test/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClientTest.java @@ -188,8 +188,8 @@ public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exc curatorClient.delete(path); valueFromCache = curatorClient.getContent(path + "/d.json"); Assertions.assertNull(valueFromCache); - Thread.sleep(2000l); - Assertions.assertTrue(9l >= atomicInteger.get()); - Assertions.assertTrue(2l <= atomicInteger.get()); + Thread.sleep(2000L); + Assertions.assertTrue(9L >= atomicInteger.get()); + Assertions.assertTrue(2L <= atomicInteger.get()); } } diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/InvokeMode.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/InvokeMode.java index a97a0be61f4..3d6a5240741 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/InvokeMode.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/InvokeMode.java @@ -18,6 +18,6 @@ public enum InvokeMode { - SYNC, ASYNC, FUTURE; + SYNC, ASYNC, FUTURE } diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java index 6a326c295ae..dc51234652c 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java @@ -79,7 +79,7 @@ public void testAttachInvocationIdIfAsync_nullAttachments() { URL url = URL.valueOf("dubbo://localhost/?test.async=true"); Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{}); RpcUtils.attachInvocationIdIfAsync(url, inv); - assertTrue(RpcUtils.getInvocationId(inv) >= 0l); + assertTrue(RpcUtils.getInvocationId(inv) >= 0L); } /** diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java index bd609721d96..8989c6417ee 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocolTest.java @@ -59,7 +59,8 @@ public static void after() { public void testDemoProtocol() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9020/" + DemoService.class.getName() + "?codec=exchange"))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9020/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9020/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", + 3000L))); assertEquals(service.getSize(new String[]{"", "", ""}), 3); } @@ -67,7 +68,8 @@ public void testDemoProtocol() throws Exception { public void testDubboProtocol() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", + 3000L))); assertEquals(service.enumlength(new Type[]{}), Type.Lower); assertEquals(service.getSize(null), -1); assertEquals(service.getSize(new String[]{"", "", ""}), 3); @@ -78,7 +80,8 @@ public void testDubboProtocol() throws Exception { assertEquals(set.iterator().next(), "aa"); service.invoke("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "", "invoke"); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty").addParameter("timeout", + 3000L))); // test netty client StringBuffer buf = new StringBuffer(); for (int i = 0; i < 1024 * 32 + 32; i++) @@ -86,7 +89,8 @@ public void testDubboProtocol() throws Exception { System.out.println(service.stringLength(buf.toString())); // cast to EchoService - EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty").addParameter("timeout", 3000l))); + EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "?client=netty").addParameter("timeout", + 3000L))); assertEquals(echo.$echo(buf.toString()), buf.toString()); assertEquals(echo.$echo("test"), "test"); assertEquals(echo.$echo("abcdefg"), "abcdefg"); @@ -97,7 +101,8 @@ public void testDubboProtocol() throws Exception { public void testDubboProtocolWithMina() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName()).addParameter(Constants.SERVER_KEY, "mina"))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName()).addParameter(Constants.CLIENT_KEY, "mina").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName()).addParameter(Constants.CLIENT_KEY, "mina").addParameter("timeout", + 3000L))); for (int i = 0; i < 10; i++) { assertEquals(service.enumlength(new Type[]{}), Type.Lower); assertEquals(service.getSize(null), -1); @@ -112,7 +117,8 @@ public void testDubboProtocolWithMina() throws Exception { service.invoke("dubbo://127.0.0.1:9010/" + DemoService.class.getName() + "", "invoke"); } - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", + 3000L))); // test netty client StringBuffer buf = new StringBuffer(); for (int i = 0; i < 1024 * 32 + 32; i++) @@ -120,7 +126,8 @@ public void testDubboProtocolWithMina() throws Exception { System.out.println(service.stringLength(buf.toString())); // cast to EchoService - EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", 3000l))); + EchoService echo = proxy.getProxy(protocol.refer(EchoService.class, URL.valueOf("dubbo://127.0.0.1:9011/" + DemoService.class.getName() + "?client=mina").addParameter("timeout", + 3000L))); for (int i = 0; i < 10; i++) { assertEquals(echo.$echo(buf.toString()), buf.toString()); assertEquals(echo.$echo("test"), "test"); @@ -133,11 +140,13 @@ public void testDubboProtocolWithMina() throws Exception { public void testDubboProtocolMultiService() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + DemoService.class.getName()).addParameter("timeout", + 3000L))); RemoteService remote = new RemoteServiceImpl(); protocol.export(proxy.getInvoker(remote, RemoteService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + RemoteService.class.getName()))); - remote = proxy.getProxy(protocol.refer(RemoteService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + RemoteService.class.getName()).addParameter("timeout", 3000l))); + remote = proxy.getProxy(protocol.refer(RemoteService.class, URL.valueOf("dubbo://127.0.0.1:9010/" + RemoteService.class.getName()).addParameter("timeout", + 3000L))); service.sayHello("world"); @@ -156,7 +165,8 @@ public void testDubboProtocolMultiService() throws Exception { public void testPerm() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange"))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", + 3000L))); long start = System.currentTimeMillis(); for (int i = 0; i < 1000; i++) service.getSize(new String[]{"", "", ""}); @@ -167,7 +177,8 @@ public void testPerm() throws Exception { public void testNonSerializedParameter() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange"))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", + 3000L))); try { service.nonSerializedParameter(new NonSerialized()); Assertions.fail(); @@ -180,7 +191,8 @@ public void testNonSerializedParameter() throws Exception { public void testReturnNonSerialized() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange"))); - service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", 3000l))); + service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo://127.0.0.1:9050/" + DemoService.class.getName() + "?codec=exchange").addParameter("timeout", + 3000L))); try { service.returnNonSerialized(); Assertions.fail(); diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java index 7490eeec1f1..d835d901505 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ExplicitCallbackTest.java @@ -253,19 +253,19 @@ interface IDemoCallback { } interface IHelloService { - public String sayHello(); + String sayHello(); } interface IDemoService { - public String get(); + String get(); - public int getCallbackCount(); + int getCallbackCount(); - public void xxx(IDemoCallback callback, String arg1, int runs, int sleep); + void xxx(IDemoCallback callback, String arg1, int runs, int sleep); - public void xxx2(IDemoCallback callback); + void xxx2(IDemoCallback callback); - public void unxxx2(IDemoCallback callback); + void unxxx2(IDemoCallback callback); } class HelloServiceImpl implements IHelloService { diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/IDemoService.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/IDemoService.java index ed1774b0cde..7b839d60ae5 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/IDemoService.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/IDemoService.java @@ -17,5 +17,5 @@ package org.apache.dubbo.rpc.protocol.dubbo; public interface IDemoService { - public String get(); + String get(); } diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ImplicitCallBackTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ImplicitCallBackTest.java index 5085a447cf8..f992b06c542 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ImplicitCallBackTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ImplicitCallBackTest.java @@ -310,15 +310,15 @@ public void test_Normal_Ex() throws Exception { } interface Nofify { - public void onreturn(Person msg, Integer id); + void onreturn(Person msg, Integer id); - public void onthrow(Throwable ex, Integer id); + void onthrow(Throwable ex, Integer id); - public void oninvoke(Integer id); + void oninvoke(Integer id); } interface IDemoService { - public Person get(int id); + Person get(int id); } public static class Person implements Serializable { diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java index 70c6ec8fba8..161d00dfc56 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/ReferenceCountExchangeClientTest.java @@ -299,11 +299,11 @@ private List getInvokerClientList(Invoker invoker) { } public interface IDemoService { - public String demo(); + String demo(); } public interface IHelloService { - public String hello(); + String hello(); } public class DemoServiceImpl implements IDemoService { diff --git a/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/DemoService.java b/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/DemoService.java index e6a39c5feb6..97572f1c3b9 100644 --- a/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/DemoService.java +++ b/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/DemoService.java @@ -12,33 +12,33 @@ public class DemoService { public interface Iface { - public String sayHello(String name) throws org.apache.thrift.TException; + String sayHello(String name) throws org.apache.thrift.TException; - public boolean hasName(boolean hasName) throws org.apache.thrift.TException; + boolean hasName(boolean hasName) throws org.apache.thrift.TException; - public String sayHelloTimes(String name, int times) throws org.apache.thrift.TException; + String sayHelloTimes(String name, int times) throws org.apache.thrift.TException; - public void timeOut(int millis) throws org.apache.thrift.TException; + void timeOut(int millis) throws org.apache.thrift.TException; - public String customException() throws org.apache.thrift.TException; + String customException() throws org.apache.thrift.TException; - public String context(String name) throws org.apache.thrift.TException; + String context(String name) throws org.apache.thrift.TException; } public interface AsyncIface { - public void sayHello(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void sayHello(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void hasName(boolean hasName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void hasName(boolean hasName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void sayHelloTimes(String name, int times, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void sayHelloTimes(String name, int times, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void timeOut(int millis, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void timeOut(int millis, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void customException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void customException(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void context(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void context(String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } diff --git a/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/UserService.java b/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/UserService.java index 3f87cb940e0..d26b460874e 100644 --- a/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/UserService.java +++ b/dubbo-rpc/dubbo-rpc-native-thrift/src/test/java/org/apache/dubbo/rpc/protocol/nativethrift/UserService.java @@ -11,13 +11,13 @@ public class UserService { public interface Iface { - public String find(int id) throws org.apache.thrift.TException; + String find(int id) throws org.apache.thrift.TException; } public interface AsyncIface { - public void find(int id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void find(int id, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerService.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerService.java index 3f6d7630baf..bc3eae8e499 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerService.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerService.java @@ -38,6 +38,6 @@ public interface DubboSwaggerService { @GET @Path("swagger") - public Response getListingJson(@Context Application app, @Context ServletConfig sc, - @Context HttpHeaders headers, @Context UriInfo uriInfo) throws JsonProcessingException; + Response getListingJson(@Context Application app, @Context ServletConfig sc, + @Context HttpHeaders headers, @Context UriInfo uriInfo) throws JsonProcessingException; } \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/support/LoggingFilter.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/support/LoggingFilter.java index f488fdf537c..62c168ecaeb 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/support/LoggingFilter.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/support/LoggingFilter.java @@ -40,6 +40,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; @@ -75,7 +76,7 @@ public void filter(ContainerRequestContext requestContext, ContainerResponseCont @Override public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException { byte[] buffer = IOUtils.toByteArray(context.getInputStream()); - logger.info("The contents of request body is: \n" + new String(buffer, "UTF-8") + "\n"); + logger.info("The contents of request body is: \n" + new String(buffer, StandardCharsets.UTF_8) + "\n"); context.setInputStream(new ByteArrayInputStream(buffer)); return context.proceed(); } @@ -85,7 +86,7 @@ public void aroundWriteTo(WriterInterceptorContext context) throws IOException, OutputStreamWrapper wrapper = new OutputStreamWrapper(context.getOutputStream()); context.setOutputStream(wrapper); context.proceed(); - logger.info("The contents of response body is: \n" + new String(wrapper.getBytes(), "UTF-8") + "\n"); + logger.info("The contents of response body is: \n" + new String(wrapper.getBytes(), StandardCharsets.UTF_8) + "\n"); } protected void logHttpHeaders(MultivaluedMap headers) { diff --git a/dubbo-rpc/dubbo-rpc-rmi/src/test/java/org/apache/dubbo/rpc/protocol/rmi/RmiProtocolTest.java b/dubbo-rpc/dubbo-rpc-rmi/src/test/java/org/apache/dubbo/rpc/protocol/rmi/RmiProtocolTest.java index 3e50501b459..9f3cb332c30 100644 --- a/dubbo-rpc/dubbo-rpc-rmi/src/test/java/org/apache/dubbo/rpc/protocol/rmi/RmiProtocolTest.java +++ b/dubbo-rpc/dubbo-rpc-rmi/src/test/java/org/apache/dubbo/rpc/protocol/rmi/RmiProtocolTest.java @@ -132,7 +132,7 @@ public void testGenericInvoke() { exporter.unexport(); } - public static interface NonStdRmiInterface { + public interface NonStdRmiInterface { void bark(); } diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ClassNameGenerator.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ClassNameGenerator.java index dd2d7f370d5..c88c2e7b042 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ClassNameGenerator.java +++ b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/org/apache/dubbo/rpc/protocol/thrift/ClassNameGenerator.java @@ -24,8 +24,8 @@ @SPI(DubboClassNameGenerator.NAME) public interface ClassNameGenerator { - public String generateArgsClassName(String serviceName, String methodName); + String generateArgsClassName(String serviceName, String methodName); - public String generateResultClassName(String serviceName, String methodName); + String generateResultClassName(String serviceName, String methodName); } diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestDubbo.java b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestDubbo.java index f0a203c0af7..5f4eaa560ab 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestDubbo.java +++ b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestDubbo.java @@ -24,6 +24,6 @@ public interface ClassNameTestDubbo { - public String echo(String arg); + String echo(String arg); } diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestThrift.java b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestThrift.java index 21758837035..4a1a3bf2126 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestThrift.java +++ b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/ClassNameTestThrift.java @@ -17,13 +17,13 @@ public class ClassNameTestThrift { public interface Iface { - public String echo(String arg) throws org.apache.thrift.TException; + String echo(String arg) throws org.apache.thrift.TException; } public interface AsyncIface { - public void echo(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echo(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/dubbo/Demo.java b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/dubbo/Demo.java index 3af2c67c602..08ab4190a2d 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/dubbo/Demo.java +++ b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/dubbo/Demo.java @@ -25,18 +25,18 @@ public interface Demo { - public boolean echoBool(boolean arg); + boolean echoBool(boolean arg); - public byte echoByte(byte arg); + byte echoByte(byte arg); - public short echoI16(short arg); + short echoI16(short arg); - public int echoI32(int arg); + int echoI32(int arg); - public long echoI64(long arg); + long echoI64(long arg); - public double echoDouble(double arg); + double echoDouble(double arg); - public String echoString(String arg); + String echoString(String arg); } diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/thrift/Demo.java b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/thrift/Demo.java index 3c9312913f4..a1f76597a1b 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/thrift/Demo.java +++ b/dubbo-rpc/dubbo-rpc-thrift/src/test/java/org/apache/dubbo/rpc/gen/thrift/Demo.java @@ -19,37 +19,39 @@ public class Demo { public interface Iface { - public boolean echoBool(boolean arg) throws org.apache.thrift.TException; + boolean echoBool(boolean arg) throws org.apache.thrift.TException; - public byte echoByte(byte arg) throws org.apache.thrift.TException; + byte echoByte(byte arg) throws org.apache.thrift.TException; - public short echoI16(short arg) throws org.apache.thrift.TException; + short echoI16(short arg) throws org.apache.thrift.TException; - public int echoI32(int arg) throws org.apache.thrift.TException; + int echoI32(int arg) throws org.apache.thrift.TException; - public long echoI64(long arg) throws org.apache.thrift.TException; + long echoI64(long arg) throws org.apache.thrift.TException; - public double echoDouble(double arg) throws org.apache.thrift.TException; + double echoDouble(double arg) throws org.apache.thrift.TException; - public String echoString(String arg) throws org.apache.thrift.TException; + String echoString(String arg) throws org.apache.thrift.TException; } public interface AsyncIface { - public void echoBool(boolean arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoBool(boolean arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void echoByte(byte arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoByte(byte arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void echoI16(short arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoI16(short arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void echoI32(int arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoI32(int arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void echoI64(long arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoI64(long arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void echoDouble(double arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoDouble(double arg, + org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void echoString(String arg, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + void echoString(String arg, + org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; } diff --git a/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectInput.java b/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectInput.java index 083d2140a45..8dc80577279 100644 --- a/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectInput.java +++ b/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectInput.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -83,7 +84,7 @@ public String readUTF() throws IOException { @Override public byte[] readBytes() throws IOException { String resultStr = decoder.readString(); - return resultStr.getBytes("utf8"); + return resultStr.getBytes(StandardCharsets.UTF_8); } /** diff --git a/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectOutput.java b/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectOutput.java index d043dd06843..e723063a4f3 100644 --- a/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectOutput.java +++ b/dubbo-serialization/dubbo-serialization-avro/src/main/java/org/apache/dubbo/common/serialize/avro/AvroObjectOutput.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; import java.util.Arrays; public class AvroObjectOutput implements ObjectOutput { @@ -76,13 +77,13 @@ public void writeUTF(String v) throws IOException { @Override public void writeBytes(byte[] v) throws IOException { - encoder.writeString(new String(v, "utf8")); + encoder.writeString(new String(v, StandardCharsets.UTF_8)); } @Override public void writeBytes(byte[] v, int off, int len) throws IOException { byte[] v2 = Arrays.copyOfRange(v, off, off + len); - encoder.writeString(new String(v2, "utf8")); + encoder.writeString(new String(v2, StandardCharsets.UTF_8)); } @Override diff --git a/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java index db16dd9d773..482337de136 100644 --- a/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java +++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java @@ -17,5 +17,5 @@ package org.apache.dubbo.common.serialize.model; public enum AnimalEnum { - dog, cat, rat, cow, bull, horse; + dog, cat, rat, cow, bull, horse } \ No newline at end of file diff --git a/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/model/GooglePB.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/model/GooglePB.java index 257b37f91be..71fb12ce413 100644 --- a/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/model/GooglePB.java +++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/protobuf/support/model/GooglePB.java @@ -122,7 +122,7 @@ public static PhoneType valueOf( private final int value; - private PhoneType(int value) { + PhoneType(int value) { this.value = value; } @@ -1753,7 +1753,7 @@ public GooglePB.PhoneNumber.Builder addPhoneBuilder( } private com.google.protobuf.MapField internalGetMutableDoubleMap() { - onChanged();; + onChanged(); if (doubleMap_ == null) { doubleMap_ = com.google.protobuf.MapField.newMapField( DoubleMapDefaultEntryHolder.defaultEntry);