- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of 
this repository and believe that this is not a duplicate.
- [ ] I have checked the 
[FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository 
and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.7.3
* Operating System version: linux
* Java version: 1.8

### Steps to reproduce this issue

1. MapTypeBuilder 中写死map泛型参数数目必须为2,导致在使用外部开源的原生类型的map判断报错。
```java
@Override
  public TypeDefinition build(Type type, Class<?> clazz, Map<Class<?>, 
TypeDefinition> typeCache) {
    if (!(type instanceof ParameterizedType)) {
      return new TypeDefinition(clazz.getName());
    }

    ParameterizedType parameterizedType = (ParameterizedType) type;
    Type[] actualTypeArgs = parameterizedType.getActualTypeArguments();
    if (actualTypeArgs == null || actualTypeArgs.length != 2) {
      throw new IllegalArgumentException(MessageFormat.format(
          "[ServiceDefinitionBuilder] Map type [{0}] with unexpected amount of 
arguments [{1}]." + actualTypeArgs,
          new Object[] {type, actualTypeArgs}));
    }

    for (Type actualType : actualTypeArgs) {
      if (actualType instanceof ParameterizedType) {
        // Nested collection or map.
        Class<?> rawType = (Class<?>) ((ParameterizedType) 
actualType).getRawType();
        TypeDefinitionBuilder.build(actualType, rawType, typeCache);
      } else if (actualType instanceof Class<?>) {
        Class<?> actualClass = (Class<?>) actualType;
        if (actualClass.isArray() || actualClass.isEnum()) {
          TypeDefinitionBuilder.build(null, actualClass, typeCache);
        } else {
          DefaultTypeBuilder.build(actualClass, typeCache);
        }
      }
    }
```

如下所示,参数长度为1。
```java
package it.unimi.dsi.fastutil.ints;
public interface Int2ObjectMap<V> extends Int2ObjectFunction<V>, Map<Integer, 
V> {}
```
该类来自于
<dependency>
    <groupId>it.unimi.dsi</groupId>
    <artifactId>fastutil</artifactId>
</dependency>

### Expected Result
是否可以去除该判断。


[ Full content available at: https://github.com/apache/dubbo/issues/5122 ]
This message was relayed via gitbox.apache.org for 
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to