-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.1, 1.1.5, 1.1.6, 1.2.0
-
None
-
generic, x86
-
generic, windows_95, windows_nt
Name: mc57594 Date: 01/16/97
Currently in the AWT, deprecated methods still contain<BR>
functional code internally. Newer methods which replace the <BR>
deprecated methods are calling the deprecated methods. As a result, <BR>
a derived class cannot disable deprecated methods by throwing an<BR>
exception or printing an error message.<BR>
<BR>
import java.awt.*;<BR>
public class MyList extends List {<BR>
// do not call this method! It is deprecated in
the base class<BR>
public synchronized void clear() {<BR>
throw new RuntimeException("java.awt.list#clear
is deprecated");<BR>
}<BR>
}<BR>
<BR>
The above example will not work, since List.removeAll() will call<BR>
List.clear(), which will now throw an exception! If you move the<BR>
functionality out of List.clear() and place it in the new method<BR>
called List.removeAll(), then I can successfully disable deprecated<BR>
methods in my derived class.<BR>
<BR>
======================================================================
- duplicates
-
JDK-4132821 Deprecated methods should call new methods resize -> setSize,not setSize->resize
-
- Closed
-