0

I'm confused by the scenario described below where I am extending a generic class. The class I am extending is below:

public abstract class PresenterWidget<V extends View> extends HandlerContainerImpl
...

At first, I had this working (warning free) using the child class below:

public abstract class SideBarPresenter<V extends SideBarPresenter.MyView> extends PresenterWidget<SideBarPresenter.MyView> {

    interface MyView extends View {
        void doSomething();
    }
...

But I want to convert MyView to an abstract class so I can implement a method. The way I think it makes sense is below.

public abstract class SideBarPresenter<V extends SideBarPresenter.MyView> extends PresenterWidget<SideBarPresenter.MyView> {

    abstract class MyView implements View {
        void doSomething() {}
    }
...

The problem is this produces 2 warnings, both stating:

SideBarPresenter.MyView is a raw type. References to generic type SideBarPresenter.MyView should be parameterized

Should I just ignore this warning or is there a better way to do this?

The Gilbert Arenas Dagger
  • 12,071
  • 13
  • 66
  • 80

1 Answers1

4

You should make MyView a static class. Otherwise its actually an inner class of a SideBarPresenter instance and that's probably where your generics warning is coming in. Inner interfaces are static by default.

sisyphus
  • 6,174
  • 1
  • 25
  • 35