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

liubao 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 350e988  [SCB-1448]support class inheritance and interface inheritance 
with template type
350e988 is described below

commit 350e988c338204db11fd074fbd678f93ad41cfd2
Author: liubao <[email protected]>
AuthorDate: Sun Aug 18 12:22:52 2019 +0800

    [SCB-1448]support class inheritance and interface inheritance with template 
type
---
 .../it/schema/generic/AbstractBaseService.java     | 48 +++++++++++++++
 .../it/schema/generic/AbstractBean.java            | 30 ++++++++++
 .../it/schema/generic/IBaseService.java            | 30 ++++++++++
 .../servicecomb/it/schema/generic/IMyService.java  | 21 +++++++
 .../servicecomb/it/schema/generic/PersonBean.java  | 21 +++++++
 .../org/apache/servicecomb/it/ConsumerMain.java    |  2 +
 .../it/schema/generic/TestMyService.java           | 50 ++++++++++++++++
 .../servicecomb/it/schema/generic/MyEndpoint.java  | 28 +++++++++
 .../servicecomb/it/schema/generic/MyService.java   | 47 +++++++++++++++
 .../swagger/generator/core/OperationGenerator.java |  7 ++-
 .../parameter/AbstractParameterProcessor.java      |  2 +-
 .../swagger/generator/core/utils/ParamUtils.java   | 69 ++++++++++++++++++++--
 .../generator/pojo/utils/PojoParamUtils.java       |  2 +-
 .../generator/core/AbstractBaseService.java        | 48 +++++++++++++++
 .../swagger/generator/core/AbstractBean.java       | 30 ++++++++++
 .../swagger/generator/core/IBaseService.java       | 30 ++++++++++
 .../swagger/generator/core/IMyService.java         | 21 +++++++
 .../swagger/generator/core/MyEndpoint.java         | 26 ++++++++
 .../swagger/generator/core/PersonBean.java         | 21 +++++++
 .../swagger/generator/core/TestParamUtils.java     | 41 ++++++++++++-
 .../SpringmvcDefaultObjectParameterProcessor.java  |  3 +-
 .../SpringmvcDefaultParameterProcessor.java        |  3 +-
 .../SpringmvcDefaultSimpleParameterProcessor.java  |  2 +-
 .../SpringmvcDefaultParameterProcessorTest.java    |  3 +-
 .../swagger/engine/SwaggerEnvironment.java         |  5 +-
 .../arguments/ArgumentsMapperConfig.java           | 10 ++++
 .../arguments/ArgumentsMapperFactory.java          |  5 +-
 27 files changed, 589 insertions(+), 16 deletions(-)

diff --git 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/AbstractBaseService.java
 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/AbstractBaseService.java
new file mode 100644
index 0000000..9bdae50
--- /dev/null
+++ 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/AbstractBaseService.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+import java.util.List;
+
+public class AbstractBaseService<T extends AbstractBean> implements 
IBaseService<T> {
+  private IBaseService<T> target;
+
+  protected AbstractBaseService(IBaseService<T> t) {
+    target = t;
+  }
+
+  @Override
+  public T hello(T a) {
+    return target.hello(a);
+  }
+
+  @Override
+  public T[] helloBody(T[] a) {
+    return target.helloBody(a);
+  }
+
+  @Override
+  public List<T> helloList(List<T> a) {
+    return a;
+  }
+
+  @Override
+  public PersonBean actual() {
+    return target.actual();
+  }
+}
diff --git 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/AbstractBean.java
 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/AbstractBean.java
new file mode 100644
index 0000000..af0366e
--- /dev/null
+++ 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/AbstractBean.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+public abstract class AbstractBean {
+  private String name;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+}
diff --git 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/IBaseService.java
 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/IBaseService.java
new file mode 100644
index 0000000..b5fa98d
--- /dev/null
+++ 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/IBaseService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+import java.util.List;
+
+public interface IBaseService<T extends AbstractBean> {
+  T hello(T a);
+
+  T[] helloBody(T[] a);
+
+  List<T> helloList(List<T> a);
+
+  PersonBean actual();
+}
diff --git 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/IMyService.java
 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/IMyService.java
