java - Generic interface implementation not working -


my interface is:

public interface salesforcerecordservice<t extends salesforcerecord> {      t update(t record) throws ioexception; } 

my implimentation class is:

public class salesforcerecordserviceimpl<t extends salesforcerecordimpl> implements salesforcerecordservice {    @override     public t update(t record) throws ioexception {         return null;     }  } 

@override gives error, method not override method superclass.

i can't able understand problem.

you have pass type super class because expects one. if want salesforcerecordserviceimpl generic posted, pass t salesforcerecordservice.

try this:

public class salesforcerecordserviceimpl<t extends salesforcerecordimpl>         implements salesforcerecordservice<t> {      @override     public t update(t record) throws ioexception {         return null;     } } 

also judging name salesforcerecordimpl looks me concrete implementation, maybe want this:

public class salesforcerecordserviceimpl         implements salesforcerecordservice<salesforcerecordimpl> {      @override     public salesforcerecordimpl update(salesforcerecordimpl record)             throws ioexception {          return null;     } } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -