mbassador을 사용 중이며 인터페이스 게시가 작동하지 않는 것 같습니다. 아래는 JUnit을 사용하는 sscce입니다. 나는이 프로그램이 hello world
을 인쇄 할 것으로 기대하지만, 그렇게하지는 않는다. 이것에MBassador는 인터페이스 메시지를 지원하지 않습니다.
public void handleFoo(FooInterface f) {
: :이 줄을 변경하는 경우에는
는public void handleFoo(FooImpl f) {
이 프로그램은 완벽하게 작동합니다. 이것은 버그입니까, 아니면 제가 잘못하고있는 것입니까? 참고 : public void handleFoo(Object o)
도 작동합니다.
import net.engio.mbassy.bus.BusConfiguration;
import net.engio.mbassy.bus.MBassador;
import net.engio.mbassy.listener.Handler;
import org.junit.Test;
public class MBassadorTest {
@Test
public void testMBassador() {
MBassador<FooInterface> bus = new MBassador<>(BusConfiguration.Default());
bus.subscribe(this);
FooInterface myFoo = new FooImpl();
bus.publish(myFoo);
}
public static interface FooInterface {
String doSomething();
}
public static class FooImpl implements FooInterface {
public String doSomething() {
return "hello world";
}
}
@Handler(rejectSubtypes = false)
public void handleFoo(FooInterface f) {
System.out.println(f.doSomething());
}
}
이제 1.1.7로 고정되었습니다. 문제가 발생하면 다시 확인하고보고하십시오. – bennidi