This is the mail archive of the kawa@sourceware.cygnus.com mailing list for the Kawa project. See the Kawa home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: `object' and interfaces



The appended patch should help.

You also have to change your example to:

#|kawa:1|# (object (<java.lang.Object> <java.awt.event.ItemListener>)
                   ((itemStateChanged (arg <java.awt.event.ItemEvent>))
                    <void>
                    (display "listener called")))

Note the arg declaration.

Tue Mar 16 20:49:08 1999  Per Bothner  <bothner@Magnus.Cygnus.COM>

	* PrimType.java (emitCoerceFromObject):  Handle coercing to void.

	* ClassType.java (getModifiers):  If access_flags is 0,
	check reflectClass.getModifiers().  (Bit of a hack.)

Index: ClassType.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/bytecode/ClassType.java,v
retrieving revision 1.18
diff -u -p -r1.18 ClassType.java
--- ClassType.java	1998/11/07 11:33:19	1.18
+++ ClassType.java	1999/03/17 04:42:21
@@ -71,7 +71,13 @@ public class ClassType extends ObjectTyp
   }
 
   /** Return the modifiers (access flags) for this class. */
-  public final int getModifiers() { return access_flags; }
+  public final int getModifiers()
+  {
+    if (access_flags == 0 && getReflectClass() != null)
+      return reflectClass.getModifiers();
+    else
+      return access_flags;
+  }
 
   /** Set the modifiers (access flags) for this class. */
   public final void setModifiers(int flags) { access_flags = flags; }
Index: PrimType.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/bytecode/PrimType.java,v
retrieving revision 1.3
diff -u -p -r1.3 PrimType.java
--- PrimType.java	1998/09/12 23:27:32	1.3
+++ PrimType.java	1999/03/17 04:42:22
@@ -52,19 +52,23 @@ public class PrimType extends Type {
       {
 	code.emitCheckcast(boolean_ctype);
 	code.emitInvokeVirtual(booleanValue_method);
-	return;
       }
-    code.emitCheckcast(number_type);
-    if (sig1 == 'I' || sig1 == 'S' || sig1 == 'B')
-      code.emitInvokeVirtual(intValue_method);
-    else if (sig1 == 'J')
-      code.emitInvokeVirtual(longValue_method);
-    else if (sig1 == 'D')
-      code.emitInvokeVirtual(doubleValue_method);
-    else if (sig1 == 'F')
-      code.emitInvokeVirtual(floatValue_method);
-    // Have left out Character -> char, since not used by Kawa.
+    else if (sig1 == 'V')
+      code.emitPop(1);
     else
-      super.emitCoerceFromObject(code);
+      {
+	code.emitCheckcast(number_type);
+	if (sig1 == 'I' || sig1 == 'S' || sig1 == 'B')
+	  code.emitInvokeVirtual(intValue_method);
+	else if (sig1 == 'J')
+	  code.emitInvokeVirtual(longValue_method);
+	else if (sig1 == 'D')
+	  code.emitInvokeVirtual(doubleValue_method);
+	else if (sig1 == 'F')
+	  code.emitInvokeVirtual(floatValue_method);
+	// Have left out Character -> char, since not used by Kawa.
+	else
+	  super.emitCoerceFromObject(code);
+      }
   }
 }