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


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

Re: Calling deprecated methods

From Kiwi User <martin@mydomain.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Calling deprecated methods
Date 2017-12-12 20:05 +0000
Organization albasani.net
Message-ID <p0pcpd$j65$1@news.albasani.net> (permalink)
References <b1215ae8-2a70-4220-b98a-6d25088c5ae6@googlegroups.com> <p0p09n$fed$1@news.albasani.net> <9db47be9-1c38-48a9-bad9-9799f54df59a@googlegroups.com>

Show all headers | View raw


On Tue, 12 Dec 2017 10:24:50 -0800, Eric Douglas wrote:

> 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,
>
Thats what 'revised API' means. In C I'd call it a revised prototype.

> 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.
>
IMHO that's never a valid reason: you should have a test harness for the 
class, and preferably a set of regression tests as well. The revised code 
should not be checked into the VCS or made visible outside the revising 
programmer's personal login environment until it has been (a) fully 
tested and (b) if the method specs didn't change, has passed the current 
set of regression tests.

> 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.
>
Agreed. At a minimum, everything in the package should use the 
replacement class/method and preferably all code in the next release 
should use it too. 

This is the "eat your own dogfood" principle and I'm suspicious of those 
who don't stick to it.



-- 
Martin    | martin at
Gregorie  | gregorie
          | dot org

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


Thread

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

csiph-web