java - abstract class multiple inheritance -


i have following structure of classes:

  • abstract class
  • class b extends class
  • abstract class c extends class b
  • class d extends class c

i have static method has return type a , returns b - ok. want change method, still has return type a, returns d - causes problems:

java.lang.error: unresolved compilation problem:      d cannot resolved type 

why happening? should have same interface parent classes don't they? edit:

this method im trying modify

public static codeformatter createdefaultcodeformatter(map<string, ?> options) {         if (options == null)             options = ccoreplugin.getoptions();         return new ccodeformatter(options);     } 

it class cdt project (http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=a83be9db5b41c0a593425798a2af91060588b38a). instead of ccodeformatter trying return myformatter. class ccodeformatter (our b in example) extends codeformatter (our in example) , extended abstract class myformatter (or c in example) , class extended class myformatter (d in example). add project required bundles (in manifest.mf) , import , return new myformatter(options). in end, error happens.

public static codeformatter createdefaultcodeformatter(map<string, ?> options) {         if (options == null)             options = ccoreplugin.getoptions();         return new myformatter(options);     } 

the "d" class

public class myformatter extends myabstractformatter{      @override     protected codeformattervisitor getformattervisitor(defaultcodeformatteroptions preferences, int offset, int length) {         return new myformattervisitor(preferences, offset, length);     }  } 

and "c" class

public abstract class myabstractformatter extends ccodeformatter {      public myabstractformatter() {         super();     }      public myabstractformatter(defaultcodeformatteroptions preferences) {         super(preferences);     }      public myabstractformatter(defaultcodeformatteroptions defaultcodeformatteroptions, map<string, ?> options) {         super(defaultcodeformatteroptions, options);     }      public myabstractformatter(map<string, ?> options) {         super(options);     }      @override     public void setoptions(map<string, ?> options) {         super.setoptions(options);     }      @override     public textedit format(int kind, string source, int offset, int length, int indentationlevel, string lineseparator) {         return super.format(kind, source, offset, length, indentationlevel, lineseparator);     }  } 

ok, problems seems in cyclic dependency (and not in abstract classes). project dependent on cdt project , trying add project project's required bundles, making cdt project dependent on project. (altought eclipse detects problem, not case).


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -