<AWT Dev> [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class

Martin Buchholz martinrb at google.com
Fri Apr 10 12:28:50 UTC 2015

OKish, but musings follow:

I was a little disappointed that Class.getCanonicalName and
Class.getSimpleName want to examine/load the enclosing class (if any).  You
would think that the class file for a static nested class would contain
enough information to answer those queries ("just turn the $ into a
dot!").   But we're probably not going to fix Class...  As a result of
Class' behavior, we are closer to the position that the test jar file I
created where the enclosing class was missing was "malformed".  Yeah, I'll
avoid doing that in future.

My biggest gripe about the Mac behavior was that java startup was doing
AWT-specific initialization even though there is no AWT code here.  Figure
out how to move this code into the AWT module somehow?  Isn't this sort of
thing one of the goals of jigsaw?

But looking at SetMainClassForAWT I see that this is hard to change.  It's
a mess.  Why does AWT, SWT and JavaFX want to get the name of the main
class, but ... only on Mac?!

 969      * WARNING: This environment variable is an implementation detail and
 970      * isn't meant for use outside of the core platform. The mechanism for
 971      * passing this information from Java launcher to other modules may
 972      * change drastically between update release, and it may even be
 973      * removed or replaced with another mechanism.
 974      *
 975      * NOTE: It is used by SWT, and JavaFX.

On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com>

> Hello.
> Please review the fix for jdk 9.
> After the fix we clear all errors caused by getCanonicalName() on the
> mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will be handled
> in the NSApplicationAWT.m.
> Plus small cleanup suggested in the bug report(jstring->jclass).
> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264
> Webrev can be found at: http://cr.openjdk.java.net/~serb/8076264/webrev.01
> --
> Best regards, Sergey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20150410/f72e9e1f/attachment.html>

More information about the awt-dev mailing list