coolness

GeorgeCJ GeorgeCJ@SNS.to
Fri Mar 12 10:21:00 GMT 1999


I use:

	Class objClass = java.lang.Object.class;

quite extensively for Table driven "tag" to object translation.  So it is
very important to me.

However, I have no problem creating a special entry in some "make" file to
force the inclusion (and entry in to some table) of all the classes that I
load this way.

Is this a "simpler" possibly short-term solution?

Thanks, george

At 10:35 AM 3/12/99 -0500, you wrote:
>Tom Tromey wrote:
>> 
>> >>>>> "Jeff" == Jeff Sturm <jsturm@sigma6.com> writes:
>> 
>> Jeff> What needs to work in gcj is Class.forName("...") which is
>> Jeff> scattered all over in most java code, including the Sun java.*
>> Jeff> classes, and most JDBC programs (consider how JDBC drivers are
>> Jeff> loaded dynamically).
>> 
>> When you write this, do you mean that it is a common idiom to pass a
>> constant string to Class.forName()?  (I'm afraid most of the Java code
>> I've read is code written here.)
>
>Yes.  Sometimes it is useful to get a reference to some class before any
>instances are created:
>
>  try {
>    Class objClass = Class.forName("java.lang.Object");
>  } catch (ClassNotFoundException ex) {
>    ...
>  }
>
>In 1.1 javac introduced a new syntax:
>
>  Class objClass = java.lang.Object.class;
>
>but javac still generates a call to Class.forName(...) in the bytecode. 
>The new syntax is just a compiler trick, not a VM feature.
>
>> Jeff> So gcj either needs some way to statically link together all the
>> Jeff> classes it will eventually need, whether or not they are
>> Jeff> initially referenced, or dynamic loading via dlopen/dlsym/etc.
>> Jeff> (Obviously dynamic loading is preferred...)
>> 
>> I agree we need to do this.  I just don't think it will be in the
>> initial release.  Implementing dynamic loading should be pretty easy;
>> we just don't have the time.
>
>Fair enough.  The sooner you can get us a developer's release, the
>better...
>
>-- 
>Jeff Sturm
>jsturm@sigma6.com
>


More information about the Java mailing list