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


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

Confusing interface

X-Received by 10.200.3.80 with SMTP id w16mr1888067qtg.64.1499433015017; Fri, 07 Jul 2017 06:10:15 -0700 (PDT)
X-Received by 10.36.124.10 with SMTP id a10mr129058itd.6.1499433014773; Fri, 07 Jul 2017 06:10:14 -0700 (PDT)
Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!v31no712797qtb.0!news-out.google.com!s132ni2801itb.0!nntp.google.com!188no849723itx.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Fri, 7 Jul 2017 06:10:14 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=50.78.95.177; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host 50.78.95.177
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <cd610d1e-ecc4-443b-b346-eb8847b22b74@googlegroups.com> (permalink)
Subject Confusing interface
From Eric Douglas <e.d.programmer@gmail.com>
Injection-Date Fri, 07 Jul 2017 13:10:14 +0000
Content-Type text/plain; charset="UTF-8"
Lines 33
Xref csiph.com comp.lang.java.programmer:36809

Show key headers only | 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