diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-17 20:36:53 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-17 20:36:53 +0000 |
commit | 94969a30859866338a1846bc7287f83690cb7b5c (patch) | |
tree | 9948bd2b26fff62001160e13ffa9b37c70c8473e /sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main | |
parent | 1099bc9633be66080426a8683b702c3739318fcb (diff) |
Make sure the generics are generated into the Resource implementation class so that Wink won't get confused
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1104536 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main')
-rw-r--r-- | sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java index c3d1ec4421..c9fc8aafe3 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGenerator.java @@ -89,8 +89,14 @@ public class RootResourceClassGenerator implements Opcodes { String produces) { String methodDescriptor = Type.getMethodDescriptor(method); + String signatureString = getSignature(method); + MethodVisitor mv = - cw.visitMethod(ACC_PUBLIC, method.getName(), methodDescriptor, null, getExceptionInternalNames(method)); + cw.visitMethod(ACC_PUBLIC, + method.getName(), + methodDescriptor, + signatureString, + getExceptionInternalNames(method)); mv.visitCode(); mv.visitFieldInsn(GETSTATIC, className, DELEGATE_FIELD, getSignature(interfaceName)); @@ -108,6 +114,21 @@ public class RootResourceClassGenerator implements Opcodes { mv.visitEnd(); } + /** + * [rfeng] A hack to get the generic method signature + * @param method + * @return + */ + private static String getSignature(Method method) { + try { + Field field = method.getClass().getDeclaredField("signature"); + field.setAccessible(true); + return (String)field.get(method); + } catch (Throwable e) { + return null; + } + } + private static String[] getExceptionInternalNames(Method method) { Class<?>[] types = method.getExceptionTypes(); if (types.length == 0) { |