(I'm not subscribed to classpath-patches so please cc me on responses)

Here are a couple of patches to deal with japi errors relating to
constant field values. In both cases they reflect stupidity in the
spec but since binary compatibility *does* require that constant field
values should match I think the japi errors are valid. Sun even
include these values in their documentation these days, ridiculous as
they are.

I'd prefer if someone else would commit these because I haven't
touched the classpath code in ages and I'm afraid of breaking things
;) I'd also like someone who understands the rmi code to check that
patch, because even though I changed the only code in Classpath itself
that uses the packagePrefix field, I'm not sure whether there are any
implications for code outside of Classpath that refers to it. (Note
that any such code would already be broken if compiled against the JDK
- my concern is whether *more* work is needed here to cover all the
cases).

Here's a changelog for the RMI one (hope I got the format right):

2005-10-04  Stuart Ballard  <[EMAIL PROTECTED]>

        * java/rmi/LoaderHandler.java (packagePrefix): Match Sun's value.
        * java/rmi/RemoteRef.java (packagePrefix): Likewise.
        * java/rmi/RemoteObject.java (readObject): Hardcode the GNU package 
prefix.

And for the swing one:

2005-10-04  Stuart Ballard  <[EMAIL PROTECTED]>

        * javax/swing/undo/StateEdit.java (RCSID): Match Sun's value.
        * javax/swing/undo/StateEditable.java (RCSID): Likewise.

Thanks,
Stuart.
--
http://sab39.dev.netreach.com/
? java/rmi/server/.RemoteObject.java.swp
Index: java/rmi/server/LoaderHandler.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/rmi/server/LoaderHandler.java,v
retrieving revision 1.7
diff -u -u -r1.7 LoaderHandler.java
--- java/rmi/server/LoaderHandler.java	2 Jul 2005 20:32:40 -0000	1.7
+++ java/rmi/server/LoaderHandler.java	4 Oct 2005 17:59:19 -0000
@@ -45,7 +45,11 @@
  */
 public interface LoaderHandler
 {
-  String packagePrefix = "";
+  /**
+   * For binary compatibility with the JDK, the string "sun.rmi.server".
+   * Not actually used for anything.
+   */
+  String packagePrefix = "sun.rmi.server";
 
   /**
    * @deprecated
Index: java/rmi/server/RemoteObject.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/rmi/server/RemoteObject.java,v
retrieving revision 1.9
diff -u -u -r1.9 RemoteObject.java
--- java/rmi/server/RemoteObject.java	2 Jul 2005 20:32:40 -0000	1.9
+++ java/rmi/server/RemoteObject.java	4 Oct 2005 17:59:19 -0000
@@ -120,7 +120,9 @@
 	    in.read (); //some unknown UnicastRef2 field
 	  }
 
-	cname = RemoteRef.packagePrefix + '.' + cname;
+  // It would be nice to use RemoteRef.packagePrefix here, but for binary
+  // compatibility with the JDK that has to contain "sun.rmi.server"...
+	cname = "gnu.java.rmi.server." + cname;
 	try 
 	  {
 	    Class cls = Class.forName(cname);
Index: java/rmi/server/RemoteRef.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/rmi/server/RemoteRef.java,v
retrieving revision 1.8
diff -u -u -r1.8 RemoteRef.java
--- java/rmi/server/RemoteRef.java	2 Jul 2005 20:32:40 -0000	1.8
+++ java/rmi/server/RemoteRef.java	4 Oct 2005 17:59:19 -0000
@@ -48,7 +48,11 @@
 {
   long serialVersionUID = 3632638527362204081L;
   
-  String packagePrefix = "gnu.java.rmi.server";
+  /**
+   * For binary compatibility with the JDK, the string "sun.rmi.server".
+   * Not actually used for anything.
+   */
+  String packagePrefix = "sun.rmi.server";
 
   /**
    * @deprecated









Index: javax/swing/undo/StateEdit.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/undo/StateEdit.java,v
retrieving revision 1.8
diff -u -u -r1.8 StateEdit.java
--- javax/swing/undo/StateEdit.java	2 Jul 2005 20:32:52 -0000	1.8
+++ javax/swing/undo/StateEdit.java	4 Oct 2005 17:59:41 -0000
@@ -104,9 +104,11 @@
    * System (RCS).  This certainly should not be part of the API
    * specification. But in order to be API-compatible with
    * Sun&#x2019;s reference implementation, GNU Classpath also has to
-   * provide this field. However, we do not try to match its value.
+   * provide this field and match its value. The value used here is
+   * from the JDK 1.5 release.
    */
-  protected static final String RCSID = "";
+  protected static final String RCSID = "$" +
+    "Id: StateEdit.java,v 1.6 1997/10/01 20:05:51 sandipc Exp $";
 
 
   /**
Index: javax/swing/undo/StateEditable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/undo/StateEditable.java,v
retrieving revision 1.7
diff -u -u -r1.7 StateEditable.java
--- javax/swing/undo/StateEditable.java	2 Jul 2005 20:32:52 -0000	1.7
+++ javax/swing/undo/StateEditable.java	4 Oct 2005 17:59:41 -0000
@@ -78,9 +78,11 @@
    * System (RCS).  This certainly should not be part of the API
    * specification. But in order to be API-compatible with
    * Sun&#x2019;s reference implementation, GNU Classpath also has to
-   * provide this field. However, we do not try to match its value.
+   * provide this field and match its value. The value used here is
+   * from the JDK 1.5 release.
    */
-  String RCSID = "";
+  String RCSID = "$" +
+    "Id: StateEditable.java,v 1.2 1997/09/08 19:39:08 marklin Exp $";
 
 
   /**









_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to