Re: [java-gnome-hackers] An idiom for deprecating things
Brought to you by:
afcowie
From: Mario T. <ne...@li...> - 2008-07-30 23:49:43
|
Il giorno mar, 29/07/2008 alle 12.15 +1000, Andrew Cowie ha scritto: > Hello, > > A couple methods needed a signature changes yesterday (renames, as it > happened). I implemented the correct signature, and then pondered what > to do with the old one. > > People in the Java land are a lot more clued in about [not using] > deprecated things that it seems most developers using GTK in C are. > Tough for them. But part of the problem there is that they weren't > strongly incented to get on with fixing their code. > > I came up with an idiom that I'm actually really happy with: > > /** > * Original JavaDoc here. > * > * @since 4.0.8 > */ > public void betterMethodName() { > GtkHotness.methodName(); > } > > @Deprecated > public void oldMethodName() { > assert false : "Deprecated. Use betterMethodName()"; > GtkHotness.methodName(); > } Hi Andrew. What we usually do in both the JDK and Classpath (and Escher now) is something like: /** * Original JavaDoc here. * * @since 4.0.8 */ public void betterMethodName() { oldMethodName(); } @Deprecated public void oldMethodName() { GtkHotness.methodName(); } This does not break code that override oldMethodName. Just my 2 cents. Mario |