Gin AssistedInject: Deferred binding result type 'Foo' should not be abstract

1.3k Views Asked by At

I'm trying to use AssistedInject with Gin in GWT 2.4.0:

  public interface ElevatorButtonFactory {
    ElevatorButton create(int shownFloorNumber, Action<Integer> onClick);
  }

  @Inject
  ElevatorButton(GameHost gameHost, @Assisted int shownFloorNumber,
      @Assisted Action<Integer> onClick) {
    // ...
  }

In my Gin module:

install(new GinFactoryModuleBuilder().implement(ElevatorButton.class, ElevatorButton.class)
        .build(ElevatorButtonFactory.class));

That seems like it should be sufficient, right? But when I try to take ElevatorButtonFactory as an injected parameter, I get the following error:

[ERROR] [foo] - Deferred binding result type 'com.foo.html.client.components.floorpicker.ElevatorButton.ElevatorButtonFactory' should not be abstract

What am I doing wrong?

1

There are 1 best solutions below

0
On

It seems like that problem is not about GIN. It's about how do you use your ElevatorButtonFactory class. Your injector interface should look like this:

@GinModules(YourGinModule.class)
public interface InjectorService extends Ginjector {

    ElevatorButtonFactory getElevatorButtonFactory();

}

Create ElevatorButton instance:

GWT.create(InjectorService.class).getElevatorButtonFactory().create(...)

May be you try to instantiate your factory via GWT.create() or something else? If the problem will not gone - let me look at the full stacktrace.