[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: Reformatted RMIC

Kaffe CVS cvs-commits at kaffe.org
Sat Oct 23 06:29:17 PDT 2004


PatchSet 5334 
Date: 2004/10/23 13:24:34
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: Reformatted RMIC

2004-10-23  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/gnu/java/rmi/rmic/RMIC.java:
        Resynced with GNU Classpath.

        2004-10-20  Michael Koch  <konqueror at gmx.de>

        * gnu/java/rmi/rmic/RMIC.java: Reformatted.

Members: 
	ChangeLog:1.2886->1.2887 
	libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2886 kaffe/ChangeLog:1.2887
--- kaffe/ChangeLog:1.2886	Sat Oct 23 12:08:11 2004
+++ kaffe/ChangeLog	Sat Oct 23 13:24:34 2004
@@ -1,5 +1,14 @@
 2004-10-23  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/gnu/java/rmi/rmic/RMIC.java:
+	Resynced with GNU Classpath.
+
+	2004-10-20  Michael Koch  <konqueror at gmx.de>
+
+        * gnu/java/rmi/rmic/RMIC.java: Reformatted.
+
+2004-10-23  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/javax/imageio/stream/FileCacheImageInputStream.java,
 	libraries/javalib/javax/imageio/stream/FileCacheImageOutputStream.java,
 	libraries/javalib/javax/imageio/stream/FileImageInputStream.java,
Index: kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java
diff -u kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.6 kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.7
--- kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.6	Fri Oct 15 10:41:45 2004
+++ kaffe/libraries/javalib/gnu/java/rmi/rmic/RMIC.java	Sat Oct 23 13:24:35 2004
@@ -52,1034 +52,1027 @@
 import java.util.Iterator;
 import java.util.Set;
 
-public class RMIC {
 
-private String[] args;
-private int next;
-private Exception exception;
-
-private boolean keep = false;
-private boolean need11Stubs = true;
-private boolean need12Stubs = true;
-private boolean compile = true;
-private boolean verbose;
-private String destination;
-
-private PrintWriter out;
-private TabbedWriter ctrl;
-
-private Class clazz;
-private String classname;
-private String fullclassname;
-private MethodRef[] remotemethods;
-private String stubname;
-private String skelname;
-private int errorCount = 0;
-
-private Class mRemoteInterface;
-public RMIC(String[] a) {
-	args = a;
-}
-
-public static void main(String args[]) {
-	RMIC r = new RMIC(args);
-	if (r.run() == false) {
-		Exception exception = r.getException();
-		if (exception != null) {
-			exception.printStackTrace();
-		}
-		else {
-			System.exit(1);
-		}
-	}
-}
-
-public boolean run() {
-	parseOptions();
-	if (next >= args.length) {
-		error("no class names found");
-	}
-	for (int i = next; i < args.length; i++) {
-		try {
-			if (verbose) {
-				System.out.println("[Processing class " + args[i] + ".class]");
-			}
-			processClass(args[i].replace(File.separatorChar, '.'));
-		}
-		catch (Exception e) {
-			exception = e;
-			return (false);
-		}
-	}
-	return (true);
-}
-
-private boolean processClass(String classname) throws Exception {
-	errorCount = 0;
-	analyzeClass(classname);
-	if(errorCount > 0) {
-		System.exit(1);
-	}
-	generateStub();
-	if (need11Stubs) {
-		generateSkel();
-	}
-	if (compile) {
-		compile(stubname.replace('.', File.separatorChar) + ".java");
-		if (need11Stubs) {
-			compile(skelname.replace('.', File.separatorChar) + ".java");
-		}
-	}
-	if (!keep) {
-		(new File(stubname.replace('.', File.separatorChar) + ".java")).delete();
-		if (need11Stubs) {
-			(new File(skelname.replace('.', File.separatorChar) + ".java")).delete();
-		}
-	}
-	return (true);
-}
-
-private void analyzeClass(String cname) throws Exception {
-	if(verbose){
-			System.out.println("[analyze class "+cname+"]");
-		}
-	int p = cname.lastIndexOf('.');
-	if (p != -1) {
-		classname = cname.substring(p+1);
-	}
-	else {
-		classname = cname;
-	}
-	fullclassname = cname;
-
-	
-	HashSet rmeths = new HashSet();
-	findClass();
-	
-	// get the remote interface
-	mRemoteInterface = getRemoteInterface(clazz);
-	if(mRemoteInterface == null)
-		return;
-	if(verbose){
-		System.out.println("[implements "+mRemoteInterface.getName()+"]");
-	}
-
-	// check if the methods of the remote interface declare RemoteExceptions
-	Method[] meths = mRemoteInterface.getDeclaredMethods();
-	for (int i = 0; i < meths.length; i++) {
-		Class[] exceptions = meths[i].getExceptionTypes();
-		int index = 0;
-		for(;index < exceptions.length; index++){
-			if(exceptions[index].equals(RemoteException.class)){
-				break;
-			}
-		}
-		if (index < exceptions.length) {
-			rmeths.add(meths[i]);
-		} else {
-			logError("Method "+meths[i]+" does not throw a java.rmi.RemoteException");
-		}
-	}
-
-
-	// Convert into a MethodRef array and sort them
-	remotemethods = new MethodRef[rmeths.size()];
-	int c = 0;
-	for (Iterator i = rmeths.iterator(); i.hasNext(); ) {
-		remotemethods[c++] = new MethodRef((Method)i.next());
-	}
-	Arrays.sort(remotemethods);
-}
-
-public Exception getException() {
-	return (exception);
-}
-
-private void findClass() throws ClassNotFoundException {
-	clazz = Class.forName(fullclassname, true, ClassLoader.getSystemClassLoader());
-}
-
-private void generateStub() throws IOException {
-	stubname = fullclassname + "_Stub";
-	String stubclassname = classname + "_Stub";
-	ctrl = new TabbedWriter(new FileWriter((destination == null ? "" : destination + File.separator)
-					       + stubname.replace('.', File.separatorChar)
-					       + ".java"));
-	out = new PrintWriter(ctrl);
-
-	if (verbose) {
-		System.out.println("[Generating class " + stubname + ".java]");
-	}
+public class RMIC
+{
+  private String[] args;
+  private int next;
+  private Exception exception;
+  private boolean keep = false;
+  private boolean need11Stubs = true;
+  private boolean need12Stubs = true;
+  private boolean compile = true;
+  private boolean verbose;
+  private String destination;
+  private PrintWriter out;
+  private TabbedWriter ctrl;
+  private Class clazz;
+  private String classname;
+  private String fullclassname;
+  private MethodRef[] remotemethods;
+  private String stubname;
+  private String skelname;
+  private int errorCount = 0;
+  private Class mRemoteInterface;
+
+  public RMIC(String[] a)
+  {
+    args = a;
+  }
+
+  public static void main(String[] args)
+  {
+    RMIC r = new RMIC(args);
+    if (r.run() == false)
+      {
+	Exception e = r.getException();
+	if (e != null)
+	  e.printStackTrace();
+	else
+	  System.exit(1);
+      }
+  }
+
+  public boolean run()
+  {
+    parseOptions();
+    if (next >= args.length)
+      error("no class names found");
+    for (int i = next; i < args.length; i++)
+      {
+	try
+	  {
+	    if (verbose)
+	      System.out.println("[Processing class " + args[i] + ".class]");
+	    processClass(args[i].replace(File.separatorChar, '.'));
+	  }
+	catch (Exception e)
+	  {
+	    exception = e;
+	    return (false);
+	  }
+      }
+    return (true);
+  }
+
+  private boolean processClass(String classname) throws Exception
+  {
+    errorCount = 0;
+    analyzeClass(classname);
+    if (errorCount > 0)
+      System.exit(1);
+    generateStub();
+    if (need11Stubs)
+      generateSkel();
+    if (compile)
+      {
+	compile(stubname.replace('.', File.separatorChar) + ".java");
+	if (need11Stubs)
+	  compile(skelname.replace('.', File.separatorChar) + ".java");
+      }
+    if (! keep)
+      {
+	(new File(stubname.replace('.', File.separatorChar) + ".java")).delete();
+	if (need11Stubs)
+	  (new File(skelname.replace('.', File.separatorChar) + ".java"))
+	  .delete();
+      }
+    return (true);
+  }
+
+  private void analyzeClass(String cname) throws Exception
+  {
+    if (verbose)
+      System.out.println("[analyze class " + cname + "]");
+    int p = cname.lastIndexOf('.');
+    if (p != -1)
+      classname = cname.substring(p + 1);
+    else
+      classname = cname;
+    fullclassname = cname;
+
+    HashSet rmeths = new HashSet();
+    findClass();
+
+    // get the remote interface
+    mRemoteInterface = getRemoteInterface(clazz);
+    if (mRemoteInterface == null)
+      return;
+    if (verbose)
+      System.out.println("[implements " + mRemoteInterface.getName() + "]");
+
+    // check if the methods of the remote interface declare RemoteExceptions
+    Method[] meths = mRemoteInterface.getDeclaredMethods();
+    for (int i = 0; i < meths.length; i++)
+      {
+	Class[] exceptions = meths[i].getExceptionTypes();
+	int index = 0;
+	for (; index < exceptions.length; index++)
+	  {
+	    if (exceptions[index].equals(RemoteException.class))
+	      break;
+	  }
+	if (index < exceptions.length)
+	  rmeths.add(meths[i]);
+	else
+	  logError("Method " + meths[i]
+	           + " does not throw a java.rmi.RemoteException");
+      }
+
+    // Convert into a MethodRef array and sort them
+    remotemethods = new MethodRef[rmeths.size()];
+    int c = 0;
+    for (Iterator i = rmeths.iterator(); i.hasNext();)
+      remotemethods[c++] = new MethodRef((Method) i.next());
+    Arrays.sort(remotemethods);
+  }
+
+  public Exception getException()
+  {
+    return (exception);
+  }
+
+  private void findClass() throws ClassNotFoundException
+  {
+    clazz =
+      Class.forName(fullclassname, true, ClassLoader.getSystemClassLoader());
+  }
+
+  private void generateStub() throws IOException
+  {
+    stubname = fullclassname + "_Stub";
+    String stubclassname = classname + "_Stub";
+    ctrl =
+      new TabbedWriter(new FileWriter((destination == null ? ""
+                                                           : destination
+                                                           + File.separator)
+                                      + stubname.replace('.',
+                                                         File.separatorChar)
+                                      + ".java"));
+    out = new PrintWriter(ctrl);
+
+    if (verbose)
+      System.out.println("[Generating class " + stubname + ".java]");
+
+    out.println("// Stub class generated by rmic - DO NOT EDIT!");
+    out.println();
+    if (fullclassname != classname)
+      {
+	String pname =
+	  fullclassname.substring(0, fullclassname.lastIndexOf('.'));
+	out.println("package " + pname + ";");
+	out.println();
+      }
 
-	out.println("// Stub class generated by rmic - DO NOT EDIT!");
+    out.print("public final class " + stubclassname);
+    ctrl.indent();
+    out.println("extends java.rmi.server.RemoteStub");
+
+    // Output interfaces we implement
+    out.print("implements ");
+    /* Scan implemented interfaces, and only print remote interfaces. */
+    Class[] ifaces = clazz.getInterfaces();
+    Set remoteIfaces = new HashSet();
+    for (int i = 0; i < ifaces.length; i++)
+      {
+	Class iface = ifaces[i];
+	if (java.rmi.Remote.class.isAssignableFrom(iface))
+	  remoteIfaces.add(iface);
+      }
+    Iterator iter = remoteIfaces.iterator();
+    while (iter.hasNext())
+      {
+	/* Print remote interface. */
+	Class iface = (Class) iter.next();
+	out.print(iface.getName());
+
+	/* Print ", " if more remote interfaces follow. */
+	if (iter.hasNext())
+	  out.print(", ");
+      }
+    ctrl.unindent();
+    out.print("{");
+    ctrl.indent();
+
+    // UID
+    if (need12Stubs)
+      {
+	out.println("private static final long serialVersionUID = 2L;");
 	out.println();
-	if (fullclassname != classname) {
-		String pname = fullclassname.substring(0, fullclassname.lastIndexOf('.'));
-		out.println("package " + pname + ";");
-		out.println();
-	}
+      }
 
-	out.print("public final class " + stubclassname);
-	ctrl.indent();
-	out.println("extends java.rmi.server.RemoteStub");
-	
-	// Output interfaces we implement
-	out.print("implements ");
-	/* Scan implemented interfaces, and only print remote interfaces. */ 
-        Class[] ifaces = clazz.getInterfaces(); 
-	Set remoteIfaces = new HashSet();
-        for (int i = 0; i < ifaces.length; i++) {
-		Class iface = ifaces[i];
-		if (java.rmi.Remote.class.isAssignableFrom(iface)) {
-			remoteIfaces.add(iface);
-		}
-	}
-	Iterator iter = remoteIfaces.iterator();
-	while (iter.hasNext()) {
-		/* Print remote interface. */
-		Class iface = (Class) iter.next();
-		out.print(iface.getName());
-
-		/* Print ", " if more remote interfaces follow. */
-		if (iter.hasNext()) {
-			out.print(", ");
-		}
-	}
-	ctrl.unindent();
-	out.print("{");
-	ctrl.indent();
+    // InterfaceHash - don't know how to calculate this - XXX
+    if (need11Stubs)
+      {
+	out.println("private static final long interfaceHash = "
+	            + RMIHashes.getInterfaceHash(clazz) + "L;");
+	out.println();
+	if (need12Stubs)
+	  {
+	    out.println("private static boolean useNewInvoke;");
+	    out.println();
+	  }
 
-	// UID
-	if (need12Stubs) {
-		out.println("private static final long serialVersionUID = 2L;");
-		out.println();
-	}
+	// Operation table
+	out.print("private static final java.rmi.server.Operation[] operations = {");
 
-	// InterfaceHash - don't know how to calculate this - XXX
-	if (need11Stubs) {
-		out.println("private static final long interfaceHash = " + RMIHashes.getInterfaceHash(clazz) + "L;");
-		out.println();
-		if (need12Stubs) {
-			out.println("private static boolean useNewInvoke;");
-			out.println();
-		}
+	ctrl.indent();
+	for (int i = 0; i < remotemethods.length; i++)
+	  {
+	    Method m = remotemethods[i].meth;
+	    out.print("new java.rmi.server.Operation(\"");
+	    out.print(getPrettyName(m.getReturnType()) + " ");
+	    out.print(m.getName() + "(");
+	    // Output signature
+	    Class[] sig = m.getParameterTypes();
+	    for (int j = 0; j < sig.length; j++)
+	      {
+		out.print(getPrettyName(sig[j]));
+		if (j + 1 < sig.length)
+		  out.print(", ");
+	      }
+	    out.print(")\")");
+	    if (i + 1 < remotemethods.length)
+	      out.println(",");
+	  }
+	ctrl.unindent();
+	out.println("};");
+	out.println();
+      }
 
-		// Operation table
-		out.print("private static final java.rmi.server.Operation[] operations = {");
+    // Set of method references.
+    if (need12Stubs)
+      {
+	for (int i = 0; i < remotemethods.length; i++)
+	  {
+	    Method m = remotemethods[i].meth;
+	    out.println("private static java.lang.reflect.Method $method_"
+	                + m.getName() + "_" + i + ";");
+	  }
 
-		ctrl.indent();
-		for (int i = 0; i < remotemethods.length; i++) {
-			Method m = remotemethods[i].meth;
-			out.print("new java.rmi.server.Operation(\"");
-			out.print(getPrettyName(m.getReturnType()) + " ");
-			out.print(m.getName() + "(");
-			// Output signature
-			Class[] sig = m.getParameterTypes();
-			for (int j = 0; j < sig.length; j++) {
-				out.print(getPrettyName(sig[j]));
-				if (j+1 < sig.length) {
-					out.print(", ");
-				}
-			}
-			out.print(")\")");
-			if (i + 1 < remotemethods.length) {
-				out.println(",");
-			}
-		}
-		ctrl.unindent();
-		out.println("};");
-		out.println();
-	}
-
-	// Set of method references.
-	if (need12Stubs) {
-		for (int i = 0; i < remotemethods.length; i++) {
-			Method m = remotemethods[i].meth;
-			out.println("private static java.lang.reflect.Method $method_" + m.getName() + "_" + i + ";");
-		}
+	// Initialize the methods references.
+	out.println();
+	out.print("static {");
+	ctrl.indent();
 
-		// Initialize the methods references.
-		out.println();
-		out.print("static {");
-		ctrl.indent();
+	out.print("try {");
+	ctrl.indent();
 
-		out.print("try {");
-		ctrl.indent();
+	if (need11Stubs)
+	  {
+	    out.println("java.rmi.server.RemoteRef.class.getMethod(\"invoke\", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });");
+	    out.println("useNewInvoke = true;");
+	  }
+
+	for (int i = 0; i < remotemethods.length; i++)
+	  {
+	    Method m = remotemethods[i].meth;
+	    out.print("$method_" + m.getName() + "_" + i + " = ");
+	    out.print(mRemoteInterface.getName() + ".class.getMethod(\""
+	              + m.getName() + "\"");
+	    out.print(", new java.lang.Class[] {");
+	    // Output signature
+	    Class[] sig = m.getParameterTypes();
+	    for (int j = 0; j < sig.length; j++)
+	      {
+		out.print(getPrettyName(sig[j]) + ".class");
+		if (j + 1 < sig.length)
+		  out.print(", ");
+	      }
+	    out.println("});");
+	  }
+	ctrl.unindent();
+	out.println("}");
+	out.print("catch (java.lang.NoSuchMethodException e) {");
+	ctrl.indent();
+	if (need11Stubs)
+	  out.print("useNewInvoke = false;");
+	else
+	  out.print("throw new java.lang.NoSuchMethodError(\"stub class initialization failed\");");
 
-		if (need11Stubs) {
-			out.println("java.rmi.server.RemoteRef.class.getMethod(\"invoke\", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });");
-			out.println("useNewInvoke = true;");
-		}
-
-		for (int i = 0; i < remotemethods.length; i++) {
-			Method m = remotemethods[i].meth;
-			out.print("$method_" + m.getName() + "_" + i + " = ");
-			out.print(mRemoteInterface.getName() + ".class.getMethod(\"" + m.getName() + "\"");
-			out.print(", new java.lang.Class[] {");
-			// Output signature
-			Class[] sig = m.getParameterTypes();
-			for (int j = 0; j < sig.length; j++) {
-				out.print(getPrettyName(sig[j]) + ".class");
-				if (j+1 < sig.length) {
-					out.print(", ");
-				}
-			}
-			out.println("});");
-		}
-		ctrl.unindent();
-		out.println("}");
-		out.print("catch (java.lang.NoSuchMethodException e) {");
-		ctrl.indent();
-		if (need11Stubs) {
-			out.print("useNewInvoke = false;");
-		}
-		else {
-			out.print("throw new java.lang.NoSuchMethodError(\"stub class initialization failed\");");
-		}
+	ctrl.unindent();
+	out.print("}");
 
-		ctrl.unindent();
-		out.print("}");
+	ctrl.unindent();
+	out.println("}");
+	out.println();
+      }
 
-		ctrl.unindent();
-		out.println("}");
-		out.println();
-	}
+    // Constructors
+    if (need11Stubs)
+      {
+	out.print("public " + stubclassname + "() {");
+	ctrl.indent();
+	out.print("super();");
+	ctrl.unindent();
+	out.println("}");
+      }
 
-	// Constructors
-	if (need11Stubs) {
-		out.print("public " + stubclassname + "() {");
-		ctrl.indent();
-		out.print("super();");
-		ctrl.unindent();
-		out.println("}");
-	}
+    if (need12Stubs)
+      {
+	out.print("public " + stubclassname
+	          + "(java.rmi.server.RemoteRef ref) {");
+	ctrl.indent();
+	out.print("super(ref);");
+	ctrl.unindent();
+	out.println("}");
+      }
 
-	if (need12Stubs) {
-		out.print("public " + stubclassname + "(java.rmi.server.RemoteRef ref) {");
-		ctrl.indent();
-		out.print("super(ref);");
-		ctrl.unindent();
-		out.println("}");
-	}
+    // Method implementations
+    for (int i = 0; i < remotemethods.length; i++)
+      {
+	Method m = remotemethods[i].meth;
+	Class[] sig = m.getParameterTypes();
+	Class returntype = m.getReturnType();
+	Class[] except = sortExceptions(m.getExceptionTypes());
 
-	// Method implementations
-	for (int i = 0; i < remotemethods.length; i++) {
-		Method m = remotemethods[i].meth;
-		Class[] sig = m.getParameterTypes();
-		Class returntype = m.getReturnType();
-		Class[] except = sortExceptions(m.getExceptionTypes());
+	out.println();
+	out.print("public " + getPrettyName(returntype) + " " + m.getName()
+	          + "(");
+	for (int j = 0; j < sig.length; j++)
+	  {
+	    out.print(getPrettyName(sig[j]));
+	    out.print(" $param_" + j);
+	    if (j + 1 < sig.length)
+	      out.print(", ");
+	  }
+	out.print(") ");
+	out.print("throws ");
+	for (int j = 0; j < except.length; j++)
+	  {
+	    out.print(getPrettyName(except[j]));
+	    if (j + 1 < except.length)
+	      out.print(", ");
+	  }
+	out.print(" {");
+	ctrl.indent();
+
+	out.print("try {");
+	ctrl.indent();
+
+	if (need12Stubs)
+	  {
+	    if (need11Stubs)
+	      {
+		out.print("if (useNewInvoke) {");
+		ctrl.indent();
+	      }
+	    if (returntype != Void.TYPE)
+	      out.print("java.lang.Object $result = ");
+	    out.print("ref.invoke(this, $method_" + m.getName() + "_" + i
+	              + ", ");
+	    if (sig.length == 0)
+	      out.print("null, ");
+	    else
+	      {
+		out.print("new java.lang.Object[] {");
+		for (int j = 0; j < sig.length; j++)
+		  {
+		    if (sig[j] == Boolean.TYPE)
+		      out.print("new java.lang.Boolean($param_" + j + ")");
+		    else if (sig[j] == Byte.TYPE)
+		      out.print("new java.lang.Byte($param_" + j + ")");
+		    else if (sig[j] == Character.TYPE)
+		      out.print("new java.lang.Character($param_" + j + ")");
+		    else if (sig[j] == Short.TYPE)
+		      out.print("new java.lang.Short($param_" + j + ")");
+		    else if (sig[j] == Integer.TYPE)
+		      out.print("new java.lang.Integer($param_" + j + ")");
+		    else if (sig[j] == Long.TYPE)
+		      out.print("new java.lang.Long($param_" + j + ")");
+		    else if (sig[j] == Float.TYPE)
+		      out.print("new java.lang.Float($param_" + j + ")");
+		    else if (sig[j] == Double.TYPE)
+		      out.print("new java.lang.Double($param_" + j + ")");
+		    else
+		      out.print("$param_" + j);
+		    if (j + 1 < sig.length)
+		      out.print(", ");
+		  }
+		out.print("}, ");
+	      }
+	    out.print(Long.toString(remotemethods[i].hash) + "L");
+	    out.print(");");
 
+	    if (returntype != Void.TYPE)
+	      {
 		out.println();
-		out.print("public " + getPrettyName(returntype) + " " + m.getName() + "(");
-		for (int j = 0; j < sig.length; j++) {
-			out.print(getPrettyName(sig[j]));
-			out.print(" $param_" + j);
-			if (j+1 < sig.length) {
-				out.print(", ");
-			}
-		}
-		out.print(") ");
-		out.print("throws ");
-		for (int j = 0; j < except.length; j++) {
-			out.print(getPrettyName(except[j]));
-			if (j+1 < except.length) {
-				out.print(", ");
-			}
-		}
-		out.print(" {");
-		ctrl.indent();
-
-		out.print("try {");
-		ctrl.indent();
-
-		if (need12Stubs) {
-			if (need11Stubs) {
-				out.print("if (useNewInvoke) {");
-				ctrl.indent();
-			}
-			if (returntype != Void.TYPE) {
-				out.print("java.lang.Object $result = ");
-			}
-			out.print("ref.invoke(this, $method_" + m.getName() + "_" + i + ", ");
-			if (sig.length == 0) {
-				out.print("null, ");
-			}
-			else {
-				out.print("new java.lang.Object[] {");
-				for (int j = 0; j < sig.length; j++) {
-					if (sig[j] == Boolean.TYPE) {
-						out.print("new java.lang.Boolean($param_" + j + ")");
-					}
-					else if (sig[j] == Byte.TYPE) {
-						out.print("new java.lang.Byte($param_" + j + ")");
-					}
-					else if (sig[j] == Character.TYPE) {
-						out.print("new java.lang.Character($param_" + j + ")");
-					}
-					else if (sig[j] == Short.TYPE) {
-						out.print("new java.lang.Short($param_" + j + ")");
-					}
-					else if (sig[j] == Integer.TYPE) {
-						out.print("new java.lang.Integer($param_" + j + ")");
-					}
-					else if (sig[j] == Long.TYPE) {
-						out.print("new java.lang.Long($param_" + j + ")");
-					}
-					else if (sig[j] == Float.TYPE) {
-						out.print("new java.lang.Float($param_" + j + ")");
-					}
-					else if (sig[j] == Double.TYPE) {
-						out.print("new java.lang.Double($param_" + j + ")");
-					}
-					else {
-						out.print("$param_" + j);
-					}
-					if (j+1 < sig.length) {
-						out.print(", ");
-					}
-				}
-				out.print("}, ");
-			}
-			out.print(Long.toString(remotemethods[i].hash) + "L");
-			out.print(");");
-
-			if (returntype != Void.TYPE) {
-				out.println();
-				out.print("return (");
-				if (returntype == Boolean.TYPE) {
-					out.print("((java.lang.Boolean)$result).booleanValue()");
-				}
-				else if (returntype == Byte.TYPE) {
-					out.print("((java.lang.Byte)$result).byteValue()");
-				}
-				else if (returntype == Character.TYPE) {
-					out.print("((java.lang.Character)$result).charValue()");
-				}
-				else if (returntype == Short.TYPE) {
-					out.print("((java.lang.Short)$result).shortValue()");
-				}
-				else if (returntype == Integer.TYPE) {
-					out.print("((java.lang.Integer)$result).intValue()");
-				}
-				else if (returntype == Long.TYPE) {
-					out.print("((java.lang.Long)$result).longValue()");
-				}
-				else if (returntype == Float.TYPE) {
-					out.print("((java.lang.Float)$result).floatValue()");
-				}
-				else if (returntype == Double.TYPE) {
-					out.print("((java.lang.Double)$result).doubleValue()");
-				}
-				else {
-					out.print("(" + getPrettyName(returntype) + ")$result");
-				}
-				out.print(");");
-			}
-
-			if (need11Stubs) {
-				ctrl.unindent();
-				out.println("}");
-				out.print("else {");
-				ctrl.indent();
-			}
-		}
-
-		if (need11Stubs) {
-			out.println("java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, " + i + ", interfaceHash);");
-			out.print("try {");
-			ctrl.indent();
-			out.print("java.io.ObjectOutput out = call.getOutputStream();");
-			for (int j = 0; j < sig.length; j++) {
-				out.println();
-				if (sig[j] == Boolean.TYPE) {
-					out.print("out.writeBoolean(");
-				}
-				else if (sig[j] == Byte.TYPE) {
-					out.print("out.writeByte(");
-				}
-				else if (sig[j] == Character.TYPE) {
-					out.print("out.writeChar(");
-				}
-				else if (sig[j] == Short.TYPE) {
-					out.print("out.writeShort(");
-				}
-				else if (sig[j] == Integer.TYPE) {
-					out.print("out.writeInt(");
-				}
-				else if (sig[j] == Long.TYPE) {
-					out.print("out.writeLong(");
-				}
-				else if (sig[j] == Float.TYPE) {
-					out.print("out.writeFloat(");
-				}
-				else if (sig[j] == Double.TYPE) {
-					out.print("out.writeDouble(");
-				}
-				else {
-					out.print("out.writeObject(");
-				}
-				out.print("$param_" + j + ");");
-			}
-			ctrl.unindent();
-			out.println("}");
-			out.print("catch (java.io.IOException e) {");
-			ctrl.indent();
-			out.print("throw new java.rmi.MarshalException(\"error marshalling arguments\", e);");
-			ctrl.unindent();
-			out.println("}");
-			out.println("ref.invoke(call);");
-			if (returntype != Void.TYPE) {
-				out.println(getPrettyName(returntype) + " $result;");
-			}
-			out.print("try {");
-			ctrl.indent();
-			out.print("java.io.ObjectInput in = call.getInputStream();");
-			boolean needcastcheck = false;
-			if (returntype != Void.TYPE) {
-				out.println();
-				out.print("$result = ");
-				if (returntype == Boolean.TYPE) {
-					out.print("in.readBoolean();");
-				}
-				else if (returntype == Byte.TYPE) {
-					out.print("in.readByte();");
-				}
-				else if (returntype == Character.TYPE) {
-					out.print("in.readChar();");
-				}
-				else if (returntype == Short.TYPE) {
-					out.print("in.readShort();");
-				}
-				else if (returntype == Integer.TYPE) {
-					out.print("in.readInt();");
-				}
-				else if (returntype == Long.TYPE) {
-					out.print("in.readLong();");
-				}
-				else if (returntype == Float.TYPE) {
-					out.print("in.readFloat();");
-				}
-				else if (returntype == Double.TYPE) {
-					out.print("in.readDouble();");
-				}
-				else {
-					if (returntype != Object.class) {
-						out.print("(" + getPrettyName(returntype) + ")");
-					}
-					else {
-						needcastcheck = true;
-					}
-					out.print("in.readObject();");
-				}
-				out.println();
-				out.print("return ($result);");
-			}
-			ctrl.unindent();
-			out.println("}");
-			out.print("catch (java.io.IOException e) {");
-			ctrl.indent();
-			out.print("throw new java.rmi.UnmarshalException(\"error unmarshalling return\", e);");
-			ctrl.unindent();
-			out.println("}");
-			if (needcastcheck) {
-				out.print("catch (java.lang.ClassNotFoundException e) {");
-				ctrl.indent();
-				out.print("throw new java.rmi.UnmarshalException(\"error unmarshalling return\", e);");
-				ctrl.unindent();
-				out.println("}");
-			}
-			out.print("finally {");
-			ctrl.indent();
-			out.print("ref.done(call);");
-			ctrl.unindent();
-			out.print("}");
-
-			if (need12Stubs && need11Stubs) {
-				ctrl.unindent();
-				out.print("}");
-			}
-		}
-
-		ctrl.unindent();
-		out.print("}");
-
-		boolean needgeneral = true;
-		for (int j = 0; j < except.length; j++) {
-			out.println();
-			out.print("catch (" + getPrettyName(except[j]) + " e) {");
-			ctrl.indent();
-			out.print("throw e;");
-			ctrl.unindent();
-			out.print("}");
-			if (except[j] == Exception.class) {
-				needgeneral = false;
-			}
-		}
-		if (needgeneral) {
-			out.println();

*** Patch too long, truncated ***




More information about the kaffe mailing list