diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2012-04-04 15:21:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2012-04-04 15:21:37 +0000 |
commit | 945f8268dfcd6213164a32470077319a196398b5 (patch) | |
tree | 9b5805cdd091181be1f185c665b3b2bae5d0e9e6 /sca-java-2.x/trunk/modules | |
parent | efa7042ce40b7a12539d0a7c6771575ad3cb2cde (diff) |
Fix the ASM code gen for long/double parameters
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1309451 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
5 files changed, 12 insertions, 6 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 c9fc8aafe3..4209ee92f6 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 @@ -101,9 +101,15 @@ public class RootResourceClassGenerator implements Opcodes { mv.visitCode(); mv.visitFieldInsn(GETSTATIC, className, DELEGATE_FIELD, getSignature(interfaceName)); Class<?>[] paramTypes = method.getParameterTypes(); + int index = 1; for (int i = 0; i < paramTypes.length; i++) { String signature = Type.getDescriptor(paramTypes[i]); - mv.visitVarInsn(CodeGenerationHelper.getLoadOPCode(signature), i + 1); + mv.visitVarInsn(CodeGenerationHelper.getLoadOPCode(signature), index); + if(paramTypes[i] == long.class || paramTypes[i] == double.class) { + index+=2; // Increase the index by 2 for the 64bit numbers + } else { + index++; + } } mv.visitMethodInsn(INVOKEINTERFACE, interfaceName, method.getName(), methodDescriptor); diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/MockedResource.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/MockedResource.java index 7940a9e145..54516f951d 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/MockedResource.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/MockedResource.java @@ -32,7 +32,7 @@ public class MockedResource implements Resource { return value; } - public void create(String value) { + public void create(long id, String value) { this.value = value; } diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/Resource.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/Resource.java index 00d0fe9264..8054abf540 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/Resource.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/Resource.java @@ -42,7 +42,7 @@ public interface Resource { void update(String value); @POST - void create(String value); + void create(long id, String value); @DELETE void delete(); diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java index 40e0bf7d2a..55e725f8b9 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/ResourceWrapper.java @@ -39,8 +39,8 @@ public class ResourceWrapper implements Resource { return delegate.get(); } - public void create(String value) { - delegate.create(value); + public void create(long id, String value) { + delegate.create(id, value); } public void delete() { diff --git a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java index 0a761df6b8..40c70b8d6a 100644 --- a/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java +++ b/sca-java-2.x/trunk/modules/interface-java-jaxrs/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxrs/RootResourceClassGeneratorTestCase.java @@ -74,7 +74,7 @@ public class RootResourceClassGeneratorTestCase { Resource resourceProxy = (Resource)cls.newInstance(); Assert.assertNull(resourceProxy.get()); - resourceProxy.create("123"); + resourceProxy.create(1l, "123"); Assert.assertEquals("123", resourceProxy.get()); resourceProxy.update("ABC"); Assert.assertEquals("ABC", resourceProxy.get()); |