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


Groups > comp.lang.java.programmer > #37350 > unrolled thread

track usage of deprecated classes in our library

Started bymike <mikaelpetterson@hotmail.com>
First post2017-08-29 04:36 -0700
Last post2017-08-30 14:17 -0700
Articles 5 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  track usage of deprecated classes in our library mike <mikaelpetterson@hotmail.com> - 2017-08-29 04:36 -0700
    Re: track usage of deprecated classes in our library Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-29 08:09 -0400
    Re: track usage of deprecated classes in our library Eric Douglas <e.d.programmer@gmail.com> - 2017-08-29 05:19 -0700
    Re: track usage of deprecated classes in our library Arne Vajhøj <arne@vajhoej.dk> - 2017-08-29 20:41 -0400
    Re: track usage of deprecated classes in our library lewbloch@gmail.com - 2017-08-30 14:17 -0700

#37350 — track usage of deprecated classes in our library

Frommike <mikaelpetterson@hotmail.com>
Date2017-08-29 04:36 -0700
Subjecttrack usage of deprecated classes in our library
Message-ID<361824ce-5337-44a8-93a3-05b92139cb30@googlegroups.com>
Hi

We have quite a number of users of our public API. We have deprecated a great number of our methods since they are inefficient and error prone. New ones are already in place. But as you all know we cannot just remove the old since we do not know if they are used.

So we need to know which deprecated methods that are still called and hopefully provide ip and username so we can contact them to assist in replacing to new method.

Is there a mechanism in java which can accomplish this? Anyone with the experience of this? All input is greatly appreciated.

//mike

[toc] | [next] | [standalone]


#37351

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2017-08-29 08:09 -0400
Message-ID<oo3la3$4sv$1@dont-email.me>
In reply to#37350
On 8/29/2017 7:36 AM, mike wrote:
> Hi
> 
> We have quite a number of users of our public API. We have deprecated a great number of our methods since they are inefficient and error prone. New ones are already in place. But as you all know we cannot just remove the old since we do not know if they are used.
> 
> So we need to know which deprecated methods that are still called and hopefully provide ip and username so we can contact them to assist in replacing to new method.
> 
> Is there a mechanism in java which can accomplish this? Anyone with the experience of this? All input is greatly appreciated.

     There's nothing (as far as I know) that records the actual use
of a deprecated method.  The compiler will issue a warning if the
method call appears somewhere, but if the user ignores the warning
and runs the code anyhow -- well, then it's just ordinary Java code.
Also, the presence of a method call in source doesn't prove that the
method will actually be called; perhaps your deprecated method is
only called from one of *their* deprecated methods ...

     All I can think of is that you might release a new version of
your library, putting a call to deprecatedMethodWasUsed() at the
start of each deprecated method.  dMWU() could then make some kind
of record of the use, or even "phone home" with the news.  (I am not
a lawyer, but I suggest you consult one before inserting "phone home"
actions; you might easily cross the line into becoming spyware if you
do that sort of thing without the client organization's permission.)

-- 
esosman@comcast-dot-net.invalid
Twelve hundred forty days to go.

[toc] | [prev] | [next] | [standalone]


#37352

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-08-29 05:19 -0700
Message-ID<7073e003-cddc-4e51-817c-7ab22be011c5@googlegroups.com>
In reply to#37350
On Tuesday, August 29, 2017 at 7:36:21 AM UTC-4, mike wrote:
> 
> Is there a mechanism in java which can accomplish this? Anyone with the experience of this? All input is greatly appreciated.
> 
> //mike

Obviously if you've already compiled a jar and put it out there in the wild without tracking you don't know who's calling what methods.  If you're pushing out a new version, or running your local Java they're somehow connecting to you can add logging as Eric S suggests.

Most APIs would put out at least one version marking methods as deprecated before releasing a new major version to completely eliminate them.  Minor version changes shouldn't be pulling the rug out removing methods but always expect that with a major version number update.

You could also just leave the methods in there telling everyone not to use them but there's really no ill effect if they do it anyway like Component did.
http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#setSize-int-int-

Deprecated since 1.1 but still exists in 8.

[toc] | [prev] | [next] | [standalone]


#37353

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-08-29 20:41 -0400
Message-ID<oo51j3$1q63$1@gioia.aioe.org>
In reply to#37350
On 8/29/2017 7:36 AM, mike wrote:
> We have quite a number of users of our public API. We have deprecated
> a great number of our methods since they are inefficient and error
> prone. New ones are already in place. But as you all know we cannot
> just remove the old since we do not know if they are used.
> 
> So we need to know which deprecated methods that are still called and
> hopefully provide ip and username so we can contact them to assist in
> replacing to new method.
> 
> Is there a mechanism in java which can accomplish this? Anyone with
> the experience of this? All input is greatly appreciated.
I don't think you can do anything.

I assume that the current binaries does not come with
"call home" functionality.

So you will need to release a new version to get
that functionality in.

And in that case the users need to see your download
page (that obviously informs about this) and then
the functionality is no longer needed.

Use @Deprecated and put a highly visible note on
download page - I think that is what you can do.

Arne

[toc] | [prev] | [next] | [standalone]


#37362

Fromlewbloch@gmail.com
Date2017-08-30 14:17 -0700
Message-ID<157bfcbb-1601-476e-a4d0-2409e0b5f64b@googlegroups.com>
In reply to#37350
On Tuesday, August 29, 2017 at 4:36:21 AM UTC-7, mike wrote:
> Hi
> 
> We have quite a number of users of our public API. We have deprecated a great number of our methods since they are inefficient and error prone. New ones are already in place. But as you all know we cannot just remove the old since we do not know if they are used.
> 
> So we need to know which deprecated methods that are still called and hopefully provide ip and username so we can contact them to assist in replacing to new method.
> 
> Is there a mechanism in java which can accomplish this? Anyone with the experience of this? All input is greatly appreciated.

Deprecate the methods in the first release of the new library after the changes. One or two versions later, remove the deprecated methods from the library.

Track who contacts you about the missing methods.

-- 
Lew

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web