Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36809

Confusing interface

Newsgroups comp.lang.java.programmer
Date 2017-07-07 06:10 -0700
Message-ID <cd610d1e-ecc4-443b-b346-eb8847b22b74@googlegroups.com> (permalink)
Subject Confusing interface
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


Oracle defines this
public interface TreeNode

which contains this
    TreeNode getParent();

Then they define this
public interface MutableTreeNode extends TreeNode

which contains this
    void setParent(MutableTreeNode newParent);

Then they define this
public class DefaultMutableTreeNode implements Cloneable,
       MutableTreeNode, Serializable

which contains this
    @Transient
    public void setParent(MutableTreeNode newParent) {

    public TreeNode getParent() {

Now I define
public class MyCustomTreeNode extends DefaultMutableTreeNode

and Eclipse allows
@Override
public MyCustomTreeNode getParent()

but I must keep the signature
public void setParent(MutableTreeNode newParent)

If I put @Override on the set and declare the parameter as MyCustomTreeNode, it says must override or implement a supertype method.
If the get and set are both using interface parameters, and my custom class is simply extending a class which implements one interface which extends the other, why is one allowed and not the other?

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 06:10 -0700
  Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 09:45 -0400
    Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 07:37 -0700
      Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 11:26 -0400
        Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 11:24 -0700
          Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 14:50 -0400
            Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 12:00 -0700
              Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 15:27 -0400
                Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 12:47 -0700
                Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 16:25 -0400
                Re: Confusing interface Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 13:39 -0700
                Re: Confusing interface Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 17:43 -0400

csiph-web