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]

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" );
+    }
+}


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