<AWT Dev> java.awt.peer work

Phil Race Phil.Race at Sun.COM
Wed Apr 23 13:28:10 PDT 2008



Roman Kennke wrote:
> Hi there,
> 
> as part of the OpenJDK challenge project 'portable GUI backends', I'd
> like to put some love to the interfaces in java.awt.peer. Several tasks
> spring to mind:
> 
> - Add documentation all around.
> - Remove depracted (dupe) methods, and use the new ones instead. [1]
> - Remove unused stuff.
> 
> [1] This is really a little weird. There are new methods (for example,
> getPreferredSize() instead of preferredSize()), but the old methods are
> used everywhere, so the new ones could just as well be removed. OTOH, I
> feel that the new ones should be used and the old ones removed. Having
> both in the interface doesn't help anybody, not for backwards
> compatibility and not for developing new peers.

Its not uncommon in the JDK to see cases where what is used is the old
method, and also for the new method to delegate to the old one.
The usual reason for this is because existing code may have
sub-classed and overridden those methods. If we didn't call
them any more that code might break as it expected to be called.
Border-line stuff I know, since except in somewhat rare cases,
none of which I could point you to offhand, say when a method
is called by the JDK.

I don't know for sure if that's really the situation you are
seeing here, but if it is then, if someone has taken the care
to preserve compatibility then its for a reason, in which case
I'd recommend against change for the sake of change.

> 
> I know that java.awt.peer is a little special, as it is in the public
> namespace but not publicly documented. What are the constraints on
> changing these interfaces and docs? If it's not feasible anyway, I
> probably better don't touch it at all. What is your optinion?

We are schizophrenic about this. Love to remove them, but nervous
to do so.

-phil.

> 
> /Roman
> 



More information about the awt-dev mailing list