This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
invoke-static
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: Kawa List <kawa at sources dot redhat dot com>
- Date: Thu, 24 Apr 2003 14:52:40 -0700
- Subject: invoke-static
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.
Regards,
Chris Dean
--- /dev/null Tue Dec 10 02:57:38 2002
+++ invoke-static/Foo.scm Thu Apr 24 14:43:21 2003
@@ -0,0 +1,5 @@
+(module-name <Foo>)
+(module-static #t)
+
+(define (call-static-method)
+ (invoke-static <MyClass> 'staticMethod))
--- /dev/null Tue Dec 10 02:57:38 2002
+++ invoke-static/MyClass.java Thu Apr 24 14:43:21 2003
@@ -0,0 +1,13 @@
+public class MyClass {
+ static {
+ System.err.println( "static block called!!!!" );
+ }
+
+ public static void staticMethod() {
+ System.err.println( "static Method" );
+ }
+
+ public MyClass() {
+ System.err.println( "created" );
+ }
+}