java - Compilation warning: Unchecked call to XXX as member of the raw type -


i getting compiler warning:

warning: [unchecked] unchecked call setview(v) member of raw type abstractpresenter

   this.presenter.setview(this); 

where v type-variable:

v extends abstractview declared in class abstractpresenter

the code of abstractpresenter class following:

public abstract class abstractpresenter<v extends abstractview, m>  implements presenter<v, m> {      private m model;     private v view;      @override     public final v getview() {         return this.view;     }      public final void setview(v view) {         if (view == null) {             throw new nullpointerexception("view cannot null.");         }          if (this.view != null) {             throw new illegalstateexception("view has been set.");         }         this.view = view;     }      @override     public final m getmodel() {         return this.model;     }      protected final void setmodel(m model) {         if (model == null) {             throw new nullpointerexception("model cannot null.");         }                 this.model = model;     } } 

the setview method called in abstractview class below:

public abstract class abstractview<p extends abstractpresenter> extends  usercontrol {     private final p presenter;      public abstractview(p presenter) {         this.presenter = presenter;         this.initialisepresenter();     }      private void initialisepresenter() {         if (this.presenter == null){             throw new illegalstateexception();         }          this.presenter.setview(this); //this call raises warning     }      protected p getpresenter() {         return this.presenter;     } } 

i have searched questions other members regarding same warning , tried adapt solutions issue did not work.

i don't understand why warning raised v type forced in declaration of abstractpresenter class:

public abstract class abstractpresenter<v extends abstractview, m>  implements presenter<v, m>  

it warning , ignore understand why happens , want code clean possible.

your types raw - is, generic types bonded type has type, haven't provided one, it's raw.

change type bounds typed. try this:

public abstract class abstractpresenter<v extends abstractview<v>, m> implements presenter<v, m> 

and

public abstract class abstractview<p extends abstractpresenter<p> extends usercontrol 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -