[PATCH] RMI patches

Carlos Valiente yo at virutass.net
Sat Jul 14 10:53:06 PDT 2001


Here's a little patch for RMI under kaffe:

- kjc cannot compile the generated XXXX_Skel.java file. That file contains a 
fragment which looks like this:

         XXXX $param_0;
         try {
                 $param_0 = ...
         }
         catch {
                 ...
         }
         int result = server.YYYYYY($param_0)

kjc complains about "Local variable "$param_0" may have not been initialized 
before use [JLS 14.4]". This patch makes RMIC generate 'XXXX $param_0 = 
null'  instead, and the problem is solved.

- The 'rmic' script now supports the '-J' switch. Options prefixed with 'J' 
will be passed to the virtual machine which executes kaffe.rmi.rmic.RMIC, 
just like Sun's rmic. The main benefit from this patch is being able to use 
'jikes' as compiler for the generated stubs and skeletons; something like 
this:

         rmic -J-Dkaffe.compiler=jikes YourObjectImpl

, which greatly accelerates development cycles!

The new 'rmic' script works well under 'bash'  and makes use of GNU expr. I 
haven't tested it under any other shell.
-------------- next part --------------
Index: kaffe/scripts/rmic.in
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/scripts/rmic.in,v
retrieving revision 1.4
diff -u -r1.4 rmic.in
--- kaffe/scripts/rmic.in	1999/10/09 19:56:38	1.4
+++ kaffe/scripts/rmic.in	2001/07/14 17:43:44
@@ -1,5 +1,16 @@
 #! /bin/sh
+
+for i in "$@"
+do
+	OPTION=`expr $i : '\-J\(.\+\)'`
+	if test "x$OPTION" == "x"; then
+		RMIC_ARGS="$RMIC_ARGS $i"
+	else
+		JAVA_OPTIONS="$JAVA_OPTIONS $OPTION"
+	fi
+done
+
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-exec @bindir@/@kaffe_TRANSF@ kaffe.rmi.rmic.RMIC ${1+"$@"}
-
+exec @bindir@/@kaffe_TRANSF@ $JAVA_OPTIONS kaffe.rmi.rmic.RMIC $RMIC_ARGS
Index: libraries/extensions/rmi/javalib/kaffe/rmi/rmic/RMIC.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/extensions/rmi/javalib/kaffe/rmi/rmic/RMIC.java,v
retrieving revision 1.4
diff -u -r1.4 RMIC.java
--- libraries/extensions/rmi/javalib/kaffe/rmi/rmic/RMIC.java	1999/10/24 22:34:15	1.4
+++ libraries/extensions/rmi/javalib/kaffe/rmi/rmic/RMIC.java	2001/07/14 17:44:18
@@ -682,7 +682,7 @@
 		Class[] sig = m.getParameterTypes();
 		for (int j = 0; j < sig.length; j++) {
 			out.print(getPrettyName(sig[j]));
-			out.println(" $param_" + j + ";");
+			out.println(" $param_" + j + " = null;");
 		}
 
 		out.print("try {");
@@ -909,7 +909,12 @@
 			destination = args[next];
 			next++;
 		}
+		/*
+		This option is handled by the script 'rmic',
+		so we shouldn't see it here.
+				
 		else if (arg.charAt(1) == 'J') {
+		*/
 		}
 		else {
 			System.err.println("Unknown option: " + arg);
@@ -933,7 +938,7 @@
 "	-verbose 		Output what's going on\n" +
 "	-classpath <path> *	Use given path as classpath\n" +
 "	-d <directory> 		Specify where to place generated classes\n" +
-"	-J<flag> *		Pass flag to Java\n" +
+"	-J<flag>		Pass flag to Java\n" +
 "  * Option currently ignored"
 	);
 }


More information about the kaffe mailing list