You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by sh...@apache.org on 2022/06/24 13:05:28 UTC

[servicecomb-java-chassis] branch master updated: [SCB-2604] Use lambad instead of annonymous class (#3128)

This is an automated email from the ASF dual-hosted git repository.

shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 5eac8d6f1 [SCB-2604] Use lambad instead of annonymous class (#3128)
5eac8d6f1 is described below

commit 5eac8d6f1ec586ac98efde88eda88f0824c1572b
Author: TingTing Wang <19...@qq.com>
AuthorDate: Fri Jun 24 21:05:23 2022 +0800

    [SCB-2604] Use lambad instead of annonymous class (#3128)
---
 .../common/rest/locator/MicroservicePaths.java     |  3 +-
 .../servicecomb/demo/pojo/client/BeanRpcTest.java  | 34 ++++++------
 .../demo/pojo/client/TestFlowControl.java          | 32 ++++++------
 .../client/TestInvokeWhenServerNotReady.java       | 60 ++++++++++------------
 .../demo/springmvc/third/EarlyConsumer.java        | 28 +++++-----
 .../java/io/protostuff/runtime/HashFieldMapEx.java |  2 +-
 .../registry/cache/MicroserviceInstanceCache.java  | 15 ++----
 .../servicecomb/foundation/ssl/SSLManagerTest.java | 28 ++++------
 .../foundation/vertx/server/TestTcpParser.java     | 11 ++--
 .../bizkeeper/TestBizkeeperHandler.java            | 23 +++------
 .../loadbalance/TestLoadBalanceCreator.java        | 54 ++++++++-----------
 .../pojo/reference/RpcReferenceProcessor.java      |  6 +--
 12 files changed, 122 insertions(+), 174 deletions(-)

diff --git a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/locator/MicroservicePaths.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/locator/MicroservicePaths.java
index 2137a0430..21f014a2c 100644
--- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/locator/MicroservicePaths.java
+++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/locator/MicroservicePaths.java
@@ -19,7 +19,6 @@ package org.apache.servicecomb.common.rest.locator;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -44,7 +43,7 @@ public class MicroservicePaths {
 
   public void sortPath() {
     RestOperationComparator comparator = new RestOperationComparator();
-    Collections.sort(this.dynamicPathOperationsList, comparator);
+    this.dynamicPathOperationsList.sort(comparator);
   }
 
   public void addResource(RestOperationMeta swaggerRestOperation) {
diff --git a/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/BeanRpcTest.java b/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/BeanRpcTest.java
index 69e7f0cbb..f5b1368f7 100644
--- a/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/BeanRpcTest.java
+++ b/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/BeanRpcTest.java
@@ -28,27 +28,25 @@ public class BeanRpcTest {
   }
 
   public void init() {
-    new Thread() {
-      public void run() {
-        while (true) {
+    new Thread(() -> {
+      while (true) {
+        try {
+          System.out.println("XXXXXXXXXXXXXXXXXXXXXXXX" + test.getTestString(null));
+          break;
+        } catch (Exception e) {
+          e.printStackTrace();
           try {
-            System.out.println("XXXXXXXXXXXXXXXXXXXXXXXX" + test.getTestString(null));
-            break;
-          } catch (Exception e) {
-            e.printStackTrace();
-            try {
-              Thread.sleep(1000);
-            } catch (InterruptedException e1) {
-              e1.printStackTrace();
-            }
-            continue;
-          } catch (Throwable e) {
-            System.out.println("XXXXXXXXXXXXXXXXXXXXXXXX: teset case error");
-            e.printStackTrace();
-            System.exit(0);
+            Thread.sleep(1000);
+          } catch (InterruptedException e1) {
+            e1.printStackTrace();
           }
+          continue;
+        } catch (Throwable e) {
+          System.out.println("XXXXXXXXXXXXXXXXXXXXXXXX: teset case error");
+          e.printStackTrace();
+          System.exit(0);
         }
       }
-    }.start();
+    }).start();
   }
 }
diff --git a/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/TestFlowControl.java b/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/TestFlowControl.java
index faed30f44..d2e06a7cb 100644
--- a/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/TestFlowControl.java
+++ b/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/TestFlowControl.java
@@ -55,26 +55,24 @@ public class TestFlowControl implements CategorizedTestCase {
     AtomicBoolean failed = new AtomicBoolean(false);
     CountDownLatch countDownLatch = new CountDownLatch(10);
     for (int i = 0; i < 10; i++) {
-      new Thread() {
-        public void run() {
-          for (int i = 0; i < 10; i++) {
-            try {
-              int result = function.apply(10);
-              if (result != 10) {
-                TestMgr.failed("", new Exception("not expected"));
-              }
-            } catch (InvocationException e) {
-              TestMgr.check(e.getStatusCode(), 429);
-              TestMgr.check(e.getMessage(),
-                  "InvocationException: code=429;msg=CommonExceptionData [message=" + role
-                      + " request rejected by qps flowcontrol]");
-              failed.set(true);
-              break;
+      new Thread(() -> {
+        for (int i1 = 0; i1 < 10; i1++) {
+          try {
+            int result = function.apply(10);
+            if (result != 10) {
+              TestMgr.failed("", new Exception("not expected"));
             }
+          } catch (InvocationException e) {
+            TestMgr.check(e.getStatusCode(), 429);
+            TestMgr.check(e.getMessage(),
+                "InvocationException: code=429;msg=CommonExceptionData [message=" + role
+                    + " request rejected by qps flowcontrol]");
+            failed.set(true);
+            break;
           }
-          countDownLatch.countDown();
         }
-      }.start();
+        countDownLatch.countDown();
+      }).start();
     }
     countDownLatch.await(10, TimeUnit.SECONDS);
     TestMgr.check(expected, failed.get());
diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestInvokeWhenServerNotReady.java b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestInvokeWhenServerNotReady.java
index 5be0e2ff1..faa6f9874 100644
--- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestInvokeWhenServerNotReady.java
+++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestInvokeWhenServerNotReady.java
@@ -41,50 +41,44 @@ public class TestInvokeWhenServerNotReady {
   }
 
   private void startRestTemplateCall() {
-    new Thread() {
-      public void run() {
-        for (int i = 0; i < 100; i++) {
-          try {
-            RestTemplate template = RestTemplateBuilder.create();
-            template.getForObject("servicecomb://springmvc/upload/isServerStartUpSuccess", Boolean.class);
-          } catch (Throwable e) {
-            // ignore
-          }
+    new Thread(() -> {
+      for (int i = 0; i < 100; i++) {
+        try {
+          RestTemplate template = RestTemplateBuilder.create();
+          template.getForObject("servicecomb://springmvc/upload/isServerStartUpSuccess", Boolean.class);
+        } catch (Throwable e) {
+          // ignore
         }
       }
-    }.start();
+    }).start();
   }
 
   private void startRpcCall() {
-    new Thread() {
-      public void run() {
-        for (int i = 0; i < 100; i++) {
-          try {
-            InvocationContext context = new InvocationContext();
-            client.testInvocationTimeout(context, 1001, "customized");
-          } catch (Throwable e) {
-            // ignore
-          }
+    new Thread(() -> {
+      for (int i = 0; i < 100; i++) {
+        try {
+          InvocationContext context = new InvocationContext();
+          client.testInvocationTimeout(context, 1001, "customized");
+        } catch (Throwable e) {
+          // ignore
         }
       }
-    }.start();
+    }).start();
   }
 
   private void startInvokerUtilsCall() {
-    new Thread() {
-      public void run() {
-        for (int i = 0; i < 100; i++) {
-          try {
-            Map<String, Object> args = new HashMap<>();
-            args.put("timeout", 1);
-            args.put("name", "customized");
-            InvokerUtils
-                .syncInvoke("springmvc", "SpringMVCCommonSchemaInterface", "testInvocationTimeout", args, String.class);
-          } catch (Throwable e) {
-            // ignore
-          }
+    new Thread(() -> {
+      for (int i = 0; i < 100; i++) {
+        try {
+          Map<String, Object> args = new HashMap<>();
+          args.put("timeout", 1);
+          args.put("name", "customized");
+          InvokerUtils
+              .syncInvoke("springmvc", "SpringMVCCommonSchemaInterface", "testInvocationTimeout", args, String.class);
+        } catch (Throwable e) {
+          // ignore
         }
       }
-    }.start();
+    }).start();
   }
 }
diff --git a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/third/EarlyConsumer.java b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/third/EarlyConsumer.java
index 6e282df8a..09cd40ed5 100644
--- a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/third/EarlyConsumer.java
+++ b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/third/EarlyConsumer.java
@@ -36,23 +36,21 @@ public class EarlyConsumer implements BootListener {
   private volatile boolean stopped = false;
 
   public EarlyConsumer() {
-    new Thread() {
-      public void run() {
-        while (!stopped) {
-          LOGGER.info("calling service");
-          try {
-            healthSchema.heartbeat();
-          } catch (Throwable e) {
-            // ignore error
-          }
-          try {
-            Thread.sleep(100);
-          } catch (Throwable e) {
-            // ignore error
-          }
+    new Thread(() -> {
+      while (!stopped) {
+        LOGGER.info("calling service");
+        try {
+          healthSchema.heartbeat();
+        } catch (Throwable e) {
+          // ignore error
+        }
+        try {
+          Thread.sleep(100);
+        } catch (Throwable e) {
+          // ignore error
         }
       }
-    }.start();
+    }).start();
   }
 
   @Override
diff --git a/foundations/foundation-protobuf/src/main/java/io/protostuff/runtime/HashFieldMapEx.java b/foundations/foundation-protobuf/src/main/java/io/protostuff/runtime/HashFieldMapEx.java
index 5e1f71e20..d810233ed 100644
--- a/foundations/foundation-protobuf/src/main/java/io/protostuff/runtime/HashFieldMapEx.java
+++ b/foundations/foundation-protobuf/src/main/java/io/protostuff/runtime/HashFieldMapEx.java
@@ -60,7 +60,7 @@ public final class HashFieldMapEx<T> implements FieldMapEx<T> {
 
     List<FieldSchema<T>> fieldList = new ArrayList<>(fields.size());
     fieldList.addAll(fields);
-    Collections.sort(fieldList, Comparator.comparingInt(FieldSchema::getFieldNumber));
+    fieldList.sort(Comparator.comparingInt(FieldSchema::getFieldNumber));
     this.fields = Collections.unmodifiableList(fieldList);
   }
 
diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/cache/MicroserviceInstanceCache.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/cache/MicroserviceInstanceCache.java
index dd3cf44c8..07fcec60f 100644
--- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/cache/MicroserviceInstanceCache.java
+++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/cache/MicroserviceInstanceCache.java
@@ -17,7 +17,6 @@
 
 package org.apache.servicecomb.registry.cache;
 
-import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
@@ -67,16 +66,12 @@ public class MicroserviceInstanceCache {
   public static MicroserviceInstance getOrCreate(String serviceId, String instanceId) {
     try {
       String key = String.format("%s@%s", serviceId, instanceId);
-      return instances.get(key, new Callable<MicroserviceInstance>() {
-
-        @Override
-        public MicroserviceInstance call() {
-          MicroserviceInstance instance = DiscoveryManager.INSTANCE.getMicroserviceInstance(serviceId, instanceId);
-          if (instance == null) {
-            throw new IllegalArgumentException("instance id not exists.");
-          }
-          return instance;
+      return instances.get(key, () -> {
+        MicroserviceInstance instance = DiscoveryManager.INSTANCE.getMicroserviceInstance(serviceId, instanceId);
+        if (instance == null) {
+          throw new IllegalArgumentException("instance id not exists.");
         }
+        return instance;
       });
     } catch (ExecutionException | UncheckedExecutionException e) {
       logger.error("get microservice instance from cache failed, {}, {}", String.format("%s@%s", serviceId, instanceId),
diff --git a/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/SSLManagerTest.java b/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/SSLManagerTest.java
index a11b70e87..87eee1aac 100644
--- a/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/SSLManagerTest.java
+++ b/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/SSLManagerTest.java
@@ -27,8 +27,6 @@ import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
 import java.util.Enumeration;
 
-import javax.net.ssl.HandshakeCompletedEvent;
-import javax.net.ssl.HandshakeCompletedListener;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLServerSocket;
@@ -151,25 +149,19 @@ public class SSLManagerTest {
     try {
       clientsocket.connect(new InetSocketAddress("127.0.0.1", 8886));
 
-      new Thread() {
-        public void run() {
+      new Thread(() -> {
 
-          try {
-            SSLSocket s = (SSLSocket) serverSocket.accept();
-            s.addHandshakeCompletedListener(new HandshakeCompletedListener() {
+        try {
+          SSLSocket s = (SSLSocket) serverSocket.accept();
+          s.addHandshakeCompletedListener(arg0 -> {
 
-              @Override
-              public void handshakeCompleted(HandshakeCompletedEvent arg0) {
-
-              }
-            });
-            s.getOutputStream().write(new byte[] {0, 1});
-          } catch (IOException e) {
-            e.printStackTrace();
-             Assertions.fail("this should not happen");
-          }
+          });
+          s.getOutputStream().write(new byte[] {0, 1});
+        } catch (IOException e) {
+          e.printStackTrace();
+           Assertions.fail("this should not happen");
         }
-      }.start();
+      }).start();
 
       clientsocket.startHandshake();
       clientsocket.close();
diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpParser.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpParser.java
index 244d67af7..5a1f7b4af 100644
--- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpParser.java
+++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpParser.java
@@ -33,13 +33,10 @@ public class TestTcpParser {
 
   @Test
   public void test() throws UnsupportedEncodingException {
-    TcpBufferHandler output = new TcpBufferHandler() {
-      @Override
-      public void handle(long _msgId, Buffer _headerBuffer, Buffer _bodyBuffer) {
-        msgId = _msgId;
-        headerBuffer = _headerBuffer;
-        bodyBuffer = _bodyBuffer;
-      }
+    TcpBufferHandler output = (_msgId, _headerBuffer, _bodyBuffer) -> {
+      msgId = _msgId;
+      headerBuffer = _headerBuffer;
+      bodyBuffer = _bodyBuffer;
     };
 
     byte[] header = new byte[] {1, 2, 3};
diff --git a/handlers/handler-bizkeeper/src/test/java/org/apache/servicecomb/bizkeeper/TestBizkeeperHandler.java b/handlers/handler-bizkeeper/src/test/java/org/apache/servicecomb/bizkeeper/TestBizkeeperHandler.java
index 8a8d403f4..dc4c307bb 100644
--- a/handlers/handler-bizkeeper/src/test/java/org/apache/servicecomb/bizkeeper/TestBizkeeperHandler.java
+++ b/handlers/handler-bizkeeper/src/test/java/org/apache/servicecomb/bizkeeper/TestBizkeeperHandler.java
@@ -26,7 +26,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
 import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
 import com.netflix.hystrix.HystrixCommandProperties;
@@ -162,13 +161,10 @@ public class TestBizkeeperHandler extends BizkeeperHandler {
         .thenThrow(new RuntimeException());
     FallbackPolicyManager.addPolicy(policy);
     System.setProperty("servicecomb.fallbackpolicy.groupname.testHandleInError.policy", "throwException");
-    Mockito.doAnswer(new Answer<Void>() {
-      @Override
-      public Void answer(InvocationOnMock invocation) {
-        AsyncResponse asyncRsp = invocation.getArgument(0, AsyncResponse.class);
-        asyncRsp.fail(InvocationType.CONSUMER, new Exception("testHandleInError"));
-        return null;
-      }
+    Mockito.doAnswer((Answer<Void>) invocation -> {
+      AsyncResponse asyncRsp = invocation.getArgument(0, AsyncResponse.class);
+      asyncRsp.fail(InvocationType.CONSUMER, new Exception("testHandleInError"));
+      return null;
     }).when(invocation).next(Mockito.any(AsyncResponse.class));
     bizkeeperHandler.handle(invocation, f -> {
       Assertions.assertTrue(f.isFailed());
@@ -193,13 +189,10 @@ public class TestBizkeeperHandler extends BizkeeperHandler {
     Mockito.when(invocation.getOperationMeta()).thenReturn(Mockito.mock(OperationMeta.class));
     Mockito.when(invocation.getOperationMeta().getMicroserviceQualifiedName())
         .thenReturn("testHandleSuccess");
-    Mockito.doAnswer(new Answer<Void>() {
-      @Override
-      public Void answer(InvocationOnMock invocation) {
-        AsyncResponse asyncRsp = invocation.getArgument(0, AsyncResponse.class);
-        asyncRsp.success("");
-        return null;
-      }
+    Mockito.doAnswer((Answer<Void>) invocation -> {
+      AsyncResponse asyncRsp = invocation.getArgument(0, AsyncResponse.class);
+      asyncRsp.success("");
+      return null;
     }).when(invocation).next(Mockito.any(AsyncResponse.class));
     bizkeeperHandler.handle(invocation, f -> {
       Assertions.assertTrue(f.isSucceed());
diff --git a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceCreator.java b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceCreator.java
index e9ee9bd27..9098f5fc6 100644
--- a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceCreator.java
+++ b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceCreator.java
@@ -57,19 +57,15 @@ public class TestLoadBalanceCreator {
 
     List<ServerListFilterExt> filters = new ArrayList<>();
 
-    filters.add(new ServerListFilterExt() {
-      @Override
-      public List<ServiceCombServer> getFilteredListOfServers(List<ServiceCombServer> serverList,
-          Invocation invocation) {
-        List<ServiceCombServer> filteredServers = new ArrayList<>();
-        for (ServiceCombServer server : servers) {
-          if (server.getHost().equals("host1")) {
-            continue;
-          }
-          filteredServers.add(server);
+    filters.add((serverList, invocation1) -> {
+      List<ServiceCombServer> filteredServers = new ArrayList<>();
+      for (ServiceCombServer server1 : servers) {
+        if (server1.getHost().equals("host1")) {
+          continue;
         }
-        return filteredServers;
+        filteredServers.add(server1);
       }
+      return filteredServers;
     });
     lb.setFilters(filters);
 
@@ -109,19 +105,15 @@ public class TestLoadBalanceCreator {
     servers.add(server2);
 
     List<ServerListFilterExt> filters = new ArrayList<>();
-    filters.add(new ServerListFilterExt() {
-      @Override
-      public List<ServiceCombServer> getFilteredListOfServers(List<ServiceCombServer> serverList,
-          Invocation invocation) {
-        List<ServiceCombServer> filteredServers = new ArrayList<>();
-        for (ServiceCombServer server : servers) {
-          if (server.getHost().equals("host1")) {
-            continue;
-          }
-          filteredServers.add(server);
+    filters.add((serverList, invocation1) -> {
+      List<ServiceCombServer> filteredServers = new ArrayList<>();
+      for (ServiceCombServer server1 : servers) {
+        if (server1.getHost().equals("host1")) {
+          continue;
         }
-        return filteredServers;
+        filteredServers.add(server1);
       }
+      return filteredServers;
     });
     lb.setFilters(filters);
     new Expectations() {
@@ -165,19 +157,15 @@ public class TestLoadBalanceCreator {
     servers.add(server);
     servers.add(server2);
     List<ServerListFilterExt> filters = new ArrayList<>();
-    filters.add(new ServerListFilterExt() {
-      @Override
-      public List<ServiceCombServer> getFilteredListOfServers(List<ServiceCombServer> serverList,
-          Invocation invocation) {
-        List<ServiceCombServer> filteredServers = new ArrayList<>();
-        for (ServiceCombServer server : servers) {
-          if (server.getHost().equals("host1")) {
-            continue;
-          }
-          filteredServers.add(server);
+    filters.add((serverList, invocation1) -> {
+      List<ServiceCombServer> filteredServers = new ArrayList<>();
+      for (ServiceCombServer server1 : servers) {
+        if (server1.getHost().equals("host1")) {
+          continue;
         }
-        return filteredServers;
+        filteredServers.add(server1);
       }
+      return filteredServers;
     });
     lb.setFilters(filters);
     new Expectations() {
diff --git a/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/reference/RpcReferenceProcessor.java b/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/reference/RpcReferenceProcessor.java
index 71be2c9ca..fb7482003 100644
--- a/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/reference/RpcReferenceProcessor.java
+++ b/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/reference/RpcReferenceProcessor.java
@@ -33,11 +33,7 @@ public class RpcReferenceProcessor implements BeanPostProcessor, EmbeddedValueRe
   @Override
   public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
     // 扫描所有field,处理扩展的field标注
-    ReflectionUtils.doWithFields(bean.getClass(), new ReflectionUtils.FieldCallback() {
-      public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
-        processConsumerField(bean, field);
-      }
-    });
+    ReflectionUtils.doWithFields(bean.getClass(), field -> processConsumerField(bean, field));
 
     return bean;
   }