new file mode 100644
index 0000000..05f07f6
--- /dev/null
+++ 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/IMyService.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+public interface IMyService extends IBaseService<PersonBean> {
+}
diff --git 
a/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/PersonBean.java
 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/PersonBean.java
new file mode 100644
index 0000000..922fc3d
--- /dev/null
+++ 
b/integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/generic/PersonBean.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+public class PersonBean extends AbstractBean {
+}
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
index 0fb528d..63772a2 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
@@ -22,6 +22,7 @@ import org.apache.servicecomb.it.deploy.Deploys;
 import org.apache.servicecomb.it.deploy.MicroserviceDeploy;
 import org.apache.servicecomb.it.junit.ITJUnitUtils;
 import org.apache.servicecomb.it.schema.TestApiOperation;
+import org.apache.servicecomb.it.schema.generic.TestMyService;
 import org.apache.servicecomb.it.testcase.TestAcceptType;
 import org.apache.servicecomb.it.testcase.TestAnnotatedAttribute;
 import org.apache.servicecomb.it.testcase.TestApiOperationOverride;
@@ -105,6 +106,7 @@ public class ConsumerMain {
     ITJUnitUtils.runWithHighwayAndRest(TestChangeTransport.class);
     ITJUnitUtils.runWithHighwayAndRest(TestDataTypePrimitive.class);
     ITJUnitUtils.runWithHighwayAndRest(TestAnnotatedAttribute.class);
+    ITJUnitUtils.runWithHighwayAndRest(TestMyService.class);
 
     // only rest support default value feature
     ITJUnitUtils.runWithRest(TestDefaultValue.class);
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/generic/TestMyService.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/generic/TestMyService.java
new file mode 100644
index 0000000..1093772
--- /dev/null
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/generic/TestMyService.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.servicecomb.it.Consumers;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestMyService {
+  private static Consumers<IMyService> myservice = new 
Consumers<>("MyEndpoint",
+      IMyService.class);
+
+  @Test
+  public void testServiceInoke() {
+    PersonBean bean = new PersonBean();
+    bean.setName("p");
+    PersonBean resultBean = myservice.getIntf().hello(bean);
+    Assert.assertEquals("p", resultBean.getName());
+
+    resultBean = myservice.getIntf().actual();
+    Assert.assertEquals("p", resultBean.getName());
+
+    PersonBean[] beanArray = new PersonBean[] {bean};
+    PersonBean[] beanArrayResult = myservice.getIntf().helloBody(beanArray);
+    Assert.assertEquals("p", beanArrayResult[0].getName());
+
+    List<PersonBean> beanList = new ArrayList<>();
+    beanList.add(bean);
+    List<PersonBean> beanListResult = myservice.getIntf().helloList(beanList);
+    Assert.assertEquals("p", beanListResult.get(0).getName());
+  }
+}
diff --git 
a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/generic/MyEndpoint.java
 
b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/generic/MyEndpoint.java
new file mode 100644
index 0000000..9955154
--- /dev/null
+++ 
b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/generic/MyEndpoint.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.schema.generic;
+
+import org.apache.servicecomb.provider.pojo.RpcSchema;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@RpcSchema(schemaId = "MyEndpoint")
+public class MyEndpoint extends AbstractBaseService<PersonBean> implements 
IMyService {
+  public MyEndpoint(@Autowired IMyService other) {
+    super(other);
+  }
+}
diff --git 
a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/generic/MyService.java
 
b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/generic/MyService.java
new file mode 100644
index 0000000..51ef504
--- /dev/null
+++ 
b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/generic/MyService.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicecomb.it.schema.generic;
+
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class MyService implements IMyService {
+  @Override
+  public PersonBean hello(PersonBean a) {
+    return a;
+  }
+
+  @Override
+  public PersonBean[] helloBody(PersonBean[] a) {
+    return a;
+  }
+
+  @Override
+  public List<PersonBean> helloList(List<PersonBean> a) {
+    return a;
+  }
+
+  @Override
+  public PersonBean actual() {
+    PersonBean p = new PersonBean();
+    p.setName("p");
+    return p;
+  }
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/OperationGenerator.java
 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/OperationGenerator.java
index 3a3c3fd..64d59e5 100644
--- 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/OperationGenerator.java
+++ 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/OperationGenerator.java
@@ -424,13 +424,18 @@ public class OperationGenerator {
     }
 
     ResponseTypeProcessor processor = 
context.findResponseTypeProcessor(responseType);
-    return processor.process(this, providerMethod.getGenericReturnType());
+    return processor.process(this, ParamUtils
+        .getGenericParameterType(getCls(), providerMethod.getDeclaringClass(), 
providerMethod.getGenericReturnType()));
   }
 
   public Method getProviderMethod() {
     return providerMethod;
   }
 
+  public Class<?> getCls() {
+    return swaggerGenerator.getCls();
+  }
+
   protected void addOperationToSwagger() {
     if (StringUtils.isEmpty(httpMethod)) {
       return;
diff --git 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/processor/parameter/AbstractParameterProcessor.java
 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/processor/parameter/AbstractParameterProcessor.java
index 54ec775..7d61e60 100644
--- 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/processor/parameter/AbstractParameterProcessor.java
+++ 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/processor/parameter/AbstractParameterProcessor.java
@@ -44,7 +44,7 @@ public abstract class AbstractParameterProcessor<T extends 
AbstractSerializableP
 
   protected void setParameterType(OperationGenerator operationGenerator, int 
paramIdx,
       T parameter) {
-    ParamUtils.setParameterType(operationGenerator.getSwagger(),
+    ParamUtils.setParameterType(operationGenerator,
         operationGenerator.getProviderMethod(),
         paramIdx,
         parameter);
diff --git 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
index 79a579c..0d1160a 100644
--- 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
+++ 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/utils/ParamUtils.java
@@ -17,13 +17,18 @@
 
 package org.apache.servicecomb.swagger.generator.core.utils;
 
+import java.lang.reflect.Array;
 import java.lang.reflect.Executable;
+import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.reflect.TypeUtils;
 import org.apache.servicecomb.swagger.generator.core.OperationGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -84,10 +89,62 @@ public final class ParamUtils {
     return paramName;
   }
 
-  public static Type getGenericParameterType(Method method, int paramIdx) {
-    return method.getGenericParameterTypes()[paramIdx];
+  public static Type getGenericParameterType(Class<?> clazz, Method method, 
int paramIdx) {
+    Type type = method.getGenericParameterTypes()[paramIdx];
+    return getGenericParameterType(clazz, method.getDeclaringClass(), type);
   }
 
+  public static Type getGenericParameterType(Class<?> mainClass, Class<?> 
declaringClass, Type type) {
+    if (type instanceof Class<?>) {
+      return type;
+    }
+
+    if (type instanceof TypeVariable) {
+      TypeVariable<?>[] typeVariables = declaringClass.getTypeParameters();
+      Type[] actualTypes;
+      if (mainClass.getGenericSuperclass() != null) {
+        actualTypes = getActualTypes(mainClass.getGenericSuperclass());
+      } else {
+        actualTypes = new Type[0];
+        Type[] interfaceTypes = mainClass.getGenericInterfaces();
+        for (Type t : interfaceTypes) {
+          Type[] ttTypes = getActualTypes(t);
+          Type[] tempTypes = new Type[actualTypes.length + ttTypes.length];
+          System.arraycopy(actualTypes, 0, tempTypes, 0, actualTypes.length);
+          System.arraycopy(ttTypes, 0, tempTypes, actualTypes.length, 
ttTypes.length);
+          actualTypes = tempTypes;
+        }
+      }
+      for (int i = 0; i < typeVariables.length; i++) {
+        if (typeVariables[i] == type) {
+          return actualTypes[i];
+        }
+      }
+    } else if (type instanceof GenericArrayType) {
+      Class<?> t = (Class<?>) getGenericParameterType(mainClass, 
declaringClass,
+          ((GenericArrayType) type).getGenericComponentType());
+      return Array.newInstance(t, 0).getClass();
+    } else if (type instanceof ParameterizedType) {
+      ParameterizedType parameterizedType = (ParameterizedType) type;
+      Type[] targetTypes = new 
Type[parameterizedType.getActualTypeArguments().length];
+      for (int i = 0; i < parameterizedType.getActualTypeArguments().length; 
i++) {
+        targetTypes[i] = getGenericParameterType(mainClass, declaringClass,
+            parameterizedType.getActualTypeArguments()[i]);
+      }
+      return TypeUtils.parameterize((Class) parameterizedType.getRawType(), 
targetTypes);
+    }
+    throw new IllegalArgumentException(String
+        .format("not implement (%s) (%s) (%s)", mainClass.getName(), 
declaringClass.getName(), type.getTypeName()));
+  }
+
+  private static Type[] getActualTypes(Type type) {
+    if (type instanceof ParameterizedType) {
+      return ((ParameterizedType) type).getActualTypeArguments();
+    }
+    return new Type[0];
+  }
+
+
   public static String generateBodyParameterName(Method method) {
     return method.getName() + "Body";
   }
@@ -96,7 +153,7 @@ public final class ParamUtils {
       int paramIdx) {
     Method method = operationGenerator.getProviderMethod();
     String paramName = getParameterName(method, paramIdx);
-    Type paramType = getGenericParameterType(method, paramIdx);
+    Type paramType = getGenericParameterType(operationGenerator.getCls(), 
method, paramIdx);
     return createBodyParameter(operationGenerator.getSwagger(), paramName, 
paramType);
   }
 
@@ -131,9 +188,11 @@ public final class ParamUtils {
   }
 
 
-  public static void setParameterType(Swagger swagger, Method method, int 
paramIdx,
+  public static void setParameterType(OperationGenerator operationGenerator, 
Method method, int paramIdx,
       AbstractSerializableParameter<?> parameter) {
-    Type paramType = ParamUtils.getGenericParameterType(method, paramIdx);
+    Swagger swagger = operationGenerator.getSwagger();
+
+    Type paramType = 
ParamUtils.getGenericParameterType(operationGenerator.getCls(), method, 
paramIdx);
 
     ParamUtils.addDefinitions(swagger, paramType);
 
diff --git 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/pojo/utils/PojoParamUtils.java
 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/pojo/utils/PojoParamUtils.java
index 33492f5..5a1946f 100644
--- 
a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/pojo/utils/PojoParamUtils.java
+++ 
b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/pojo/utils/PojoParamUtils.java
@@ -34,7 +34,7 @@ public final class PojoParamUtils {
       int paramIdx) {
     Method method = operationGenerator.getProviderMethod();
     String paramName = ParamUtils.getParameterName(method, paramIdx);
-    Type paramType = ParamUtils.getGenericParameterType(method, paramIdx);
+    Type paramType = 
ParamUtils.getGenericParameterType(operationGenerator.getCls(), method, 
paramIdx);
     return createPendingBodyParameter(operationGenerator, paramName, 
paramType);
   }
 
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/AbstractBaseService.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/AbstractBaseService.java
new file mode 100644
index 0000000..8a6f37c
--- /dev/null
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/AbstractBaseService.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.swagger.generator.core;
+
+import java.util.List;
+
+public class AbstractBaseService<T extends AbstractBean> implements 
IBaseService<T> {
+  private IBaseService<T> target;
+
+  protected AbstractBaseService(IBaseService<T> t) {
+    target = t;
+  }
+
+  @Override
+  public T hello(T a) {
+    return target.hello(a);
+  }
+
+  @Override
+  public T[] helloBody(T[] a) {
+    return target.helloBody(a);
+  }
+
+  @Override
+  public List<T> helloList(List<T> a) {
+    return a;
+  }
+
+  @Override
+  public PersonBean actual() {
+    return target.actual();
+  }
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/AbstractBean.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/AbstractBean.java
new file mode 100644
index 0000000..cca7929
--- /dev/null
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/AbstractBean.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.swagger.generator.core;
+
+public abstract class AbstractBean {
+  private String name;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/IBaseService.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/IBaseService.java
new file mode 100644
index 0000000..09db55e
--- /dev/null
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/IBaseService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.swagger.generator.core;
+
+import java.util.List;
+
+public interface IBaseService<T extends AbstractBean> {
+  T hello(T a);
+
+  T[] helloBody(T[] a);
+
+  List<T> helloList(List<T> a);
+
+  PersonBean actual();
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/IMyService.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/IMyService.java
new file mode 100644
index 0000000..99dc529
--- /dev/null
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/IMyService.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.swagger.generator.core;
+
+public interface IMyService extends IBaseService<PersonBean> {
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/MyEndpoint.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/MyEndpoint.java
new file mode 100644
index 0000000..1792814
--- /dev/null
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/MyEndpoint.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.swagger.generator.core;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class MyEndpoint extends AbstractBaseService<PersonBean> implements 
IMyService {
+  public MyEndpoint(@Autowired IMyService other) {
+    super(other);
+  }
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/PersonBean.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/PersonBean.java
new file mode 100644
index 0000000..b2c4eff
--- /dev/null
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/PersonBean.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.swagger.generator.core;
+
+public class PersonBean extends AbstractBean {
+}
diff --git 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestParamUtils.java
 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestParamUtils.java
index cc5d4ad..450d8a2 100644
--- 
a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestParamUtils.java
+++ 
b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestParamUtils.java
@@ -19,18 +19,19 @@ package org.apache.servicecomb.swagger.generator.core;
 
 import static junit.framework.TestCase.fail;
 import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.when;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import io.swagger.models.Swagger;
-
+import org.apache.commons.lang3.reflect.TypeUtils;
 import org.apache.servicecomb.swagger.generator.core.pojo.TestType1;
 import org.apache.servicecomb.swagger.generator.core.pojo.TestType2;
 import org.apache.servicecomb.swagger.generator.core.utils.ClassUtils;
@@ -39,6 +40,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+import io.swagger.models.Swagger;
 import io.swagger.models.parameters.AbstractSerializableParameter;
 import io.swagger.models.parameters.HeaderParameter;
 import io.swagger.models.parameters.Parameter;
@@ -150,4 +152,39 @@ public class TestParamUtils {
     ParamUtils.addDefinitions(swagger, f1);
     ParamUtils.addDefinitions(swagger, f2);
   }
+
+  @Test
+  public void testGenericTypeInheritance() throws Exception {
+    Method hello = IMyService.class.getMethod("hello", AbstractBean.class);
+    assertEquals(PersonBean.class,
+        ParamUtils.getGenericParameterType(IMyService.class, 
IBaseService.class, hello.getGenericReturnType()));
+
+    hello = MyEndpoint.class.getMethod("hello", AbstractBean.class);
+    assertEquals(PersonBean.class,
+        ParamUtils.getGenericParameterType(MyEndpoint.class, 
AbstractBaseService.class, hello.getGenericReturnType()));
+
+    Method helloBody = IMyService.class.getMethod("helloBody", 
AbstractBean[].class);
+    assertEquals(PersonBean[].class,
+        ParamUtils.getGenericParameterType(IMyService.class, 
IBaseService.class, helloBody.getGenericReturnType()));
+
+    helloBody = MyEndpoint.class.getMethod("helloBody", AbstractBean[].class);
+    assertEquals(PersonBean[].class, ParamUtils
+        .getGenericParameterType(MyEndpoint.class, AbstractBaseService.class, 
helloBody.getGenericReturnType()));
+
+    Method helloList = IMyService.class.getMethod("helloList", List.class);
+    assertEquals(TypeUtils.parameterize(List.class, PersonBean.class),
+        ParamUtils.getGenericParameterType(IMyService.class, 
IBaseService.class, helloList.getGenericReturnType()));
+
+    helloList = MyEndpoint.class.getMethod("helloList", List.class);
+    assertEquals(TypeUtils.parameterize(List.class, PersonBean.class), 
ParamUtils
+        .getGenericParameterType(MyEndpoint.class, AbstractBaseService.class, 
helloList.getGenericReturnType()));
+
+    Method actual = IMyService.class.getMethod("actual");
+    assertEquals(PersonBean.class,
+        ParamUtils.getGenericParameterType(IMyService.class, 
IBaseService.class, actual.getGenericReturnType()));
+
+    helloList = MyEndpoint.class.getMethod("actual");
+    assertEquals(PersonBean.class,
+        ParamUtils.getGenericParameterType(MyEndpoint.class, 
AbstractBaseService.class, actual.getGenericReturnType()));
+  }
 }
diff --git 
a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultObjectParameterProcessor.java
 
b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultObjectParameterProcessor.java
index ed0aa9e..aa876a7 100644
--- 
a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultObjectParameterProcessor.java
+++ 
b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultObjectParameterProcessor.java
@@ -66,7 +66,8 @@ public class SpringmvcDefaultObjectParameterProcessor 
implements DefaultParamete
   }
 
   private Model getParamModel(OperationGenerator operationGenerator, int 
paramIndex) {
-    Type paramType = 
ParamUtils.getGenericParameterType(operationGenerator.getProviderMethod(), 
paramIndex);
+    Type paramType = ParamUtils
+        .getGenericParameterType(operationGenerator.getCls(), 
operationGenerator.getProviderMethod(), paramIndex);
     Property property = 
ModelConverters.getInstance().readAsProperty(paramType);
     // ensure type
     if (!RefProperty.class.isInstance(property)) {
diff --git 
a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessor.java
 
b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessor.java
index d9b5a5d..1a46f00 100644
--- 
a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessor.java
+++ 
b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessor.java
@@ -34,7 +34,8 @@ public class SpringmvcDefaultParameterProcessor implements 
DefaultParameterProce
 
   @Override
   public void process(OperationGenerator operationGenerator, int paramIdx) {
-    Type paramType = 
ParamUtils.getGenericParameterType(operationGenerator.getProviderMethod(), 
paramIdx);
+    Type paramType = ParamUtils
+        .getGenericParameterType(operationGenerator.getCls(), 
operationGenerator.getProviderMethod(), paramIdx);
     Property property = 
ModelConverters.getInstance().readAsProperty(paramType);
 
     if (RefProperty.class.isInstance(property)) {
diff --git 
a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultSimpleParameterProcessor.java
 
b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultSimpleParameterProcessor.java
index 3d9f5a1..eef7b0c 100644
--- 
a/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultSimpleParameterProcessor.java
+++ 
b/swagger/swagger-generator/generator-springmvc/src/main/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultSimpleParameterProcessor.java
@@ -31,7 +31,7 @@ public class SpringmvcDefaultSimpleParameterProcessor 
implements DefaultParamete
 
     QueryParameter queryParameter = new QueryParameter();
     queryParameter.setName(paramName);
-    ParamUtils.setParameterType(operationGenerator.getSwagger(),
+    ParamUtils.setParameterType(operationGenerator,
         operationGenerator.getProviderMethod(),
         paramIdx,
         queryParameter);
diff --git 
a/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessorTest.java
 
b/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessorTest.java
index 4d194a1..da8a901 100644
--- 
a/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessorTest.java
+++ 
b/swagger/swagger-generator/generator-springmvc/src/test/java/org/apache/servicecomb/swagger/generator/springmvc/processor/parameter/SpringmvcDefaultParameterProcessorTest.java
@@ -92,11 +92,12 @@ public class SpringmvcDefaultParameterProcessorTest {
       new SpringmvcDefaultParameterProcessor().process(operationGenerator, 1);
       fail("an error is expected!");
     } catch (Error e) {
+      // toString is different between apache library ParameterizedTypeImpl 
and sun libray
       Assert.assertEquals(
           "cannot process parameter [integerList], 
method=org.apache.servicecomb.swagger.generator.springmvc"
               + 
".processor.parameter.SpringmvcDefaultParameterProcessorTest$TestProvider:testUnsupportedParamType,
 "
               + "paramIdx=1, 
type=java.util.List<org.apache.servicecomb.swagger.generator.springmvc.processor.parameter"
-              + ".SpringmvcDefaultParameterProcessorTest$TestParam>",
+              + ".SpringmvcDefaultParameterProcessorTest.TestParam>",
           e.getMessage());
     }
     try {
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/engine/SwaggerEnvironment.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/engine/SwaggerEnvironment.java
index d00ff18..b3a2d55 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/engine/SwaggerEnvironment.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/engine/SwaggerEnvironment.java
@@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 import org.apache.servicecomb.foundation.common.utils.ReflectUtils;
 import 
org.apache.servicecomb.swagger.generator.core.CompositeSwaggerGeneratorContext;
+import org.apache.servicecomb.swagger.generator.core.utils.ParamUtils;
 import 
org.apache.servicecomb.swagger.invocation.arguments.ArgumentsMapperConfig;
 import 
org.apache.servicecomb.swagger.invocation.arguments.consumer.ConsumerArgumentsMapper;
 import 
org.apache.servicecomb.swagger.invocation.arguments.consumer.ConsumerArgumentsMapperFactory;
@@ -128,12 +129,13 @@ public class SwaggerEnvironment {
       ArgumentsMapperConfig config = new ArgumentsMapperConfig();
       config.setSwaggerMethod(swaggerMethod);
       config.setProviderMethod(consumerMethod);
+      config.setClz(consumerIntf);
 
       ConsumerArgumentsMapper argsMapper =
           consumerArgumentsFactory.createArgumentsMapper(config);
       ConsumerResponseMapper responseMapper = 
consumerResponseMapperFactorys.createResponseMapper(
           swaggerMethod.getGenericReturnType(),
-          consumerMethod.getGenericReturnType());
+          ParamUtils.getGenericParameterType(consumerIntf, 
consumerMethod.getDeclaringClass(), consumerMethod.getGenericReturnType()));
 
       SwaggerConsumerOperation op = new SwaggerConsumerOperation();
       op.setName(swaggerMethodName);
@@ -180,6 +182,7 @@ public class SwaggerEnvironment {
       ArgumentsMapperConfig config = new ArgumentsMapperConfig();
       config.setSwaggerMethod(swaggerMethod);
       config.setProviderMethod(producerMethod);
+      config.setClz(producerCls);
       config.setSwaggerOperation(swaggerOperationMap.get(methodName));
       
config.setSwaggerGeneratorContext(compositeSwaggerGeneratorContext.selectContext(producerCls));
 
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperConfig.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperConfig.java
index da27083..8147649 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperConfig.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperConfig.java
@@ -35,6 +35,8 @@ public class ArgumentsMapperConfig {
 
   private SwaggerGeneratorContext swaggerGeneratorContext;
 
+  private Class<?> clz;
+
   // output
   private List<ArgumentMapper> argumentMapperList = new ArrayList<>();
 
@@ -83,6 +85,14 @@ public class ArgumentsMapperConfig {
     argumentMapperList.add(argumentMapper);
   }
 
+  public Class<?> getClz() {
+    return clz;
+  }
+
+  public void setClz(Class<?> clz) {
+    this.clz = clz;
+  }
+
   @Override
   public String toString() {
     final StringBuilder sb = new StringBuilder("ArgumentsMapperConfig{");
diff --git 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperFactory.java
 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperFactory.java
index 001f808..ea4b4fd 100644
--- 
a/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperFactory.java
+++ 
b/swagger/swagger-invocation/invocation-core/src/main/java/org/apache/servicecomb/swagger/invocation/arguments/ArgumentsMapperFactory.java
@@ -128,7 +128,10 @@ public abstract class ArgumentsMapperFactory<T> {
     final Annotation[][] parameterAnnotations = 
config.getProviderMethod().getParameterAnnotations();
     Type[] providerParameterTypes = 
config.getProviderMethod().getGenericParameterTypes();
     for (int providerIdx = 0; providerIdx < providerParameterTypes.length; 
providerIdx++) {
-      Type parameterType = providerParameterTypes[providerIdx];
+
+      Type parameterType = ParamUtils
+          .getGenericParameterType(config.getClz(), 
config.getProviderMethod().getDeclaringClass(),
+              providerParameterTypes[providerIdx]);
       ContextArgumentMapperFactory factory = findFactory(parameterType);
       if (factory != null) {
         ArgumentMapper mapper = factory.create(providerIdx);

Reply via email to