sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1550874 [1/2] - in /sis/branches/JDK7: application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/...
Date Sat, 14 Dec 2013 03:23:44 GMT
Author: desruisseaux
Date: Sat Dec 14 03:23:43 2013
New Revision: 1550874

URL: http://svn.apache.org/r1550874
Log:
Uses shorts intead than integers for resource keys.
This is sufficient and avoid to fill the constants pool in ".class" files.

Modified:
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
    sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/IndexedResourceCompiler.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
    sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java [UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -264,7 +264,8 @@ abstract class SubCommand {
      */
     final boolean hasUnexpectedFileCount(final int min, final int max) {
         final int size = files.size();
-        final int expected, key;
+        final int expected;
+        final short key;
         if (size < min) {
             expected = min;
             key = Errors.Keys.TooFewArguments_2;

Modified: sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/IndexedResourceCompiler.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/IndexedResourceCompiler.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/IndexedResourceCompiler.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/IndexedResourceCompiler.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -76,7 +76,7 @@ class IndexedResourceCompiler implements
     /**
      * The Java modifiers applies on the key constants to be generated.
      */
-    private static final String KEY_MODIFIERS = "public static final int ";
+    private static final String KEY_MODIFIERS = "public static final short ";
 
     /**
      * Margin to write before the {@link #KEY_MODIFIERS}.

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -104,7 +104,7 @@ public final class MetadataUtilities ext
      * @param  key       The key from the message resource bundle to use for creating a message.
      * @param  arguments The arguments to be used together with the key for building the message.
      */
-    public static void warning(final Class<?> caller, final String method, final int key, final Object... arguments) {
+    public static void warning(final Class<?> caller, final String method, final short key, final Object... arguments) {
         final LogRecord record = Messages.getResources(null).getLogRecord(Level.WARNING, key, arguments);
         record.setSourceClassName(caller.getCanonicalName());
         record.setSourceMethodName(method);

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -295,7 +295,7 @@ public abstract class AbstractDirectPosi
             final char close = (c == '(') ? ')' : ']';
             final int pos = CharSequences.lastIndexOf(wkt, close, i, length);
             if (pos != --length) {
-                final int key;
+                final short key;
                 final Object[] args;
                 if (pos < 0) {
                     key  = Errors.Keys.NonEquilibratedParenthesis_2;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -493,7 +493,7 @@ public enum GeodeticObjects {
         /**
          * The resource keys for the name as one of the {@code Vocabulary.Keys} constants.
          */
-        private final int key;
+        private final short key;
 
         /**
          * The cached object. This is initially {@code null}, then set to various kind of objects depending
@@ -509,7 +509,7 @@ public enum GeodeticObjects {
          *        early class initialization. In particular, we do not want early dependency to the SIS-specific
          *        <code>VerticalDatumTypes.ELLIPSOIDAL</code> constant.}
          */
-        private Vertical(final int name) {
+        private Vertical(final short name) {
             this.key = name;
         }
 
@@ -637,7 +637,7 @@ public enum GeodeticObjects {
         /**
          * The resource keys for the name as one of the {@code Vocabulary.Keys} constants.
          */
-        private final int key;
+        private final short key;
 
         /**
          * The date and time origin of this temporal datum.
@@ -654,7 +654,7 @@ public enum GeodeticObjects {
         /**
          * Creates a new enumeration value of the given name with time counted since the given epoch.
          */
-        private Temporal(final int name, final long epoch) {
+        private Temporal(final short name, final long epoch) {
             this.key   = name;
             this.epoch = epoch;
         }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -420,7 +420,7 @@ public final class Context extends Marsh
      * @param arguments The arguments to be given to {@code MessageFormat} for formatting the log message.
      */
     public static void warningOccured(final Context context, final Object source, final Class<?> classe, final String method,
-            final Class<? extends IndexedResourceBundle> resources, final int key, final Object... arguments)
+            final Class<? extends IndexedResourceBundle> resources, final short key, final Object... arguments)
     {
         final Locale locale = context != null ? context.getLocale() : null;
         final IndexedResourceBundle bundle;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -56,7 +56,7 @@ public final class LocalizedParseExcepti
     /**
      * The resources key as one of the {@code Errors.Keys} constant.
      */
-    private final int key;
+    private final short key;
 
     /**
      * The arguments for the localization message.
@@ -72,7 +72,7 @@ public final class LocalizedParseExcepti
      * @param arguments   The value of {@link #arguments(String, ParsePosition)}.
      * @param errorOffset The position where the error is found while parsing.
      */
-    public LocalizedParseException(final Locale locale, final int key, final Object[] arguments, final int errorOffset) {
+    public LocalizedParseException(final Locale locale, final short key, final Object[] arguments, final int errorOffset) {
         super(Errors.format(key, arguments), errorOffset);
         this.locale    = locale;
         this.arguments = arguments;
@@ -89,7 +89,7 @@ public final class LocalizedParseExcepti
      * @param text        The full text that {@code Format} failed to parse.
      * @param errorOffset The position where the error is found while parsing.
      */
-    public LocalizedParseException(final Locale locale, final int key, final CharSequence text, final int errorOffset) {
+    public LocalizedParseException(final Locale locale, final short key, final CharSequence text, final int errorOffset) {
         this(locale, key, new Object[] {CharSequences.token(text, errorOffset)}, errorOffset);
     }
 
@@ -157,8 +157,8 @@ public final class LocalizedParseExcepti
      * ("Relax constraint on placement of this()/super() call in constructors").
      */
     @Workaround(library="JDK", version="1.7")
-    private static int key(final Object[] arguments) {
-        final int key;
+    private static short key(final Object[] arguments) {
+        final short key;
         switch (arguments.length) {
             case 1: key = Errors.Keys.UnexpectedEndOfString_1;    break;
             case 2: key = Errors.Keys.UnparsableStringForClass_2; break;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -682,7 +682,7 @@ public final class MathFunctions extends
         if (ordinal >= MIN_NAN_ORDINAL && ordinal <= MAX_NAN_ORDINAL) {
             return ordinal;
         }
-        final int resourceKey;
+        final short resourceKey;
         final Object obj;
         if (Float.isNaN(value)) {
             resourceKey = Errors.Keys.IllegalBitsPattern_1;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -124,6 +124,8 @@ public class StatisticsFormat extends Ta
 
     /**
      * Returns the kind of objects formatted by this class.
+     *
+     * @return {@code Statistics.class}
      */
     @Override
     public Class<Statistics> getValueType() {
@@ -186,6 +188,9 @@ public class StatisticsFormat extends Ta
 
     /**
      * Not yet implemented.
+     *
+     * @return Currently never return.
+     * @throws ParseException Currently never thrown.
      */
     @Override
     public Statistics parse(CharSequence text, ParsePosition pos) throws ParseException {
@@ -357,7 +362,7 @@ public class StatisticsFormat extends Ta
      * switch statements inside the {@link #format(Statistics[], Appendable)} method
      * (we define this static field close to the format methods for this purpose).
      */
-    private static final int[] KEYS = {
+    private static final short[] KEYS = {
         Vocabulary.Keys.NumberOfValues,
         Vocabulary.Keys.NumberOfNaN,
         Vocabulary.Keys.MinimumValue,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -129,12 +129,12 @@ public enum About {
     /**
      * The resource key for this section in the {@link Vocabulary} resources bundle.
      */
-    private final int resourceKey;
+    private final short resourceKey;
 
     /**
      * Creates a new section to be formatted using the given resource.
      */
-    private About(final int resourceKey) {
+    private About(final short resourceKey) {
         this.resourceKey = resourceKey;
     }
 
@@ -187,7 +187,7 @@ public enum About {
         TreeTable.Node section = null;
         About newSection = VERSIONS;
 fill:   for (int i=0; ; i++) {
-            int      nameKey  = 0;    // The Vocabulary.Key for 'name', used only if name is null.
+            short    nameKey  = 0;    // The Vocabulary.Key for 'name', used only if name is null.
             String   name     = null; // The value to put in the 'Name' column of the table.
             Object   value    = null; // The value to put in the 'Value' column of the table.
             String[] children = null; // Optional children to write below the node.
@@ -377,7 +377,7 @@ fill:   for (int i=0; ; i++) {
 pathTree:   for (int j=0; ; j++) {
                 TreeTable.Node directory = null;
                 final String home;
-                final int homeKey;
+                final short homeKey;
                 switch (j) {
                     case 0: home = javaHome; homeKey = Vocabulary.Keys.JavaHome; break;
                     case 1: home = userHome; homeKey = Vocabulary.Keys.UserHome; break;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -182,7 +182,7 @@ public final class ArgumentChecks extend
         if (value != null) {
             final Class<?> valueClass = value.getClass();
             if (!expectedType.isAssignableFrom(valueClass)) {
-                final int key;
+                final short key;
                 final Object[] args;
                 if (name != null) {
                     key = Errors.Keys.IllegalArgumentClass_3;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -201,7 +201,7 @@ public class TableColumn<V> implements C
         /**
          * The resource key for the column header.
          */
-        private final transient int resourceKey;
+        private final transient short resourceKey;
 
         /**
          * Creates a new instance for a build-in constant.
@@ -210,7 +210,7 @@ public class TableColumn<V> implements C
          * @param type   Base type of all values in the column identified by this instance.
          * @param header The resource key for the column header.
          */
-        Constant(final String field, final Class<V> type, final int header) {
+        Constant(final String field, final Class<V> type, final short header) {
             super(type);
             this.field       = field;
             this.resourceKey = header;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -35,7 +35,7 @@ import org.opengis.util.InternationalStr
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.2)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class Errors extends IndexedResourceBundle {
@@ -66,674 +66,674 @@ public final class Errors extends Indexe
          * No element can be added to this set because properties ‘{0}’ and ‘{1}’ are mutually
          * exclusive.
          */
-        public static final int CanNotAddToExclusiveSet_2 = 87;
+        public static final short CanNotAddToExclusiveSet_2 = 0;
 
         /**
          * Can not compute the derivative.
          */
-        public static final int CanNotComputeDerivative = 44;
+        public static final short CanNotComputeDerivative = 1;
 
         /**
          * Can not connect to “{0}”.
          */
-        public static final int CanNotConnectTo_1 = 114;
+        public static final short CanNotConnectTo_1 = 2;
 
         /**
          * Can not convert from type ‘{0}’ to type ‘{1}’.
          */
-        public static final int CanNotConvertFromType_2 = 72;
+        public static final short CanNotConvertFromType_2 = 3;
 
         /**
          * Can not convert value “{0}” to type ‘{1}’.
          */
-        public static final int CanNotConvertValue_2 = 74;
+        public static final short CanNotConvertValue_2 = 4;
 
         /**
          * Can not instantiate an object of type ‘{0}’.
          */
-        public static final int CanNotInstantiate_1 = 81;
+        public static final short CanNotInstantiate_1 = 5;
 
         /**
          * Can not map an axis from “{0}” to direction “{1}”.
          */
-        public static final int CanNotMapAxisToDirection_2 = 123;
+        public static final short CanNotMapAxisToDirection_2 = 6;
 
         /**
          * Can not open “{0}”.
          */
-        public static final int CanNotOpen_1 = 97;
+        public static final short CanNotOpen_1 = 7;
 
         /**
          * Can not parse “{1}” as a file in the {0} format.
          */
-        public static final int CanNotParseFile_2 = 79;
+        public static final short CanNotParseFile_2 = 8;
 
         /**
          * Can not read “{0}”.
          */
-        public static final int CanNotRead_1 = 108;
+        public static final short CanNotRead_1 = 9;
 
         /**
          * Can not represent “{1}” in the {0} format.
          */
-        public static final int CanNotRepresentInFormat_2 = 110;
+        public static final short CanNotRepresentInFormat_2 = 10;
 
         /**
          * Can not set a value for property “{0}”.
          */
-        public static final int CanNotSetPropertyValue_1 = 75;
+        public static final short CanNotSetPropertyValue_1 = 11;
 
         /**
          * Class ‘{0}’ is not final.
          */
-        public static final int ClassNotFinal_1 = 71;
+        public static final short ClassNotFinal_1 = 12;
 
         /**
          * Can not clone an object of type ‘{0}’.
          */
-        public static final int CloneNotSupported_1 = 42;
+        public static final short CloneNotSupported_1 = 13;
 
         /**
          * Axis directions {0} and {1} are colinear.
          */
-        public static final int ColinearAxisDirections_2 = 122;
+        public static final short ColinearAxisDirections_2 = 14;
 
         /**
          * Thread “{0}” is dead.
          */
-        public static final int DeadThread_1 = 43;
+        public static final short DeadThread_1 = 15;
 
         /**
          * Element “{0}” is duplicated.
          */
-        public static final int DuplicatedElement_1 = 116;
+        public static final short DuplicatedElement_1 = 16;
 
         /**
          * Identifier “{0}” is duplicated.
          */
-        public static final int DuplicatedIdentifier_1 = 38;
+        public static final short DuplicatedIdentifier_1 = 17;
 
         /**
          * Option “{0}” is duplicated.
          */
-        public static final int DuplicatedOption_1 = 100;
+        public static final short DuplicatedOption_1 = 18;
 
         /**
          * Element “{0}” is already present.
          */
-        public static final int ElementAlreadyPresent_1 = 36;
+        public static final short ElementAlreadyPresent_1 = 19;
 
         /**
          * Argument ‘{0}’ shall not be empty.
          */
-        public static final int EmptyArgument_1 = 1;
+        public static final short EmptyArgument_1 = 20;
 
         /**
          * The dictionary shall contain at least one entry.
          */
-        public static final int EmptyDictionary = 54;
+        public static final short EmptyDictionary = 21;
 
         /**
          * Envelope must be at least two-dimensional and non-empty.
          */
-        public static final int EmptyEnvelope2D = 88;
+        public static final short EmptyEnvelope2D = 22;
 
         /**
          * Property named “{0}” shall not be empty.
          */
-        public static final int EmptyProperty_1 = 55;
+        public static final short EmptyProperty_1 = 23;
 
         /**
          * Argument ‘{0}’ shall not contain more than {1} elements. A number of {2} is excessive.
          */
-        public static final int ExcessiveArgumentSize_3 = 52;
+        public static final short ExcessiveArgumentSize_3 = 24;
 
         /**
          * A size of {1} elements is excessive for the “{0}” list.
          */
-        public static final int ExcessiveListSize_2 = 94;
+        public static final short ExcessiveListSize_2 = 25;
 
         /**
          * Attribute “{0}” is not allowed for an object of type ‘{1}’.
          */
-        public static final int ForbiddenAttribute_2 = 21;
+        public static final short ForbiddenAttribute_2 = 26;
 
         /**
          * Identifier “{0}” is already associated to another object.
          */
-        public static final int IdentifierAlreadyBound_1 = 50;
+        public static final short IdentifierAlreadyBound_1 = 27;
 
         /**
          * Argument ‘{0}’ can not be an instance of ‘{1}’.
          */
-        public static final int IllegalArgumentClass_2 = 17;
+        public static final short IllegalArgumentClass_2 = 28;
 
         /**
          * Argument ‘{0}’ can not be an instance of ‘{2}’. Expected an instance of ‘{1}’ or derived
          * type.
          */
-        public static final int IllegalArgumentClass_3 = 2;
+        public static final short IllegalArgumentClass_3 = 29;
 
         /**
          * Argument ‘{0}’ can not take the “{1}” value, because the ‘{2}’ field can not take the “{3}”
          * value.
          */
-        public static final int IllegalArgumentField_4 = 15;
+        public static final short IllegalArgumentField_4 = 30;
 
         /**
          * Argument ‘{0}’ can not take the “{1}” value.
          */
-        public static final int IllegalArgumentValue_2 = 14;
+        public static final short IllegalArgumentValue_2 = 31;
 
         /**
          * Coordinate system of class ‘{0}’ can not have axis in the {1} direction.
          */
-        public static final int IllegalAxisDirection_2 = 128;
+        public static final short IllegalAxisDirection_2 = 32;
 
         /**
          * Illegal bits pattern: {0}.
          */
-        public static final int IllegalBitsPattern_1 = 16;
+        public static final short IllegalBitsPattern_1 = 33;
 
         /**
          * Class ‘{1}’ is illegal. It must be ‘{0}’ or a derived class.
          */
-        public static final int IllegalClass_2 = 3;
+        public static final short IllegalClass_2 = 34;
 
         /**
          * The “{1}” pattern can not be applied to formating of objects of type ‘{0}’.
          */
-        public static final int IllegalFormatPatternForClass_2 = 29;
+        public static final short IllegalFormatPatternForClass_2 = 35;
 
         /**
          * The “{0}” language is not recognized.
          */
-        public static final int IllegalLanguageCode_1 = 12;
+        public static final short IllegalLanguageCode_1 = 36;
 
         /**
          * Member “{0}” can not be associated to type “{1}”.
          */
-        public static final int IllegalMemberType_2 = 106;
+        public static final short IllegalMemberType_2 = 37;
 
         /**
          * Option ‘{0}’ can not take the “{1}” value.
          */
-        public static final int IllegalOptionValue_2 = 101;
+        public static final short IllegalOptionValue_2 = 38;
 
         /**
          * The [{0} … {1}] range of ordinate values is not valid for the “{2}” axis.
          */
-        public static final int IllegalOrdinateRange_3 = 5;
+        public static final short IllegalOrdinateRange_3 = 39;
 
         /**
          * Property ‘{0}’ does not accept instances of ‘{1}’.
          */
-        public static final int IllegalPropertyClass_2 = 62;
+        public static final short IllegalPropertyClass_2 = 40;
 
         /**
          * Range [{0} … {1}] is not valid.
          */
-        public static final int IllegalRange_2 = 11;
+        public static final short IllegalRange_2 = 41;
 
         /**
          * Value {1} for “{0}” is not a valid Unicode code point.
          */
-        public static final int IllegalUnicodeCodePoint_2 = 112;
+        public static final short IllegalUnicodeCodePoint_2 = 42;
 
         /**
          * Unit of measurement “{1}” is not valid for “{0}” values.
          */
-        public static final int IllegalUnitFor_2 = 129;
+        public static final short IllegalUnitFor_2 = 43;
 
         /**
          * Incompatible coordinate system types.
          */
-        public static final int IncompatibleCoordinateSystemTypes = 130;
+        public static final short IncompatibleCoordinateSystemTypes = 44;
 
         /**
          * Property “{0}” has an incompatible value.
          */
-        public static final int IncompatiblePropertyValue_1 = 86;
+        public static final short IncompatiblePropertyValue_1 = 45;
 
         /**
          * Units “{0}” and “{1}” are incompatible.
          */
-        public static final int IncompatibleUnits_2 = 67;
+        public static final short IncompatibleUnits_2 = 46;
 
         /**
          * Value “{1}” of attribute ‘{0}’ is inconsistent with other attributes.
          */
-        public static final int InconsistentAttribute_2 = 27;
+        public static final short InconsistentAttribute_2 = 47;
 
         /**
          * Inconsistent table columns.
          */
-        public static final int InconsistentTableColumns = 40;
+        public static final short InconsistentTableColumns = 48;
 
         /**
          * Index {0} is out of bounds.
          */
-        public static final int IndexOutOfBounds_1 = 4;
+        public static final short IndexOutOfBounds_1 = 49;
 
         /**
          * Indices ({0}, {1}) are out of bounds.
          */
-        public static final int IndicesOutOfBounds_2 = 120;
+        public static final short IndicesOutOfBounds_2 = 50;
 
         /**
          * Argument ‘{0}’ can not take an infinite value.
          */
-        public static final int InfiniteArgumentValue_1 = 45;
+        public static final short InfiniteArgumentValue_1 = 51;
 
         /**
          * Infinite recursivity.
          */
-        public static final int InfiniteRecursivity = 51;
+        public static final short InfiniteRecursivity = 52;
 
         /**
          * Argument ‘{0}’ shall contain at least {1} elements. A number of {2} is insufficient.
          */
-        public static final int InsufficientArgumentSize_3 = 53;
+        public static final short InsufficientArgumentSize_3 = 53;
 
         /**
          * A different value is already associated to the “{0}” key.
          */
-        public static final int KeyCollision_1 = 19;
+        public static final short KeyCollision_1 = 54;
 
         /**
          * Attribute “{0}” is mandatory for an object of type ‘{1}’.
          */
-        public static final int MandatoryAttribute_2 = 22;
+        public static final short MandatoryAttribute_2 = 55;
 
         /**
          * Mismatched array lengths.
          */
-        public static final int MismatchedArrayLengths = 111;
+        public static final short MismatchedArrayLengths = 56;
 
         /**
          * The coordinate reference system must be the same for all objects.
          */
-        public static final int MismatchedCRS = 57;
+        public static final short MismatchedCRS = 57;
 
         /**
          * Mismatched object dimensions: {0}D and {1}D.
          */
-        public static final int MismatchedDimension_2 = 60;
+        public static final short MismatchedDimension_2 = 58;
 
         /**
          * Argument ‘{0}’ has {2} dimension{2,choice,1#|2#s}, while {1} was expected.
          */
-        public static final int MismatchedDimension_3 = 58;
+        public static final short MismatchedDimension_3 = 59;
 
         /**
          * Mismatched matrix sizes: expected {0}×{1} but got {2}×{3}.
          */
-        public static final int MismatchedMatrixSize_4 = 118;
+        public static final short MismatchedMatrixSize_4 = 60;
 
         /**
          * This operation requires the “{0}” module.
          */
-        public static final int MissingRequiredModule_1 = 84;
+        public static final short MissingRequiredModule_1 = 61;
 
         /**
          * Missing scheme in URI.
          */
-        public static final int MissingSchemeInURI = 109;
+        public static final short MissingSchemeInURI = 62;
 
         /**
          * Missing value for option “{0}”.
          */
-        public static final int MissingValueForOption_1 = 99;
+        public static final short MissingValueForOption_1 = 63;
 
         /**
          * Missing value for property “{0}”.
          */
-        public static final int MissingValueForProperty_1 = 85;
+        public static final short MissingValueForProperty_1 = 64;
 
         /**
          * Missing value in the “{0}” column.
          */
-        public static final int MissingValueInColumn_1 = 77;
+        public static final short MissingValueInColumn_1 = 65;
 
         /**
          * Options “{0}” and “{1}” are mutually exclusive.
          */
-        public static final int MutuallyExclusiveOptions_2 = 103;
+        public static final short MutuallyExclusiveOptions_2 = 66;
 
         /**
          * Argument ‘{0}’ shall not be negative. The given value was {1}.
          */
-        public static final int NegativeArgument_2 = 8;
+        public static final short NegativeArgument_2 = 67;
 
         /**
          * Can not create a “{0}” array of negative length.
          */
-        public static final int NegativeArrayLength_1 = 78;
+        public static final short NegativeArrayLength_1 = 68;
 
         /**
          * No convergence for points {0} and {1}.
          */
-        public static final int NoConvergenceForPoints_2 = 117;
+        public static final short NoConvergenceForPoints_2 = 69;
 
         /**
          * Element “{0}” has not been found.
          */
-        public static final int NoSuchElement_1 = 96;
+        public static final short NoSuchElement_1 = 70;
 
         /**
          * No property named “{0}” has been found in “{1}”.
          */
-        public static final int NoSuchProperty_2 = 73;
+        public static final short NoSuchProperty_2 = 71;
 
         /**
          * No unit of measurement has been specified.
          */
-        public static final int NoUnit = 68;
+        public static final short NoUnit = 72;
 
         /**
          * Node “{0}” can not be a child of itself.
          */
-        public static final int NodeChildOfItself_1 = 37;
+        public static final short NodeChildOfItself_1 = 73;
 
         /**
          * Node “{0}” already has another parent.
          */
-        public static final int NodeHasAnotherParent_1 = 35;
+        public static final short NodeHasAnotherParent_1 = 74;
 
         /**
          * Node “{0}” has no parent.
          */
-        public static final int NodeHasNoParent_1 = 34;
+        public static final short NodeHasNoParent_1 = 75;
 
         /**
          * Node “{0}” is a leaf.
          */
-        public static final int NodeIsLeaf_1 = 90;
+        public static final short NodeIsLeaf_1 = 76;
 
         /**
          * No “{0}” node found.
          */
-        public static final int NodeNotFound_1 = 39;
+        public static final short NodeNotFound_1 = 77;
 
         /**
          * “{0}” is not an angular unit.
          */
-        public static final int NonAngularUnit_1 = 46;
+        public static final short NonAngularUnit_1 = 78;
 
         /**
          * Missing a ‘{1}’ parenthesis in “{0}”.
          */
-        public static final int NonEquilibratedParenthesis_2 = 59;
+        public static final short NonEquilibratedParenthesis_2 = 79;
 
         /**
          * Conversion is not invertible.
          */
-        public static final int NonInvertibleConversion = 82;
+        public static final short NonInvertibleConversion = 80;
 
         /**
          * Non invertible {0}×{1} matrix.
          */
-        public static final int NonInvertibleMatrix_2 = 124;
+        public static final short NonInvertibleMatrix_2 = 81;
 
         /**
          * Transform is not invertible.
          */
-        public static final int NonInvertibleTransform = 83;
+        public static final short NonInvertibleTransform = 82;
 
         /**
          * Unit conversion from “{0}” to “{1}” is non-linear.
          */
-        public static final int NonLinearUnitConversion_2 = 131;
+        public static final short NonLinearUnitConversion_2 = 83;
 
         /**
          * “{0}” is not a linear unit.
          */
-        public static final int NonLinearUnit_1 = 47;
+        public static final short NonLinearUnit_1 = 84;
 
         /**
          * Axis directions {0} and {1} are not perpendicular.
          */
-        public static final int NonPerpendicularDirections_2 = 132;
+        public static final short NonPerpendicularDirections_2 = 85;
 
         /**
          * “{0}” is not a scale unit.
          */
-        public static final int NonScaleUnit_1 = 48;
+        public static final short NonScaleUnit_1 = 86;
 
         /**
          * “{0}” is not a time unit.
          */
-        public static final int NonTemporalUnit_1 = 49;
+        public static final short NonTemporalUnit_1 = 87;
 
         /**
          * Scale is not uniform.
          */
-        public static final int NonUniformScale = 126;
+        public static final short NonUniformScale = 88;
 
         /**
          * Argument ‘{0}’ shall not be NaN (Not-a-Number).
          */
-        public static final int NotANumber_1 = 9;
+        public static final short NotANumber_1 = 89;
 
         /**
          * Class ‘{0}’ is not a primitive type wrapper.
          */
-        public static final int NotAPrimitiveWrapper_1 = 10;
+        public static final short NotAPrimitiveWrapper_1 = 90;
 
         /**
          * Matrix is not skew-symmetric.
          */
-        public static final int NotASkewSymmetricMatrix = 127;
+        public static final short NotASkewSymmetricMatrix = 91;
 
         /**
          * Text “{0}” is not a Unicode identifier.
          */
-        public static final int NotAUnicodeIdentifier_1 = 113;
+        public static final short NotAUnicodeIdentifier_1 = 92;
 
         /**
          * Transform is not affine.
          */
-        public static final int NotAnAffineTransform = 121;
+        public static final short NotAnAffineTransform = 93;
 
         /**
          * Class ‘{0}’ is not a comparable.
          */
-        public static final int NotComparableClass_1 = 66;
+        public static final short NotComparableClass_1 = 94;
 
         /**
          * Argument ‘{0}’ shall not be null.
          */
-        public static final int NullArgument_1 = 0;
+        public static final short NullArgument_1 = 95;
 
         /**
          * Null key is not allowed in this dictionary.
          */
-        public static final int NullMapKey = 64;
+        public static final short NullMapKey = 96;
 
         /**
          * Null values are not allowed in this dictionary.
          */
-        public static final int NullMapValue = 65;
+        public static final short NullMapValue = 97;
 
         /**
          * Array length is {0}, while we expected an even length.
          */
-        public static final int OddArrayLength_1 = 61;
+        public static final short OddArrayLength_1 = 98;
 
         /**
          * Recursive call while creating an object for the “{0}” key.
          */
-        public static final int RecursiveCreateCallForKey_1 = 18;
+        public static final short RecursiveCreateCallForKey_1 = 99;
 
         /**
          * A decimal separator is required.
          */
-        public static final int RequireDecimalSeparator = 33;
+        public static final short RequireDecimalSeparator = 100;
 
         /**
          * Matrix is singular.
          */
-        public static final int SingularMatrix = 125;
+        public static final short SingularMatrix = 101;
 
         /**
          * Thread “{0}” seems stalled.
          */
-        public static final int StalledThread_1 = 63;
+        public static final short StalledThread_1 = 102;
 
         /**
          * Can not move backward in the “{0}” stream.
          */
-        public static final int StreamIsForwardOnly_1 = 95;
+        public static final short StreamIsForwardOnly_1 = 103;
 
         /**
          * Expected at least {0} argument{0,choice,1#|2#s}, but got {1}.
          */
-        public static final int TooFewArguments_2 = 104;
+        public static final short TooFewArguments_2 = 104;
 
         /**
          * Expected at most {0} argument{0,choice,1#|2#s}, but got {1}.
          */
-        public static final int TooManyArguments_2 = 105;
+        public static final short TooManyArguments_2 = 105;
 
         /**
          * Ordering between “{0}” and “{1}” elements is undefined.
          */
-        public static final int UndefinedOrderingForElements_2 = 70;
+        public static final short UndefinedOrderingForElements_2 = 106;
 
         /**
          * Expected an array of length {0}, but got {1}.
          */
-        public static final int UnexpectedArrayLength_2 = 119;
+        public static final short UnexpectedArrayLength_2 = 107;
 
         /**
          * Unexpected change in ‘{0}’.
          */
-        public static final int UnexpectedChange_1 = 56;
+        public static final short UnexpectedChange_1 = 108;
 
         /**
          * Unexpected end of file while reading “{0}”.
          */
-        public static final int UnexpectedEndOfFile_1 = 91;
+        public static final short UnexpectedEndOfFile_1 = 109;
 
         /**
          * More characters were expected at the end of “{0}”.
          */
-        public static final int UnexpectedEndOfString_1 = 30;
+        public static final short UnexpectedEndOfString_1 = 110;
 
         /**
          * File “{1}” seems to be encoded in an other format than {0}.
          */
-        public static final int UnexpectedFileFormat_2 = 92;
+        public static final short UnexpectedFileFormat_2 = 111;
 
         /**
          * Axis direction “{0}” is unknown.
          */
-        public static final int UnknownAxisDirection_1 = 133;
+        public static final short UnknownAxisDirection_1 = 112;
 
         /**
          * Command “{0}” is not recognized.
          */
-        public static final int UnknownCommand_1 = 102;
+        public static final short UnknownCommand_1 = 113;
 
         /**
          * Unknown enumeration value: {0}.
          */
-        public static final int UnknownEnumValue_1 = 115;
+        public static final short UnknownEnumValue_1 = 114;
 
         /**
          * Format of “{0}” is not recognized.
          */
-        public static final int UnknownFormatFor_1 = 107;
+        public static final short UnknownFormatFor_1 = 115;
 
         /**
          * Option “{0}” is not recognized.
          */
-        public static final int UnknownOption_1 = 98;
+        public static final short UnknownOption_1 = 116;
 
         /**
          * Type of the “{0}” property is unknown.
          */
-        public static final int UnknownTypeForProperty_1 = 80;
+        public static final short UnknownTypeForProperty_1 = 117;
 
         /**
          * Type ‘{0}’ is unknown in this context.
          */
-        public static final int UnknownType_1 = 76;
+        public static final short UnknownType_1 = 118;
 
         /**
          * This affine transform is unmodifiable.
          */
-        public static final int UnmodifiableAffineTransform = 23;
+        public static final short UnmodifiableAffineTransform = 119;
 
         /**
          * The cell at column “{1}” of row “{0}” is unmodifiable.
          */
-        public static final int UnmodifiableCellValue_2 = 89;
+        public static final short UnmodifiableCellValue_2 = 120;
 
         /**
          * This geometry is unmodifiable.
          */
-        public static final int UnmodifiableGeometry = 24;
+        public static final short UnmodifiableGeometry = 121;
 
         /**
          * This metadata is unmodifiable.
          */
-        public static final int UnmodifiableMetadata = 25;
+        public static final short UnmodifiableMetadata = 122;
 
         /**
          * Object ‘{0}’ is unmodifiable.
          */
-        public static final int UnmodifiableObject_1 = 26;
+        public static final short UnmodifiableObject_1 = 123;
 
         /**
          * Text “{1}” can not be parsed as an object of type ‘{0}’.
          */
-        public static final int UnparsableStringForClass_2 = 31;
+        public static final short UnparsableStringForClass_2 = 124;
 
         /**
          * Text “{1}” can not be parsed as an object of type ‘{0}’, because of the “{2}” characters.
          */
-        public static final int UnparsableStringForClass_3 = 32;
+        public static final short UnparsableStringForClass_3 = 125;
 
         /**
          * No format is specified for objects of class ‘{0}’.
          */
-        public static final int UnspecifiedFormatForClass_1 = 41;
+        public static final short UnspecifiedFormatForClass_1 = 126;
 
         /**
          * Can not handle instances of ‘{0}’ because arbitrary implementations are not yet supported.
          */
-        public static final int UnsupportedImplementation_1 = 28;
+        public static final short UnsupportedImplementation_1 = 127;
 
         /**
          * The ‘{0}’ operation is unsupported.
          */
-        public static final int UnsupportedOperation_1 = 20;
+        public static final short UnsupportedOperation_1 = 128;
 
         /**
          * The ‘{0}’ type is unsupported.
          */
-        public static final int UnsupportedType_1 = 69;
+        public static final short UnsupportedType_1 = 129;
 
         /**
          * Version {0} is not supported.
          */
-        public static final int UnsupportedVersion_1 = 93;
+        public static final short UnsupportedVersion_1 = 130;
 
         /**
          * A value is already defined for “{0}”.
          */
-        public static final int ValueAlreadyDefined_1 = 13;
+        public static final short ValueAlreadyDefined_1 = 131;
 
         /**
          * Value ‘{0}’={1} is invalid. Expected a number greater than 0.
          */
-        public static final int ValueNotGreaterThanZero_2 = 7;
+        public static final short ValueNotGreaterThanZero_2 = 132;
 
         /**
          * Value ‘{0}’={3} is invalid. Expected a value in the [{1} … {2}] range.
          */
-        public static final int ValueOutOfRange_4 = 6;
+        public static final short ValueOutOfRange_4 = 133;
     }
 
     /**
@@ -772,7 +772,7 @@ public final class Errors extends Indexe
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int key) throws MissingResourceException {
+    public static String format(final short key) throws MissingResourceException {
         return getResources(null).getString(key);
     }
 
@@ -785,7 +785,7 @@ public final class Errors extends Indexe
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0) throws MissingResourceException
     {
         return getResources(null).getString(key, arg0);
@@ -801,7 +801,7 @@ public final class Errors extends Indexe
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1) throws MissingResourceException
     {
@@ -819,7 +819,7 @@ public final class Errors extends Indexe
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1,
                                 final Object arg2) throws MissingResourceException
@@ -839,7 +839,7 @@ public final class Errors extends Indexe
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1,
                                 final Object arg2,
@@ -854,8 +854,8 @@ public final class Errors extends Indexe
     private static final class International extends ResourceInternationalString {
         private static final long serialVersionUID = -5355796215044405012L;
 
-        International(int key)                   {super(key);}
-        International(int key, Object args)      {super(key, args);}
+        International(short key)                 {super(key);}
+        International(short key, Object args)    {super(key, args);}
         @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
         @Override IndexedResourceBundle getBundle(final Locale locale) {
             return getResources(locale);
@@ -870,7 +870,7 @@ public final class Errors extends Indexe
      * @param  key The key for the desired string.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key) {
+    public static InternationalString formatInternational(final short key) {
         return new International(key);
     }
 
@@ -887,7 +887,7 @@ public final class Errors extends Indexe
      * @param  arg Values to substitute to "{0}".
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object arg) {
+    public static InternationalString formatInternational(final short key, final Object arg) {
         return new International(key, arg);
     }
 
@@ -900,7 +900,7 @@ public final class Errors extends Indexe
      * @param  args Values to substitute to "{0}", "{1}", <i>etc</i>.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object... args) {
+    public static InternationalString formatInternational(final short key, final Object... args) {
         return new International(key, args);
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -48,8 +48,8 @@ import org.apache.sis.util.logging.Loggi
  * inner classes, with the side-effect of compile-time safety. Because integer constants are
  * inlined right into class files at compile time, the declarative classes is not loaded at run time.
  *
- * <p>Localized resources are fetched by calls to {@link #getString(int)}.
- * Arguments can optionally be provided by calls to {@link #getString(int, Object) getString(int, Object, ...)}.
+ * <p>Localized resources are fetched by calls to {@link #getString(short)}.
+ * Arguments can optionally be provided by calls to {@link #getString(short, Object) getString(short, Object, ...)}.
  * If arguments are present, then the string will be formatted using {@link MessageFormat},
  * completed by some special cases handled by this class. Roughly speaking:</p>
  *
@@ -104,7 +104,7 @@ public class IndexedResourceBundle exten
      * knowing its key allows us to avoid invoking the costly {@link MessageFormat#applyPattern}
      * method.
      */
-    private transient int lastKey;
+    private transient short lastKey;
 
     /**
      * Constructs a new resource bundle loading data from the given UTF file.
@@ -331,9 +331,9 @@ public class IndexedResourceBundle exten
     protected final Object handleGetObject(final String key) {
         // Synchronization performed by 'ensureLoaded'
         final String[] values = ensureLoaded(key);
-        int keyID;
+        short keyID;
         try {
-            keyID = Integer.parseInt(key);
+            keyID = Short.parseShort(key);
         } catch (NumberFormatException exception) {
             /*
              * Maybe the full key name has been specified instead. We do that for localized
@@ -414,7 +414,7 @@ public class IndexedResourceBundle exten
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getMenuLabel(final int key) throws MissingResourceException {
+    public final String getMenuLabel(final short key) throws MissingResourceException {
         return getString(key) + '…';
     }
 
@@ -426,7 +426,7 @@ public class IndexedResourceBundle exten
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getLabel(final int key) throws MissingResourceException {
+    public final String getLabel(final short key) throws MissingResourceException {
         return getString(key) + ": ";
     }
 
@@ -437,7 +437,7 @@ public class IndexedResourceBundle exten
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getString(final int key) throws MissingResourceException {
+    public final String getString(final short key) throws MissingResourceException {
         return getString(String.valueOf(key));
     }
 
@@ -462,11 +462,11 @@ public class IndexedResourceBundle exten
      * @throws MissingResourceException If no object for the given key can be found.
      *
      * @see #getString(String)
-     * @see #getString(int,Object,Object)
-     * @see #getString(int,Object,Object,Object)
+     * @see #getString(short,Object,Object)
+     * @see #getString(short,Object,Object,Object)
      * @see MessageFormat
      */
-    public final String getString(final int key, final Object arg0) throws MissingResourceException {
+    public final String getString(final short key, final Object arg0) throws MissingResourceException {
         final String pattern = getString(key);
         final Object[] arguments = toArray(arg0);
         synchronized (this) {
@@ -506,7 +506,7 @@ public class IndexedResourceBundle exten
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getString(final int    key,
+    public final String getString(final short  key,
                                   final Object arg0,
                                   final Object arg1) throws MissingResourceException
     {
@@ -524,7 +524,7 @@ public class IndexedResourceBundle exten
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getString(final int    key,
+    public final String getString(final short  key,
                                   final Object arg0,
                                   final Object arg1,
                                   final Object arg2) throws MissingResourceException
@@ -544,7 +544,7 @@ public class IndexedResourceBundle exten
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getString(final int    key,
+    public final String getString(final short  key,
                                   final Object arg0,
                                   final Object arg1,
                                   final Object arg2,
@@ -566,7 +566,7 @@ public class IndexedResourceBundle exten
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public final String getString(final int    key,
+    public final String getString(final short  key,
                                   final Object arg0,
                                   final Object arg1,
                                   final Object arg2,
@@ -583,7 +583,7 @@ public class IndexedResourceBundle exten
      * @param  key   The resource key.
      * @return The log record.
      */
-    public final LogRecord getLogRecord(final Level level, final int key) {
+    public final LogRecord getLogRecord(final Level level, final short key) {
         final LogRecord record = new LogRecord(level, getKeyConstants().getKeyName(key));
         record.setResourceBundleName(getClass().getName());
         record.setResourceBundle(this);
@@ -598,7 +598,7 @@ public class IndexedResourceBundle exten
      * @param  arg0  The parameter for the log message, which may be an array.
      * @return The log record.
      */
-    public final LogRecord getLogRecord(final Level level, final int key,
+    public final LogRecord getLogRecord(final Level level, final short key,
                                         final Object arg0)
     {
         final LogRecord record = getLogRecord(level, key);
@@ -615,7 +615,7 @@ public class IndexedResourceBundle exten
      * @param  arg1  The second parameter.
      * @return The log record.
      */
-    public final LogRecord getLogRecord(final Level level, final int key,
+    public final LogRecord getLogRecord(final Level level, final short key,
                                         final Object arg0,
                                         final Object arg1)
     {
@@ -632,7 +632,7 @@ public class IndexedResourceBundle exten
      * @param  arg2  The third parameter.
      * @return The log record.
      */
-    public final LogRecord getLogRecord(final Level level, final int key,
+    public final LogRecord getLogRecord(final Level level, final short key,
                                         final Object arg0,
                                         final Object arg1,
                                         final Object arg2)
@@ -651,7 +651,7 @@ public class IndexedResourceBundle exten
      * @param  arg3  The fourth parameter.
      * @return The log record.
      */
-    public final LogRecord getLogRecord(final Level level, final int key,
+    public final LogRecord getLogRecord(final Level level, final short key,
                                         final Object arg0,
                                         final Object arg1,
                                         final Object arg2,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/KeyConstants.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -30,7 +30,7 @@ import org.apache.sis.util.CharSequences
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  */
 class KeyConstants {
@@ -44,7 +44,7 @@ class KeyConstants {
      * inner class in some occasions.
      *
      * @see #getKeyNames()
-     * @see #getKeyName(int)
+     * @see #getKeyName(short)
      */
     private transient String[] keys;
 
@@ -76,8 +76,8 @@ class KeyConstants {
                 final Field[] fields = keysClass.getFields();
                 names = new String[fields.length];
                 for (final Field field : fields) {
-                    if (Modifier.isStatic(field.getModifiers()) && field.getType() == Integer.TYPE) {
-                        final int index = (Integer) field.get(null);
+                    if (Modifier.isStatic(field.getModifiers()) && field.getType() == Short.TYPE) {
+                        final int index = ((Short) field.get(null)) & 0xFFFF;
                         if (index >= length) {
                             length = index + 1;
                             if (length > names.length) {
@@ -88,7 +88,7 @@ class KeyConstants {
                         names[index] = field.getName();
                     }
                 }
-            } catch (ReflectiveOperationException e) {
+            } catch (IllegalAccessException e) {
                 names = CharSequences.EMPTY_ARRAY;
             }
             keys = ArraysExt.resize(names, length);
@@ -101,10 +101,11 @@ class KeyConstants {
      * index, format the index as a decimal number. Those decimal numbers are parsed by
      * our {@link IndexedResourceBundle#handleGetObject(String)} implementation.
      */
-    final String getKeyName(final int index) {
+    final String getKeyName(final short index) {
+        final int i = index & 0xFFFF;
         final String[] keys = getKeyNames();
-        if (index < keys.length) {
-            final String key = keys[index];
+        if (i < keys.length) {
+            final String key = keys[i];
             if (key != null) {
                 return key;
             }
@@ -115,7 +116,7 @@ class KeyConstants {
     /**
      * Returns the numerical value for the key of the given name.
      */
-    final int getKeyValue(final String name) throws NoSuchFieldException, IllegalAccessException {
-        return (Integer) keysClass.getField(name).get(null);
+    final short getKeyValue(final String name) throws NoSuchFieldException, IllegalAccessException {
+        return (Short) keysClass.getField(name).get(null);
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -27,7 +27,7 @@ import org.opengis.util.InternationalStr
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.2)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class Messages extends IndexedResourceBundle {
@@ -57,34 +57,34 @@ public final class Messages extends Inde
         /**
          * {0} “{1}” is already registered. The second instance will be ignored.
          */
-        public static final int AlreadyRegistered_2 = 5;
+        public static final short AlreadyRegistered_2 = 0;
 
         /**
          * Changed the container capacity from {0} to {1} elements.
          */
-        public static final int ChangedContainerCapacity_2 = 0;
+        public static final short ChangedContainerCapacity_2 = 1;
 
         /**
          * Property “{0}” has been discarded in favor of “{1}”, because those two properties are
          * mutually exclusive.
          */
-        public static final int DiscardedExclusiveProperty_2 = 1;
+        public static final short DiscardedExclusiveProperty_2 = 2;
 
         /**
          * Text were discarded for some locales.
          */
-        public static final int LocalesDiscarded = 2;
+        public static final short LocalesDiscarded = 3;
 
         /**
          * Property “{0}” is hidden by “{1}”.
          */
-        public static final int PropertyHiddenBy_2 = 3;
+        public static final short PropertyHiddenBy_2 = 4;
 
         /**
          * Can not parse “{1}” as an instance of {0}. The value is stored as plain text instead, but
          * will be ignored by some processing.
          */
-        public static final int UnparsableValueStoredAsText_2 = 4;
+        public static final short UnparsableValueStoredAsText_2 = 5;
     }
 
     /**
@@ -123,7 +123,7 @@ public final class Messages extends Inde
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int key) throws MissingResourceException {
+    public static String format(final short key) throws MissingResourceException {
         return getResources(null).getString(key);
     }
 
@@ -136,7 +136,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0) throws MissingResourceException
     {
         return getResources(null).getString(key, arg0);
@@ -152,7 +152,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1) throws MissingResourceException
     {
@@ -170,7 +170,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1,
                                 final Object arg2) throws MissingResourceException
@@ -190,7 +190,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1,
                                 final Object arg2,
@@ -205,8 +205,8 @@ public final class Messages extends Inde
     private static final class International extends ResourceInternationalString {
         private static final long serialVersionUID = 4553487496835099424L;
 
-        International(int key)                   {super(key);}
-        International(int key, Object args)      {super(key, args);}
+        International(short key)                 {super(key);}
+        International(short key, Object args)    {super(key, args);}
         @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
         @Override IndexedResourceBundle getBundle(final Locale locale) {
             return getResources(locale);
@@ -221,7 +221,7 @@ public final class Messages extends Inde
      * @param  key The key for the desired string.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key) {
+    public static InternationalString formatInternational(final short key) {
         return new International(key);
     }
 
@@ -238,7 +238,7 @@ public final class Messages extends Inde
      * @param  arg Values to substitute to "{0}".
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object arg) {
+    public static InternationalString formatInternational(final short key, final Object arg) {
         return new International(key, arg);
     }
 
@@ -251,7 +251,7 @@ public final class Messages extends Inde
      * @param  args Values to substitute to "{0}", "{1}", <i>etc</i>.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object... args) {
+    public static InternationalString formatInternational(final short key, final Object... args) {
         return new International(key, args);
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java?rev=1550874&r1=1550873&r2=1550874&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java [UTF-8] Sat Dec 14 03:23:43 2013
@@ -25,7 +25,6 @@ import java.util.Locale;
 import java.util.MissingResourceException;
 import org.apache.sis.util.Immutable;
 import org.apache.sis.util.Utilities;
-import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.iso.AbstractInternationalString;
 
 // Related to JDK7
@@ -39,7 +38,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @Immutable
@@ -47,14 +46,19 @@ abstract class ResourceInternationalStri
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -3910920973710535738L;
+    private static final long serialVersionUID = -3910920973710535739L;
 
     /**
-     * The key for the resource to fetch. A negative value means that the resource takes no
-     * argument, in which case the {@link #arguments} field shall be ignored. Negative key
-     * values are converted to positive values using the {@code ~} operator.
+     * The key for the resource to fetch.
      */
-    private transient int key;
+    private transient short key;
+
+    /**
+     * {@code true} if the key has arguments. If {@code false}, then the {@link #arguments}
+     * field shall be ignored. We can not rely on {@code null} arguments value because null
+     * may be a valid value.
+     */
+    private final boolean hasArguments;
 
     /**
      * The argument(s), or {@code null} if none. Note that the user may also really want to
@@ -68,10 +72,10 @@ abstract class ResourceInternationalStri
      *
      * @param key The key for the resource to fetch.
      */
-    ResourceInternationalString(final int key) {
-        ArgumentChecks.ensurePositive("key", key);
-        this.key  = ~key;
-        arguments = null;
+    ResourceInternationalString(final short key) {
+        this.key     = key;
+        hasArguments = false;
+        arguments    = null;
     }
 
     /**
@@ -80,10 +84,10 @@ abstract class ResourceInternationalStri
      * @param key The key for the resource to fetch.
      * @param The argument(s).
      */
-    ResourceInternationalString(final int key, final Object arguments) {
-        ArgumentChecks.ensurePositive("key", key);
-        this.key = key;
-        this.arguments = arguments;
+    ResourceInternationalString(final short key, final Object arguments) {
+        this.key          = key;
+        this.hasArguments = true;
+        this.arguments    = arguments;
     }
 
     /**
@@ -111,10 +115,9 @@ abstract class ResourceInternationalStri
      * @throws MissingResourceException is the key given to the constructor is invalid.
      */
     @Override
-    public String toString(final Locale locale) throws MissingResourceException {
+    public final String toString(final Locale locale) throws MissingResourceException {
         final IndexedResourceBundle resources = getBundle(locale);
-        return (key < 0) ? resources.getString(~key)
-                         : resources.getString(key, arguments);
+        return hasArguments ? resources.getString(key, arguments) : resources.getString(key);
     }
 
     /**
@@ -124,12 +127,12 @@ abstract class ResourceInternationalStri
      * @return {@code true} if the given object is equal to this string.
      */
     @Override
-    public boolean equals(final Object object) {
-        if (object != null && object.getClass() == getClass()) {
-            final ResourceInternationalString that = (ResourceInternationalString) object;
-            return this.key == that.key && Objects.equals(this.arguments, that.arguments);
+    public final boolean equals(final Object object) {
+        if (object == null || object.getClass() != getClass()) {
+            return false;
         }
-        return false;
+        final ResourceInternationalString that = (ResourceInternationalString) object;
+        return (key == that.key) && (hasArguments == that.hasArguments) && Objects.equals(arguments, that.arguments);
     }
 
     /**
@@ -138,7 +141,7 @@ abstract class ResourceInternationalStri
      * @return A hash code value for this international text.
      */
     @Override
-    public int hashCode() {
+    public final int hashCode() {
         return getClass().hashCode() ^ (key + 31*Utilities.deepHashCode(arguments)) ^ (int) serialVersionUID;
     }
 
@@ -147,8 +150,7 @@ abstract class ResourceInternationalStri
      */
     private void writeObject(final ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
-        out.writeUTF(getKeyConstants().getKeyName(key >= 0 ? key : ~key));
-        out.writeBoolean(key < 0);
+        out.writeUTF(getKeyConstants().getKeyName(key));
     }
 
     /**
@@ -163,8 +165,5 @@ abstract class ResourceInternationalStri
             e.initCause(cause);
             throw e;
         }
-        if (in.readBoolean()) {
-            key = ~key;
-        }
     }
 }



Mime
View raw message