Merge GNU Classpath libgcj-snapshot-20090102.
2009-01-06 Andrew John Hughes <gnu_andrew@member.fsf.org> Import GNU Classpath (libgcj-snapshot-20090102). * libjava/classpath/lib/java/text/RuleBasedCollator$CollationSorter.class, * libjava/classpath/lib/java/text/MessageFormat$MessageFormatElement.class, * libjava/classpath/lib/java/text/MessageFormat.class, * libjava/classpath/lib/java/text/SimpleDateFormat.class, * libjava/classpath/lib/java/text/NumberFormat.class, * libjava/classpath/lib/java/text/RuleBasedCollator$CollationElement.class, * libjava/classpath/lib/java/text/MessageFormat$Field.class, * libjava/classpath/lib/java/text/RuleBasedCollator.class, * libjava/classpath/lib/java/text/NumberFormat$Field.class, * libjava/classpath/lib/gnu/xml/transform/Bindings.class, * libjava/classpath/lib/gnu/java/locale/LocaleData.class, * libjava/classpath/lib/gnu/java/awt/peer/gtk/FreetypeGlyphVector.class, * libjava/classpath/lib/gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.class, * libjava/gnu/java/awt/peer/gtk/FreetypeGlyphVector.h, * libjava/java/text/MessageFormat.h, * libjava/java/text/RuleBasedCollator$CollationSorter.h, * libjava/java/text/RuleBasedCollator.h, * libjava/java/text/SimpleDateFormat.h: Regenerated. 2009-01-02 Andrew John Hughes <gnu_andrew@member.fsf.org> * ChangeLog-2008: New file. 2009-01-02 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/MessageFormat.java: (setLocale(Locale)): Integer format should use NumberFormat.getIntegerInstance. libjava/classpath/ChangeLog-2008 2008-12-31 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/MessageFormat.java: (parse(String,ParsePosition)): Emulate behaviour of Vector's setSize() which was being implicitly relied on. 2008-12-31 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/SimpleDateFormat.java: Remove superfluous empty line introduced in last commit. 2008-12-31 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/MessageFormat.java: Convert variables to use generic types, use CPStringBuilder in place of StringBuilder. (Field()): Suppress warning due to only being used by deserialization. (scanFormat(String,int,CPStringBuilder,List,Locale)): Use ArrayList instead of Vector as no synchronisation needed. (parse(String,ParsePosition)): Likewise. * java/text/NumberFormat.java: (Field()): Suppress warning due to only being used by deserialization. * java/text/RuleBasedCollator.java: Convert variables to use generic types. (CollationElement): Make fields final. (CollationSorter): Likewise. (CollationSorter(int,String,int,boolean)): New constructor. * java/text/SimpleDateFormat.java, Convert variables to use generic types. (applyPattern(String)): Clear list rather than creating a new instance. 2008-12-30 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/SimpleDateFormat.java: (standardChars): Use standard characters from CLDR. (RFC822_TIMEZONE_FIELD): Fixed to match new standard characters. 2008-12-22 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/lang/String.java: (byte[],int,int,String): Call new Charset method. (stringToCharset(String)): Private method added to handle exception conversion. (byte[],int,int,Charset): Implemented. (byte[], Charset): Likewise. (getBytes(String)): Call new Charset method. (getBytes(Charset)): Implemented. 2008-12-18 Andrew John Hughes <gnu_andrew@member.fsf.org> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c: Include '\0' in the string. 2008-12-09 Andrew John Hughes <gnu_andrew@member.fsf.org> PR classpath/38473: * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c: (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative): Check that the glyph is an outline before calling FT_Outline_Decompose. 2008-11-16 Andrew John Hughes <gnu_andrew@member.fsf.org> * gnu/xml/transform/Bindings.java: Add generics to collections. 2008-11-16 Andrew John Hughes <gnu_andrew@member.fsf.org> * gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java: (init(int,SecureRandom)): Improve exception message. 2008-11-06 Mark Wielaard <mark@klomp.org> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (getKerning): Removed unused cls, method, values. 2008-11-05 Andrew Haley <aph@redhat.com> * gnu/java/awt/peer/gtk/FreetypeGlyphVector.java (getKerning): Return result in a float[], not a Point2D. (performDefaultLayout): Call getKerning with a float[]. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (getKerning): Return result in a float[], not a Point2D. 2008-11-05 Andrew Haley <aph@redhat.com> * tools/Makefile.am (UPDATE_TOOLS_ZIP, CREATE_TOOLS_ZIP): Exclude .svn direcories. 2008-10-23 David Edelsohn <edelsohn@gnu.org> * native/fdlibm/fdlibm.h: Undef hz. 2008-10-20 Andrew John Hughes <gnu_andrew@member.fsf.org> * m4/ac_prog_antlr.m4: Remove redundant checks. * tools/Makefile.am: Use gjdoc_gendir when calling antlr. 2008-10-17 Robert Lougher <rob.lougher@gmail.com> * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c (Java_gnu_java_awt_peer_gtk_CairoGraphics2D_cairoDrawGlyphVector): Release 'fonts'. 2008-10-16 Tom Tromey <tromey@redhat.com> * tools/gnu/classpath/tools/jar/WorkSet.java (initSet): Use foreach. Change argument type. (WorkSet): Change argument type. * tools/gnu/classpath/tools/jar/Indexer.java (indexJarFile): Use foreach. * tools/gnu/classpath/tools/jar/Creator.java (writeCommandLineEntries): Use foreach. (getAllEntries): Likewise. 2008-10-15 Andrew John Hughes <gnu_andrew@member.fsf.org> * configure.ac: Remove superfluous AC_PROG_JAVA call. From-SVN: r143139
This commit is contained in:
parent
5e5debf66a
commit
c10bf728da
32 changed files with 5129 additions and 4669 deletions
|
@ -38,13 +38,17 @@ exception statement from your version. */
|
|||
|
||||
package java.text;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import gnu.java.text.FormatCharacterIterator;
|
||||
|
||||
import java.io.InvalidObjectException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
public class MessageFormat extends Format
|
||||
{
|
||||
|
@ -69,7 +73,7 @@ public class MessageFormat extends Format
|
|||
|
||||
// Argument will be checked to make sure it is an instance of this
|
||||
// class.
|
||||
Class formatClass;
|
||||
Class<?> formatClass;
|
||||
|
||||
// Formatter type.
|
||||
String type;
|
||||
|
@ -95,12 +99,7 @@ public class MessageFormat extends Format
|
|||
else if (style.equals("percent"))
|
||||
format = NumberFormat.getPercentInstance(loc);
|
||||
else if (style.equals("integer"))
|
||||
{
|
||||
NumberFormat nf = NumberFormat.getNumberInstance(loc);
|
||||
nf.setMaximumFractionDigits(0);
|
||||
nf.setGroupingUsed(false);
|
||||
format = nf;
|
||||
}
|
||||
format = NumberFormat.getIntegerInstance(loc);
|
||||
else
|
||||
{
|
||||
format = NumberFormat.getNumberInstance(loc);
|
||||
|
@ -165,6 +164,7 @@ public class MessageFormat extends Format
|
|||
public static final MessageFormat.Field ARGUMENT = new MessageFormat.Field("argument");
|
||||
|
||||
// For deserialization
|
||||
@SuppressWarnings("unused")
|
||||
private Field()
|
||||
{
|
||||
super("");
|
||||
|
@ -194,7 +194,7 @@ public class MessageFormat extends Format
|
|||
// Helper that returns the text up to the next format opener. The
|
||||
// text is put into BUFFER. Returns index of character after end of
|
||||
// string. Throws IllegalArgumentException on error.
|
||||
private static int scanString(String pat, int index, StringBuilder buffer)
|
||||
private static int scanString(String pat, int index, CPStringBuilder buffer)
|
||||
{
|
||||
int max = pat.length();
|
||||
buffer.setLength(0);
|
||||
|
@ -234,7 +234,7 @@ public class MessageFormat extends Format
|
|||
// This helper retrieves a single part of a format element. Returns
|
||||
// the index of the terminating character.
|
||||
private static int scanFormatElement(String pat, int index,
|
||||
StringBuilder buffer, char term)
|
||||
CPStringBuilder buffer, char term)
|
||||
{
|
||||
int max = pat.length();
|
||||
buffer.setLength(0);
|
||||
|
@ -281,11 +281,11 @@ public class MessageFormat extends Format
|
|||
|
||||
// This is used to parse a format element and whatever non-format
|
||||
// text might trail it.
|
||||
private static int scanFormat(String pat, int index, StringBuilder buffer,
|
||||
Vector elts, Locale locale)
|
||||
private static int scanFormat(String pat, int index, CPStringBuilder buffer,
|
||||
List<MessageFormatElement> elts, Locale locale)
|
||||
{
|
||||
MessageFormatElement mfe = new MessageFormatElement ();
|
||||
elts.addElement(mfe);
|
||||
elts.add(mfe);
|
||||
|
||||
int max = pat.length();
|
||||
|
||||
|
@ -342,17 +342,16 @@ public class MessageFormat extends Format
|
|||
{
|
||||
pattern = newPattern;
|
||||
|
||||
StringBuilder tempBuffer = new StringBuilder ();
|
||||
CPStringBuilder tempBuffer = new CPStringBuilder ();
|
||||
|
||||
int index = scanString (newPattern, 0, tempBuffer);
|
||||
leader = tempBuffer.toString();
|
||||
|
||||
Vector elts = new Vector ();
|
||||
List<MessageFormatElement> elts = new ArrayList<MessageFormatElement>();
|
||||
while (index < newPattern.length())
|
||||
index = scanFormat (newPattern, index, tempBuffer, elts, locale);
|
||||
|
||||
elements = new MessageFormatElement[elts.size()];
|
||||
elts.copyInto(elements);
|
||||
elements = elts.toArray(new MessageFormatElement[elts.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -494,7 +493,8 @@ public class MessageFormat extends Format
|
|||
|
||||
if (output_iterator != null)
|
||||
{
|
||||
HashMap hash_argument = new HashMap();
|
||||
HashMap<MessageFormat.Field, Integer> hash_argument =
|
||||
new HashMap<MessageFormat.Field, Integer>();
|
||||
int position = output_iterator.getEndIndex();
|
||||
|
||||
hash_argument.put (MessageFormat.Field.ARGUMENT,
|
||||
|
@ -613,7 +613,7 @@ public class MessageFormat extends Format
|
|||
}
|
||||
index += leader.length();
|
||||
|
||||
Vector results = new Vector (elements.length, 1);
|
||||
ArrayList<Object> results = new ArrayList<Object>(elements.length);
|
||||
// Now check each format.
|
||||
for (int i = 0; i < elements.length; ++i)
|
||||
{
|
||||
|
@ -681,15 +681,18 @@ public class MessageFormat extends Format
|
|||
}
|
||||
|
||||
if (elements[i].argNumber >= results.size())
|
||||
results.setSize(elements[i].argNumber + 1);
|
||||
results.setElementAt(value, elements[i].argNumber);
|
||||
{
|
||||
// Emulate padding behaviour of Vector.setSize() with ArrayList
|
||||
results.ensureCapacity(elements[i].argNumber + 1);
|
||||
for (int a = results.size(); a <= elements[i].argNumber; ++a)
|
||||
results.add(a, null);
|
||||
}
|
||||
results.set(elements[i].argNumber, value);
|
||||
|
||||
index += elements[i].trailer.length();
|
||||
}
|
||||
|
||||
Object[] r = new Object[results.size()];
|
||||
results.copyInto(r);
|
||||
return r;
|
||||
return results.toArray(new Object[results.size()]);
|
||||
}
|
||||
|
||||
public Object[] parse (String sourceStr) throws ParseException
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue