Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: track usage of deprecated classes in our library Date: Tue, 29 Aug 2017 08:09:42 -0400 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <361824ce-5337-44a8-93a3-05b92139cb30@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 29 Aug 2017 12:05:23 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b42a2d116319f3bce9707afdbc77f6fd"; logging-data="5023"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Rm1pKdyClaoEtCSdVrEoF" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 In-Reply-To: <361824ce-5337-44a8-93a3-05b92139cb30@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:ZFr9vo5sPD7iOVjwl+1CWVIwzXg= Xref: csiph.com comp.lang.java.programmer:37351 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.