[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: swing, and various fixes

Kaffe CVS cvs-commits at kaffe.org
Tue Sep 20 20:24:04 PDT 2005


PatchSet 6925 
Date: 2005/09/21 03:18:46
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: swing, and various fixes

Members: 
	ChangeLog:1.4447->1.4448 
	libraries/clib/classpath/jcl.c:1.6->1.7 
	libraries/javalib/all.files:1.165->1.166 
	libraries/javalib/gnu/java/security/PolicyFile.java:1.9->1.10 
	libraries/javalib/java/awt/Container.java:1.43->1.44 
	libraries/javalib/java/io/ObjectInputStream.java:1.59->1.60 
	libraries/javalib/java/io/ObjectStreamClass.java:1.33->1.34 
	libraries/javalib/java/io/PrintWriter.java:1.10->1.11 
	libraries/javalib/java/lang/Boolean.java:1.17->1.18 
	libraries/javalib/java/lang/Byte.java:1.19->1.20 
	libraries/javalib/java/lang/Character.java:1.28->1.29 
	libraries/javalib/java/lang/Double.java:1.24->1.25 
	libraries/javalib/java/lang/Float.java:1.24->1.25 
	libraries/javalib/java/lang/Long.java:1.23->1.24 
	libraries/javalib/java/lang/Short.java:1.14->1.15 
	libraries/javalib/java/lang/String.java:1.49->1.50 
	libraries/javalib/java/lang/StringBuffer.java:1.31->1.32 
	libraries/javalib/java/net/URLClassLoader.java:1.30->1.31 
	libraries/javalib/java/nio/charset/Charset.java:1.19->1.20 
	libraries/javalib/java/security/Security.java:1.22->1.23 
	libraries/javalib/java/text/ParsePosition.java:1.9->1.10 
	libraries/javalib/java/text/RuleBasedCollator.java:1.27->1.28 
	libraries/javalib/java/text/StringCharacterIterator.java:1.18->1.19 
	libraries/javalib/java/util/Timer.java:1.11->1.12 
	libraries/javalib/java/util/logging/LoggingPermission.java:1.3->1.4 
	libraries/javalib/java/util/prefs/Preferences.java:1.8->1.9 
	libraries/javalib/javax/swing/JFileChooser.java:1.10->1.11 
	libraries/javalib/javax/swing/JTree.java:1.29->1.30 
	libraries/javalib/javax/swing/ProgressMonitor.java:1.3->1.4 
	libraries/javalib/javax/swing/ProgressMonitorInputStream.java:1.4->1.5 
	libraries/javalib/javax/swing/Timer.java:1.11->1.12 
	libraries/javalib/javax/swing/filechooser/FileSystemView.java:1.5->1.6 
	libraries/javalib/javax/swing/plaf/basic/BasicComboBoxRenderer.java:1.5->1.6 
	libraries/javalib/javax/swing/plaf/basic/BasicComboBoxUI.java:1.11->1.12 
	libraries/javalib/javax/swing/plaf/basic/BasicLookAndFeel.java:1.27->1.28 
	libraries/javalib/javax/swing/plaf/basic/BasicMenuItemUI.java:1.13->1.14 
	libraries/javalib/javax/swing/plaf/metal/MetalComboBoxEditor.java:INITIAL->1.1 
	libraries/javalib/org/ietf/jgss/GSSException.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4447 kaffe/ChangeLog:1.4448
--- kaffe/ChangeLog:1.4447	Wed Sep 21 01:42:06 2005
+++ kaffe/ChangeLog	Wed Sep 21 03:18:46 2005
@@ -1,5 +1,348 @@
 2005-09-20  Dalibor Topic  <robilad at kaffe.org>
 
+	Resynced with GNU Classpath.
+
+	2005-09-18  Tom Tromey  <tromey at redhat.com>
+
+        * java/util/Timer.java (TaskQueue.purge): New method.
+        (Timer(String)): New constructor.
+        (Timer(String,boolean)): Likewise.
+        (purge): New method.
+
+	2005-09-18  Tom Tromey  <tromey at redhat.com>
+
+        * java/lang/Short.java (valueOf): New method.
+        * java/lang/Double.java (valueOf): New method.
+        * java/lang/Float.java (valueOf): New method.
+
+	2005-09-18  Tom Tromey  <tromey at redhat.com>
+
+        * java/lang/Long.java (reverse): Correctly handle sign extension.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/basic/BasicComboBoxUI.java
+        (installComponents): remove listBox color settings,
+        * javax/swing/plaf/basic/BasicLookAndFeel.java
+        (initComponentDefaults): corrected ComboBox and ListBox defaults.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+        (BasicComboBoxRenderer): set no focus border,
+        (getListCellRendererComponent): set background color if cell has focus,
+        removed border switching code.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/basic/BasicComboBoxUI.java
+        (borderInsets): deleted,
+        (arrowButtonWidth): deleted,
+        (configureEditor): set font,
+        (isFocusTraversable): set to true for non-editable combobox,
+        (paint): deleted border painting code,
+        (paintBorder): deleted,
+        (getPreferredSize): returns a value, not null,
+        (getMinimumSize): likewise,
+        (getMaximumSize): likewise,
+        (rectangleForCurrentValue): reimplemented,
+        (paintCurrentValue): no longer adjusts for border insets,
+        (getDisplaySize): update maximum width and height independently,
+        (ComboBoxLayoutManager): removed redundant 'extends Object',
+        (ComboBoxLayoutManager.preferredLayoutSize): call getPreferredSize(),
+        (ComboBoxLayoutManager.minimumLayoutSize): delegate to
+        preferredLayoutSize(),
+        (ComboBoxLayoutManager.layoutContainer): use arrow button preferred
+        size in layout,
+        (PropertyChangeHandler.propertyChange): added 'font' handling.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/basic/BasicComboBoxUI.java
+        (installListeners): add listener to arrowButton instead of comboBox,
+        deleted call to configureArrowButton(),
+        (uninstallListeners): remove listener from arrowButton instead of
+        comboBox, and deleted call to unconfigureArrowButton(),
+        (configureArrowButton): set font and enabled state, deleted
+        addMouseListener() call,
+        (unconfigureArrowButton): deleted removeMouseListener() call,
+        (MouseHandler.mousePressed): just toggle display status of popup,
+        (MouseHandler.mouseReleased): deleted.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/basic/BasicComboBoxUI.java
+        (largestItemSize): renamed displaySize,
+        (getLargestItemSize): renamed getDisplaySize and changed to protected,
+        (ComboBoxLayoutManager.preferredLayoutSize): updated for renamed field
+        and method,
+        (ListDataHandler.intervalAdded): likewise,
+        (ListDataHandler.intervalRemoved): likewise.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * javax/swing/plaf/basic/BasicComboBoxUI.java:
+        Updated API docs all over.
+
+	2005-09-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+        * java/text/RuleBasedCollator.java:
+        Fixed spelling error in comment.
+
+	2005-09-17  Anthony Green  <green at redhat.com>
+
+        * java/security/Security.java (getProviders): Pre-allocate the
+        target array for Collection.toArray call.
+        * gnu/java/security/PolicyFile.java (parse): Ditto.
+        * javax/swing/filechooser/FileSystemView.java: Ditto.
+        * javax/swing/JFileChooser.java (getChoosableFileFilters): Ditto.
+
+	2005-09-17  Tom Tromey  <tromey at redhat.com>
+
+        PR classpath/22963:
+        * java/nio/charset/Charset.java (forName): Javadoc fix.
+        (providers2): Use ServiceFactory.
+
+	2005-09-17  Mark Wielaard  <mark at klomp.org>
+
+        * org/ietf/jgss/GSSException.java (BAD_BINDINGS, BAD_MECH,
+        BAD_NAME, BAD_NAMETYPE, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED,
+        DEFECTIVE_CREDENTIAL, DEFECTIVE_TOKEN, DUPLICATE_TOKEN, FAILURE,
+        NO_CONTEXT, NO_CRED, OLD_TOKEN): Document official RFC values.
+
+	2005-09-17  Tom Tromey  <tromey at redhat.com>
+
+        * java/lang/Short.java (SIZE): New constant.
+        (MIN_CACHE, MAX_CACHE): Likewise.
+        (shortCache): New field.
+        (reverseBytes): New method.
+        * java/lang/Long.java (SIZE): New constant.
+        (valueOf): New method.
+        (bitCount): New method.
+        (rotateLeft): New method.
+        (rotateRight): New method.
+        (highestOneBit): New method.
+        (numberOfLeadingZeros): New method.
+        (lowestOneBit): New method.
+        (numberOfTrailingZeros): New method.
+        (signum): New method.
+        (reverseBytes): New method.
+        (reverse): New method.
+        * java/lang/Float.java (SIZE): New constant.
+        * java/lang/Double.java (SIZE): New constant.
+        * java/lang/Character.java (SIZE): New constant.
+        (MAX_CACHE): Likewise.
+        (charCache): New field.
+        (valueOf): New method.
+        (reverseBytes): Likewise.
+        * java/lang/Byte.java (SIZE): New constant.
+        (byteCache): New field.
+        (valueOf): New method.
+        * java/lang/Boolean.java (parseBoolean): New method.
+
+	2005-09-17  Mark Wielaard  <mark at klomp.org>
+
+        Reported by David Lichteblau <david at lichteblau.com>
+        * native/jni/classpath/jcl.c (JCL_NewRawDataObject): Create
+        NewGlobalRef before calling DeleteLocalRef.
+
+	2005-09-17  Mark Wielaard  <mark at klomp.org>
+
+        * javax/swing/plaf/basic/BasicMenuItemUI.java: Reindent boilerplate.
+
+	2005-09-17  Tom Tromey  <tromey at redhat.com>
+
+        * java/util/prefs/Preferences.java (systemNodeForPackage):
+        Javadoc fix.
+        (userNodeForPackage): Likewise.
+        * java/util/logging/LoggingPermission.java (serialVersionUID):
+        New field.
+        * java/io/ObjectInputStream.java (parseContent): Javadoc fix.
+
+	2005-09-16  Anthony Green  <green at redhat.com>
+
+        PR libgcj/20198
+        * java/net/URLClassLoader.java (FileURLLoader.getResource): File
+        resources should all have canonicalized names.
+
+	2005-09-16  Lillian Angel  <langel at redhat.com>
+
+        * javax/swing/JTree.java
+        (AccessibleJTreeNode): Fixed documentation.
+        (addAccessibleSelection): Likewise, still needs to
+        be implemented.
+        (addFocusListener): Implemented.
+        (addPropertyChangeListener): Implemented.
+        (clearAccessibleSelection): Implemented.
+        (contains): Implemented.
+        (doAccessibleAction): Fixed documentation, still
+        needs to be implemented.
+        (getAccessibleAction): Likewise.
+        (getAccessibleActionCount): Likewise.
+        (getAccessibleActionDescription): Implemented.
+        (getAccessibleAt): Implemented.
+        (getAccessibleChild): Implemented.
+        (getAccessibleChildrenCount): Implemented.
+        (getAccessibleComponent): Fixed documentation.
+        (getAccessibleContext): Implemented.
+        (getAccessibleDescription): Implemented.
+        (getAccessibleIndexInParent): Implemented.
+        (getAccessibleName): Implemented.
+        (getAccessibleParent): Fixed documentation.
+        (getAccessibleRole): Likewise.
+        (getAccessibleSelection): Likewise, still needs to
+        be implemented.
+        (getAccessibleSelection): Likewise.
+        (getAccessibleSelectionCount): Implemented.
+        (getAccessibleStateSet): Implemented.
+        (getAccessibleText): Fixed documentation.
+        (getAccessibleValue): Likewise.
+        (getBackground): Implemented.
+        (getBounds): Implemented.
+        (getCursor): Fixed documentation, still needs to be
+        implemented.
+        (getFont): Implemented.
+        (getFontMetrics): Implemented.
+        (getForeground): Implemented.
+        (getLocale): Implemented.
+        (getLocation): Implemented.
+        (getLocationInJTree): Implemented.
+        (getLocationOnScreen): Implemented.
+        (getSize): Implemented.
+        (isAccessibleChildSelected): Implemented.
+        (isEnabled): Implemented.
+        (isFocusTraversable): Implemented.
+        (isShowing): Implemented.
+        (isVisible): Implemented.
+        (removeAccessibleSelection): Fixed documentation, need to
+        fix current implementation.
+        (removeFocusListener): Implemented.
+        (removePropertyChangeListener): Implemented.
+        (requestFocus): Implemented.
+        (selectAllAccessibleSelection): Need to implement. Added FIXME.
+        (setAccessibleDescription): Implemented.
+        (setAccessibleName): Implemented.
+        (setBackground): Implemented.
+        (setBounds): Implemented.
+        (setCursor): Fixed documentation, still need to implement.
+        (setEnabled): Implemented.
+        (setFont): Implemented.
+        (setForeground): Implemented.
+        (setLocation): Implemented.
+        (setSize): Implemented.
+        (setVisible): Implemented.
+        (AccessibleJTree): Fixed documentation, still need
+        to implement.
+        (addAccessibleSelection): Implemented.
+        (clearAccessibleSelection): Implemented.
+        (fireVisibleDataPropertyChange): Implemented.
+        (getAccessibleAt): Fixed documentation, need to implement.
+        (getAccessibleChild): Implemented.
+        (getAccessibleChildrenCount): Implemented.
+        (getAccessibleIndexInParent): Fixed documentation.
+        (getAccessibleRole): Likewise.
+        (getAccessibleSelection): Likewise, still need to implement.
+        (getAccessibleSelection): Likewise.
+        (getAccessibleSelectionCount): Implemented.
+        (isAccessibleChildSelected): Implemented.
+        (removeAccessibleSelection): Implemented.
+        (selectAllAccessibleSelection): Implemented.
+        (treeCollapsed): Implemented.
+        (treeExpanded): Implemented.
+        (treeNodesChanged): Implemented.
+        (treeNodesInserted): Implemented.
+        (treeNodesRemoved): Implemented.
+        (treeStructureChanged): Implemented.
+        (valueChanged): Implemented.
+        (TreeModelListener): Fixed documentation.
+
+	2005-09-16  Tom Tromey  <tromey at redhat.com>
+
+        * java/io/PrintWriter.java (PrintWriter): New constructors.
+
+	2005-09-16  Tom Tromey  <tromey at redhat.com>
+
+        PR classpath/22689:
+        * java/io/PrintWriter.java (closed): New field.
+        (checkError): Only flush if stream not closed.
+        (close): Set 'closed'.
+
+	2005-09-16  Tom Tromey  <tromey at redhat.com>
+
+        * java/lang/Character.java (MIN_SURROGATE, MAX_SURROGATE): New
+        constants.
+        (isHighSurrogate): New method.
+        (isLowSurrogate): Likewise.
+        (isSurrogatePair): Likewise.
+        (toCodePoint): Likewise.
+        (codePointAt): Likewise.
+        (codePointBefore): Likewise.
+        * java/lang/StringBuffer.java (codePointCount): Check bounds.
+        (codePointAt): Rewrote.
+        (codePointBefore): Likewise.
+        * java/lang/String.java (codePointAt): New method.
+        (codePointBefore): Likewise.
+        (codePointCount): Likewise.
+        (contentEquals): New overload.
+
+	2005-09-16  Robert Schuster  <robertschuster at fsfe.org>
+
+        * javax/swing/ProgressMonitor: Implemented the former stubbed
+        class and added documentation.
+        (close): Implemented and added documentation.
+        (setProgress): Dito.
+        (isCanceled): Dito.
+        (setMinimum): Added documentation.
+        (getMinimum): Dito.
+        (setMaximum): Dito.
+        (getMaximum): Dito.
+        (setNote): Dito.
+        (getMillisToDecideToPopup): Dito.
+        (setMillisToDecideToPopup): Dito.
+        (getMillisToPopup): Dito.
+        (setMillisToPopup): Dito.
+        (getNote): Dito.
+        * javax/swing/ProgressMonitorInputStream: Implemented stub
+        methods.
+        (close): Implemented.
+        (read): Dito.
+        (reset): Dito.
+        (skip): Dito.
+        (getProgressMonitor): Dito.
+
+	2005-09-16  Tom Tromey  <tromey at redhat.com>
+
+        PR classpath/23882:
+        * java/text/StringCharacterIterator.java (StringCharacterIterator):
+        Javadoc fix.
+        (hashCode): New method.
+        * java/text/ParsePosition.java (hashCode): New method
+
+	2005-09-16    Audrius Meskauskas  <AudriusA at Bioinformatics.org>
+
+        * javax/swing/Timer.java (Waker.run): Do not enter loop on
+        repeats = false (fixes #23918).
+
+	2005-09-16  Andrew Haley  <aph at redhat.com>
+
+        * java/io/ObjectStreamClass.java (findAccessibleMethod): Allow
+        protected readResolve().  Rewrite accessibility check.
+
+	2005-09-16  Anthony Green  <green at redhat.com>
+
+        * java/lang/String.java (getBytes): Throw an InternalError instead
+        of silently returning null.
+
+	2005-09-16  Lillian Angel  <langel at redhat.com>
+
+        Fixes Bug #22610
+        * java/awt/Container.java
+        (remove): Removed component listeners from the component
+        being removed. This was a problem if that same component
+        that was removed was added to a new component.
+
+2005-09-20  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/Makefile.am.in: Replaced gnu/bytecode usage
 	by gnu/bytecodecvssnap.
 
Index: kaffe/libraries/clib/classpath/jcl.c
diff -u kaffe/libraries/clib/classpath/jcl.c:1.6 kaffe/libraries/clib/classpath/jcl.c:1.7
--- kaffe/libraries/clib/classpath/jcl.c:1.6	Thu Sep 15 02:25:34 2005
+++ kaffe/libraries/clib/classpath/jcl.c	Wed Sep 21 03:18:49 2005
@@ -193,6 +193,7 @@
 {
   if (rawDataClass == NULL)
     {
+      jclass tmp;
 #if SIZEOF_VOID_P == 8
       rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
       if (rawDataClass == NULL)
@@ -243,14 +244,15 @@
 	}
 
 #endif
-      (*env)->DeleteLocalRef(env, rawDataClass);
-      rawDataClass = (*env)->NewGlobalRef (env, rawDataClass);
-      if (rawDataClass == NULL)
+      tmp = (*env)->NewGlobalRef (env, rawDataClass);
+      if (tmp == NULL)
 	{
 	  JCL_ThrowException (env, "java/lang/InternalError",
 			      "unable to create an internal global ref");
 	  return NULL;
 	}
+      (*env)->DeleteLocalRef(env, rawDataClass);
+      rawDataClass = tmp;
     }
 
 #if SIZEOF_VOID_P == 8
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.165 kaffe/libraries/javalib/all.files:1.166
--- kaffe/libraries/javalib/all.files:1.165	Wed Sep 21 01:42:13 2005
+++ kaffe/libraries/javalib/all.files	Wed Sep 21 03:18:49 2005
@@ -3424,6 +3424,7 @@
 javax/swing/plaf/metal/MetalButtonUI.java
 javax/swing/plaf/metal/MetalCheckBoxIcon.java
 javax/swing/plaf/metal/MetalCheckBoxUI.java
+javax/swing/plaf/metal/MetalComboBoxEditor.java
 javax/swing/plaf/metal/MetalComboBoxIcon.java
 javax/swing/plaf/metal/MetalComboBoxUI.java
 javax/swing/plaf/metal/MetalDesktopIconUI.java
Index: kaffe/libraries/javalib/gnu/java/security/PolicyFile.java
diff -u kaffe/libraries/javalib/gnu/java/security/PolicyFile.java:1.9 kaffe/libraries/javalib/gnu/java/security/PolicyFile.java:1.10
--- kaffe/libraries/javalib/gnu/java/security/PolicyFile.java:1.9	Sat Aug 13 21:45:48 2005
+++ kaffe/libraries/javalib/gnu/java/security/PolicyFile.java	Wed Sep 21 03:18:50 2005
@@ -533,7 +533,7 @@
                 if (clazz == null)
                   {
                     currentPerms.add(new UnresolvedPermission(className,
-                      null, null, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+		      null, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
                     continue;
                   }
                 try
@@ -555,7 +555,7 @@
                 if (clazz == null)
                   {
                     currentPerms.add(new UnresolvedPermission(className,
-                      target, null, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+		      target, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
                     continue;
                   }
                 try
@@ -598,7 +598,7 @@
             if (clazz == null)
               {
                 currentPerms.add(new UnresolvedPermission(className,
-                  target, action, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+		  target, action, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
                 continue;
               }
             else
Index: kaffe/libraries/javalib/java/awt/Container.java
diff -u kaffe/libraries/javalib/java/awt/Container.java:1.43 kaffe/libraries/javalib/java/awt/Container.java:1.44
--- kaffe/libraries/javalib/java/awt/Container.java:1.43	Wed Sep 14 22:19:49 2005
+++ kaffe/libraries/javalib/java/awt/Container.java	Wed Sep 21 03:18:52 2005
@@ -38,6 +38,7 @@
 
 package java.awt;
 
+import java.awt.event.ComponentListener;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
 import java.awt.event.KeyEvent;
@@ -419,6 +420,10 @@
       {
         Component r = component[index];
 
+        ComponentListener[] list = r.getComponentListeners();
+        for (int j = 0; j < list.length; j++)
+              r.removeComponentListener(list[j]);
+        
         r.removeNotify();
 
         System.arraycopy(component, index + 1, component, index,
Index: kaffe/libraries/javalib/java/io/ObjectInputStream.java
diff -u kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.59 kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.60
--- kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.59	Thu Sep 15 02:25:45 2005
+++ kaffe/libraries/javalib/java/io/ObjectInputStream.java	Wed Sep 21 03:18:53 2005
@@ -167,7 +167,7 @@
     * Handles a content block within the stream, which begins with a marker
     * byte indicating its type.
     *
-    * @param byte the byte marker.
+    * @param marker the byte marker.
     * @return an object which represents the parsed content.
     * @throws ClassNotFoundException if the class of an object being
     *                                read in cannot be found.
Index: kaffe/libraries/javalib/java/io/ObjectStreamClass.java
diff -u kaffe/libraries/javalib/java/io/ObjectStreamClass.java:1.33 kaffe/libraries/javalib/java/io/ObjectStreamClass.java:1.34
--- kaffe/libraries/javalib/java/io/ObjectStreamClass.java:1.33	Sun Jul 10 02:11:40 2005
+++ kaffe/libraries/javalib/java/io/ObjectStreamClass.java	Wed Sep 21 03:18:53 2005
@@ -514,14 +514,15 @@
 	  {
 	    Method res = c.getDeclaredMethod(name, noArgs);
 	    int mods = res.getModifiers();
-
-	    if (c != from
-		&& (Modifier.isPrivate(mods)
-		    || ! Modifier.isPublic(mods) && ! inSamePackage(c, from)))
-	      continue;
-
-	    AccessController.doPrivileged(new SetAccessibleAction(res));
-	    return res;
+	    
+	    if (c == from  
+		|| Modifier.isProtected(mods)
+		|| Modifier.isPublic(mods)
+		|| (! Modifier.isPrivate(mods) && inSamePackage(c, from)))
+	      {
+		AccessController.doPrivileged(new SetAccessibleAction(res));
+		return res;
+	      }
 	  }
 	catch (NoSuchMethodException e)
 	  {
Index: kaffe/libraries/javalib/java/io/PrintWriter.java
diff -u kaffe/libraries/javalib/java/io/PrintWriter.java:1.10 kaffe/libraries/javalib/java/io/PrintWriter.java:1.11
--- kaffe/libraries/javalib/java/io/PrintWriter.java:1.10	Mon Jul  4 00:06:40 2005
+++ kaffe/libraries/javalib/java/io/PrintWriter.java	Wed Sep 21 03:18:53 2005
@@ -70,6 +70,11 @@
    * on this stream.
    */
   private boolean error;
+  
+  /**
+   * Indicates whether or not the stream has been closed.
+   */
+  private boolean closed;
 
   /**
    * This is the underlying <code>Writer</code> we are sending output
@@ -139,6 +144,68 @@
   }
 
   /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the default encoding.
+   * @param file name of the file to write to
+   * @throws FileNotFoundException if the file cannot be written or created
+   * 
+   * @since 1.5
+   */
+  public PrintWriter(String file) throws FileNotFoundException
+  {
+    this(new FileOutputStream(file));
+  }
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the specified encoding.
+   * @param file name of the file to write to
+   * @param enc the encoding to use
+   * @throws FileNotFoundException if the file cannot be written or created
+   * @throws UnsupportedEncodingException if the encoding is not supported
+   * 
+   * @since 1.5
+   */
+  public PrintWriter(String file, String enc) 
+    throws FileNotFoundException, UnsupportedEncodingException
+  {
+    this(new OutputStreamWriter(new FileOutputStream(file), enc));
+  }
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the default encoding.
+   * @param file the file to write to
+   * @throws FileNotFoundException if the file cannot be written or created
+   * 
+   * @since 1.5
+   */
+  public PrintWriter(File file) throws FileNotFoundException
+  {
+    this(new FileOutputStream(file));
+  }
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the specified encoding.
+   * @param file the file to write to
+   * @param enc the encoding to use
+   * @throws FileNotFoundException if the file cannot be written or created
+   * @throws UnsupportedEncodingException if the encoding is not supported
+   * 
+   * @since 1.5
+   */
+  public PrintWriter(File file, String enc) 
+    throws FileNotFoundException, UnsupportedEncodingException
+  {
+    this(new OutputStreamWriter(new FileOutputStream(file), enc));
+  }
+
+  /**
    * This method can be called by subclasses to indicate that an error
    * has occurred and should be reported by <code>checkError</code>.
    */
@@ -158,7 +225,8 @@
    */
   public boolean checkError()
   {
-    flush();
+    if (! closed)
+      flush();
     return error;
   }
 
@@ -185,7 +253,8 @@
   {
     try
       {
-	out.close();
+        out.close();
+        closed = true;
       }
     catch (IOException ex)
       {
Index: kaffe/libraries/javalib/java/lang/Boolean.java
diff -u kaffe/libraries/javalib/java/lang/Boolean.java:1.17 kaffe/libraries/javalib/java/lang/Boolean.java:1.18
--- kaffe/libraries/javalib/java/lang/Boolean.java:1.17	Mon Jul  4 00:06:42 2005
+++ kaffe/libraries/javalib/java/lang/Boolean.java	Wed Sep 21 03:18:53 2005
@@ -221,4 +221,16 @@
       return false;
     return "true".equalsIgnoreCase(System.getProperty(name));
   }
+
+  /**
+   * If the String argument is "true", ignoring case, return true.
+   * Otherwise, return false.
+   *
+   * @param b String to parse
+   * @since 1.5
+   */
+  public static boolean parseBoolean(String b)
+  {
+    return "true".equalsIgnoreCase(b) ? true : false;
+  }
 }
Index: kaffe/libraries/javalib/java/lang/Byte.java
diff -u kaffe/libraries/javalib/java/lang/Byte.java:1.19 kaffe/libraries/javalib/java/lang/Byte.java:1.20
--- kaffe/libraries/javalib/java/lang/Byte.java:1.19	Mon Jul  4 00:06:42 2005
+++ kaffe/libraries/javalib/java/lang/Byte.java	Wed Sep 21 03:18:53 2005
@@ -50,7 +50,7 @@
  * @author Per Bothner
  * @author Eric Blake (ebb9 at email.byu.edu)
  * @since 1.1
- * @status updated to 1.4
+ * @status updated to 1.5
  */
 public final class Byte extends Number implements Comparable
 {
@@ -78,6 +78,16 @@
   public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');
 
   /**
+   * The number of bits needed to represent a <code>byte</code>.
+   * @since 1.5
+   */
+  public static final int SIZE = 8;
+
+  // This caches Byte values, and is used by boxing conversions via
+  // valueOf().  We're required to cache all possible values here.
+  private static Byte[] byteCache = new Byte[MAX_VALUE - MIN_VALUE + 1];
+
+  /**
    * The immutable value of this Byte.
    *
    * @serial the wrapped byte
@@ -192,6 +202,26 @@
   }
 
   /**
+   * Returns a <code>Byte</code> object wrapping the value.
+   * In contrast to the <code>Byte</code> constructor, this method
+   * will cache some values.  It is used by boxing conversion.
+   *
+   * @param val the value to wrap
+   * @return the <code>Byte</code>
+   * 
+   * @since 1.5
+   */
+  public static Byte valueOf(byte val)
+  {
+    synchronized (byteCache)
+      {
+    if (byteCache[val - MIN_VALUE] == null)
+      byteCache[val - MIN_VALUE] = new Byte(val);
+    return byteCache[val - MIN_VALUE];
+      }
+  }
+
+ /**
    * Convert the specified <code>String</code> into a <code>Byte</code>.
    * The <code>String</code> may represent decimal, hexadecimal, or
    * octal numbers.
Index: kaffe/libraries/javalib/java/lang/Character.java
diff -u kaffe/libraries/javalib/java/lang/Character.java:1.28 kaffe/libraries/javalib/java/lang/Character.java:1.29
--- kaffe/libraries/javalib/java/lang/Character.java:1.28	Thu Sep 15 02:25:45 2005
+++ kaffe/libraries/javalib/java/lang/Character.java	Wed Sep 21 03:18:53 2005
@@ -1034,6 +1034,18 @@
   public static final Class TYPE = VMClassLoader.getPrimitiveClass('C');
 
   /**
+   * The number of bits needed to represent a <code>char</code>.
+   * @since 1.5
+   */
+  public static final int SIZE = 16;
+
+  // This caches some Character values, and is used by boxing
+  // conversions via valueOf().  We must cache at least 0..127;
+  // this constant controls how much we actually cache.
+  private static final int MAX_CACHE = 127;
+  private static Character[] charCache = new Character[MAX_CACHE + 1];
+
+  /**
    * Lu = Letter, Uppercase (Informative).
    *
    * @since 1.1
@@ -1508,6 +1520,20 @@
   public static final char MAX_LOW_SURROGATE = '\udfff';
 
   /**
+   * Minimum surrogate code in UTF-16 encoding.
+   *
+   * @since 1.5
+   */
+  public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE;
+
+  /**
+   * Maximum low surrogate code in UTF-16 encoding.
+   *
+   * @since 1.5
+   */
+  public static final char MAX_SURROGATE = MAX_LOW_SURROGATE;
+
+  /**
    * Grabs an attribute offset from the Unicode attribute database. The lower
    * 5 bits are the character type, the next 2 bits are flags, and the top
    * 9 bits are the offset into the attribute tables.
@@ -2303,6 +2329,37 @@
   }
 
   /**
+   * Returns an <code>Character</code> object wrapping the value.
+   * In contrast to the <code>Character</code> constructor, this method
+   * will cache some values.  It is used by boxing conversion.
+   *
+   * @param val the value to wrap
+   * @return the <code>Character</code>
+   * 
+   * @since 1.5
+   */
+  public static Character valueOf(char val)
+  {
+    if (val > MAX_CACHE)
+      return new Character(val);
+    synchronized (charCache)
+      {
+    if (charCache[val - MIN_VALUE] == null)
+      charCache[val - MIN_VALUE] = new Character(val);
+    return charCache[val - MIN_VALUE];
+      }
+  }
+
+  /**
+   * Reverse the bytes in val.
+   * @since 1.5
+   */
+  public static char reverseBytes(char val)
+  {
+    return (char) (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
+  }
+
+  /**
    * Converts a unicode code point to a UTF-16 representation of that
    * code point.
    * 
@@ -2414,5 +2471,211 @@
   public static boolean isValidCodePoint(int codePoint)
   {
     return codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT;
+  }
+
+  /**
+   * Return true if the given character is a high surrogate.
+   * @param ch the character
+   * @return true if the character is a high surrogate character
+   *
+   * @since 1.5
+   */
+  public static boolean isHighSurrogate(char ch)
+  {
+    return ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE;
+  }
+
+  /**
+   * Return true if the given character is a low surrogate.
+   * @param ch the character
+   * @return true if the character is a low surrogate character
+   *
+   * @since 1.5
+   */
+  public static boolean isLowSurrogate(char ch)
+  {
+    return ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE;
+  }
+
+  /**
+   * Return true if the given characters compose a surrogate pair.
+   * This is true if the first character is a high surrogate and the
+   * second character is a low surrogate.
+   * @param ch1 the first character
+   * @param ch2 the first character
+   * @return true if the characters compose a surrogate pair
+   *
+   * @since 1.5
+   */
+  public static boolean isSurrogatePair(char ch1, char ch2)
+  {
+    return isHighSurrogate(ch1) && isLowSurrogate(ch2);
+  }
+
+  /**
+   * Given a valid surrogate pair, this returns the corresponding
+   * code point.
+   * @param high the high character of the pair
+   * @param low the low character of the pair
+   * @return the corresponding code point
+   *
+   * @since 1.5
+   */
+  public static int toCodePoint(char high, char low)
+  {
+    return ((high - MIN_HIGH_SURROGATE) << 10) + (low - MIN_LOW_SURROGATE);
+  }
+
+  /**
+   * Get the code point at the specified index in the CharSequence.
+   * This is like CharSequence#charAt(int), but if the character is
+   * the start of a surrogate pair, and there is a following
+   * character, and this character completes the pair, then the
+   * corresponding supplementary code point is returned.  Otherwise,
+   * the character at the index is returned.
+   *
+   * @param sequence the CharSequence
+   * @param index the index of the codepoint to get, starting at 0
+   * @return the codepoint at the specified index
+   * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+   * @since 1.5
+   */
+  public static int codePointAt(CharSequence sequence, int index)
+  {
+    int len = sequence.length();
+    if (index < 0 || index >= len)
+      throw new IndexOutOfBoundsException();
+    char high = sequence.charAt(index);
+    if (! isHighSurrogate(high) || ++index >= len)
+      return high;
+    char low = sequence.charAt(index);
+    if (! isLowSurrogate(low))
+      return high;
+    return toCodePoint(high, low);
+  }
+
+  /**
+   * Get the code point at the specified index in the CharSequence.
+   * If the character is the start of a surrogate pair, and there is a
+   * following character, and this character completes the pair, then
+   * the corresponding supplementary code point is returned.
+   * Otherwise, the character at the index is returned.
+   *
+   * @param chars the character array in which to look
+   * @param index the index of the codepoint to get, starting at 0
+   * @return the codepoint at the specified index
+   * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+   * @since 1.5
+   */
+  public static int codePointAt(char[] chars, int index)
+  {
+    return codePointAt(chars, index, chars.length);
+  }
+
+  /**
+   * Get the code point at the specified index in the CharSequence.
+   * If the character is the start of a surrogate pair, and there is a
+   * following character within the specified range, and this
+   * character completes the pair, then the corresponding
+   * supplementary code point is returned.  Otherwise, the character
+   * at the index is returned.
+   *
+   * @param chars the character array in which to look
+   * @param index the index of the codepoint to get, starting at 0
+   * @param limit the limit past which characters should not be examined
+   * @return the codepoint at the specified index
+   * @throws IndexOutOfBoundsException if index is negative or &gt;=
+   * limit, or if limit is negative or &gt;= the length of the array
+   * @since 1.5
+   */
+  public static int codePointAt(char[] chars, int index, int limit)
+  {
+    if (index < 0 || index >= limit || limit < 0 || limit >= chars.length)
+      throw new IndexOutOfBoundsException();
+    char high = chars[index];
+    if (! isHighSurrogate(high) || ++index >= limit)
+      return high;
+    char low = chars[index];
+    if (! isLowSurrogate(low))
+      return high;
+    return toCodePoint(high, low);
+  }
+
+  /**
+   * Get the code point before the specified index.  This is like
+   * #codePointAt(char[], int), but checks the characters at
+   * <code>index-1</code> and <code>index-2</code> to see if they form
+   * a supplementary code point.  If they do not, the character at
+   * <code>index-1</code> is returned.
+   *
+   * @param chars the character array
+   * @param index the index just past the codepoint to get, starting at 0
+   * @return the codepoint at the specified index
+   * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+   * @since 1.5
+   */
+  public static int codePointBefore(char[] chars, int index)
+  {
+    return codePointBefore(chars, index, 1);
+  }
+
+  /**
+   * Get the code point before the specified index.  This is like
+   * #codePointAt(char[], int), but checks the characters at
+   * <code>index-1</code> and <code>index-2</code> to see if they form
+   * a supplementary code point.  If they do not, the character at
+   * <code>index-1</code> is returned.  The start parameter is used to
+   * limit the range of the array which may be examined.
+   *
+   * @param chars the character array
+   * @param index the index just past the codepoint to get, starting at 0
+   * @param start the index before which characters should not be examined
+   * @return the codepoint at the specified index
+   * @throws IndexOutOfBoundsException if index is &gt; start or &gt;
+   * the length of the array, or if limit is negative or &gt;= the
+   * length of the array
+   * @since 1.5
+   */
+  public static int codePointBefore(char[] chars, int index, int start)
+  {
+    if (index < start || index > chars.length
+	|| start < 0 || start >= chars.length)
+      throw new IndexOutOfBoundsException();
+    --index;
+    char low = chars[index];
+    if (! isLowSurrogate(low) || --index < start)
+      return low;
+    char high = chars[index];
+    if (! isHighSurrogate(high))
+      return low;
+    return toCodePoint(high, low);
+  }
+
+  /**
+   * Get the code point before the specified index.  This is like
+   * #codePointAt(CharSequence, int), but checks the characters at
+   * <code>index-1</code> and <code>index-2</code> to see if they form
+   * a supplementary code point.  If they do not, the character at
+   * <code>index-1</code> is returned.
+   *
+   * @param sequence the CharSequence
+   * @param index the index just past the codepoint to get, starting at 0
+   * @return the codepoint at the specified index
+   * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+   * @since 1.5

*** Patch too long, truncated ***




More information about the kaffe mailing list