This is an automated email from the ASF dual-hosted git repository. albumenj pushed a commit to branch 3.2 in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push: new 00812ce41c Fix Sonar issue s2293 The diamond operator ('<>') should be used (#14005) 00812ce41c is described below commit 00812ce41c44be6e5cd5e2b8e5bf602f806bbbca Author: jean pierre Lerbscher <5850581+jler...@users.noreply.github.com> AuthorDate: Fri Mar 29 04:40:06 2024 +0100 Fix Sonar issue s2293 The diamond operator ('<>') should be used (#14005) --- .../apache/dubbo/rpc/cluster/SingleRouterChain.java | 6 +++--- .../rpc/cluster/configurator/AbstractConfigurator.java | 2 +- .../cluster/loadbalance/ConsistentHashLoadBalance.java | 5 ++--- .../org/apache/dubbo/rpc/cluster/merger/MapMerger.java | 2 +- .../apache/dubbo/rpc/cluster/merger/MergerFactory.java | 2 +- .../org/apache/dubbo/rpc/cluster/merger/SetMerger.java | 2 +- .../router/condition/ConditionStateRouterFactory.java | 2 +- .../condition/config/ServiceStateRouterFactory.java | 2 +- .../rpc/cluster/router/mesh/route/MeshRuleCache.java | 2 +- .../cluster/router/mock/MockStateRouterFactory.java | 2 +- .../rpc/cluster/router/tag/TagStateRouterFactory.java | 2 +- .../rpc/cluster/support/FailoverClusterInvoker.java | 4 ++-- .../dubbo/rpc/cluster/support/MergeableCluster.java | 2 +- .../rpc/cluster/support/registry/ZoneAwareCluster.java | 2 +- .../cluster/support/wrapper/MockClusterWrapper.java | 2 +- .../src/main/java/org/apache/dubbo/common/Version.java | 2 +- .../dubbo/common/beanutil/JavaBeanSerializeUtil.java | 6 +++--- .../java/org/apache/dubbo/common/bytecode/Mixin.java | 2 +- .../java/org/apache/dubbo/common/bytecode/Wrapper.java | 4 ++-- .../dubbo/common/compiler/support/ClassUtils.java | 2 +- .../common/threadlocal/InternalThreadLocalMap.java | 2 +- .../apache/dubbo/common/timer/HashedWheelTimer.java | 2 +- .../java/org/apache/dubbo/common/utils/CIDRUtils.java | 2 +- .../org/apache/dubbo/common/utils/ConfigUtils.java | 4 ++-- .../java/org/apache/dubbo/common/utils/IOUtils.java | 2 +- .../main/java/org/apache/dubbo/common/utils/Stack.java | 2 +- .../org/apache/dubbo/common/utils/StringUtils.java | 4 ++-- .../java/org/apache/dubbo/common/utils/UrlUtils.java | 2 +- .../apache/dubbo/config/AbstractInterfaceConfig.java | 2 +- .../org/apache/dubbo/config/ApplicationConfig.java | 2 +- .../java/org/apache/dubbo/config/ModuleConfig.java | 2 +- .../dubbo/metadata/definition/util/ClassUtils.java | 2 +- .../java/org/apache/dubbo/rpc/model/ProviderModel.java | 2 +- .../dubbo/cache/support/AbstractCacheFactory.java | 2 +- .../java/com/alibaba/dubbo/config/ServiceConfig.java | 2 +- .../java/com/alibaba/dubbo/container/page/Page.java | 4 ++-- .../com/alibaba/dubbo/container/page/PageServlet.java | 4 ++-- .../alibaba/dubbo/container/page/ResourceFilter.java | 2 +- .../dubbo/container/page/pages/HomePageHandler.java | 4 ++-- .../dubbo/container/page/pages/LogPageHandler.java | 4 ++-- .../dubbo/container/page/pages/StatusPageHandler.java | 8 ++++---- .../dubbo/container/page/pages/SystemPageHandler.java | 18 +++++++++--------- .../main/java/com/alibaba/dubbo/rpc/RpcContext.java | 2 +- .../main/java/com/alibaba/dubbo/rpc/RpcInvocation.java | 6 +++--- .../java/org/apache/dubbo/config/ServiceConfig.java | 4 ++-- .../dubbo/config/utils/ConfigValidationUtils.java | 4 ++-- .../AbstractAnnotationBeanPostProcessor.java | 5 ++--- .../dubbo/config/spring/util/AnnotationUtils.java | 4 ++-- .../dubbo/config/spring/util/PropertySourcesUtils.java | 2 +- .../src/main/java/org/apache/dubbo/container/Main.java | 2 +- .../dubbo/cache/support/AbstractCacheFactory.java | 2 +- .../dubbo/cache/support/expiring/ExpiringMap.java | 2 +- .../metadata/store/nacos/NacosMetadataReport.java | 2 +- .../dubbo/monitor/support/AbstractMonitorFactory.java | 4 ++-- .../dubbo/qos/command/decoder/HttpCommandDecoder.java | 4 ++-- .../org/apache/dubbo/qos/command/impl/CountTelnet.java | 6 +++--- .../apache/dubbo/qos/command/util/CommandHelper.java | 2 +- .../main/java/org/apache/dubbo/qos/textui/TLadder.java | 2 +- .../main/java/org/apache/dubbo/qos/textui/TTable.java | 2 +- .../main/java/org/apache/dubbo/qos/textui/TTree.java | 2 +- .../dubbo/reactive/calls/ReactorServerCalls.java | 4 ++-- .../InterfaceCompatibleRegistryProtocol.java | 2 +- .../dubbo/registry/multicast/MulticastRegistry.java | 6 +++--- .../dubbo/registry/multiple/MultipleRegistry.java | 2 +- .../remoting/exchange/support/ReplierDispatcher.java | 2 +- .../exchange/support/header/HeaderExchangeServer.java | 2 +- .../dubbo/remoting/telnet/codec/TelnetCodec.java | 2 +- .../telnet/support/command/HelpTelnetHandler.java | 4 ++-- .../telnet/support/command/StatusTelnetHandler.java | 10 +++++----- .../apache/dubbo/remoting/transport/CodecSupport.java | 6 +++--- .../apache/dubbo/remoting/http/RequestTemplate.java | 4 ++-- .../dubbo/remoting/http/servlet/DispatcherServlet.java | 2 +- .../dubbo/remoting/http/servlet/ServletManager.java | 2 +- .../dubbo/remoting/transport/netty/NettyChannel.java | 4 ++-- .../dubbo/remoting/transport/netty/NettyHandler.java | 2 +- .../dubbo/remoting/transport/netty4/NettyChannel.java | 5 ++--- .../java/org/apache/dubbo/rpc/RpcServiceContext.java | 2 +- .../src/main/java/org/apache/dubbo/rpc/RpcStatus.java | 7 +++---- .../org/apache/dubbo/rpc/filter/DeprecatedFilter.java | 2 +- .../apache/dubbo/rpc/filter/tps/DefaultTPSLimiter.java | 2 +- .../dubbo/rpc/protocol/AbstractProxyProtocol.java | 2 +- .../dubbo/rpc/protocol/ProtocolListenerWrapper.java | 3 +-- .../java/org/apache/dubbo/rpc/support/MockInvoker.java | 4 ++-- .../apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java | 4 ++-- .../apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java | 4 ++-- .../apache/dubbo/rpc/protocol/rest/RestProtocol.java | 2 +- .../dubbo/rpc/protocol/rest/ViolationReport.java | 2 +- .../filter/DubboPreMatchContainerRequestContext.java | 2 +- .../dubbo/rpc/protocol/rest/util/ReflectUtils.java | 2 +- .../rpc/protocol/tri/TriHttp2RemoteFlowController.java | 2 +- .../java/org/apache/dubbo/test/common/SysProps.java | 2 +- 91 files changed, 143 insertions(+), 148 deletions(-) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/SingleRouterChain.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/SingleRouterChain.java index c217bdb0d6..5c6dec6efc 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/SingleRouterChain.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/SingleRouterChain.java @@ -212,7 +212,7 @@ public class SingleRouterChain<T> { public RouterSnapshotNode<T> buildRouterSnapshot( URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) { BitList<Invoker<T>> resultInvokers = availableInvokers.clone(); - RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<T>("Parent", resultInvokers.clone()); + RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<>("Parent", resultInvokers.clone()); parentNode.setNodeOutputInvokers(resultInvokers.clone()); // 1. route state router @@ -227,7 +227,7 @@ public class SingleRouterChain<T> { return parentNode; } - RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<T>("CommonRouter", resultInvokers.clone()); + RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<>("CommonRouter", resultInvokers.clone()); parentNode.appendNode(commonRouterNode); List<Invoker<T>> commonRouterResult = resultInvokers; @@ -237,7 +237,7 @@ public class SingleRouterChain<T> { List<Invoker<T>> inputInvokers = new ArrayList<>(commonRouterResult); RouterSnapshotNode<T> currentNode = - new RouterSnapshotNode<T>(router.getClass().getSimpleName(), inputInvokers); + new RouterSnapshotNode<>(router.getClass().getSimpleName(), inputInvokers); // append to router node chain commonRouterNode.appendNode(currentNode); diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java index a72956054a..406756ad03 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java @@ -223,7 +223,7 @@ public abstract class AbstractConfigurator implements Configurator { } private Set<String> genConditionKeys() { - Set<String> conditionKeys = new HashSet<String>(); + Set<String> conditionKeys = new HashSet<>(); conditionKeys.add(CATEGORY_KEY); conditionKeys.add(Constants.CHECK_KEY); conditionKeys.add(DYNAMIC_KEY); diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java index fb777ef03a..82421e460f 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java @@ -46,8 +46,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance { */ public static final String HASH_ARGUMENTS = "hash.arguments"; - private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors = - new ConcurrentHashMap<String, ConsistentHashSelector<?>>(); + private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors = new ConcurrentHashMap<>(); @SuppressWarnings("unchecked") @Override @@ -75,7 +74,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance { private final int[] argumentIndex; ConsistentHashSelector(List<Invoker<T>> invokers, String methodName, int identityHashCode) { - this.virtualInvokers = new TreeMap<Long, Invoker<T>>(); + this.virtualInvokers = new TreeMap<>(); this.identityHashCode = identityHashCode; URL url = invokers.get(0).getUrl(); this.replicaNumber = url.getMethodParameter(methodName, HASH_NODES, 160); diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MapMerger.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MapMerger.java index eaa863ed64..dca9c34b25 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MapMerger.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MapMerger.java @@ -32,7 +32,7 @@ public class MapMerger implements Merger<Map<?, ?>> { if (ArrayUtils.isEmpty(items)) { return Collections.emptyMap(); } - Map<Object, Object> result = new HashMap<Object, Object>(); + Map<Object, Object> result = new HashMap<>(); Stream.of(items).filter(Objects::nonNull).forEach(result::putAll); return result; } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java index 3aa07f2ad3..0ac9949470 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java @@ -36,7 +36,7 @@ public class MergerFactory implements ScopeModelAware { private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(MergerFactory.class); - private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<Class<?>, Merger<?>>(); + private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<>(); private ScopeModel scopeModel; @Override diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/SetMerger.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/SetMerger.java index 5b0dc5e0c3..5b77177cd0 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/SetMerger.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/SetMerger.java @@ -32,7 +32,7 @@ public class SetMerger implements Merger<Set<?>> { if (ArrayUtils.isEmpty(items)) { return Collections.emptySet(); } - Set<Object> result = new HashSet<Object>(); + Set<Object> result = new HashSet<>(); Stream.of(items).filter(Objects::nonNull).forEach(result::addAll); return result; } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterFactory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterFactory.java index 06a40e81df..c18f674c3e 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterFactory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouterFactory.java @@ -30,6 +30,6 @@ public class ConditionStateRouterFactory extends CacheableStateRouterFactory { @Override protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) { - return new ConditionStateRouter<T>(url); + return new ConditionStateRouter<>(url); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ServiceStateRouterFactory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ServiceStateRouterFactory.java index ecc536953b..d35baf6ee3 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ServiceStateRouterFactory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ServiceStateRouterFactory.java @@ -32,6 +32,6 @@ public class ServiceStateRouterFactory extends CacheableStateRouterFactory { @Override protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) { - return new ServiceStateRouter<T>(url); + return new ServiceStateRouter<>(url); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCache.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCache.java index 098b9bd4cf..a53e47280a 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCache.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleCache.java @@ -136,7 +136,7 @@ public class MeshRuleCache<T> { Collections.unmodifiableMap(totalSubsetMap), unmatchedInvokers); } else { - return new MeshRuleCache<T>( + return new MeshRuleCache<>( Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap(), invokers); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockStateRouterFactory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockStateRouterFactory.java index 9bff80a573..d81b578ae3 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockStateRouterFactory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockStateRouterFactory.java @@ -30,6 +30,6 @@ public class MockStateRouterFactory implements StateRouterFactory { @Override public <T> StateRouter<T> getRouter(Class<T> interfaceClass, URL url) { - return new MockInvokersSelector<T>(url); + return new MockInvokersSelector<>(url); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterFactory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterFactory.java index b05e09e703..de38ff8f7f 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterFactory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouterFactory.java @@ -31,6 +31,6 @@ public class TagStateRouterFactory extends CacheableStateRouterFactory { @Override protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) { - return new TagStateRouter<T>(url); + return new TagStateRouter<>(url); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java index a840773c51..1fc3cadcc1 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java @@ -63,8 +63,8 @@ public class FailoverClusterInvoker<T> extends AbstractClusterInvoker<T> { int len = calculateInvokeTimes(methodName); // retry loop. RpcException le = null; // last exception. - List<Invoker<T>> invoked = new ArrayList<Invoker<T>>(copyInvokers.size()); // invoked invokers. - Set<String> providers = new HashSet<String>(len); + List<Invoker<T>> invoked = new ArrayList<>(copyInvokers.size()); // invoked invokers. + Set<String> providers = new HashSet<>(len); for (int i = 0; i < len; i++) { // Reselect before retry to avoid a change of candidate `invokers`. // NOTE: if `invokers` changed, then `invoked` also lose accuracy. diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/MergeableCluster.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/MergeableCluster.java index 9bc030729f..c219745b38 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/MergeableCluster.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/MergeableCluster.java @@ -26,6 +26,6 @@ public class MergeableCluster extends AbstractCluster { @Override public <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException { - return new MergeableClusterInvoker<T>(directory); + return new MergeableClusterInvoker<>(directory); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareCluster.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareCluster.java index a1cbf14e60..10a1297983 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareCluster.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/registry/ZoneAwareCluster.java @@ -27,6 +27,6 @@ public class ZoneAwareCluster extends AbstractCluster { @Override protected <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException { - return new ZoneAwareClusterInvoker<T>(directory); + return new ZoneAwareClusterInvoker<>(directory); } } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterWrapper.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterWrapper.java index 0836e48e25..0a2a2e7388 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterWrapper.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterWrapper.java @@ -35,7 +35,7 @@ public class MockClusterWrapper implements Cluster { @Override public <T> Invoker<T> join(Directory<T> directory, boolean buildFilterChain) throws RpcException { - return new MockClusterInvoker<T>(directory, this.cluster.join(directory, buildFilterChain)); + return new MockClusterInvoker<>(directory, this.cluster.join(directory, buildFilterChain)); } public Cluster getCluster() { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java b/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java index a33be42ddc..90f2b70704 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java @@ -60,7 +60,7 @@ public final class Version { public static final int LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200; // 2.0.2 public static final int HIGHEST_PROTOCOL_VERSION = 2009900; // 2.0.99 - private static final Map<String, Integer> VERSION2INT = new HashMap<String, Integer>(); + private static final Map<String, Integer> VERSION2INT = new HashMap<>(); static { // get dubbo version and last commit id diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java b/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java index 6a3afbde42..0149cc9ee7 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java @@ -35,7 +35,7 @@ import java.util.Map; public final class JavaBeanSerializeUtil { private static final Logger logger = LoggerFactory.getLogger(JavaBeanSerializeUtil.class); - private static final Map<String, Class<?>> TYPES = new HashMap<String, Class<?>>(); + private static final Map<String, Class<?>> TYPES = new HashMap<>(); private static final String ARRAY_PREFIX = "["; private static final String REFERENCE_TYPE_PREFIX = "L"; private static final String REFERENCE_TYPE_SUFFIX = ";"; @@ -72,7 +72,7 @@ public final class JavaBeanSerializeUtil { if (obj instanceof JavaBeanDescriptor) { return (JavaBeanDescriptor) obj; } - IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<Object, JavaBeanDescriptor>(); + IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<>(); return createDescriptorIfAbsent(obj, accessor, cache); } @@ -209,7 +209,7 @@ public final class JavaBeanSerializeUtil { if (beanDescriptor == null) { return null; } - IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<JavaBeanDescriptor, Object>(); + IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<>(); Object result = instantiateForDeserialize(beanDescriptor, loader, cache); deserializeInternal(result, beanDescriptor, loader, cache); return result; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Mixin.java b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Mixin.java index 81cadc0d76..4a6e37c883 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Mixin.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Mixin.java @@ -120,7 +120,7 @@ public abstract class Mixin { Class<?> neighbor = null; // impl methods. - Set<String> worked = new HashSet<String>(); + Set<String> worked = new HashSet<>(); for (int i = 0; i < ics.length; i++) { if (!Modifier.isPublic(ics[i].getModifiers())) { String npkg = ics[i].getPackage().getName(); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java index b42d5e286f..b68e1ab5e1 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Wrapper.java @@ -42,8 +42,8 @@ import javassist.CtMethod; * Wrapper. */ public abstract class Wrapper { - private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP = - new ConcurrentHashMap<Class<?>, Wrapper>(); // class wrapper map + // class wrapper map + private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP = new ConcurrentHashMap<>(); private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] OBJECT_METHODS = new String[] {"getClass", "hashCode", "toString", "equals"}; private static final Wrapper OBJECT_WRAPPER = new Wrapper() { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java index d2c39053d6..aba14f4cea 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java @@ -392,7 +392,7 @@ public class ClassUtils { } public static <K, V> Map<K, V> toMap(Map.Entry<K, V>[] entries) { - Map<K, V> map = new HashMap<K, V>(); + Map<K, V> map = new HashMap<>(); if (entries != null && entries.length > 0) { for (Map.Entry<K, V> entry : entries) { map.put(entry.getKey(), entry.getValue()); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalMap.java b/dubbo-common/src/main/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalMap.java index 58b269a4f3..88a4fc74f4 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalMap.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/threadlocal/InternalThreadLocalMap.java @@ -28,7 +28,7 @@ public final class InternalThreadLocalMap { private Object[] indexedVariables; - private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<InternalThreadLocalMap>(); + private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<>(); private static final AtomicInteger NEXT_INDEX = new AtomicInteger(); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java b/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java index a5c255b2b8..fb03da44ea 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/timer/HashedWheelTimer.java @@ -427,7 +427,7 @@ public class HashedWheelTimer implements Timer { } private final class Worker implements Runnable { - private final Set<Timeout> unprocessedTimeouts = new HashSet<Timeout>(); + private final Set<Timeout> unprocessedTimeouts = new HashSet<>(); private long tick; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CIDRUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CIDRUtils.java index 5d9dc8bcbd..5f3632af7a 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CIDRUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CIDRUtils.java @@ -98,7 +98,7 @@ public class CIDRUtils { private byte[] toBytes(byte[] array, int targetSize) { int counter = 0; - List<Byte> newArr = new ArrayList<Byte>(); + List<Byte> newArr = new ArrayList<>(); while (counter < targetSize && (array.length - 1 - counter >= 0)) { newArr.add(0, array[array.length - 1 - counter]); counter++; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java index 74ad48add5..27b9c41c64 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java @@ -87,7 +87,7 @@ public class ConfigUtils { */ public static List<String> mergeValues( ExtensionDirector extensionDirector, Class<?> type, String cfg, List<String> def) { - List<String> defaults = new ArrayList<String>(); + List<String> defaults = new ArrayList<>(); if (def != null) { for (String name : def) { if (extensionDirector.getExtensionLoader(type).hasExtension(name)) { @@ -96,7 +96,7 @@ public class ConfigUtils { } } - List<String> names = new ArrayList<String>(); + List<String> names = new ArrayList<>(); // add initial values String[] configs = (cfg == null || cfg.trim().length() == 0) ? new String[0] : COMMA_SPLIT_PATTERN.split(cfg); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/IOUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/IOUtils.java index 0578feed90..c2ee5587b3 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/IOUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/IOUtils.java @@ -179,7 +179,7 @@ public class IOUtils { * @throws IOException If an I/O error occurs */ public static String[] readLines(InputStream is) throws IOException { - List<String> lines = new ArrayList<String>(); + List<String> lines = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { String line; while ((line = reader.readLine()) != null) { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/Stack.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/Stack.java index 13e7ae4e7d..38f274d98f 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/Stack.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/Stack.java @@ -26,7 +26,7 @@ import java.util.List; public class Stack<E> { private int mSize = 0; - private final List<E> mElements = new ArrayList<E>(); + private final List<E> mElements = new ArrayList<>(); public Stack() {} diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java index e46c77e059..54b87a28a0 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java @@ -861,7 +861,7 @@ public final class StringUtils { */ private static Map<String, String> parseKeyValuePair(String str, String itemSeparator) { String[] tmp = str.split(itemSeparator); - Map<String, String> map = new HashMap<String, String>(tmp.length); + Map<String, String> map = new HashMap<>(tmp.length); for (int i = 0; i < tmp.length; i++) { Matcher matcher = KVP_PATTERN.matcher(tmp[i]); if (!matcher.matches()) { @@ -885,7 +885,7 @@ public final class StringUtils { */ public static Map<String, String> parseQueryString(String qs) { if (isEmpty(qs)) { - return new HashMap<String, String>(); + return new HashMap<>(); } return parseKeyValuePair(qs, "\\&"); } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java index ec1745e431..89e6b52b8d 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java @@ -181,7 +181,7 @@ public class UrlUtils { throw new IllegalArgumentException( "Addresses is not allowed to be empty, please re-enter."); // here won't be empty } - List<URL> registries = new ArrayList<URL>(); + List<URL> registries = new ArrayList<>(); for (String addr : addresses) { registries.add(parseURL(addr, defaults)); } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java index 9eec9c55d8..e82a8a1a77 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java @@ -204,7 +204,7 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig { /** * The url of the reference service */ - protected final transient List<URL> urls = new ArrayList<URL>(); + protected final transient List<URL> urls = new ArrayList<>(); @Transient public List<URL> getExportedUrls() { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/ApplicationConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/ApplicationConfig.java index 3666135ae8..7f25d99d47 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/config/ApplicationConfig.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/config/ApplicationConfig.java @@ -361,7 +361,7 @@ public class ApplicationConfig extends AbstractConfig { } public void setRegistry(RegistryConfig registry) { - List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1); + List<RegistryConfig> registries = new ArrayList<>(1); registries.add(registry); this.registries = registries; } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/config/ModuleConfig.java b/dubbo-common/src/main/java/org/apache/dubbo/config/ModuleConfig.java index 51fb4706ff..6e0fd8719f 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/config/ModuleConfig.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/config/ModuleConfig.java @@ -186,7 +186,7 @@ public class ModuleConfig extends AbstractConfig { } public void setRegistry(RegistryConfig registry) { - List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1); + List<RegistryConfig> registries = new ArrayList<>(1); registries.add(registry); this.registries = registries; } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/metadata/definition/util/ClassUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/metadata/definition/util/ClassUtils.java index 1115c451b2..b7441b76b0 100755 --- a/dubbo-common/src/main/java/org/apache/dubbo/metadata/definition/util/ClassUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/metadata/definition/util/ClassUtils.java @@ -96,7 +96,7 @@ public final class ClassUtils { * @return methods list */ public static List<Method> getPublicNonStaticMethods(final Class<?> clazz) { - List<Method> result = new ArrayList<Method>(); + List<Method> result = new ArrayList<>(); Method[] methods = clazz.getMethods(); for (Method method : methods) { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ProviderModel.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ProviderModel.java index bb1f0ed8a0..a509506ec5 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ProviderModel.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ProviderModel.java @@ -135,7 +135,7 @@ public class ProviderModel extends ServiceModel { } public List<ProviderMethodModel> getAllMethodModels() { - List<ProviderMethodModel> result = new ArrayList<ProviderMethodModel>(); + List<ProviderMethodModel> result = new ArrayList<>(); for (List<ProviderMethodModel> models : methods.values()) { result.addAll(models); } diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/cache/support/AbstractCacheFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/cache/support/AbstractCacheFactory.java index 05a9c25d52..eba2fa5613 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/cache/support/AbstractCacheFactory.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/cache/support/AbstractCacheFactory.java @@ -30,7 +30,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.METHOD_KEY; @Deprecated public abstract class AbstractCacheFactory implements CacheFactory { - private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>(); + private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>(); @Override public Cache getCache(URL url, Invocation invocation) { diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index fbd752f358..58ad1e779c 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -86,7 +86,7 @@ public class ServiceConfig<T> extends org.apache.dubbo.config.ServiceConfig<T> { if (providers == null || providers.isEmpty()) { return null; } - List<ProtocolConfig> protocols = new ArrayList<ProtocolConfig>(providers.size()); + List<ProtocolConfig> protocols = new ArrayList<>(providers.size()); for (ProviderConfig provider : providers) { protocols.add(convertProviderToProtocol(provider)); } diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/Page.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/Page.java index 24042939a8..387723e82f 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/Page.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/Page.java @@ -57,8 +57,8 @@ public class Page { } private static List<List<String>> stringToList(String str) { - List<List<String>> rows = new ArrayList<List<String>>(); - List<String> row = new ArrayList<String>(); + List<List<String>> rows = new ArrayList<>(); + List<String> row = new ArrayList<>(); row.add(str); rows.add(row); return rows; diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/PageServlet.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/PageServlet.java index 25486c07ed..f9cf0fb3fa 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/PageServlet.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/PageServlet.java @@ -49,8 +49,8 @@ public class PageServlet extends HttpServlet { private static final long serialVersionUID = -8370312705453328501L; private static PageServlet INSTANCE; protected final Random random = new Random(); - protected final Map<String, PageHandler> pages = new ConcurrentHashMap<String, PageHandler>(); - protected final List<PageHandler> menus = new ArrayList<PageHandler>(); + protected final Map<String, PageHandler> pages = new ConcurrentHashMap<>(); + protected final List<PageHandler> menus = new ArrayList<>(); public static PageServlet getInstance() { return INSTANCE; diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/ResourceFilter.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/ResourceFilter.java index 62f3da3d8e..981508e4ae 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/ResourceFilter.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/ResourceFilter.java @@ -46,7 +46,7 @@ public class ResourceFilter implements Filter { private final long start = System.currentTimeMillis(); - private final List<String> resources = new ArrayList<String>(); + private final List<String> resources = new ArrayList<>(); public void init(FilterConfig filterConfig) throws ServletException { String config = filterConfig.getInitParameter("resources"); diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/HomePageHandler.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/HomePageHandler.java index 306706c22c..0556a55a55 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/HomePageHandler.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/HomePageHandler.java @@ -35,11 +35,11 @@ public class HomePageHandler implements PageHandler { @Override public Page handle(URL url) { - List<List<String>> rows = new ArrayList<List<String>>(); + List<List<String>> rows = new ArrayList<>(); for (PageHandler handler : PageServlet.getInstance().getMenus()) { String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler); Menu menu = handler.getClass().getAnnotation(Menu.class); - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>"); row.add(menu.desc()); rows.add(row); diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/LogPageHandler.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/LogPageHandler.java index ee9f3670d5..cc5a5b3ec0 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/LogPageHandler.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/LogPageHandler.java @@ -97,8 +97,8 @@ public class LogPageHandler implements PageHandler { } } Level level = LogManager.getRootLogger().getLevel(); - List<List<String>> rows = new ArrayList<List<String>>(); - List<String> row = new ArrayList<String>(); + List<List<String>> rows = new ArrayList<>(); + List<String> row = new ArrayList<>(); row.add(content); rows.add(row); return new Page( diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/StatusPageHandler.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/StatusPageHandler.java index f0fdb34a2a..7a6b762309 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/StatusPageHandler.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/StatusPageHandler.java @@ -40,14 +40,14 @@ public class StatusPageHandler implements PageHandler { @Override public Page handle(URL url) { - List<List<String>> rows = new ArrayList<List<String>>(); + List<List<String>> rows = new ArrayList<>(); Set<String> names = ExtensionLoader.getExtensionLoader(StatusChecker.class).getSupportedExtensions(); - Map<String, Status> statuses = new HashMap<String, Status>(); + Map<String, Status> statuses = new HashMap<>(); for (String name : names) { StatusChecker checker = ExtensionLoader.getExtensionLoader(StatusChecker.class).getExtension(name); - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); row.add(name); Status status = checker.check(); if (status != null && !Status.Level.UNKNOWN.equals(status.getLevel())) { @@ -61,7 +61,7 @@ public class StatusPageHandler implements PageHandler { if ("status".equals(url.getPath())) { return new Page("", "", "", status.getLevel().toString()); } else { - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); row.add("summary"); row.add(getLevelHtml(status.getLevel())); row.add("<a href=\"/status\" target=\"_blank\">summary</a>"); diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/SystemPageHandler.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/SystemPageHandler.java index 0c8e3c26ec..d771c061e9 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/SystemPageHandler.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/container/page/pages/SystemPageHandler.java @@ -44,49 +44,49 @@ public class SystemPageHandler implements PageHandler { @Override public Page handle(URL url) { - List<List<String>> rows = new ArrayList<List<String>>(); + List<List<String>> rows = new ArrayList<>(); List<String> row; - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("Version"); row.add(Version.getVersion(SystemPageHandler.class, "2.0.0")); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("Host"); String address = NetUtils.getLocalHost(); row.add(NetUtils.getHostName(address) + "/" + address); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("OS"); row.add(System.getProperty("os.name") + " " + System.getProperty("os.version")); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("JVM"); row.add(System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version") + ",<br/>" + System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version") + " " + System.getProperty("java.vm.info", "")); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("CPU"); row.add(System.getProperty("os.arch", "") + ", " + String.valueOf(Runtime.getRuntime().availableProcessors()) + " cores"); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("Locale"); row.add(Locale.getDefault().toString() + "/" + System.getProperty("file.encoding")); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("Uptime"); row.add(formatUptime(ManagementFactory.getRuntimeMXBean().getUptime())); rows.add(row); - row = new ArrayList<String>(); + row = new ArrayList<>(); row.add("Time"); row.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z").format(new Date())); rows.add(row); diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java index 6f1b383e62..0f19232bca 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java @@ -353,7 +353,7 @@ public class RpcContext { final T o = callable.call(); // local invoke will return directly if (o != null) { - FutureTask<T> f = new FutureTask<T>(new Callable<T>() { + FutureTask<T> f = new FutureTask<>(new Callable<T>() { @Override public T call() throws Exception { return o; diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java index d9bc2dd662..2a741489d0 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/rpc/RpcInvocation.java @@ -162,14 +162,14 @@ public class RpcInvocation implements Invocation, Serializable { public void setAttachment(String key, String value) { if (attachments == null) { - attachments = new HashMap<String, String>(); + attachments = new HashMap<>(); } attachments.put(key, value); } public void setAttachmentIfAbsent(String key, String value) { if (attachments == null) { - attachments = new HashMap<String, String>(); + attachments = new HashMap<>(); } if (!attachments.containsKey(key)) { attachments.put(key, value); @@ -181,7 +181,7 @@ public class RpcInvocation implements Invocation, Serializable { return; } if (this.attachments == null) { - this.attachments = new HashMap<String, String>(); + this.attachments = new HashMap<>(); } this.attachments.putAll(attachments); } diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java index e77c9e2e82..bde86c3a9b 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java @@ -128,7 +128,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> { /** * A random port cache, the different protocols who have no port specified have different random port */ - private static final Map<String, Integer> RANDOM_PORT_MAP = new HashMap<String, Integer>(); + private static final Map<String, Integer> RANDOM_PORT_MAP = new HashMap<>(); private Protocol protocolSPI; @@ -651,7 +651,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> { private Map<String, String> buildAttributes(ProtocolConfig protocolConfig) { - Map<String, String> map = new HashMap<String, String>(); + Map<String, String> map = new HashMap<>(); map.put(SIDE_KEY, PROVIDER_SIDE); // append params with basic configs, diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java index 728aa21845..696c12eb43 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java @@ -209,7 +209,7 @@ public class ConfigValidationUtils { address = ANYHOST_VALUE; } if (!RegistryConfig.NO_AVAILABLE.equalsIgnoreCase(address)) { - Map<String, String> map = new HashMap<String, String>(); + Map<String, String> map = new HashMap<>(); AbstractConfig.appendParameters(map, application); AbstractConfig.appendParameters(map, config); map.put(PATH_KEY, RegistryService.class.getName()); @@ -309,7 +309,7 @@ public class ConfigValidationUtils { } public static URL loadMonitor(AbstractInterfaceConfig interfaceConfig, URL registryURL) { - Map<String, String> map = new HashMap<String, String>(); + Map<String, String> map = new HashMap<>(); map.put(INTERFACE_KEY, MonitorService.class.getName()); AbstractInterfaceConfig.appendRuntimeParameters(map); // set ip diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationBeanPostProcessor.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationBeanPostProcessor.java index c287e23ae4..683a335fef 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationBeanPostProcessor.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/AbstractAnnotationBeanPostProcessor.java @@ -78,8 +78,7 @@ public abstract class AbstractAnnotationBeanPostProcessor private final Class<? extends Annotation>[] annotationTypes; private final ConcurrentMap<String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata> - injectionMetadataCache = new ConcurrentHashMap< - String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata>(CACHE_SIZE); + injectionMetadataCache = new ConcurrentHashMap<>(CACHE_SIZE); private ConfigurableListableBeanFactory beanFactory; @@ -98,7 +97,7 @@ public abstract class AbstractAnnotationBeanPostProcessor } private static <T> Collection<T> combine(Collection<? extends T>... elements) { - List<T> allElements = new ArrayList<T>(); + List<T> allElements = new ArrayList<>(); for (Collection<? extends T> e : elements) { allElements.addAll(e); } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java index 713a191835..02771ca121 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/AnnotationUtils.java @@ -87,7 +87,7 @@ public abstract class AnnotationUtils { Set<String> ignoreAttributeNamesSet = new HashSet<>(Arrays.asList(ignoreAttributeNames)); - Map<String, Object> actualAttributes = new LinkedHashMap<String, Object>(); + Map<String, Object> actualAttributes = new LinkedHashMap<>(); for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) { @@ -143,7 +143,7 @@ public abstract class AnnotationUtils { if (ignoreDefaultValue && !isEmpty(annotationAttributes)) { - List<String> attributeNamesToIgnore = new LinkedList<String>(asList(ignoreAttributeNames)); + List<String> attributeNamesToIgnore = new LinkedList<>(asList(ignoreAttributeNames)); for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) { String attributeName = annotationAttribute.getKey(); diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java index 15e164b5ee..8a5eff73e5 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/PropertySourcesUtils.java @@ -103,7 +103,7 @@ public abstract class PropertySourcesUtils { public static Map<String, Object> getSubProperties( PropertySources propertySources, PropertyResolver propertyResolver, String prefix) { - Map<String, Object> subProperties = new LinkedHashMap<String, Object>(); + Map<String, Object> subProperties = new LinkedHashMap<>(); String normalizedPrefix = normalizePrefix(prefix); diff --git a/dubbo-container/dubbo-container-api/src/main/java/org/apache/dubbo/container/Main.java b/dubbo-container/dubbo-container-api/src/main/java/org/apache/dubbo/container/Main.java index 9845e778c3..89add47aff 100644 --- a/dubbo-container/dubbo-container-api/src/main/java/org/apache/dubbo/container/Main.java +++ b/dubbo-container/dubbo-container-api/src/main/java/org/apache/dubbo/container/Main.java @@ -60,7 +60,7 @@ public class Main { args = COMMA_SPLIT_PATTERN.split(config); } - final List<Container> containers = new ArrayList<Container>(); + final List<Container> containers = new ArrayList<>(); for (int i = 0; i < args.length; i++) { containers.add(LOADER.getExtension(args[i])); } diff --git a/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/AbstractCacheFactory.java b/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/AbstractCacheFactory.java index 00276dda8c..ac3c155463 100644 --- a/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/AbstractCacheFactory.java +++ b/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/AbstractCacheFactory.java @@ -42,7 +42,7 @@ public abstract class AbstractCacheFactory implements CacheFactory { /** * This is used to store factory level-1 cached data. */ - private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>(); + private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>(); private final Object MONITOR = new Object(); diff --git a/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/expiring/ExpiringMap.java b/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/expiring/ExpiringMap.java index cec8854d7d..9061e7a6f4 100644 --- a/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/expiring/ExpiringMap.java +++ b/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/expiring/ExpiringMap.java @@ -158,7 +158,7 @@ public class ExpiringMap<K, V> implements Map<K, V> { @Override public Collection<V> values() { - List<V> list = new ArrayList<V>(); + List<V> list = new ArrayList<>(); Set<Entry<K, ExpiryObject>> delegatedSet = delegateMap.entrySet(); for (Entry<K, ExpiryObject> entry : delegatedSet) { ExpiryObject value = entry.getValue(); diff --git a/dubbo-metadata/dubbo-metadata-report-nacos/src/main/java/org/apache/dubbo/metadata/store/nacos/NacosMetadataReport.java b/dubbo-metadata/dubbo-metadata-report-nacos/src/main/java/org/apache/dubbo/metadata/store/nacos/NacosMetadataReport.java index bdd5e83006..d6dac4355e 100644 --- a/dubbo-metadata/dubbo-metadata-report-nacos/src/main/java/org/apache/dubbo/metadata/store/nacos/NacosMetadataReport.java +++ b/dubbo-metadata/dubbo-metadata-report-nacos/src/main/java/org/apache/dubbo/metadata/store/nacos/NacosMetadataReport.java @@ -258,7 +258,7 @@ public class NacosMetadataReport extends AbstractMetadataReport { if (StringUtils.isEmpty(content)) { return Collections.emptyList(); } - return new ArrayList<String>(Arrays.asList(URL.decode(content))); + return new ArrayList<>(Arrays.asList(URL.decode(content))); } @Override diff --git a/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java b/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java index 0e774cc018..cdd45552d7 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java +++ b/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java @@ -53,9 +53,9 @@ public abstract class AbstractMonitorFactory implements MonitorFactory { /** * The monitor centers Map<RegistryAddress, Registry> */ - private static final Map<String, Monitor> MONITORS = new ConcurrentHashMap<String, Monitor>(); + private static final Map<String, Monitor> MONITORS = new ConcurrentHashMap<>(); - private static final Map<String, Future<Monitor>> FUTURES = new ConcurrentHashMap<String, Future<Monitor>>(); + private static final Map<String, Future<Monitor>> FUTURES = new ConcurrentHashMap<>(); /** * The monitor create executor diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoder.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoder.java index 77e7fa8928..2d0367ae6a 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoder.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/decoder/HttpCommandDecoder.java @@ -46,7 +46,7 @@ public class HttpCommandDecoder { commandContext = CommandContextFactory.newInstance(name); commandContext.setHttp(true); } else { - List<String> valueList = new ArrayList<String>(); + List<String> valueList = new ArrayList<>(); for (List<String> values : queryStringDecoder.parameters().values()) { valueList.addAll(values); @@ -56,7 +56,7 @@ public class HttpCommandDecoder { } } else if (request.method() == HttpMethod.POST) { HttpPostRequestDecoder httpPostRequestDecoder = new HttpPostRequestDecoder(request); - List<String> valueList = new ArrayList<String>(); + List<String> valueList = new ArrayList<>(); for (InterfaceHttpData interfaceHttpData : httpPostRequestDecoder.getBodyHttpDatas()) { if (interfaceHttpData.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) { Attribute attribute = (Attribute) interfaceHttpData; diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/CountTelnet.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/CountTelnet.java index 425f4706b3..e81c8a0c95 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/CountTelnet.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/CountTelnet.java @@ -155,8 +155,8 @@ public class CountTelnet implements BaseCommand { private String count(Invoker<?> invoker, String method) { URL url = invoker.getUrl(); - List<List<String>> table = new ArrayList<List<String>>(); - List<String> header = new ArrayList<String>(); + List<List<String>> table = new ArrayList<>(); + List<String> header = new ArrayList<>(); header.add("method"); header.add("total"); header.add("failed"); @@ -188,7 +188,7 @@ public class CountTelnet implements BaseCommand { } private List<String> createRow(String methodName, RpcStatus count) { - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); row.add(methodName); row.add(String.valueOf(count.getTotal())); row.add(String.valueOf(count.getFailed())); diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/util/CommandHelper.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/util/CommandHelper.java index faad6041de..0889eecf15 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/util/CommandHelper.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/util/CommandHelper.java @@ -46,7 +46,7 @@ public class CommandHelper { public List<Class<?>> getAllCommandClass() { final Set<String> commandList = frameworkModel.getExtensionLoader(BaseCommand.class).getSupportedExtensions(); - final List<Class<?>> classes = new ArrayList<Class<?>>(); + final List<Class<?>> classes = new ArrayList<>(); for (String commandName : commandList) { BaseCommand command = diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TLadder.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TLadder.java index f89996d0ef..66e8421c6f 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TLadder.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TLadder.java @@ -35,7 +35,7 @@ public class TLadder implements TComponent { // indent length private static final int INDENT_STEP = 2; - private final List<String> items = new LinkedList<String>(); + private final List<String> items = new LinkedList<>(); @Override public String rendering() { diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTable.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTable.java index f96e857184..326f1be16e 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTable.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTable.java @@ -299,7 +299,7 @@ public class TTable implements TComponent { private final Align align; // data rows - private final List<String> rows = new ArrayList<String>(); + private final List<String> rows = new ArrayList<>(); public ColumnDefine(int width, boolean isAutoResize, Align align) { this.width = width; diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTree.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTree.java index 6b599da45a..8c4d650682 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTree.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/textui/TTree.java @@ -181,7 +181,7 @@ public class TTree implements TComponent { /** * child nodes */ - final List<Node> children = new ArrayList<Node>(); + final List<Node> children = new ArrayList<>(); /** * begin timestamp diff --git a/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java b/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java index 33e529336e..58ec934c42 100644 --- a/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java +++ b/dubbo-plugin/dubbo-reactive/src/main/java/org/apache/dubbo/reactive/calls/ReactorServerCalls.java @@ -83,7 +83,7 @@ public final class ReactorServerCalls { public static <T, R> StreamObserver<T> manyToOne( StreamObserver<R> responseObserver, Function<Flux<T>, Mono<R>> func) { ServerTripleReactorPublisher<T> serverPublisher = - new ServerTripleReactorPublisher<T>((CallStreamObserver<R>) responseObserver); + new ServerTripleReactorPublisher<>((CallStreamObserver<R>) responseObserver); try { Mono<R> responseMono = func.apply(Flux.from(serverPublisher)); responseMono.subscribe( @@ -118,7 +118,7 @@ public final class ReactorServerCalls { StreamObserver<R> responseObserver, Function<Flux<T>, Flux<R>> func) { // responseObserver is also a subscription of publisher, we can use it to request more data ServerTripleReactorPublisher<T> serverPublisher = - new ServerTripleReactorPublisher<T>((CallStreamObserver<R>) responseObserver); + new ServerTripleReactorPublisher<>((CallStreamObserver<R>) responseObserver); try { Flux<R> responseFlux = func.apply(Flux.from(serverPublisher)); ServerTripleReactorSubscriber<R> serverSubscriber = diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java index ba3e936d16..8ee41924a2 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/InterfaceCompatibleRegistryProtocol.java @@ -75,6 +75,6 @@ public class InterfaceCompatibleRegistryProtocol extends RegistryProtocol { URL url, URL consumerUrl) { // ClusterInvoker<T> invoker = getInvoker(cluster, registry, type, url); - return new MigrationInvoker<T>(registryProtocol, cluster, registry, type, url, consumerUrl); + return new MigrationInvoker<>(registryProtocol, cluster, registry, type, url, consumerUrl); } } diff --git a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java index c5e386bb99..6763543c7c 100644 --- a/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java +++ b/dubbo-registry/dubbo-registry-multicast/src/main/java/org/apache/dubbo/registry/multicast/MulticastRegistry.java @@ -82,7 +82,7 @@ public class MulticastRegistry extends FailbackRegistry { private final int multicastPort; - private final ConcurrentMap<URL, Set<URL>> received = new ConcurrentHashMap<URL, Set<URL>>(); + private final ConcurrentMap<URL, Set<URL>> received = new ConcurrentHashMap<>(); private final ScheduledExecutorService cleanExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("DubboMulticastRegistryCleanTimer", true)); @@ -361,7 +361,7 @@ public class MulticastRegistry extends FailbackRegistry { } if (urls == null || urls.isEmpty()) { if (urls == null) { - urls = new ConcurrentHashSet<URL>(); + urls = new ConcurrentHashSet<>(); } URL empty = url.setProtocol(EMPTY_PROTOCOL); urls.add(empty); @@ -380,7 +380,7 @@ public class MulticastRegistry extends FailbackRegistry { } private List<URL> toList(Set<URL> urls) { - List<URL> list = new ArrayList<URL>(); + List<URL> list = new ArrayList<>(); if (CollectionUtils.isNotEmpty(urls)) { list.addAll(urls); } diff --git a/dubbo-registry/dubbo-registry-multiple/src/main/java/org/apache/dubbo/registry/multiple/MultipleRegistry.java b/dubbo-registry/dubbo-registry-multiple/src/main/java/org/apache/dubbo/registry/multiple/MultipleRegistry.java index 44a2e57126..4a7edf788b 100644 --- a/dubbo-registry/dubbo-registry-multiple/src/main/java/org/apache/dubbo/registry/multiple/MultipleRegistry.java +++ b/dubbo-registry/dubbo-registry-multiple/src/main/java/org/apache/dubbo/registry/multiple/MultipleRegistry.java @@ -268,7 +268,7 @@ public class MultipleRegistry extends AbstractRegistry { protected static class MultipleNotifyListenerWrapper implements NotifyListener { - Map<URL, SingleNotifyListener> registryMap = new ConcurrentHashMap<URL, SingleNotifyListener>(4); + Map<URL, SingleNotifyListener> registryMap = new ConcurrentHashMap<>(4); NotifyListener sourceNotifyListener; public MultipleNotifyListenerWrapper(NotifyListener sourceNotifyListener) { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/ReplierDispatcher.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/ReplierDispatcher.java index 549593a888..979c49c2a5 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/ReplierDispatcher.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/ReplierDispatcher.java @@ -30,7 +30,7 @@ public class ReplierDispatcher implements Replier<Object> { private final Replier<?> defaultReplier; - private final Map<Class<?>, Replier<?>> repliers = new ConcurrentHashMap<Class<?>, Replier<?>>(); + private final Map<Class<?>, Replier<?>> repliers = new ConcurrentHashMap<>(); public ReplierDispatcher() { this(null, null); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java index 340c50c724..2204076aba 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java @@ -161,7 +161,7 @@ public class HeaderExchangeServer implements ExchangeServer { @Override public Collection<ExchangeChannel> getExchangeChannels() { - Collection<ExchangeChannel> exchangeChannels = new ArrayList<ExchangeChannel>(); + Collection<ExchangeChannel> exchangeChannels = new ArrayList<>(); Collection<Channel> channels = server.getChannels(); if (CollectionUtils.isNotEmpty(channels)) { for (Channel channel : channels) { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/codec/TelnetCodec.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/codec/TelnetCodec.java index c106572e3f..3f1140b22c 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/codec/TelnetCodec.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/codec/TelnetCodec.java @@ -283,7 +283,7 @@ public class TelnetCodec extends TransportCodec { String result = toString(message, getCharset(channel)); if (result.trim().length() > 0) { if (history == null) { - history = new LinkedList<String>(); + history = new LinkedList<>(); channel.setAttribute(HISTORY_LIST_KEY, history); } if (history.isEmpty()) { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/HelpTelnetHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/HelpTelnetHandler.java index da5b727398..f33c61360b 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/HelpTelnetHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/HelpTelnetHandler.java @@ -73,12 +73,12 @@ public class HelpTelnetHandler implements TelnetHandler { } private String generateForAllCommand(Channel channel) { - List<List<String>> table = new ArrayList<List<String>>(); + List<List<String>> table = new ArrayList<>(); List<TelnetHandler> handlers = extensionLoader.getActivateExtension(channel.getUrl(), "telnet"); if (CollectionUtils.isNotEmpty(handlers)) { for (TelnetHandler handler : handlers) { Help help = handler.getClass().getAnnotation(Help.class); - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); String parameter = " " + extensionLoader.getExtensionName(handler) + " " + (help != null ? help.parameter().replace("\r\n", " ").replace("\n", " ") : ""); row.add(parameter.length() > 55 ? parameter.substring(0, 55) + "..." : parameter); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java index f65966321c..d111a87fc9 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/telnet/support/command/StatusTelnetHandler.java @@ -53,8 +53,8 @@ public class StatusTelnetHandler implements TelnetHandler { if ("-l".equals(message)) { List<StatusChecker> checkers = extensionLoader.getActivateExtension(channel.getUrl(), STATUS_KEY); String[] header = new String[] {"resource", "status", "message"}; - List<List<String>> table = new ArrayList<List<String>>(); - Map<String, Status> statuses = new HashMap<String, Status>(); + List<List<String>> table = new ArrayList<>(); + Map<String, Status> statuses = new HashMap<>(); if (CollectionUtils.isNotEmpty(checkers)) { for (StatusChecker checker : checkers) { String name = extensionLoader.getExtensionName(checker); @@ -66,7 +66,7 @@ public class StatusTelnetHandler implements TelnetHandler { } statuses.put(name, stat); if (stat.getLevel() != null && stat.getLevel() != Status.Level.UNKNOWN) { - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); row.add(name); row.add(String.valueOf(stat.getLevel())); row.add(stat.getMessage() == null ? "" : stat.getMessage()); @@ -75,7 +75,7 @@ public class StatusTelnetHandler implements TelnetHandler { } } Status stat = StatusUtils.getSummaryStatus(statuses); - List<String> row = new ArrayList<String>(); + List<String> row = new ArrayList<>(); row.add("summary"); row.add(String.valueOf(stat.getLevel())); row.add(stat.getMessage()); @@ -85,7 +85,7 @@ public class StatusTelnetHandler implements TelnetHandler { return "Unsupported parameter " + message + " for status."; } String status = channel.getUrl().getParameter("status"); - Map<String, Status> statuses = new HashMap<String, Status>(); + Map<String, Status> statuses = new HashMap<>(); if (StringUtils.isNotEmpty(status)) { String[] ss = COMMA_SPLIT_PATTERN.split(status); for (String s : ss) { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java index 8023274ac4..d3e24111a3 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java @@ -42,9 +42,9 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FA public class CodecSupport { private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(CodecSupport.class); - private static Map<Byte, Serialization> ID_SERIALIZATION_MAP = new HashMap<Byte, Serialization>(); - private static Map<Byte, String> ID_SERIALIZATIONNAME_MAP = new HashMap<Byte, String>(); - private static Map<String, Byte> SERIALIZATIONNAME_ID_MAP = new HashMap<String, Byte>(); + private static Map<Byte, Serialization> ID_SERIALIZATION_MAP = new HashMap<>(); + private static Map<Byte, String> ID_SERIALIZATIONNAME_MAP = new HashMap<>(); + private static Map<String, Byte> SERIALIZATIONNAME_ID_MAP = new HashMap<>(); // Cache null object serialize results, for heartbeat request/response serialize use. private static ConcurrentMap<Byte, byte[]> ID_NULLBYTES_MAP = new ConcurrentHashMap<>(); diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java index d02d63be29..5536e6c83e 100644 --- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java +++ b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/RequestTemplate.java @@ -35,8 +35,8 @@ public class RequestTemplate implements Serializable { public static final String ENCODING_DEFLATE = "deflate"; private static final List<String> EMPTY_ARRAYLIST = new ArrayList<>(); - private final Map<String, Collection<String>> queries = new LinkedHashMap<String, Collection<String>>(); - private final Map<String, Collection<String>> headers = new LinkedHashMap<String, Collection<String>>(); + private final Map<String, Collection<String>> queries = new LinkedHashMap<>(); + private final Map<String, Collection<String>> headers = new LinkedHashMap<>(); private String httpMethod; private String path; private String address; diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java index ced2170b3b..0f2358cee0 100644 --- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java +++ b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/DispatcherServlet.java @@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap; public class DispatcherServlet extends HttpServlet { private static final long serialVersionUID = 5766349180380479888L; - private static final Map<Integer, HttpHandler> HANDLERS = new ConcurrentHashMap<Integer, HttpHandler>(); + private static final Map<Integer, HttpHandler> HANDLERS = new ConcurrentHashMap<>(); private static DispatcherServlet INSTANCE; public DispatcherServlet() { diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java index a261b6e54c..dc71cd862d 100644 --- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java +++ b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/servlet/ServletManager.java @@ -30,7 +30,7 @@ public class ServletManager { private static final ServletManager INSTANCE = new ServletManager(); - private final Map<Integer, ServletContext> contextMap = new ConcurrentHashMap<Integer, ServletContext>(); + private final Map<Integer, ServletContext> contextMap = new ConcurrentHashMap<>(); public static ServletManager getInstance() { return INSTANCE; diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java index 695983a22f..95539ac9ac 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyChannel.java @@ -43,11 +43,11 @@ final class NettyChannel extends AbstractChannel { private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(NettyChannel.class); private static final ConcurrentMap<org.jboss.netty.channel.Channel, NettyChannel> CHANNEL_MAP = - new ConcurrentHashMap<org.jboss.netty.channel.Channel, NettyChannel>(); + new ConcurrentHashMap<>(); private final org.jboss.netty.channel.Channel channel; - private final Map<String, Object> attributes = new ConcurrentHashMap<String, Object>(); + private final Map<String, Object> attributes = new ConcurrentHashMap<>(); private NettyChannel(org.jboss.netty.channel.Channel channel, URL url, ChannelHandler handler) { super(url, handler); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHandler.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHandler.java index f1d4bfd23c..d864639dac 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHandler.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHandler.java @@ -42,7 +42,7 @@ public class NettyHandler extends SimpleChannelHandler { private static final Logger logger = LoggerFactory.getLogger(NettyHandler.class); - private final Map<String, Channel> channels = new ConcurrentHashMap<String, Channel>(); // <ip:port, channel> + private final Map<String, Channel> channels = new ConcurrentHashMap<>(); // <ip:port, channel> private final URL url; diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java index 41b7bb5f4c..8041c72bd8 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyChannel.java @@ -61,14 +61,13 @@ final class NettyChannel extends AbstractChannel { /** * the cache for netty channel and dubbo channel */ - private static final ConcurrentMap<Channel, NettyChannel> CHANNEL_MAP = - new ConcurrentHashMap<Channel, NettyChannel>(); + private static final ConcurrentMap<Channel, NettyChannel> CHANNEL_MAP = new ConcurrentHashMap<>(); /** * netty channel */ private final Channel channel; - private final Map<String, Object> attributes = new ConcurrentHashMap<String, Object>(); + private final Map<String, Object> attributes = new ConcurrentHashMap<>(); private final AtomicBoolean active = new AtomicBoolean(false); diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcServiceContext.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcServiceContext.java index 5a8a640bd6..6bc36b75ae 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcServiceContext.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcServiceContext.java @@ -459,7 +459,7 @@ public class RpcServiceContext extends RpcContext { public RpcServiceContext setInvokers(List<Invoker<?>> invokers) { this.invokers = invokers; if (CollectionUtils.isNotEmpty(invokers)) { - List<URL> urls = new ArrayList<URL>(invokers.size()); + List<URL> urls = new ArrayList<>(invokers.size()); for (Invoker<?> invoker : invokers) { urls.add(invoker.getUrl()); } diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcStatus.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcStatus.java index 30de38825d..9b0769f545 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcStatus.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcStatus.java @@ -33,13 +33,12 @@ import java.util.concurrent.atomic.AtomicLong; */ public class RpcStatus { - private static final ConcurrentMap<String, RpcStatus> SERVICE_STATISTICS = - new ConcurrentHashMap<String, RpcStatus>(); + private static final ConcurrentMap<String, RpcStatus> SERVICE_STATISTICS = new ConcurrentHashMap<>(); private static final ConcurrentMap<String, ConcurrentMap<String, RpcStatus>> METHOD_STATISTICS = - new ConcurrentHashMap<String, ConcurrentMap<String, RpcStatus>>(); + new ConcurrentHashMap<>(); - private final ConcurrentMap<String, Object> values = new ConcurrentHashMap<String, Object>(); + private final ConcurrentMap<String, Object> values = new ConcurrentHashMap<>(); private final AtomicInteger active = new AtomicInteger(); private final AtomicLong total = new AtomicLong(); diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/DeprecatedFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/DeprecatedFilter.java index 1cbabd45d0..e1b2c4966c 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/DeprecatedFilter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/DeprecatedFilter.java @@ -44,7 +44,7 @@ public class DeprecatedFilter implements Filter { private static final ErrorTypeAwareLogger LOGGER = LoggerFactory.getErrorTypeAwareLogger(DeprecatedFilter.class); - private static final Set<String> LOGGED = new ConcurrentHashSet<String>(); + private static final Set<String> LOGGED = new ConcurrentHashSet<>(); @Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiter.java index 0410d70c50..645345db3f 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/tps/DefaultTPSLimiter.java @@ -35,7 +35,7 @@ import static org.apache.dubbo.rpc.Constants.TPS_LIMIT_RATE_KEY; */ public class DefaultTPSLimiter implements TPSLimiter { - private final ConcurrentMap<String, StatItem> stats = new ConcurrentHashMap<String, StatItem>(); + private final ConcurrentMap<String, StatItem> stats = new ConcurrentHashMap<>(); @Override public boolean isAllowable(URL url, Invocation invocation) { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProxyProtocol.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProxyProtocol.java index 843754a1dd..8bd9e41a36 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProxyProtocol.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProxyProtocol.java @@ -50,7 +50,7 @@ import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_UNS */ public abstract class AbstractProxyProtocol extends AbstractProtocol { - private final List<Class<?>> rpcExceptions = new CopyOnWriteArrayList<Class<?>>(); + private final List<Class<?>> rpcExceptions = new CopyOnWriteArrayList<>(); protected ProxyFactory proxyFactory; diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapper.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapper.java index 421e1148e7..52ca299bb8 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapper.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/ProtocolListenerWrapper.java @@ -74,8 +74,7 @@ public class ProtocolListenerWrapper implements Protocol { .getBeanFactory() .getBean(InjvmExporterListener.class)); } - return new ListenerExporterWrapper<T>( - protocol.export(invoker), Collections.unmodifiableList(exporterListeners)); + return new ListenerExporterWrapper<>(protocol.export(invoker), Collections.unmodifiableList(exporterListeners)); } @Override diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java index 9e798e51df..4f35a9cb31 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/support/MockInvoker.java @@ -47,8 +47,8 @@ import static org.apache.dubbo.rpc.Constants.THROW_PREFIX; public final class MockInvoker<T> implements Invoker<T> { private final ProxyFactory proxyFactory; - private static final Map<String, Invoker<?>> MOCK_MAP = new ConcurrentHashMap<String, Invoker<?>>(); - private static final Map<String, Throwable> THROWABLE_MAP = new ConcurrentHashMap<String, Throwable>(); + private static final Map<String, Invoker<?>> MOCK_MAP = new ConcurrentHashMap<>(); + private static final Map<String, Throwable> THROWABLE_MAP = new ConcurrentHashMap<>(); private final URL url; private final Class<T> type; diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java index a8bd3c0c02..4a919adf25 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java @@ -339,7 +339,7 @@ public class DubboProtocol extends AbstractProtocol { // export service. String key = serviceKey(url); - DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); + DubboExporter<T> exporter = new DubboExporter<>(invoker, key, exporterMap); // export a stub service for dispatching event boolean isStubSupportEvent = url.getParameter(STUB_EVENT_KEY, DEFAULT_STUB_EVENT); @@ -443,7 +443,7 @@ public class DubboProtocol extends AbstractProtocol { optimizeSerialization(url); // create rpc invoker. - DubboInvoker<T> invoker = new DubboInvoker<T>(serviceType, url, getClients(url), invokers); + DubboInvoker<T> invoker = new DubboInvoker<>(serviceType, url, getClients(url), invokers); invokers.add(invoker); return invoker; diff --git a/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java b/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java index c4955e7ce7..b335784709 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java +++ b/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java @@ -75,12 +75,12 @@ public class InjvmProtocol extends AbstractProtocol { @Override public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException { - return new InjvmExporter<T>(invoker, invoker.getUrl().getServiceKey(), exporterMap); + return new InjvmExporter<>(invoker, invoker.getUrl().getServiceKey(), exporterMap); } @Override public <T> Invoker<T> protocolBindingRefer(Class<T> serviceType, URL url) throws RpcException { - return new InjvmInvoker<T>(serviceType, url, url.getServiceKey(), exporterMap); + return new InjvmInvoker<>(serviceType, url, url.getServiceKey(), exporterMap); } public boolean isInjvmRefer(URL url) { diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java index 2311928019..16d30ba264 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java @@ -134,7 +134,7 @@ public class RestProtocol extends AbstractProtocol { MetadataResolver.resolveConsumerServiceMetadata(type, url, contextPathFromUrl); Invoker<T> invoker = - new RestInvoker<T>(type, url, refClient, httpConnectionPreBuildIntercepts, serviceRestMetadata); + new RestInvoker<>(type, url, refClient, httpConnectionPreBuildIntercepts, serviceRestMetadata); invokers.add(invoker); return invoker; diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java index 0a87d6d8f3..fcf7faf5f5 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/ViolationReport.java @@ -42,7 +42,7 @@ public class ViolationReport implements Serializable { public void addConstraintViolation(RestConstraintViolation constraintViolation) { if (constraintViolations == null) { - constraintViolations = new LinkedList<RestConstraintViolation>(); + constraintViolations = new LinkedList<>(); } constraintViolations.add(constraintViolation); } diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/extension/resteasy/filter/DubboPreMatchContainerRequestContext.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/extension/resteasy/filter/DubboPreMatchContainerRequestContext.java index 4964f1792d..6350eaaf15 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/extension/resteasy/filter/DubboPreMatchContainerRequestContext.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/extension/resteasy/filter/DubboPreMatchContainerRequestContext.java @@ -82,7 +82,7 @@ public class DubboPreMatchContainerRequestContext implements SuspendableContaine @Override public Collection<String> getPropertyNames() { - ArrayList<String> names = new ArrayList<String>(); + ArrayList<String> names = new ArrayList<>(); Enumeration<String> enames = httpRequest.getAttributeNames(); while (enames.hasMoreElements()) { names.add(enames.nextElement()); diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/util/ReflectUtils.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/util/ReflectUtils.java index 627ad1c195..deacffa63a 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/util/ReflectUtils.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/util/ReflectUtils.java @@ -115,7 +115,7 @@ public class ReflectUtils { } catch (Exception e) { } - return new ArrayList<Constructor<?>>(methods); + return new ArrayList<>(methods); } private static void filterConstructMethod(Set<Constructor<?>> methods, Constructor<?>[] declaredMethods) { diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriHttp2RemoteFlowController.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriHttp2RemoteFlowController.java index b29439fe3e..aa5339317d 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriHttp2RemoteFlowController.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriHttp2RemoteFlowController.java @@ -306,7 +306,7 @@ public class TriHttp2RemoteFlowController implements Http2RemoteFlowController { FlowState(Http2Stream stream) { this.stream = stream; - pendingWriteQueue = new ArrayDeque<FlowControlled>(2); + pendingWriteQueue = new ArrayDeque<>(2); } /** diff --git a/dubbo-test/dubbo-test-common/src/main/java/org/apache/dubbo/test/common/SysProps.java b/dubbo-test/dubbo-test-common/src/main/java/org/apache/dubbo/test/common/SysProps.java index dcfafc37f8..6c9f5c1001 100644 --- a/dubbo-test/dubbo-test-common/src/main/java/org/apache/dubbo/test/common/SysProps.java +++ b/dubbo-test/dubbo-test-common/src/main/java/org/apache/dubbo/test/common/SysProps.java @@ -24,7 +24,7 @@ import java.util.Map; */ public class SysProps { - private static Map<String, String> map = new LinkedHashMap<String, String>(); + private static Map<String, String> map = new LinkedHashMap<>(); public static void reset() { map.clear();