Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: Fixing "typos" in enums... Date: Mon, 18 Nov 2013 11:35:25 -0800 Organization: A noiseless patient Spider Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 18 Nov 2013 19:35:28 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="6120"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PDJAHO6seWhfe3q0LiwaJFd+JD3Ncd54=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 In-Reply-To: Cancel-Lock: sha1:RbQ3+KqWDV27N3qnohX/KMTC6L8= Xref: csiph.com comp.lang.java.programmer:26546 On 11/18/2013 10:58 AM, Andreas Leitgeb wrote: > Not quite as simple. I'd need a *copy* of each method (even as an > overload) taking the new Fooing, while the original would be > changed to @Deprecated and left at taking the Foo argument. > > @Deprecated void applyRank(Foo rank) { ... blah ... } > void applyRank(Fooing rank) { ... mostly the same blah ... } OK I see what you mean. You'd have to duplicate your own API everywhere for the new type. Maybe public enum Foo { @Deprecated FURST, SECOND, FIRST } public void applyRank( Foo rank ) { if( rank == FIRST || rank == FURST ) //... else // second ... Which I think you will have to do with your solution as well. My previous solutions allows you to migrate the entire API to the new type. Yours allows you to keep the old type. I think you're stuck with "FURST" forever though if you keep the old type.