How to avoid potential pitfalls of Microsoft's non-standard SDK for Java
Find out exactly which methods, classes, and variables have been added to, or omitted from, the key Java class libraries in
Microsoft's implementation of Java 1.1
By John Zukowski, JavaWorld.com, 10/01/97
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Microsoft's Internet Explorer (IE) 4.0 has been out for a little over a week now, and the company now is shipping the 2.0
version of its Software Development Kit (SDK) for Java. According to Microsoft's Win32 Virtual Machine for Java Release Notes
(see the
Resources section below for links to this document and other information related to this article), the virtual machine (VM) for Java
that ships with IE 4.0 is the same as the one in the new SDK. Using the Java source files that come with the SDK and comparing
them to the Java source files that come with Sun's Java Development Kit (JDK) 1.1.4 release reveals exactly why Alan Baratz,
president of Sun's JavaSoft division, said, "Microsoft deceptively altered key classes and inserted them into their SDK."
(This was during the conference detailing Sun's October 7 announcement of Sun's suit against Microsoft alleging breach of
contract. For more information on this lawsuit, see "
Sun-Microsoft dispute gets ugly," in this month's issue of
JavaWorld.)
I have analyzed the source files and have run across six issues that should be of great concern to developers if they want to develop solutions with Microsoft's SDK for Java that will work
in other Java 1.1 certified environments. These six concerns are: new classes, methods, and variables; the com.ms packages;
missing methods; and behavioral differences. They go far beyond the often-cited concern over Microsoft's lack of JNI and RMI
support, as mentioned in my other JavaWorld article this month, "What does Sun's lawsuit against Microsoft mean for Java developers?"
Baratz used the word "deceptively" in Sun's announcement of the lawsuit because the (javadoc) documentation for the Java classes
that comes with the SDK makes no mention of these changes. To find these differences, it is necessary to use either the ClassVue
tool that comes with the SDK or manually examine the source code. Your best bet is to rely on ClassVue, as the source files
provided with the SDK are not always the ones used for the generated classes. For those unfamiliar with ClassVue, the equivalent
tool that comes with the JDK from Sun is javap.
As much as I'd like to claim that what follows is an exhaustive list of changes to the SDK, it is possible that something
was missed. With several items, there is a pattern -- so if you avoid similarly named things you should be okay. All of the
problems identified here are in the java.lang, java.io, and java.awt packages/sub-packages.
Hey, what's that class doing there?
The first set of changes in Microsoft's SDK for Java is new classes, methods, and variables that were added to the system
packages. A system package, or core Java API, is anything that begins with java.* in its fully qualified class name. As for
classes, 16 new ones were added into java.awt. These are:
| WButtonPeer |
WCheckboxMenuItemPeer |
WCheckboxPeer |
WChoicePeer |
| WLabelPeer |
WListPeer |
WMenuBarPeer |
WMenuItemPeer |
| WMenuPeer |
WPopupMenuPeer |
WScrollbarPeer |
WScrollPanePeer |
| WTextAreaPeer |
WTextComponentPeer |
WTextFieldPeer |
WUIPeer |
With the exception of the last one, all of the classes above are peer classes for AWT components. Normally, these classes
would go into a package like sun.awt.windows or sun.awt.motif. Since you aren't supposed to use them anyway, they should be
easy to avoid. The WUIPeer class also is a peer, but it supports a Microsoft-specific behavior. Stay away from that too. Additional package private
(also called friendly, for when no access specifier keyword is specified) classes were added, like __AwtUIBand and __UIMenuRoot. Because these are inaccessible outside of java.awt, you cannot directly use them.
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Resources
- "Sun-Microsoft dispute gets ugly," JavaWorld, October 1997 http://www.javaworld.com/jw-10-1997/jw-10-sunsuit.html
- "What does Sun's lawsuit against Microsoft mean for Java developers?", JavaWorld, October 1997 http://www.javaworld.com/jw-10-1997/jw-10-lawsuit.html
- Microsoft's Win32 Virtual Machine for Java Release Notes http://microsoft.com/java/sdk/20/relnotes/vm.htm
- Rule 3 of SunTest's "100% Pure Java Cookbook" http://www.suntest.com/100percent/cpd/doc/cbook/cookbook.html#8592
- Microsoft's Application Foundation Classes http://microsoft.com/java/sdk/20/relnotes/afc.htm
- Internet Explorer 4.0 http://microsoft.com/ie/ie40/
- Microsoft's SDK for Java http://microsoft.com/java/sdk/20/relnotes/intro.htm
- Borland's JBuilder http://www.borland.com/jbuilder/
- IBM's VisualAge for Java http://www.software.ibm.com/ad/vajava/
- Symantec's Visual Cafe http://www.symantec.com/domain/cafe/deved/index.html
- Should Microsoft be allowed to alter the key class libraries of Java? Take our latest poll
http://nigeria.wpi.com/cgi-bin/gwpoll/gwpoll/ballot.html
- A review of platform-neutral Java development tools in NC World, JavaWorld's sister publication
http://www.ncworldmag.com/ncw-10-1997/ncw-10-jvtools.html
- Nick Petreley's commentary about the Sun/MS lawsuit, also in NC World
http://www.ncworldmag.com/ncw-10-1997/ncw-10-straypackets.html