Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / October 2004

Tip: Looking for answers? Try searching our database.

static Class class$java$awt$event$ActionListener; ????

Thread view: 
linux newbie - 29 Oct 2004 06:27 GMT
is there any java experts could tell me what the problem below and
explain the code to me, your explanation is greatly appreciated  :)

static Class class$java$awt$event$ActionListener;

static Class _mthclass$(String x$0)
    {
        try
        {
            return Class.forName(x$0);
        }
        catch(ClassNotFoundException x$0)
        {
            throw new NoClassDefFoundError(x$0.getMessage());
        }
    }

MainFrame.class$java$awt$event$ActionListener != null ?
MainFrame.class$java$awt$event$ActionListener :
(MainFrame.class$java$awt$event$ActionListener =
MainFrame._mthclass$("java.awt.event.ActionListener");
Chris Smith - 29 Oct 2004 06:58 GMT
linux_newbie@linuxmail.org says...
> is there any java experts could tell me what the problem below and
> explain the code to me, your explanation is greatly appreciated  :)

Where did you get this code?  It's terribly ugly to the point of being
practically useless.  Nevertheless, here's what it does:

> static Class class$java$awt$event$ActionListener;

Declares a variables called 'class$java$awt$event$ActionListener', which
is a terrible name for a variable.  It's legal, but the JLS suggests
reserving the $ character in identifiers for either machine-generated
code names, or compatibility with existing APIs.  I suppose the latter
would only apply to native OS function wrappers on VMS.

> static Class _mthclass$(String x$0)
>      {
[quoted text clipped - 7 lines]
>          }
>      }

This defines a method called _mthclass$, which takes as a parameter the
name of a class, and returns the java.lang.Class instance that
represents it.  Again, the $ characters are ill-advised.

> MainFrame.class$java$awt$event$ActionListener != null ?
> MainFrame.class$java$awt$event$ActionListener :
> (MainFrame.class$java$awt$event$ActionListener =
> MainFrame._mthclass$("java.awt.event.ActionListener");

This expression attempts to load the class java.awt.event.ActionListener
and assign it's representative java.lang.Class instance to the first
variable above.  Once it's loaded once, the previously loaded value is
returned without attempting to reload the class.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

linux newbie - 29 Oct 2004 08:27 GMT
> linux_newbie@linuxmail.org says...
>
[quoted text clipped - 37 lines]
> variable above.  Once it's loaded once, the previously loaded value is
> returned without attempting to reload the class.

thanks so much :) now i understand it
Paul H. van Rossem - 29 Oct 2004 07:56 GMT
> is there any java experts could tell me what the problem below and
> explain the code to me, your explanation is greatly appreciated  :)
[quoted text clipped - 17 lines]
> (MainFrame.class$java$awt$event$ActionListener =
> MainFrame._mthclass$("java.awt.event.ActionListener");

This looks like reverse engineered or generated code. Probably from a
tool that got it from the class file or obfuscated the source or
something like that...
I wouldn't like to debug this! If you want some help, why don't you show
the real source of this code, or ... why don't you have that?

Paul.
linux newbie - 29 Oct 2004 08:32 GMT
>> is there any java experts could tell me what the problem below and
>> explain the code to me, your explanation is greatly appreciated  :)
[quoted text clipped - 25 lines]
>
> Paul.

thanks anyway :)
David Zimmerman - 31 Oct 2004 16:22 GMT
> is there any java experts could tell me what the problem below and
> explain the code to me, your explanation is greatly appreciated  :)
[quoted text clipped - 17 lines]
> (MainFrame.class$java$awt$event$ActionListener =
> MainFrame._mthclass$("java.awt.event.ActionListener");

This looks like compiler generated code to handle the .class synthetic
variable.

EG
   if (foo.getClass() == ActionListener.class) { ...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.