This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Small ResourceBundle clean-up/merge


This patch removes cloning from ResourceBundle's BundleKey class. It turns out to be simpler just to use the constructor to copy the keys.

This merges libgcj more closely with the current Classpath version.

Bryce


2004-11-25  Bryce McKinlay  <mckinlay@redhat.com>

	* java/util/ResourceBundle.java (BundleKey): Don't implement
	Cloneable.
	(BundleKey.clone): Removed.
	(getBundle): Copy BundleKey using constructor, not clone().

Index: java/util/ResourceBundle.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/ResourceBundle.java,v
retrieving revision 1.30
diff -u -r1.30 ResourceBundle.java
--- java/util/ResourceBundle.java	24 Nov 2004 13:26:27 -0000	1.30
+++ java/util/ResourceBundle.java	25 Nov 2004 19:19:11 -0000
@@ -244,7 +244,7 @@
 
   /** Cache key for the ResourceBundle cache.  Resource bundles are keyed
       by the combination of bundle name, locale, and class loader. */
-  private static class BundleKey implements Cloneable
+  private static class BundleKey
   {
     String baseName;
     Locale locale;
@@ -281,18 +281,6 @@
 	baseName.equals(key.baseName) &&
         locale.equals(key.locale) &&
 	classLoader.equals(key.classLoader);
-    }
-    
-    public Object clone()
-    {
-      Object clone = null;
-      try
-      {
-	clone = super.clone();
-      }
-      catch (CloneNotSupportedException x) {}
-      
-      return clone;
     }    
   }
   
@@ -417,7 +405,7 @@
 	if (bundle == null && !locale.equals(defaultLocale))
 	  bundle = tryBundle(baseName, defaultLocale, classLoader, true);
 
-	BundleKey key = (BundleKey) lookupKey.clone();
+	BundleKey key = new BundleKey(baseName, locale, classLoader);
         if (bundle == null)
 	  {
 	    // Cache the fact that this lookup has previously failed.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]