[
https://issues.apache.org/jira/browse/TUSCANY-3926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13195233#comment-13195233
]
Sebastian Millies commented on TUSCANY-3926:
--------------------------------------------
I encounter the same problem.In JavaInterfaceUtil#match() the input type will
have the value of the type parameter, but the method will have the erased type
(Object), whcih do not match.
> tuscany can't support generic interface perfectly
> -------------------------------------------------
>
> Key: TUSCANY-3926
> URL: https://issues.apache.org/jira/browse/TUSCANY-3926
> Project: Tuscany
> Issue Type: Bug
> Components: Java SCA Assembly Model
> Affects Versions: Java-SCA-1.6.2
> Environment: tuscany 1.6.x
> Reporter: fzhong
> Attachments: test-rmi-service.rar
>
>
> I created a generic interface as an component interface,I got an error when
> i called the generic method exposed by the component service.See more details
> as follows:
> 1.generic interface
> public interface OtaService<T> {
> /**
> * 根据id获取对象
> * */
> public T get(Long id);
> /**
> *
> * */
> public List<T> queryList(T t,boolean fuzzy);
> /**
> * 根据id获取对象
> * */
> public List<T> getList(Long...id);
> /**
> * 根据id删除对象
> * */
> public void del(Long...id);
> /**
> * 新增对象
> * */
> public Long insert(T t);
> /**
> * 更新对象
> * */
> public void update(T t);
> }
> 2.@Remotable
> public interface UserService extends OtaService<User>{
> /**
> * 校验用户名密码,通过返回用户ID,其他返回null
> * */
> public Long checkUserPassword(String username,String password);
> /**
> * 根据角色获取用户列表
> * */
> public List<User> getUserByRole(Long... roleId);
> /**
> * 根据授权获取用户列表
> * */
> public List<User> getUserByAuthority(Long... authorityId);
> /**
> * 根据资源获取用户列表
> * */
> public List<User> getUserByResource(Long... resourceId);
> }
> UserService is an remotable interface ,that extends the OtaService interface.
> 3.UserServiceImpl implemented UserService interface.You can get it from
> attachment;
> When I called the method that parameter types are generic,such as
> queryList(T t,boolean fuzzy), insert(T t),update(T t),it threw exceptions.
> java.lang.NullPointerException
> at
> java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:157)
> at
> java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:730)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.getInvocationChain(RuntimeWireImpl.java:144)
> at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:103)
> at
> org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:98)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWireImpl.java:175)
> at
> org.apache.tuscany.sca.binding.rmi.provider.RMIServiceBindingProvider.invokeTarget(RMIServiceBindingProvider.java:148)
> at
> org.apache.tuscany.sca.binding.rmi.provider.RMIServiceBindingProvider$1.intercept(RMIServiceBindingProvider.java:110)
> at
> $java.rmi.server.UnicastRemoteObject$$EnhancerByCGLIB$$a0894c50.insert(<generated>)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
> at sun.rmi.transport.Transport$1.run(Transport.java:153)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
> at java.lang.Thread.run(Thread.java:595)
> at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
> at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
> at
> java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
> at
> java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
> at $Proxy6.insert(Unknown Source)
> at test.RMIServerTestCase.testUserService(RMIServerTestCase.java:32)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:168)
> at junit.framework.TestCase.runBare(TestCase.java:134)
> at junit.framework.TestResult$1.protect(TestResult.java:110)
> at junit.framework.TestResult.runProtected(TestResult.java:128)
> at junit.framework.TestResult.run(TestResult.java:113)
> at junit.framework.TestCase.run(TestCase.java:124)
> at junit.framework.TestSuite.runTest(TestSuite.java:232)
> at junit.framework.TestSuite.run(TestSuite.java:227)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira