简体   繁体   中英

GWT Classes generator of inherited interface

I have interface A:

public interface A{
     String someMethod();
}

And using GWT.create(A.class) I get instant of implementation of this interface.

However if I create interface B();

public interface B extends A{
     String someOtherMethod();
}

And do GWT.create(B.class) i get implementation of B interface, but without implementations A interface methods.

And get compilation error:

[Error] Line 3: The type B_impl must implement the abstract method A.someMethod()

Additional: As i find out later, may be it's connected with Annotations.

So i have:

public interface annotationHelperClass{
}

that has:

public final class annotationHelperClassGenerator{
//Some code
}

annotation:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
    String someParam();
}

so interface A will be:

public interface A extends annotationHelperClass{
         @MyAnnotation(someParam = "Some string")
         String someMethod();
    }

interface B:

public interface B extends A{
         @MyAnnotation(someParam = "Some another string")
         String someOtherMethod();
    }

The problem was that my generator use:

for (JMethod method : targetClass.getMethods()) {
    MyAnnotation descriptor = method.getAnnotation(MyAnnotation.class);
        JParameter[] parameters = method.getParameters();
        //some code
}

So changing getMethods() on getInheritableMethods() solved this problem.

Sorry for being not in detail, i was not sure what is important in this case!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM