views:

30

answers:

1

I just upgraded our project to JDK 1.6, and on compilation, I have a test class that implements java.awt.Toolkit and implements the methods to do nothing special (other than capture the call to the beep command).

(This is an old test that should probably be rewritten in several ways (either mock it or wrap that functionality in a simple interface. However, regardless of the badness of the test) the compiler now spits out a bunch of warnings like this:

[19:50:10]: [javac] MemoryManagerTest.java:14: warning: java.awt.dnd.peer.DragSourceContextPeer is Sun proprietary API and may be removed in a future release [19:50:10]: [javac] import java.awt.dnd.peer.DragSourceContextPeer

First it is interesting that something with a package called java.awt.dnd.peer would be a sun proprietary API (although obviously the implementation is), but is this message bogus, or is it really true? And if it is true, what does that say about the whole Toolkit class which is tied to those interfaces?

+1  A: 

You could have checked the API documentation and found, that none of the classes in java.awt.dnd.peer are listed, and hence implementation specific for the Sun VM. Even if the Toolkit class itself is part of the public API, the implementation of the class is of course also VM specific and may use other proprietary Sun-internal classes.

jarnbjo
A public API that statically references to a non-public API isn't much of a public API, is it? BTW, I don't use the public javadocs much, as my IDE just reads the javadoc comments from the source code.
Yishai
What do you mean by "statical reference"?
jarnbjo
@jarnbjo, by having a static reference to the interface that is part of a proprietary API in the return method of the public API, that is a static reference that would throw an error at runtime if it were not there. So it is not possible to implement the public API without referencing the private one.
Yishai