This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: invoke-static


Chris Dean wrote:
Say we have a file with an invoke-static expression:

(invoke-static <MyClass> 'staticMethod)

When we compile this file, the static block in MyClass is executed.

I *really* don't want it to do that.  Any ideas for a workaround?  There
is come code below to demonstrate this.

This is probably because Class.forName is called, and forName by default initializes the class. In Java 2 there is a forName version that takes an explicit 'initialize' parameter, which we could set to false.

But that gets us into the issue of Kawa requiring Java 2.
Last time we discussed this, the concern was that there are
some platforms (such as Mac classic, I believe) that have
JDK 1.1, but not JDK 1.2 or anything similar.

My solution has been to "pre-process" the Java files, but
that is an ugly and heavy-duty solution.  It would be
less confusing to use real .java files.  On the other hand,
I'm unhappy to cut off the JDK 1.1 users, few though they are.

Perhaps a better model is that the actual source file are
the .java files that may depend on Java 2 features, but
I provide a patch file to remove Java 2 dependencies.
The "mainline" would be the intersection of JDK 1.4.1,
GCJ 3.3, and possibly Kaffe; if you're using a Java
implementation that does not have these features, you'd
have to run the patch file first.

Comments?
--
	--Per Bothner
per at bothner dot com   http://per.bothner.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]