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

albumenj pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new e6a6ba890d style: Eliminate some IDE warnings (#10626)
e6a6ba890d is described below

commit e6a6ba890db6e3be9751abaedb6631fbc3e9a443
Author: sunchaser-lilu <[email protected]>
AuthorDate: Fri Sep 16 11:29:30 2022 +0800

    style: Eliminate some IDE warnings (#10626)
---
 .../dubbo/common/beans/support/InstantiationStrategy.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/beans/support/InstantiationStrategy.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/beans/support/InstantiationStrategy.java
index b4ca8b49b1..9d73843279 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/beans/support/InstantiationStrategy.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/beans/support/InstantiationStrategy.java
@@ -33,7 +33,7 @@ import java.util.List;
  */
 public class InstantiationStrategy {
 
-    private ScopeModelAccessor scopeModelAccessor;
+    private final ScopeModelAccessor scopeModelAccessor;
 
     public InstantiationStrategy() {
         this(null);
@@ -43,6 +43,7 @@ public class InstantiationStrategy {
         this.scopeModelAccessor = scopeModelAccessor;
     }
 
+    @SuppressWarnings("unchecked")
     public <T> T instantiate(Class<T> type) throws 
ReflectiveOperationException {
 
         // should not use default constructor directly, maybe also has another 
constructor matched scope model arguments
@@ -55,7 +56,7 @@ public class InstantiationStrategy {
         }
 
         // 2. use matched constructor if found
-        List<Constructor> matchedConstructors = new ArrayList<>();
+        List<Constructor<?>> matchedConstructors = new ArrayList<>();
         Constructor<?>[] declaredConstructors = type.getConstructors();
         for (Constructor<?> constructor : declaredConstructors) {
             if (isMatched(constructor)) {
@@ -71,7 +72,7 @@ public class InstantiationStrategy {
         // 1. the only matched constructor with parameters
         // 2. default constructor if absent
 
-        Constructor targetConstructor;
+        Constructor<?> targetConstructor;
         if (matchedConstructors.size() > 1) {
             throw new IllegalArgumentException("Expect only one but found " +
                 matchedConstructors.size() + " matched constructors for type: 
" + type.getName() +
@@ -85,7 +86,7 @@ public class InstantiationStrategy {
         }
 
         // create instance with arguments
-        Class[] parameterTypes = targetConstructor.getParameterTypes();
+        Class<?>[] parameterTypes = targetConstructor.getParameterTypes();
         Object[] args = new Object[parameterTypes.length];
         for (int i = 0; i < parameterTypes.length; i++) {
             args[i] = getArgumentValueForType(parameterTypes[i]);
@@ -106,7 +107,7 @@ public class InstantiationStrategy {
         return ScopeModel.class.isAssignableFrom(parameterType);
     }
 
-    private Object getArgumentValueForType(Class parameterType) {
+    private Object getArgumentValueForType(Class<?> parameterType) {
         // get scope mode value
         if (scopeModelAccessor != null) {
             if (parameterType == ScopeModel.class) {

Reply via email to