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


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

Re: Calling deprecated methods

From Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas)
Newsgroups comp.lang.java.programmer
Subject Re: Calling deprecated methods
Date 2017-12-12 10:24 +1200
Organization fsxNet Usenet Gateway | bbs.geek.nz/#fsxNet
Message-ID <2761950898@f38.n261.z1.binkp.net> (permalink)
References <2726543365@f38.n261.z1.binkp.net>

Show all headers | View raw


On Tuesday, December 12, 2017 at 11:32:12 AM UTC-5, Kiwi User wrote:
> Deprecated methods tend to have a revised API, i.e. returning a
> Collection or a List instead of an array, so you'd want to deprecate the
> older method as an indication that Java now provides better ways of
> handling data passed to or from the method, i.e. if our sort() method
> now returns a List or Collection instead of Object[].
>
Sometimes you have to make a new method because you're changing the parameters
or return value, possible also just making a new method because better
internals and some cases where the new guts just don't work and you have to
stick with the old.

> > Does it make sense to just keep calling the deprecated method and have
> > to tell your compiler to ignore that, or why would Oracle deprecate
> > their own method they're still calling?
> >
> Yes, they would and have deprecated their own methods, usually for the
> sort of reasons I've just used as examples.
>

The fact they deprecated a method isn't a problem.  The fact they're still
calling it is questionable.  javax.swing.JTree calls
java.awt.event.MouseEvent.getModifiers() which is marked deprecated in Java 9.

So now I'm doing something similar to what the JTree class is doing, with a
control overlapping a JTree trying to forward mouse events by creating new
events from existing events and I'm not sure how to do that without called
getModifiers().  Javadoc on getModifiers() says to use getModifiersEx() for
some reason but yes it's certainly not a drop in replacement.  It compiles if
you straight up change it to that but then the mouse clicks to expand/collapse
a tree node don't work.

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


Thread

Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-12 16:31 +1200
  Re: Calling deprecated methods Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-12 10:24 +1200
    Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-12 20:05 +1200
      Re: Calling deprecated methods Eric Sosman <esosman@comcast-dot-net.invalid> (Eric Sosman) - 2017-12-12 15:41 +1200
        Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-12 21:04 +1200
          Re: Calling deprecated methods Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-12 13:33 +1200
            Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-12 22:41 +1200
              Re: Calling deprecated methods Eric Sosman <esosman@comcast-dot-net.invalid> (Eric Sosman) - 2017-12-12 17:57 +1200
                Re: Calling deprecated methods Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-13 04:51 +1200
                Re: Calling deprecated methods Eric Sosman <esosman@comcast-dot-net.invalid> (Eric Sosman) - 2017-12-13 08:21 +1200
                Re: Calling deprecated methods Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-13 05:40 +1200
                Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-13 15:19 +1200
                Re: Calling deprecated methods Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-13 07:57 +1200
                Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-13 17:30 +1200
                Re: Calling deprecated methods Richard Damon <Richard@Damon-Family.org> - 2017-12-15 22:31 -0500
                Re: Calling deprecated methods Kiwi User <martin@mydomain.invalid> - 2017-12-16 09:08 +0000

csiph-web