josesamuel / remoter

Remoter - An alternative to Android AIDL for Android Remote IPC services using plain java interfaces
Apache License 2.0
84 stars 14 forks source link

issue with generic interface inheritance #15

Closed herv closed 1 month ago

herv commented 11 months ago

Dear @josesamuel,

Thank you for this great library !

I've faced to some build issue with remoter code generation while trying to create some remote interface inheriting some generic interface.

Here is a trivial code example bringing out the issue:

package example;

import java.util.List;

public interface GenericInterface<T extends List<?>> {

    void onNext(T list);
}
package example;

import java.util.ArrayList;

import remoter.annotations.Remoter;

@Remoter
public interface RemoteInterface extends GenericInterface<ArrayList<?>> {
}

Trying to compile those to files results in following error in generated RemoteInterface_Proxy.java:

error: cannot find symbol
  public void onNext(T list_0) {
                     ^
  symbol:   class T
  location: class RemoteInterface_Proxy

It looks like the T generic parameter is not replaced with ArrayList<?> in Proxy class.

I've specified an upper bounded-type List<?> to simplify the example but actually in my real code the upper bounded-type is a remoter interface. This means that I would expect the generated proxy code to deal with this and work with binder in the remote procedure onNext rather than trying to serialize the input parameter.

I'm not familiar with java annotation processor but I can try to give a hand to fix this, if needed.

Best Regards,

josesamuel commented 1 month ago

Fixed in 2.0.6