tiger822 opened a new issue #9847:
URL: https://github.com/apache/dubbo/issues/9847


   
   ### Environment
   
   * Dubbo version: 3.0.3
   * Operating System version: windows10
   * Java version: 11
   
   ### Steps to reproduce this issue
   
   1. 我定义了一个返回类型 ResponseEntity
      public class ResponseEntity<T> extends LinkedHashMap<String,Object> 
implements Serializable {...}
      @Override
     public ResponseEntity<String> sayHello(String a) {
       return ResponseEntity.fromResult(0,a);
     }
     
那么启动时会报错,org.apache.dubbo.metadata.definition.builder.MapTypeBuilder#build,if 
(actualTypeArgsLength != 2) {。。。}
     不明白为什么要写死
   2.如果我将ResponseEntity改为2目:
   public class ResponseEntity<T,Object> extends LinkedHashMap<String,Object>  
implements Serializable {...}
   @Override
     public ResponseEntity<String,Object> sayHello(String a) {
       return ResponseEntity.fromResult(0,a);
     }
   ...这样就可以,这算是一个bug么? 我看21年的时候有人提出过,但新版本也没改善。
   
   
   
   ### Expected Behavior
   
   <!-- What do you expect from the above steps?-->
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   
   If there is an exception, please attach the exception trace:
   
   ```
   Just put your stack trace here!
   
   Caused by: java.lang.IllegalArgumentException: [ServiceDefinitionBuilder] 
Map type [com.freestyle.common.models.ResponseEntity<java.lang.String>] with 
unexpected amount of arguments [[Ljava.lang.reflect.Type;@3c1f2651].[class 
java.lang.String]
        at 
org.apache.dubbo.metadata.definition.builder.MapTypeBuilder.build(MapTypeBuilder.java:56)
        at 
org.apache.dubbo.metadata.definition.TypeDefinitionBuilder.build(TypeDefinitionBuilder.java:56)
        at 
org.apache.dubbo.metadata.definition.TypeDefinitionBuilder.build(TypeDefinitionBuilder.java:80)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to