Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Using native datatypes as method parameters

On 02/21/2011 01:37 PM, Fabian Meyer wrote:
> Hi,
> 
> is it possible to use primitive data types as method parameter in ECF?
> It seems to me that the deserialization of the shared message objects
> doesn't work correctly. A java.lang.NoSuchMethodException is always
> thrown, because ECF is trying to find a method with "class
> java.lang.Integer" as parameter data type instead of the primitive int
> data type. I wrote a little example application:
> 
> Interface:
> public interface Test {
>         void doSomething(int pBla);
> }
> 
> Server:
> public void start(BundleContext bundleContext) throws Exception {
>         Activator.context = bundleContext;
>         Properties props = new Properties();
>         props.put("service.exported.interfaces", "*");         
>         context.registerService(Test.class.getName(), new Test() {
>                
>                 @Override
>                 public void doSomething(int pBla) {
>                        
>                 }
>         }, props);
> }
> 
> Client:
> Test t = (Test) getContext().getService(reference);
> t.doSomething(42);
> 
> Throws:
> java.lang.NoSuchMethodException: No such method: doSomething([class
> java.lang.Integer])
>         at
> org.eclipse.ecf.core.sharedobject.SharedObjectMsg.doInvoke(SharedObjectMsg.java:310)
>         at
> org.eclipse.ecf.core.sharedobject.SharedObjectMsg.invoke(SharedObjectMsg.java:290)
>         at
> org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceRegistrationImpl.callService(RemoteServiceRegistrationImpl.java:342)
>         at
> org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject$11.run(RegistrySharedObject.java:1423)
>         at
> org.eclipse.equinox.concurrent.future.SingleOperationFuture$1.run(SingleOperationFuture.java:96)
>         at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
>         at
> org.eclipse.equinox.concurrent.future.SingleOperationFuture.runWithProgress(SingleOperationFuture.java:89)
>         at
> org.eclipse.ecf.core.jobs.JobsExecutor.safeRun(JobsExecutor.java:52)
>         at
> org.eclipse.ecf.core.jobs.JobsExecutor$1.run(JobsExecutor.java:79)
>         at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
> 
> Configuration:
> JDK 1.6_20
> ECF 1.4 with patch for Eclipse 3.5, 3.6

https://bugs.eclipse.org/331383 might be related too.

Markus


Back to the top