diff options
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) { |