# HG changeset patch
# User Jaroslav Tulach Note that the detail message associated with {@code cause} is
+ * not automatically incorporated into this exception's detail
+ * message.
+ *
+ * @param message
+ * The detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method)
+ *
+ * @param cause
+ * The cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ *
+ * @since 1.6
+ */
+ public IOException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs an {@code IOException} with the specified cause and a
+ * detail message of {@code (cause==null ? null : cause.toString())}
+ * (which typically contains the class and detail message of {@code cause}).
+ * This constructor is useful for IO exceptions that are little more
+ * than wrappers for other throwables.
+ *
+ * @param cause
+ * The cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ *
+ * @since 1.6
+ */
+ public IOException(Throwable cause) {
+ super(cause);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/io/Serializable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/io/Serializable.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.io;
+
+/**
+ * Serializability of a class is enabled by the class implementing the
+ * java.io.Serializable interface. Classes that do not implement this
+ * interface will not have any of their state serialized or
+ * deserialized. All subtypes of a serializable class are themselves
+ * serializable. The serialization interface has no methods or fields
+ * and serves only to identify the semantics of being serializable.
+ *
+ * To allow subtypes of non-serializable classes to be serialized, the
+ * subtype may assume responsibility for saving and restoring the
+ * state of the supertype's public, protected, and (if accessible)
+ * package fields. The subtype may assume this responsibility only if
+ * the class it extends has an accessible no-arg constructor to
+ * initialize the class's state. It is an error to declare a class
+ * Serializable if this is not the case. The error will be detected at
+ * runtime.
+ *
+ * During deserialization, the fields of non-serializable classes will
+ * be initialized using the public or protected no-arg constructor of
+ * the class. A no-arg constructor must be accessible to the subclass
+ * that is serializable. The fields of serializable subclasses will
+ * be restored from the stream.
+ *
+ * When traversing a graph, an object may be encountered that does not
+ * support the Serializable interface. In this case the
+ * NotSerializableException will be thrown and will identify the class
+ * of the non-serializable object.
+ *
+ * Classes that require special handling during the serialization and
+ * deserialization process must implement special methods with these exact
+ * signatures:
+ *
+ * The writeObject method is responsible for writing the state of the
+ * object for its particular class so that the corresponding
+ * readObject method can restore it. The default mechanism for saving
+ * the Object's fields can be invoked by calling
+ * out.defaultWriteObject. The method does not need to concern
+ * itself with the state belonging to its superclasses or subclasses.
+ * State is saved by writing the individual fields to the
+ * ObjectOutputStream using the writeObject method or by using the
+ * methods for primitive data types supported by DataOutput.
+ *
+ * The readObject method is responsible for reading from the stream and
+ * restoring the classes fields. It may call in.defaultReadObject to invoke
+ * the default mechanism for restoring the object's non-static and
+ * non-transient fields. The defaultReadObject method uses information in
+ * the stream to assign the fields of the object saved in the stream with the
+ * correspondingly named fields in the current object. This handles the case
+ * when the class has evolved to add new fields. The method does not need to
+ * concern itself with the state belonging to its superclasses or subclasses.
+ * State is saved by writing the individual fields to the
+ * ObjectOutputStream using the writeObject method or by using the
+ * methods for primitive data types supported by DataOutput.
+ *
+ * The readObjectNoData method is responsible for initializing the state of
+ * the object for its particular class in the event that the serialization
+ * stream does not list the given class as a superclass of the object being
+ * deserialized. This may occur in cases where the receiving party uses a
+ * different version of the deserialized instance's class than the sending
+ * party, and the receiver's version extends classes that are not extended by
+ * the sender's version. This may also occur if the serialization stream has
+ * been tampered; hence, readObjectNoData is useful for initializing
+ * deserialized objects properly despite a "hostile" or incomplete source
+ * stream.
+ *
+ * Serializable classes that need to designate an alternative object to be
+ * used when writing an object to the stream should implement this
+ * special method with the exact signature:
+ *
+ *
+ *
+ * This writeReplace method is invoked by serialization if the method
+ * exists and it would be accessible from a method defined within the
+ * class of the object being serialized. Thus, the method can have private,
+ * protected and package-private access. Subclass access to this method
+ * follows java accessibility rules.
+ *
+ * Classes that need to designate a replacement when an instance of it
+ * is read from the stream should implement this special method with the
+ * exact signature.
+ *
+ *
+ *
+ * This readResolve method follows the same invocation rules and
+ * accessibility rules as writeReplace.
+ *
+ * The serialization runtime associates with each serializable class a version
+ * number, called a serialVersionUID, which is used during deserialization to
+ * verify that the sender and receiver of a serialized object have loaded
+ * classes for that object that are compatible with respect to serialization.
+ * If the receiver has loaded a class for the object that has a different
+ * serialVersionUID than that of the corresponding sender's class, then
+ * deserialization will result in an {@link InvalidClassException}. A
+ * serializable class can declare its own serialVersionUID explicitly by
+ * declaring a field named
+ *
+ *
+ * Implements a modifiable string. At any point in time it contains some
+ * particular sequence of characters, but the length and content of the
+ * sequence can be changed through certain method calls.
+ *
+ * @author Michael McCloskey
+ * @author Martin Buchholz
+ * @author Ulf Zibis
+ * @since 1.5
+ */
+abstract class AbstractStringBuilder implements Appendable, CharSequence {
+ /**
+ * The value is used for character storage.
+ */
+ char[] value;
+
+ /**
+ * The count is the number of characters used.
+ */
+ int count;
+
+ /**
+ * This no-arg constructor is necessary for serialization of subclasses.
+ */
+ AbstractStringBuilder() {
+ }
+
+ /**
+ * Creates an AbstractStringBuilder of the specified capacity.
+ */
+ AbstractStringBuilder(int capacity) {
+ value = new char[capacity];
+ }
+
+ /**
+ * Returns the length (character count).
+ *
+ * @return the length of the sequence of characters currently
+ * represented by this object
+ */
+ public int length() {
+ return count;
+ }
+
+ /**
+ * Returns the current capacity. The capacity is the amount of storage
+ * available for newly inserted characters, beyond which an allocation
+ * will occur.
+ *
+ * @return the current capacity
+ */
+ public int capacity() {
+ return value.length;
+ }
+
+ /**
+ * Ensures that the capacity is at least equal to the specified minimum.
+ * If the current capacity is less than the argument, then a new internal
+ * array is allocated with greater capacity. The new capacity is the
+ * larger of:
+ *
+ * If the
+ * The
+ * The index argument must be greater than or equal to
+ * If the If the If the
+ * The index argument must be greater than or equal to
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(Object)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param obj an {@code Object}.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(Object obj) {
+ return append(String.valueOf(obj));
+ }
+
+ /**
+ * Appends the specified string to this character sequence.
+ *
+ * The characters of the {@code String} argument are appended, in
+ * order, increasing the length of this sequence by the length of the
+ * argument. If {@code str} is {@code null}, then the four
+ * characters {@code "null"} are appended.
+ *
+ * Let n be the length of this character sequence just prior to
+ * execution of the {@code append} method. Then the character at
+ * index k in the new character sequence is equal to the character
+ * at index k in the old character sequence, if k is less
+ * than n; otherwise, it is equal to the character at index
+ * k-n in the argument {@code str}.
+ *
+ * @param str a string.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(String str) {
+ if (str == null) str = "null";
+ int len = str.length();
+ ensureCapacityInternal(count + len);
+ str.getChars(0, len, value, count);
+ count += len;
+ return this;
+ }
+
+ // Documentation in subclasses because of synchro difference
+ public AbstractStringBuilder append(StringBuffer sb) {
+ if (sb == null)
+ return append("null");
+ int len = sb.length();
+ ensureCapacityInternal(count + len);
+ sb.getChars(0, len, value, count);
+ count += len;
+ return this;
+ }
+
+ // Documentation in subclasses because of synchro difference
+ public AbstractStringBuilder append(CharSequence s) {
+ if (s == null)
+ s = "null";
+ if (s instanceof String)
+ return this.append((String)s);
+ if (s instanceof StringBuffer)
+ return this.append((StringBuffer)s);
+ return this.append(s, 0, s.length());
+ }
+
+ /**
+ * Appends a subsequence of the specified {@code CharSequence} to this
+ * sequence.
+ *
+ * Characters of the argument {@code s}, starting at
+ * index {@code start}, are appended, in order, to the contents of
+ * this sequence up to the (exclusive) index {@code end}. The length
+ * of this sequence is increased by the value of {@code end - start}.
+ *
+ * Let n be the length of this character sequence just prior to
+ * execution of the {@code append} method. Then the character at
+ * index k in this character sequence becomes equal to the
+ * character at index k in this sequence, if k is less than
+ * n; otherwise, it is equal to the character at index
+ * k+start-n in the argument {@code s}.
+ *
+ * If {@code s} is {@code null}, then this method appends
+ * characters as if the s parameter was a sequence containing the four
+ * characters {@code "null"}.
+ *
+ * @param s the sequence to append.
+ * @param start the starting index of the subsequence to be appended.
+ * @param end the end index of the subsequence to be appended.
+ * @return a reference to this object.
+ * @throws IndexOutOfBoundsException if
+ * {@code start} is negative, or
+ * {@code start} is greater than {@code end} or
+ * {@code end} is greater than {@code s.length()}
+ */
+ public AbstractStringBuilder append(CharSequence s, int start, int end) {
+ if (s == null)
+ s = "null";
+ if ((start < 0) || (start > end) || (end > s.length()))
+ throw new IndexOutOfBoundsException(
+ "start " + start + ", end " + end + ", s.length() "
+ + s.length());
+ int len = end - start;
+ ensureCapacityInternal(count + len);
+ for (int i = start, j = count; i < end; i++, j++)
+ value[j] = s.charAt(i);
+ count += len;
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code char} array
+ * argument to this sequence.
+ *
+ * The characters of the array argument are appended, in order, to
+ * the contents of this sequence. The length of this sequence
+ * increases by the length of the argument.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(char[])},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param str the characters to be appended.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(char[] str) {
+ int len = str.length;
+ ensureCapacityInternal(count + len);
+ String.arraycopy(str, 0, value, count, len);
+ count += len;
+ return this;
+ }
+
+ /**
+ * Appends the string representation of a subarray of the
+ * {@code char} array argument to this sequence.
+ *
+ * Characters of the {@code char} array {@code str}, starting at
+ * index {@code offset}, are appended, in order, to the contents
+ * of this sequence. The length of this sequence increases
+ * by the value of {@code len}.
+ *
+ * The overall effect is exactly as if the arguments were converted
+ * to a string by the method {@link String#valueOf(char[],int,int)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param str the characters to be appended.
+ * @param offset the index of the first {@code char} to append.
+ * @param len the number of {@code char}s to append.
+ * @return a reference to this object.
+ * @throws IndexOutOfBoundsException
+ * if {@code offset < 0} or {@code len < 0}
+ * or {@code offset+len > str.length}
+ */
+ public AbstractStringBuilder append(char str[], int offset, int len) {
+ if (len > 0) // let arraycopy report AIOOBE for len < 0
+ ensureCapacityInternal(count + len);
+ String.arraycopy(str, offset, value, count, len);
+ count += len;
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code boolean}
+ * argument to the sequence.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(boolean)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param b a {@code boolean}.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(boolean b) {
+ if (b) {
+ ensureCapacityInternal(count + 4);
+ value[count++] = 't';
+ value[count++] = 'r';
+ value[count++] = 'u';
+ value[count++] = 'e';
+ } else {
+ ensureCapacityInternal(count + 5);
+ value[count++] = 'f';
+ value[count++] = 'a';
+ value[count++] = 'l';
+ value[count++] = 's';
+ value[count++] = 'e';
+ }
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code char}
+ * argument to this sequence.
+ *
+ * The argument is appended to the contents of this sequence.
+ * The length of this sequence increases by {@code 1}.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(char)},
+ * and the character in that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param c a {@code char}.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(char c) {
+ ensureCapacityInternal(count + 1);
+ value[count++] = c;
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code int}
+ * argument to this sequence.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(int)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param i an {@code int}.
+ * @return a reference to this object.
+ */
+ @JavaScriptBody(
+ args={ "self", "i" },
+ body="return java_lang_AbstractStringBuilder_appendLjava_lang_AbstractStringBuilderLjava_lang_String(self,i.toString());"
+ )
+ public AbstractStringBuilder append(int i) {
+ if (i == Integer.MIN_VALUE) {
+ append("-2147483648");
+ return this;
+ }
+ int appendedLength = (i < 0) ? Integer.stringSize(-i) + 1
+ : Integer.stringSize(i);
+ int spaceNeeded = count + appendedLength;
+ ensureCapacityInternal(spaceNeeded);
+ Integer.getChars(i, spaceNeeded, value);
+ count = spaceNeeded;
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code long}
+ * argument to this sequence.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(long)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param l a {@code long}.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(long l) {
+ if (l == Long.MIN_VALUE) {
+ append("-9223372036854775808");
+ return this;
+ }
+ int appendedLength = (l < 0) ? Long.stringSize(-l) + 1
+ : Long.stringSize(l);
+ int spaceNeeded = count + appendedLength;
+ ensureCapacityInternal(spaceNeeded);
+ Long.getChars(l, spaceNeeded, value);
+ count = spaceNeeded;
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code float}
+ * argument to this sequence.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(float)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param f a {@code float}.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(float f) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Appends the string representation of the {@code double}
+ * argument to this sequence.
+ *
+ * The overall effect is exactly as if the argument were converted
+ * to a string by the method {@link String#valueOf(double)},
+ * and the characters of that string were then
+ * {@link #append(String) appended} to this character sequence.
+ *
+ * @param d a {@code double}.
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder append(double d) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Removes the characters in a substring of this sequence.
+ * The substring begins at the specified {@code start} and extends to
+ * the character at index {@code end - 1} or to the end of the
+ * sequence if no such character exists. If
+ * {@code start} is equal to {@code end}, no changes are made.
+ *
+ * @param start The beginning index, inclusive.
+ * @param end The ending index, exclusive.
+ * @return This object.
+ * @throws StringIndexOutOfBoundsException if {@code start}
+ * is negative, greater than {@code length()}, or
+ * greater than {@code end}.
+ */
+ public AbstractStringBuilder delete(int start, int end) {
+ if (start < 0)
+ throw new StringIndexOutOfBoundsException(start);
+ if (end > count)
+ end = count;
+ if (start > end)
+ throw new StringIndexOutOfBoundsException();
+ int len = end - start;
+ if (len > 0) {
+ String.arraycopy(value, start+len, value, start, count-end);
+ count -= len;
+ }
+ return this;
+ }
+
+ /**
+ * Appends the string representation of the {@code codePoint}
+ * argument to this sequence.
+ *
+ * The argument is appended to the contents of this sequence.
+ * The length of this sequence increases by
+ * {@link Character#charCount(int) Character.charCount(codePoint)}.
+ *
+ * The overall effect is exactly as if the argument were
+ * converted to a {@code char} array by the method
+ * {@link Character#toChars(int)} and the character in that array
+ * were then {@link #append(char[]) appended} to this character
+ * sequence.
+ *
+ * @param codePoint a Unicode code point
+ * @return a reference to this object.
+ * @exception IllegalArgumentException if the specified
+ * {@code codePoint} isn't a valid Unicode code point
+ */
+ public AbstractStringBuilder appendCodePoint(int codePoint) {
+ final int count = this.count;
+
+ if (Character.isBmpCodePoint(codePoint)) {
+ ensureCapacityInternal(count + 1);
+ value[count] = (char) codePoint;
+ this.count = count + 1;
+ } else if (Character.isValidCodePoint(codePoint)) {
+ ensureCapacityInternal(count + 2);
+ Character.toSurrogates(codePoint, value, count);
+ this.count = count + 2;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ return this;
+ }
+
+ /**
+ * Removes the Note: If the character at the given index is a supplementary
+ * character, this method does not remove the entire character. If
+ * correct handling of supplementary characters is required,
+ * determine the number of An invocation of this method of the form
+ *
+ *
+ * private void writeObject(java.io.ObjectOutputStream out)
+ * throws IOException
+ * private void readObject(java.io.ObjectInputStream in)
+ * throws IOException, ClassNotFoundException;
+ * private void readObjectNoData()
+ * throws ObjectStreamException;
+ *
+ *
+ *
+ * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
+ *
+ * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
+ *
"serialVersionUID"
that must be static,
+ * final, and of type long
:
+ * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
+ *
+ *
+ * If a serializable class does not explicitly declare a serialVersionUID, then
+ * the serialization runtime will calculate a default serialVersionUID value
+ * for that class based on various aspects of the class, as described in the
+ * Java(TM) Object Serialization Specification. However, it is strongly
+ * recommended that all serializable classes explicitly declare
+ * serialVersionUID values, since the default serialVersionUID computation is
+ * highly sensitive to class details that may vary depending on compiler
+ * implementations, and can thus result in unexpected
+ * InvalidClassException
s during deserialization. Therefore, to
+ * guarantee a consistent serialVersionUID value across different java compiler
+ * implementations, a serializable class must declare an explicit
+ * serialVersionUID value. It is also strongly advised that explicit
+ * serialVersionUID declarations use the private
modifier where
+ * possible, since such declarations apply only to the immediately declaring
+ * class--serialVersionUID fields are not useful as inherited members. Array
+ * classes cannot declare an explicit serialVersionUID, so they always have
+ * the default computed value, but the requirement for matching
+ * serialVersionUID values is waived for array classes.
+ *
+ * @author unascribed
+ * @see java.io.ObjectOutputStream
+ * @see java.io.ObjectInputStream
+ * @see java.io.ObjectOutput
+ * @see java.io.ObjectInput
+ * @see java.io.Externalizable
+ * @since JDK1.1
+ */
+public interface Serializable {
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/io/UnsupportedEncodingException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/io/UnsupportedEncodingException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.io;
+
+/**
+ * The Character Encoding is not supported.
+ *
+ * @author Asmus Freytag
+ * @since JDK1.1
+ */
+public class UnsupportedEncodingException
+ extends IOException
+{
+ private static final long serialVersionUID = -4274276298326136670L;
+
+ /**
+ * Constructs an UnsupportedEncodingException without a detail message.
+ */
+ public UnsupportedEncodingException() {
+ super();
+ }
+
+ /**
+ * Constructs an UnsupportedEncodingException with a detail message.
+ * @param s Describes the reason for the exception.
+ */
+ public UnsupportedEncodingException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/AbstractStringBuilder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/AbstractStringBuilder.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,1408 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import org.apidesign.bck2brwsr.core.JavaScriptBody;
+
+/**
+ * A mutable sequence of characters.
+ *
+ *
+ * If the minimumCapacity
argument.
+ * 2
.
+ * minimumCapacity
argument is nonpositive, this
+ * method takes no action and simply returns.
+ *
+ * @param minimumCapacity the minimum desired capacity.
+ */
+ public void ensureCapacity(int minimumCapacity) {
+ if (minimumCapacity > 0)
+ ensureCapacityInternal(minimumCapacity);
+ }
+
+ /**
+ * This method has the same contract as ensureCapacity, but is
+ * never synchronized.
+ */
+ private void ensureCapacityInternal(int minimumCapacity) {
+ // overflow-conscious code
+ if (minimumCapacity - value.length > 0)
+ expandCapacity(minimumCapacity);
+ }
+
+ /**
+ * This implements the expansion semantics of ensureCapacity with no
+ * size check or synchronization.
+ */
+ void expandCapacity(int minimumCapacity) {
+ int newCapacity = value.length * 2 + 2;
+ if (newCapacity - minimumCapacity < 0)
+ newCapacity = minimumCapacity;
+ if (newCapacity < 0) {
+ if (minimumCapacity < 0) // overflow
+ throw new OutOfMemoryError();
+ newCapacity = Integer.MAX_VALUE;
+ }
+ value = String.copyOf(value, newCapacity);
+ }
+
+ /**
+ * Attempts to reduce storage used for the character sequence.
+ * If the buffer is larger than necessary to hold its current sequence of
+ * characters, then it may be resized to become more space efficient.
+ * Calling this method may, but is not required to, affect the value
+ * returned by a subsequent call to the {@link #capacity()} method.
+ */
+ public void trimToSize() {
+ if (count < value.length) {
+ value = String.copyOf(value, count);
+ }
+ }
+
+ /**
+ * Sets the length of the character sequence.
+ * The sequence is changed to a new character sequence
+ * whose length is specified by the argument. For every nonnegative
+ * index k less than newLength
, the character at
+ * index k in the new character sequence is the same as the
+ * character at index k in the old sequence if k is less
+ * than the length of the old character sequence; otherwise, it is the
+ * null character '\u0000'
.
+ *
+ * In other words, if the newLength
argument is less than
+ * the current length, the length is changed to the specified length.
+ * newLength
argument is greater than or equal
+ * to the current length, sufficient null characters
+ * ('\u0000'
) are appended so that
+ * length becomes the newLength
argument.
+ * newLength
argument must be greater than or equal
+ * to 0
.
+ *
+ * @param newLength the new length
+ * @throws IndexOutOfBoundsException if the
+ * newLength
argument is negative.
+ */
+ public void setLength(int newLength) {
+ if (newLength < 0)
+ throw new StringIndexOutOfBoundsException(newLength);
+ ensureCapacityInternal(newLength);
+
+ if (count < newLength) {
+ for (; count < newLength; count++)
+ value[count] = '\0';
+ } else {
+ count = newLength;
+ }
+ }
+
+ /**
+ * Returns the char
value in this sequence at the specified index.
+ * The first char
value is at index 0
, the next at index
+ * 1
, and so on, as in array indexing.
+ * 0
, and less than the length of this sequence.
+ *
+ * char
value specified by the index is a
+ * surrogate, the surrogate
+ * value is returned.
+ *
+ * @param index the index of the desired char
value.
+ * @return the char
value at the specified index.
+ * @throws IndexOutOfBoundsException if index
is
+ * negative or greater than or equal to length()
.
+ */
+ public char charAt(int index) {
+ if ((index < 0) || (index >= count))
+ throw new StringIndexOutOfBoundsException(index);
+ return value[index];
+ }
+
+ /**
+ * Returns the character (Unicode code point) at the specified
+ * index. The index refers to char
values
+ * (Unicode code units) and ranges from 0
to
+ * {@link #length()} - 1
.
+ *
+ * char
value specified at the given index
+ * is in the high-surrogate range, the following index is less
+ * than the length of this sequence, and the
+ * char
value at the following index is in the
+ * low-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the char
value at the given index is returned.
+ *
+ * @param index the index to the char
values
+ * @return the code point value of the character at the
+ * index
+ * @exception IndexOutOfBoundsException if the index
+ * argument is negative or not less than the length of this
+ * sequence.
+ */
+ public int codePointAt(int index) {
+ if ((index < 0) || (index >= count)) {
+ throw new StringIndexOutOfBoundsException(index);
+ }
+ return Character.codePointAt(value, index);
+ }
+
+ /**
+ * Returns the character (Unicode code point) before the specified
+ * index. The index refers to char
values
+ * (Unicode code units) and ranges from 1
to {@link
+ * #length()}.
+ *
+ * char
value at (index - 1)
+ * is in the low-surrogate range, (index - 2)
is not
+ * negative, and the char
value at (index -
+ * 2)
is in the high-surrogate range, then the
+ * supplementary code point value of the surrogate pair is
+ * returned. If the char
value at index -
+ * 1
is an unpaired low-surrogate or a high-surrogate, the
+ * surrogate value is returned.
+ *
+ * @param index the index following the code point that should be returned
+ * @return the Unicode code point value before the given index.
+ * @exception IndexOutOfBoundsException if the index
+ * argument is less than 1 or greater than the length
+ * of this sequence.
+ */
+ public int codePointBefore(int index) {
+ int i = index - 1;
+ if ((i < 0) || (i >= count)) {
+ throw new StringIndexOutOfBoundsException(index);
+ }
+ return Character.codePointBefore(value, index);
+ }
+
+ /**
+ * Returns the number of Unicode code points in the specified text
+ * range of this sequence. The text range begins at the specified
+ * beginIndex
and extends to the char
at
+ * index endIndex - 1
. Thus the length (in
+ * char
s) of the text range is
+ * endIndex-beginIndex
. Unpaired surrogates within
+ * this sequence count as one code point each.
+ *
+ * @param beginIndex the index to the first char
of
+ * the text range.
+ * @param endIndex the index after the last char
of
+ * the text range.
+ * @return the number of Unicode code points in the specified text
+ * range
+ * @exception IndexOutOfBoundsException if the
+ * beginIndex
is negative, or endIndex
+ * is larger than the length of this sequence, or
+ * beginIndex
is larger than endIndex
.
+ */
+ public int codePointCount(int beginIndex, int endIndex) {
+ if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) {
+ throw new IndexOutOfBoundsException();
+ }
+ return Character.codePointCountImpl(value, beginIndex, endIndex-beginIndex);
+ }
+
+ /**
+ * Returns the index within this sequence that is offset from the
+ * given index
by codePointOffset
code
+ * points. Unpaired surrogates within the text range given by
+ * index
and codePointOffset
count as
+ * one code point each.
+ *
+ * @param index the index to be offset
+ * @param codePointOffset the offset in code points
+ * @return the index within this sequence
+ * @exception IndexOutOfBoundsException if index
+ * is negative or larger then the length of this sequence,
+ * or if codePointOffset
is positive and the subsequence
+ * starting with index
has fewer than
+ * codePointOffset
code points,
+ * or if codePointOffset
is negative and the subsequence
+ * before index
has fewer than the absolute value of
+ * codePointOffset
code points.
+ */
+ public int offsetByCodePoints(int index, int codePointOffset) {
+ if (index < 0 || index > count) {
+ throw new IndexOutOfBoundsException();
+ }
+ return Character.offsetByCodePointsImpl(value, 0, count,
+ index, codePointOffset);
+ }
+
+ /**
+ * Characters are copied from this sequence into the
+ * destination character array dst
. The first character to
+ * be copied is at index srcBegin
; the last character to
+ * be copied is at index srcEnd-1
. The total number of
+ * characters to be copied is srcEnd-srcBegin
. The
+ * characters are copied into the subarray of dst
starting
+ * at index dstBegin
and ending at index:
+ *
+ *
+ * @param srcBegin start copying at this offset.
+ * @param srcEnd stop copying at this offset.
+ * @param dst the array to copy the data into.
+ * @param dstBegin offset into
+ * dstbegin + (srcEnd-srcBegin) - 1
+ *
dst
.
+ * @throws NullPointerException if dst
is
+ * null
.
+ * @throws IndexOutOfBoundsException if any of the following is true:
+ *
+ *
+ */
+ public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
+ {
+ if (srcBegin < 0)
+ throw new StringIndexOutOfBoundsException(srcBegin);
+ if ((srcEnd < 0) || (srcEnd > count))
+ throw new StringIndexOutOfBoundsException(srcEnd);
+ if (srcBegin > srcEnd)
+ throw new StringIndexOutOfBoundsException("srcBegin > srcEnd");
+ String.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
+ }
+
+ /**
+ * The character at the specified index is set to srcBegin
is negative
+ * dstBegin
is negative
+ * srcBegin
argument is greater than
+ * the srcEnd
argument.
+ * srcEnd
is greater than
+ * this.length()
.
+ * dstBegin+srcEnd-srcBegin
is greater than
+ * dst.length
+ * ch
. This
+ * sequence is altered to represent a new character sequence that is
+ * identical to the old character sequence, except that it contains the
+ * character ch
at position index
.
+ * 0
, and less than the length of this sequence.
+ *
+ * @param index the index of the character to modify.
+ * @param ch the new character.
+ * @throws IndexOutOfBoundsException if index
is
+ * negative or greater than or equal to length()
.
+ */
+ public void setCharAt(int index, char ch) {
+ if ((index < 0) || (index >= count))
+ throw new StringIndexOutOfBoundsException(index);
+ value[index] = ch;
+ }
+
+ /**
+ * Appends the string representation of the {@code Object} argument.
+ * char
at the specified position in this
+ * sequence. This sequence is shortened by one char
.
+ *
+ * char
s to remove by calling
+ * Character.charCount(thisSequence.codePointAt(index))
,
+ * where thisSequence
is this sequence.
+ *
+ * @param index Index of char
to remove
+ * @return This object.
+ * @throws StringIndexOutOfBoundsException if the index
+ * is negative or greater than or equal to
+ * length()
.
+ */
+ public AbstractStringBuilder deleteCharAt(int index) {
+ if ((index < 0) || (index >= count))
+ throw new StringIndexOutOfBoundsException(index);
+ String.arraycopy(value, index+1, value, index, count-index-1);
+ count--;
+ return this;
+ }
+
+ /**
+ * Replaces the characters in a substring of this sequence
+ * with characters in the specified String
. The substring
+ * begins at the specified start
and extends to the character
+ * at index end - 1
or to the end of the
+ * sequence if no such character exists. First the
+ * characters in the substring are removed and then the specified
+ * String
is inserted at start
. (This
+ * sequence will be lengthened to accommodate the
+ * specified String if necessary.)
+ *
+ * @param start The beginning index, inclusive.
+ * @param end The ending index, exclusive.
+ * @param str String that will replace previous contents.
+ * @return This object.
+ * @throws StringIndexOutOfBoundsException if start
+ * is negative, greater than length()
, or
+ * greater than end
.
+ */
+ public AbstractStringBuilder replace(int start, int end, String str) {
+ if (start < 0)
+ throw new StringIndexOutOfBoundsException(start);
+ if (start > count)
+ throw new StringIndexOutOfBoundsException("start > length()");
+ if (start > end)
+ throw new StringIndexOutOfBoundsException("start > end");
+
+ if (end > count)
+ end = count;
+ int len = str.length();
+ int newCount = count + len - (end - start);
+ ensureCapacityInternal(newCount);
+
+ String.arraycopy(value, end, value, start + len, count - end);
+ str.getChars(value, start);
+ count = newCount;
+ return this;
+ }
+
+ /**
+ * Returns a new String
that contains a subsequence of
+ * characters currently contained in this character sequence. The
+ * substring begins at the specified index and extends to the end of
+ * this sequence.
+ *
+ * @param start The beginning index, inclusive.
+ * @return The new string.
+ * @throws StringIndexOutOfBoundsException if start
is
+ * less than zero, or greater than the length of this object.
+ */
+ public String substring(int start) {
+ return substring(start, count);
+ }
+
+ /**
+ * Returns a new character sequence that is a subsequence of this sequence.
+ *
+ *
+ *
+ * behaves in exactly the same way as the invocation
+ *
+ *
+ * sb.subSequence(begin, end)
+ *
+ * This method is provided so that this class can
+ * implement the {@link CharSequence} interface.
+ * sb.substring(begin, end)
String
that contains a subsequence of
+ * characters currently contained in this sequence. The
+ * substring begins at the specified start
and
+ * extends to the character at index end - 1
.
+ *
+ * @param start The beginning index, inclusive.
+ * @param end The ending index, exclusive.
+ * @return The new string.
+ * @throws StringIndexOutOfBoundsException if start
+ * or end
are negative or greater than
+ * length()
, or start
is
+ * greater than end
.
+ */
+ public String substring(int start, int end) {
+ if (start < 0)
+ throw new StringIndexOutOfBoundsException(start);
+ if (end > count)
+ throw new StringIndexOutOfBoundsException(end);
+ if (start > end)
+ throw new StringIndexOutOfBoundsException(end - start);
+ return new String(value, start, end - start);
+ }
+
+ /**
+ * Inserts the string representation of a subarray of the {@code str}
+ * array argument into this sequence. The subarray begins at the
+ * specified {@code offset} and extends {@code len} {@code char}s.
+ * The characters of the subarray are inserted into this sequence at
+ * the position indicated by {@code index}. The length of this
+ * sequence increases by {@code len} {@code char}s.
+ *
+ * @param index position at which to insert subarray.
+ * @param str A {@code char} array.
+ * @param offset the index of the first {@code char} in subarray to
+ * be inserted.
+ * @param len the number of {@code char}s in the subarray to
+ * be inserted.
+ * @return This object
+ * @throws StringIndexOutOfBoundsException if {@code index}
+ * is negative or greater than {@code length()}, or
+ * {@code offset} or {@code len} are negative, or
+ * {@code (offset+len)} is greater than
+ * {@code str.length}.
+ */
+ public AbstractStringBuilder insert(int index, char[] str, int offset,
+ int len)
+ {
+ if ((index < 0) || (index > length()))
+ throw new StringIndexOutOfBoundsException(index);
+ if ((offset < 0) || (len < 0) || (offset > str.length - len))
+ throw new StringIndexOutOfBoundsException(
+ "offset " + offset + ", len " + len + ", str.length "
+ + str.length);
+ ensureCapacityInternal(count + len);
+ String.arraycopy(value, index, value, index + len, count - index);
+ String.arraycopy(str, offset, value, index, len);
+ count += len;
+ return this;
+ }
+
+ /**
+ * Inserts the string representation of the {@code Object}
+ * argument into this character sequence.
+ * + * The overall effect is exactly as if the second argument were + * converted to a string by the method {@link String#valueOf(Object)}, + * and the characters of that string were then + * {@link #insert(int,String) inserted} into this character + * sequence at the indicated offset. + *
+ * The {@code offset} argument must be greater than or equal to + * {@code 0}, and less than or equal to the {@linkplain #length() length} + * of this sequence. + * + * @param offset the offset. + * @param obj an {@code Object}. + * @return a reference to this object. + * @throws StringIndexOutOfBoundsException if the offset is invalid. + */ + public AbstractStringBuilder insert(int offset, Object obj) { + return insert(offset, String.valueOf(obj)); + } + + /** + * Inserts the string into this character sequence. + *
+ * The characters of the {@code String} argument are inserted, in + * order, into this sequence at the indicated offset, moving up any + * characters originally above that position and increasing the length + * of this sequence by the length of the argument. If + * {@code str} is {@code null}, then the four characters + * {@code "null"} are inserted into this sequence. + *
+ * The character at index k in the new character sequence is + * equal to: + *
+ * The {@code offset} argument must be greater than or equal to + * {@code 0}, and less than or equal to the {@linkplain #length() length} + * of this sequence. + * + * @param offset the offset. + * @param str a string. + * @return a reference to this object. + * @throws StringIndexOutOfBoundsException if the offset is invalid. + */ + public AbstractStringBuilder insert(int offset, String str) { + if ((offset < 0) || (offset > length())) + throw new StringIndexOutOfBoundsException(offset); + if (str == null) + str = "null"; + int len = str.length(); + ensureCapacityInternal(count + len); + String.arraycopy(value, offset, value, offset + len, count - offset); + str.getChars(value, offset); + count += len; + return this; + } + + /** + * Inserts the string representation of the {@code char} array + * argument into this sequence. + *
+ * The characters of the array argument are inserted into the + * contents of this sequence at the position indicated by + * {@code offset}. The length of this sequence increases by + * the length of the argument. + *
+ * The overall effect is exactly as if the second argument were + * converted to a string by the method {@link String#valueOf(char[])}, + * and the characters of that string were then + * {@link #insert(int,String) inserted} into this character + * sequence at the indicated offset. + *
+ * The {@code offset} argument must be greater than or equal to + * {@code 0}, and less than or equal to the {@linkplain #length() length} + * of this sequence. + * + * @param offset the offset. + * @param str a character array. + * @return a reference to this object. + * @throws StringIndexOutOfBoundsException if the offset is invalid. + */ + public AbstractStringBuilder insert(int offset, char[] str) { + if ((offset < 0) || (offset > length())) + throw new StringIndexOutOfBoundsException(offset); + int len = str.length; + ensureCapacityInternal(count + len); + String.arraycopy(value, offset, value, offset + len, count - offset); + String.arraycopy(str, 0, value, offset, len); + count += len; + return this; + } + + /** + * Inserts the specified {@code CharSequence} into this sequence. + *
+ * The characters of the {@code CharSequence} argument are inserted, + * in order, into this sequence at the indicated offset, moving up + * any characters originally above that position and increasing the length + * of this sequence by the length of the argument s. + *
+ * The result of this method is exactly the same as if it were an + * invocation of this object's + * {@link #insert(int,CharSequence,int,int) insert}(dstOffset, s, 0, s.length()) + * method. + * + *
If {@code s} is {@code null}, then the four characters + * {@code "null"} are inserted into this sequence. + * + * @param dstOffset the offset. + * @param s the sequence to be inserted + * @return a reference to this object. + * @throws IndexOutOfBoundsException if the offset is invalid. + */ + public AbstractStringBuilder insert(int dstOffset, CharSequence s) { + if (s == null) + s = "null"; + if (s instanceof String) + return this.insert(dstOffset, (String)s); + return this.insert(dstOffset, s, 0, s.length()); + } + + /** + * Inserts a subsequence of the specified {@code CharSequence} into + * this sequence. + *
+ * The subsequence of the argument {@code s} specified by + * {@code start} and {@code end} are inserted, + * in order, into this sequence at the specified destination offset, moving + * up any characters originally above that position. The length of this + * sequence is increased by {@code end - start}. + *
+ * The character at index k in this sequence becomes equal to: + *
+ * The {@code dstOffset} argument must be greater than or equal to + * {@code 0}, and less than or equal to the {@linkplain #length() length} + * of this sequence. + *
The start argument must be nonnegative, and not greater than + * {@code end}. + *
The end argument must be greater than or equal to + * {@code start}, and less than or equal to the length of s. + * + *
If {@code s} is {@code null}, then this method inserts
+ * characters as if the s parameter was a sequence containing the four
+ * characters {@code "null"}.
+ *
+ * @param dstOffset the offset in this sequence.
+ * @param s the sequence to be inserted.
+ * @param start the starting index of the subsequence to be inserted.
+ * @param end the end index of the subsequence to be inserted.
+ * @return a reference to this object.
+ * @throws IndexOutOfBoundsException if {@code dstOffset}
+ * is negative or greater than {@code this.length()}, or
+ * {@code start} or {@code end} are negative, or
+ * {@code start} is greater than {@code end} or
+ * {@code end} is greater than {@code s.length()}
+ */
+ public AbstractStringBuilder insert(int dstOffset, CharSequence s,
+ int start, int end) {
+ if (s == null)
+ s = "null";
+ if ((dstOffset < 0) || (dstOffset > this.length()))
+ throw new IndexOutOfBoundsException("dstOffset "+dstOffset);
+ if ((start < 0) || (end < 0) || (start > end) || (end > s.length()))
+ throw new IndexOutOfBoundsException(
+ "start " + start + ", end " + end + ", s.length() "
+ + s.length());
+ int len = end - start;
+ ensureCapacityInternal(count + len);
+ String.arraycopy(value, dstOffset, value, dstOffset + len,
+ count - dstOffset);
+ for (int i=start; i
+ * The {@code offset} argument must be greater than or equal to
+ * {@code 0}, and less than or equal to the {@linkplain #length() length}
+ * of this sequence.
+ *
+ * @param offset the offset.
+ * @param b a {@code boolean}.
+ * @return a reference to this object.
+ * @throws StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ public AbstractStringBuilder insert(int offset, boolean b) {
+ return insert(offset, String.valueOf(b));
+ }
+
+ /**
+ * Inserts the string representation of the {@code char}
+ * argument into this sequence.
+ *
+ * The overall effect is exactly as if the second argument were
+ * converted to a string by the method {@link String#valueOf(char)},
+ * and the character in that string were then
+ * {@link #insert(int,String) inserted} into this character
+ * sequence at the indicated offset.
+ *
+ * The {@code offset} argument must be greater than or equal to
+ * {@code 0}, and less than or equal to the {@linkplain #length() length}
+ * of this sequence.
+ *
+ * @param offset the offset.
+ * @param c a {@code char}.
+ * @return a reference to this object.
+ * @throws IndexOutOfBoundsException if the offset is invalid.
+ */
+ public AbstractStringBuilder insert(int offset, char c) {
+ ensureCapacityInternal(count + 1);
+ String.arraycopy(value, offset, value, offset + 1, count - offset);
+ value[offset] = c;
+ count += 1;
+ return this;
+ }
+
+ /**
+ * Inserts the string representation of the second {@code int}
+ * argument into this sequence.
+ *
+ * The overall effect is exactly as if the second argument were
+ * converted to a string by the method {@link String#valueOf(int)},
+ * and the characters of that string were then
+ * {@link #insert(int,String) inserted} into this character
+ * sequence at the indicated offset.
+ *
+ * The {@code offset} argument must be greater than or equal to
+ * {@code 0}, and less than or equal to the {@linkplain #length() length}
+ * of this sequence.
+ *
+ * @param offset the offset.
+ * @param i an {@code int}.
+ * @return a reference to this object.
+ * @throws StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ public AbstractStringBuilder insert(int offset, int i) {
+ return insert(offset, String.valueOf(i));
+ }
+
+ /**
+ * Inserts the string representation of the {@code long}
+ * argument into this sequence.
+ *
+ * The overall effect is exactly as if the second argument were
+ * converted to a string by the method {@link String#valueOf(long)},
+ * and the characters of that string were then
+ * {@link #insert(int,String) inserted} into this character
+ * sequence at the indicated offset.
+ *
+ * The {@code offset} argument must be greater than or equal to
+ * {@code 0}, and less than or equal to the {@linkplain #length() length}
+ * of this sequence.
+ *
+ * @param offset the offset.
+ * @param l a {@code long}.
+ * @return a reference to this object.
+ * @throws StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ public AbstractStringBuilder insert(int offset, long l) {
+ return insert(offset, String.valueOf(l));
+ }
+
+ /**
+ * Inserts the string representation of the {@code float}
+ * argument into this sequence.
+ *
+ * The overall effect is exactly as if the second argument were
+ * converted to a string by the method {@link String#valueOf(float)},
+ * and the characters of that string were then
+ * {@link #insert(int,String) inserted} into this character
+ * sequence at the indicated offset.
+ *
+ * The {@code offset} argument must be greater than or equal to
+ * {@code 0}, and less than or equal to the {@linkplain #length() length}
+ * of this sequence.
+ *
+ * @param offset the offset.
+ * @param f a {@code float}.
+ * @return a reference to this object.
+ * @throws StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ public AbstractStringBuilder insert(int offset, float f) {
+ return insert(offset, String.valueOf(f));
+ }
+
+ /**
+ * Inserts the string representation of the {@code double}
+ * argument into this sequence.
+ *
+ * The overall effect is exactly as if the second argument were
+ * converted to a string by the method {@link String#valueOf(double)},
+ * and the characters of that string were then
+ * {@link #insert(int,String) inserted} into this character
+ * sequence at the indicated offset.
+ *
+ * The {@code offset} argument must be greater than or equal to
+ * {@code 0}, and less than or equal to the {@linkplain #length() length}
+ * of this sequence.
+ *
+ * @param offset the offset.
+ * @param d a {@code double}.
+ * @return a reference to this object.
+ * @throws StringIndexOutOfBoundsException if the offset is invalid.
+ */
+ public AbstractStringBuilder insert(int offset, double d) {
+ return insert(offset, String.valueOf(d));
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of the
+ * specified substring. The integer returned is the smallest value
+ * k such that:
+ * Note that the reverse operation may result in producing
+ * surrogate pairs that were unpaired low-surrogates and
+ * high-surrogates before the operation. For example, reversing
+ * "\uDC00\uD800" produces "\uD800\uDC00" which is
+ * a valid surrogate pair.
+ *
+ * @return a reference to this object.
+ */
+ public AbstractStringBuilder reverse() {
+ boolean hasSurrogate = false;
+ int n = count - 1;
+ for (int j = (n-1) >> 1; j >= 0; --j) {
+ char temp = value[j];
+ char temp2 = value[n - j];
+ if (!hasSurrogate) {
+ hasSurrogate = (temp >= Character.MIN_SURROGATE && temp <= Character.MAX_SURROGATE)
+ || (temp2 >= Character.MIN_SURROGATE && temp2 <= Character.MAX_SURROGATE);
+ }
+ value[j] = temp2;
+ value[n - j] = temp;
+ }
+ if (hasSurrogate) {
+ // Reverse back all valid surrogate pairs
+ for (int i = 0; i < count - 1; i++) {
+ char c2 = value[i];
+ if (Character.isLowSurrogate(c2)) {
+ char c1 = value[i + 1];
+ if (Character.isHighSurrogate(c1)) {
+ value[i++] = c1;
+ value[i] = c2;
+ }
+ }
+ }
+ }
+ return this;
+ }
+
+ /**
+ * Returns a string representing the data in this sequence.
+ * A new The characters to be appended should be valid Unicode characters as
+ * described in Unicode Character
+ * Representation. Note that supplementary characters may be composed of
+ * multiple 16-bit char values.
+ *
+ * Appendables are not necessarily safe for multithreaded access. Thread
+ * safety is the responsibility of classes that extend and implement this
+ * interface.
+ *
+ * Since this interface may be implemented by existing classes
+ * with different styles of error handling there is no guarantee that
+ * errors will be propagated to the invoker.
+ *
+ * @since 1.5
+ */
+public interface Appendable {
+
+ /**
+ * Appends the specified character sequence to this Appendable.
+ *
+ * Depending on which class implements the character sequence
+ * csq, the entire sequence may not be appended. For
+ * instance, if csq is a {@link java.nio.CharBuffer} then
+ * the subsequence to append is defined by the buffer's position and limit.
+ *
+ * @param csq
+ * The character sequence to append. If csq is
+ * null, then the four characters "null" are
+ * appended to this Appendable.
+ *
+ * @return A reference to this Appendable
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ Appendable append(CharSequence csq) throws IOException;
+
+ /**
+ * Appends a subsequence of the specified character sequence to this
+ * Appendable.
+ *
+ * An invocation of this method of the form out.append(csq, start,
+ * end) when csq is not null, behaves in
+ * exactly the same way as the invocation
+ *
+ * The seven one-argument public constructors provided by this
+ * class ensure that the assertion error returned by the invocation:
+ *
+ * If the specified object is an instance of {@code Throwable}, it
+ * becomes the cause of the newly constructed assertion error.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ * @see Throwable#getCause()
+ */
+ public AssertionError(Object detailMessage) {
+ this("" + detailMessage);
+ if (detailMessage instanceof Throwable)
+ initCause((Throwable) detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this error's detail message.
+ *
+ * @param message the detail message, may be {@code null}
+ * @param cause the cause, may be {@code null}
+ *
+ * @since 1.7
+ */
+ public AssertionError(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Boolean.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Boolean.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The Boolean class wraps a value of the primitive type
+ * {@code boolean} in an object. An object of type
+ * {@code Boolean} contains a single field whose type is
+ * {@code boolean}.
+ *
+ * In addition, this class provides many methods for
+ * converting a {@code boolean} to a {@code String} and a
+ * {@code String} to a {@code boolean}, as well as other
+ * constants and methods useful when dealing with a
+ * {@code boolean}.
+ *
+ * @author Arthur van Hoff
+ * @since JDK1.0
+ */
+public final class Boolean implements java.io.Serializable,
+ Comparable Note: It is rarely appropriate to use this constructor.
+ * Unless a new instance is required, the static factory
+ * {@link #valueOf(boolean)} is generally a better choice. It is
+ * likely to yield significantly better space and time performance.
+ *
+ * @param value the value of the {@code Boolean}.
+ */
+ public Boolean(boolean value) {
+ this.value = value;
+ }
+
+ /**
+ * Allocates a {@code Boolean} object representing the value
+ * {@code true} if the string argument is not {@code null}
+ * and is equal, ignoring case, to the string {@code "true"}.
+ * Otherwise, allocate a {@code Boolean} object representing the
+ * value {@code false}. Examples:
+ * {@code new Boolean("True")} produces a {@code Boolean} object
+ * that represents {@code true}.
+ * Example: {@code Boolean.parseBoolean("True")} returns {@code true}.
+ * If there is no property with the specified name, or if the specified
+ * name is empty or null, then {@code false} is returned.
+ *
+ * @param name the system property name.
+ * @return the {@code boolean} value of the system property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ */
+ public static boolean getBoolean(String name) {
+ boolean result = false;
+ try {
+ result = toBoolean(String.getProperty(name));
+ } catch (IllegalArgumentException e) {
+ } catch (NullPointerException e) {
+ }
+ return result;
+ }
+
+ /**
+ * Compares this {@code Boolean} instance with another.
+ *
+ * @param b the {@code Boolean} instance to be compared
+ * @return zero if this object represents the same boolean value as the
+ * argument; a positive value if this object represents true
+ * and the argument represents false; and a negative value if
+ * this object represents false and the argument represents true
+ * @throws NullPointerException if the argument is {@code null}
+ * @see Comparable
+ * @since 1.5
+ */
+ public int compareTo(Boolean b) {
+ return compare(this.value, b.value);
+ }
+
+ /**
+ * Compares two {@code boolean} values.
+ * The value returned is identical to what would be returned by:
+ * In addition, this class provides several methods for converting
+ * a {@code byte} to a {@code String} and a {@code String} to a {@code
+ * byte}, as well as other constants and methods useful when dealing
+ * with a {@code byte}.
+ *
+ * @author Nakul Saraiya
+ * @author Joseph D. Darcy
+ * @see java.lang.Number
+ * @since JDK1.1
+ */
+public final class Byte extends Number implements Comparable An exception of type {@code NumberFormatException} is
+ * thrown if any of the following situations occurs:
+ * In other words, this method returns a {@code Byte} object
+ * equal to the value of:
+ *
+ * In other words, this method returns a {@code Byte} object
+ * equal to the value of:
+ *
+ *
+ * The sequence of characters following an optional
+ * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
+ * "{@code #}", or leading zero) is parsed as by the {@code
+ * Byte.parseByte} method with the indicated radix (10, 16, or 8).
+ * This sequence of characters must represent a positive value or
+ * a {@link NumberFormatException} will be thrown. The result is
+ * negated if first character of the specified {@code String} is
+ * the minus sign. No whitespace characters are permitted in the
+ * {@code String}.
+ *
+ * @param nm the {@code String} to decode.
+ * @return a {@code Byte} object holding the {@code byte}
+ * value represented by {@code nm}
+ * @throws NumberFormatException if the {@code String} does not
+ * contain a parsable {@code byte}.
+ * @see java.lang.Byte#parseByte(java.lang.String, int)
+ */
+ public static Byte decode(String nm) throws NumberFormatException {
+ int i = Integer.decode(nm);
+ if (i < MIN_VALUE || i > MAX_VALUE)
+ throw new NumberFormatException(
+ "Value " + i + " out of range from input " + nm);
+ return valueOf((byte)i);
+ }
+
+ /**
+ * The value of the {@code Byte}.
+ *
+ * @serial
+ */
+ private final byte value;
+
+ /**
+ * Constructs a newly allocated {@code Byte} object that
+ * represents the specified {@code byte} value.
+ *
+ * @param value the value to be represented by the
+ * {@code Byte}.
+ */
+ public Byte(byte value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Byte} object that
+ * represents the {@code byte} value indicated by the
+ * {@code String} parameter. The string is converted to a
+ * {@code byte} value in exactly the manner used by the
+ * {@code parseByte} method for radix 10.
+ *
+ * @param s the {@code String} to be converted to a
+ * {@code Byte}
+ * @throws NumberFormatException If the {@code String}
+ * does not contain a parsable {@code byte}.
+ * @see java.lang.Byte#parseByte(java.lang.String, int)
+ */
+ public Byte(String s) throws NumberFormatException {
+ this.value = parseByte(s, 10);
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code byte}.
+ */
+ public byte byteValue() {
+ return value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code short}.
+ */
+ public short shortValue() {
+ return (short)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as an
+ * {@code int}.
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code long}.
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code float}.
+ */
+ public float floatValue() {
+ return (float)value;
+ }
+
+ /**
+ * Returns the value of this {@code Byte} as a
+ * {@code double}.
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a {@code String} object representing this
+ * {@code Byte}'s value. The value is converted to signed
+ * decimal representation and returned as a string, exactly as if
+ * the {@code byte} value were given as an argument to the
+ * {@link java.lang.Byte#toString(byte)} method.
+ *
+ * @return a string representation of the value of this object in
+ * base 10.
+ */
+ public String toString() {
+ return Integer.toString((int)value);
+ }
+
+ /**
+ * Returns a hash code for this {@code Byte}; equal to the result
+ * of invoking {@code intValue()}.
+ *
+ * @return a hash code value for this {@code Byte}
+ */
+ public int hashCode() {
+ return (int)value;
+ }
+
+ /**
+ * Compares this object to the specified object. The result is
+ * {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Byte} object that
+ * contains the same {@code byte} value as this object.
+ *
+ * @param obj the object to compare with
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Byte) {
+ return value == ((Byte)obj).byteValue();
+ }
+ return false;
+ }
+
+ /**
+ * Compares two {@code Byte} objects numerically.
+ *
+ * @param anotherByte the {@code Byte} to be compared.
+ * @return the value {@code 0} if this {@code Byte} is
+ * equal to the argument {@code Byte}; a value less than
+ * {@code 0} if this {@code Byte} is numerically less
+ * than the argument {@code Byte}; and a value greater than
+ * {@code 0} if this {@code Byte} is numerically
+ * greater than the argument {@code Byte} (signed
+ * comparison).
+ * @since 1.2
+ */
+ public int compareTo(Byte anotherByte) {
+ return compare(this.value, anotherByte.value);
+ }
+
+ /**
+ * Compares two {@code byte} values numerically.
+ * The value returned is identical to what would be returned by:
+ * This interface does not refine the general contracts of the {@link
+ * java.lang.Object#equals(java.lang.Object) equals} and {@link
+ * java.lang.Object#hashCode() hashCode} methods. The result of comparing two
+ * objects that implement CharSequence is therefore, in general,
+ * undefined. Each object may be implemented by a different class, and there
+ * is no guarantee that each class will be capable of testing its instances
+ * for equality with those of the other. It is therefore inappropriate to use
+ * arbitrary CharSequence instances as elements in a set or as keys in
+ * a map. If the
+ * is
+ * this.toString().startsWith(str, k)
+ *
true
.
+ *
+ * @param str any string.
+ * @return if the string argument occurs as a substring within this
+ * object, then the index of the first character of the first
+ * such substring is returned; if it does not occur as a
+ * substring, -1
is returned.
+ * @throws java.lang.NullPointerException if str
is
+ * null
.
+ */
+ public int indexOf(String str) {
+ return indexOf(str, 0);
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of the
+ * specified substring, starting at the specified index. The integer
+ * returned is the smallest value k for which:
+ *
+ * If no such value of k exists, then -1 is returned.
+ *
+ * @param str the substring for which to search.
+ * @param fromIndex the index from which to start the search.
+ * @return the index within this string of the first occurrence of the
+ * specified substring, starting at the specified index.
+ * @throws java.lang.NullPointerException if
+ * k >= Math.min(fromIndex, str.length()) &&
+ * this.toString().startsWith(str, k)
+ *
str
is
+ * null
.
+ */
+ public int indexOf(String str, int fromIndex) {
+ return String.indexOf(value, 0, count,
+ str.toCharArray(), 0, str.length(), fromIndex);
+ }
+
+ /**
+ * Returns the index within this string of the rightmost occurrence
+ * of the specified substring. The rightmost empty string "" is
+ * considered to occur at the index value this.length()
.
+ * The returned index is the largest value k such that
+ *
+ * is true.
+ *
+ * @param str the substring to search for.
+ * @return if the string argument occurs one or more times as a substring
+ * within this object, then the index of the first character of
+ * the last such substring is returned. If it does not occur as
+ * a substring,
+ * this.toString().startsWith(str, k)
+ *
-1
is returned.
+ * @throws java.lang.NullPointerException if str
is
+ * null
.
+ */
+ public int lastIndexOf(String str) {
+ return lastIndexOf(str, count);
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of the
+ * specified substring. The integer returned is the largest value k
+ * such that:
+ *
+ * If no such value of k exists, then -1 is returned.
+ *
+ * @param str the substring to search for.
+ * @param fromIndex the index to start the search from.
+ * @return the index within this sequence of the last occurrence of the
+ * specified substring.
+ * @throws java.lang.NullPointerException if
+ * k <= Math.min(fromIndex, str.length()) &&
+ * this.toString().startsWith(str, k)
+ *
str
is
+ * null
.
+ */
+ public int lastIndexOf(String str, int fromIndex) {
+ return String.lastIndexOf(value, 0, count,
+ str.toCharArray(), 0, str.length(), fromIndex);
+ }
+
+ /**
+ * Causes this character sequence to be replaced by the reverse of
+ * the sequence. If there are any surrogate pairs included in the
+ * sequence, these are treated as single characters for the
+ * reverse operation. Thus, the order of the high-low surrogates
+ * is never reversed.
+ *
+ * Let n be the character length of this character sequence
+ * (not the length in char
values) just prior to
+ * execution of the reverse
method. Then the
+ * character at index k in the new character sequence is
+ * equal to the character at index n-k-1 in the old
+ * character sequence.
+ *
+ * String
object is allocated and initialized to
+ * contain the character sequence currently represented by this
+ * object. This String
is then returned. Subsequent
+ * changes to this sequence do not affect the contents of the
+ * String
.
+ *
+ * @return a string representation of this sequence of characters.
+ */
+ public abstract String toString();
+
+ /**
+ * Needed by String for the contentEquals method.
+ */
+ final char[] getValue() {
+ return value;
+ }
+
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Appendable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Appendable.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.io.IOException;
+
+/**
+ * An object to which char sequences and values can be appended. The
+ * Appendable interface must be implemented by any class whose
+ * instances are intended to receive formatted output from a {@link
+ * java.util.Formatter}.
+ *
+ *
+ * out.append(csq.subSequence(start, end))
+ *
+ * @param csq
+ * The character sequence from which a subsequence will be
+ * appended. If csq is null, then characters
+ * will be appended as if csq contained the four
+ * characters "null".
+ *
+ * @param start
+ * The index of the first character in the subsequence
+ *
+ * @param end
+ * The index of the character following the last character in the
+ * subsequence
+ *
+ * @return A reference to this Appendable
+ *
+ * @throws IndexOutOfBoundsException
+ * If start or end are negative, start
+ * is greater than end, or end is greater than
+ * csq.length()
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ Appendable append(CharSequence csq, int start, int end) throws IOException;
+
+ /**
+ * Appends the specified character to this Appendable.
+ *
+ * @param c
+ * The character to append
+ *
+ * @return A reference to this Appendable
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ Appendable append(char c) throws IOException;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/ArrayIndexOutOfBoundsException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/ArrayIndexOutOfBoundsException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that an array has been accessed with an
+ * illegal index. The index is either negative or greater than or
+ * equal to the size of the array.
+ *
+ * @author unascribed
+ * @since JDK1.0
+ */
+public
+class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
+ private static final long serialVersionUID = -5116101128118950844L;
+
+ /**
+ * Constructs an ArrayIndexOutOfBoundsException
with no
+ * detail message.
+ */
+ public ArrayIndexOutOfBoundsException() {
+ super();
+ }
+
+ /**
+ * Constructs a new ArrayIndexOutOfBoundsException
+ * class with an argument indicating the illegal index.
+ *
+ * @param index the illegal index.
+ */
+ public ArrayIndexOutOfBoundsException(int index) {
+ super("Array index out of range: " + index);
+ }
+
+ /**
+ * Constructs an ArrayIndexOutOfBoundsException
class
+ * with the specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public ArrayIndexOutOfBoundsException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/AssertionError.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/AssertionError.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that an assertion has failed.
+ *
+ *
+ * new AssertionError(expression)
+ *
+ * has as its detail message the string conversion of
+ * expression (as defined in section 15.18.1.1 of
+ * The Java™ Language Specification),
+ * regardless of the type of expression.
+ *
+ * @since 1.4
+ */
+public class AssertionError extends Error {
+ private static final long serialVersionUID = -5013299493970297370L;
+
+ /**
+ * Constructs an AssertionError with no detail message.
+ */
+ public AssertionError() {
+ }
+
+ /**
+ * This internal constructor does no processing on its string argument,
+ * even if it is a null reference. The public constructors will
+ * never call this constructor with a null argument.
+ */
+ private AssertionError(String detailMessage) {
+ super(detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified object, which is converted to a string as
+ * defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *boolean
, which is converted to
+ * a string as defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public AssertionError(boolean detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified char
, which is converted to a
+ * string as defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public AssertionError(char detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified int
, which is converted to a
+ * string as defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public AssertionError(int detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified long
, which is converted to a
+ * string as defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public AssertionError(long detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified float
, which is converted to a
+ * string as defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public AssertionError(float detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs an AssertionError with its detail message derived
+ * from the specified double
, which is converted to a
+ * string as defined in section 15.18.1.1 of
+ * The Java™ Language Specification.
+ *
+ * @param detailMessage value to be used in constructing detail message
+ */
+ public AssertionError(double detailMessage) {
+ this("" + detailMessage);
+ }
+
+ /**
+ * Constructs a new {@code AssertionError} with the specified
+ * detail message and cause.
+ *
+ *
+ * {@code new Boolean("yes")} produces a {@code Boolean} object
+ * that represents {@code false}.
+ *
+ * @param s the string to be converted to a {@code Boolean}.
+ */
+ public Boolean(String s) {
+ this(toBoolean(s));
+ }
+
+ /**
+ * Parses the string argument as a boolean. The {@code boolean}
+ * returned represents the value {@code true} if the string argument
+ * is not {@code null} and is equal, ignoring case, to the string
+ * {@code "true"}.
+ * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}.
+ *
+ * @param s the {@code String} containing the boolean
+ * representation to be parsed
+ * @return the boolean represented by the string argument
+ * @since 1.5
+ */
+ public static boolean parseBoolean(String s) {
+ return toBoolean(s);
+ }
+
+ /**
+ * Returns the value of this {@code Boolean} object as a boolean
+ * primitive.
+ *
+ * @return the primitive {@code boolean} value of this object.
+ */
+ public boolean booleanValue() {
+ return value;
+ }
+
+ /**
+ * Returns a {@code Boolean} instance representing the specified
+ * {@code boolean} value. If the specified {@code boolean} value
+ * is {@code true}, this method returns {@code Boolean.TRUE};
+ * if it is {@code false}, this method returns {@code Boolean.FALSE}.
+ * If a new {@code Boolean} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Boolean(boolean)}, as this method is likely to yield
+ * significantly better space and time performance.
+ *
+ * @param b a boolean value.
+ * @return a {@code Boolean} instance representing {@code b}.
+ * @since 1.4
+ */
+ public static Boolean valueOf(boolean b) {
+ return (b ? TRUE : FALSE);
+ }
+
+ /**
+ * Returns a {@code Boolean} with a value represented by the
+ * specified string. The {@code Boolean} returned represents a
+ * true value if the string argument is not {@code null}
+ * and is equal, ignoring case, to the string {@code "true"}.
+ *
+ * @param s a string.
+ * @return the {@code Boolean} value represented by the string.
+ */
+ public static Boolean valueOf(String s) {
+ return toBoolean(s) ? TRUE : FALSE;
+ }
+
+ /**
+ * Returns a {@code String} object representing the specified
+ * boolean. If the specified boolean is {@code true}, then
+ * the string {@code "true"} will be returned, otherwise the
+ * string {@code "false"} will be returned.
+ *
+ * @param b the boolean to be converted
+ * @return the string representation of the specified {@code boolean}
+ * @since 1.4
+ */
+ public static String toString(boolean b) {
+ return b ? "true" : "false";
+ }
+
+ /**
+ * Returns a {@code String} object representing this Boolean's
+ * value. If this object represents the value {@code true},
+ * a string equal to {@code "true"} is returned. Otherwise, a
+ * string equal to {@code "false"} is returned.
+ *
+ * @return a string representation of this object.
+ */
+ public String toString() {
+ return value ? "true" : "false";
+ }
+
+ /**
+ * Returns a hash code for this {@code Boolean} object.
+ *
+ * @return the integer {@code 1231} if this object represents
+ * {@code true}; returns the integer {@code 1237} if this
+ * object represents {@code false}.
+ */
+ public int hashCode() {
+ return value ? 1231 : 1237;
+ }
+
+ /**
+ * Returns {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Boolean} object that
+ * represents the same {@code boolean} value as this object.
+ *
+ * @param obj the object to compare with.
+ * @return {@code true} if the Boolean objects represent the
+ * same value; {@code false} otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Boolean) {
+ return value == ((Boolean)obj).booleanValue();
+ }
+ return false;
+ }
+
+ /**
+ * Returns {@code true} if and only if the system property
+ * named by the argument exists and is equal to the string
+ * {@code "true"}. (Beginning with version 1.0.2 of the
+ * JavaTM platform, the test of
+ * this string is case insensitive.) A system property is accessible
+ * through {@code getProperty}, a method defined by the
+ * {@code System} class.
+ *
+ * Boolean.valueOf(x).compareTo(Boolean.valueOf(y))
+ *
+ *
+ * @param x the first {@code boolean} to compare
+ * @param y the second {@code boolean} to compare
+ * @return the value {@code 0} if {@code x == y};
+ * a value less than {@code 0} if {@code !x && y}; and
+ * a value greater than {@code 0} if {@code x && !y}
+ * @since 1.7
+ */
+ public static int compare(boolean x, boolean y) {
+ return (x == y) ? 0 : (x ? 1 : -1);
+ }
+
+ private static boolean toBoolean(String name) {
+ return ((name != null) && name.equalsIgnoreCase("true"));
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Byte.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Byte.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,452 @@
+/*
+ * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ *
+ * The {@code Byte} class wraps a value of primitive type {@code byte}
+ * in an object. An object of type {@code Byte} contains a single
+ * field whose type is {@code byte}.
+ *
+ * '\u002D'
) to indicate a negative value or an
+ * ASCII plus sign {@code '+'} ('\u002B'
) to
+ * indicate a positive value. The resulting {@code byte} value is
+ * returned.
+ *
+ *
+ *
+ *
+ * @param s the {@code String} containing the
+ * {@code byte}
+ * representation to be parsed
+ * @param radix the radix to be used while parsing {@code s}
+ * @return the {@code byte} value represented by the string
+ * argument in the specified radix
+ * @throws NumberFormatException If the string does
+ * not contain a parsable {@code byte}.
+ */
+ public static byte parseByte(String s, int radix)
+ throws NumberFormatException {
+ int i = Integer.parseInt(s, radix);
+ if (i < MIN_VALUE || i > MAX_VALUE)
+ throw new NumberFormatException(
+ "Value out of range. Value:\"" + s + "\" Radix:" + radix);
+ return (byte)i;
+ }
+
+ /**
+ * Parses the string argument as a signed decimal {@code
+ * byte}. The characters in the string must all be decimal digits,
+ * except that the first character may be an ASCII minus sign
+ * {@code '-'} ('\u002D'
) or plus sign
+ * {@code '+'} ('\u002B'
) provided that the
+ * string is longer than length 1.
+ *
+ * '\u002D'
) to indicate a negative
+ * value or an ASCII plus sign {@code '+'}
+ * ('\u002B'
) to indicate a positive value. The
+ * resulting {@code byte} value is returned, exactly as if the
+ * argument and the radix 10 were given as arguments to the {@link
+ * #parseByte(java.lang.String, int)} method.
+ *
+ * @param s a {@code String} containing the
+ * {@code byte} representation to be parsed
+ * @return the {@code byte} value represented by the
+ * argument in decimal
+ * @throws NumberFormatException if the string does not
+ * contain a parsable {@code byte}.
+ */
+ public static byte parseByte(String s) throws NumberFormatException {
+ return parseByte(s, 10);
+ }
+
+ /**
+ * Returns a {@code Byte} object holding the value
+ * extracted from the specified {@code String} when parsed
+ * with the radix given by the second argument. The first argument
+ * is interpreted as representing a signed {@code byte} in
+ * the radix specified by the second argument, exactly as if the
+ * argument were given to the {@link #parseByte(java.lang.String,
+ * int)} method. The result is a {@code Byte} object that
+ * represents the {@code byte} value specified by the string.
+ *
+ *
+ * {@code new Byte(Byte.parseByte(s, radix))}
+ *
+ *
+ * @param s the string to be parsed
+ * @param radix the radix to be used in interpreting {@code s}
+ * @return a {@code Byte} object holding the value
+ * represented by the string argument in the
+ * specified radix.
+ * @throws NumberFormatException If the {@code String} does
+ * not contain a parsable {@code byte}.
+ */
+ public static Byte valueOf(String s, int radix)
+ throws NumberFormatException {
+ return valueOf(parseByte(s, radix));
+ }
+
+ /**
+ * Returns a {@code Byte} object holding the value
+ * given by the specified {@code String}. The argument is
+ * interpreted as representing a signed decimal {@code byte},
+ * exactly as if the argument were given to the {@link
+ * #parseByte(java.lang.String)} method. The result is a
+ * {@code Byte} object that represents the {@code byte}
+ * value specified by the string.
+ *
+ *
+ * {@code new Byte(Byte.parseByte(s))}
+ *
+ *
+ * @param s the string to be parsed
+ * @return a {@code Byte} object holding the value
+ * represented by the string argument
+ * @throws NumberFormatException If the {@code String} does
+ * not contain a parsable {@code byte}.
+ */
+ public static Byte valueOf(String s) throws NumberFormatException {
+ return valueOf(s, 10);
+ }
+
+ /**
+ * Decodes a {@code String} into a {@code Byte}.
+ * Accepts decimal, hexadecimal, and octal numbers given by
+ * the following grammar:
+ *
+ *
+ *
+ *
+ * DecimalNumeral, HexDigits, and OctalDigits
+ * are as defined in section 3.10.1 of
+ * The Java™ Language Specification,
+ * except that underscores are not accepted between digits.
+ *
+ *
+ *
+ *
+ * Byte.valueOf(x).compareTo(Byte.valueOf(y))
+ *
+ *
+ * @param x the first {@code byte} to compare
+ * @param y the second {@code byte} to compare
+ * @return the value {@code 0} if {@code x == y};
+ * a value less than {@code 0} if {@code x < y}; and
+ * a value greater than {@code 0} if {@code x > y}
+ * @since 1.7
+ */
+ public static int compare(byte x, byte y) {
+ return x - y;
+ }
+
+ /**
+ * The number of bits used to represent a {@code byte} value in two's
+ * complement binary form.
+ *
+ * @since 1.5
+ */
+ public static final int SIZE = 8;
+
+ /** use serialVersionUID from JDK 1.1. for interoperability */
+ private static final long serialVersionUID = -7183698231559129828L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/CharSequence.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/CharSequence.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+
+/**
+ * A CharSequence is a readable sequence of char
values. This
+ * interface provides uniform, read-only access to many different kinds of
+ * char
sequences.
+ * A char
value represents a character in the Basic
+ * Multilingual Plane (BMP) or a surrogate. Refer to Unicode Character Representation for details.
+ *
+ * char
s in the sequence.char
s in this sequence
+ */
+ int length();
+
+ /**
+ * Returns the char
value at the specified index. An index ranges from zero
+ * to length() - 1. The first char
value of the sequence is at
+ * index zero, the next at index one, and so on, as for array
+ * indexing. char
value specified by the index is a
+ * surrogate, the surrogate
+ * value is returned.
+ *
+ * @param index the index of the char
value to be returned
+ *
+ * @return the specified char
value
+ *
+ * @throws IndexOutOfBoundsException
+ * if the index argument is negative or not less than
+ * length()
+ */
+ char charAt(int index);
+
+ /**
+ * Returns a new CharSequence
that is a subsequence of this sequence.
+ * The subsequence starts with the char
value at the specified index and
+ * ends with the char
value at index end - 1. The length
+ * (in char
s) of the
+ * returned sequence is end - start, so if start == end
+ * then an empty sequence is returned.
+ * In addition, this class provides several methods for determining + * a character's category (lowercase letter, digit, etc.) and for converting + * characters from uppercase to lowercase and vice versa. + *
+ * Character information is based on the Unicode Standard, version 6.0.0. + *
+ * The methods and data of class {@code Character} are defined by + * the information in the UnicodeData file that is part of the + * Unicode Character Database maintained by the Unicode + * Consortium. This file specifies various properties including name + * and general category for every defined Unicode code point or + * character range. + *
+ * The file and its description are available from the Unicode Consortium at: + *
The {@code char} data type (and therefore the value that a + * {@code Character} object encapsulates) are based on the + * original Unicode specification, which defined characters as + * fixed-width 16-bit entities. The Unicode Standard has since been + * changed to allow for characters whose representation requires more + * than 16 bits. The range of legal code points is now + * U+0000 to U+10FFFF, known as Unicode scalar value. + * (Refer to the + * definition of the U+n notation in the Unicode + * Standard.) + * + *
The set of characters from U+0000 to U+FFFF is + * sometimes referred to as the Basic Multilingual Plane (BMP). + * Characters whose code points are greater + * than U+FFFF are called supplementary characters. The Java + * platform uses the UTF-16 representation in {@code char} arrays and + * in the {@code String} and {@code StringBuffer} classes. In + * this representation, supplementary characters are represented as a pair + * of {@code char} values, the first from the high-surrogates + * range, (\uD800-\uDBFF), the second from the + * low-surrogates range (\uDC00-\uDFFF). + * + *
A {@code char} value, therefore, represents Basic + * Multilingual Plane (BMP) code points, including the surrogate + * code points, or code units of the UTF-16 encoding. An + * {@code int} value represents all Unicode code points, + * including supplementary code points. The lower (least significant) + * 21 bits of {@code int} are used to represent Unicode code + * points and the upper (most significant) 11 bits must be zero. + * Unless otherwise specified, the behavior with respect to + * supplementary characters and surrogate {@code char} values is + * as follows: + * + *
In the Java SE API documentation, Unicode code point is
+ * used for character values in the range between U+0000 and U+10FFFF,
+ * and Unicode code unit is used for 16-bit
+ * {@code char} values that are code units of the UTF-16
+ * encoding. For more information on Unicode terminology, refer to the
+ * Unicode Glossary.
+ *
+ * @author Lee Boynton
+ * @author Guy Steele
+ * @author Akira Tanaka
+ * @author Martin Buchholz
+ * @author Ulf Zibis
+ * @since 1.0
+ */
+public final
+class Character implements java.io.Serializable, Comparable Such values do not represent characters by themselves,
+ * but are used in the representation of
+ * supplementary characters
+ * in the UTF-16 encoding.
+ *
+ * @param ch the {@code char} value to be tested.
+ * @return {@code true} if the {@code char} value is between
+ * {@link #MIN_HIGH_SURROGATE} and
+ * {@link #MAX_HIGH_SURROGATE} inclusive;
+ * {@code false} otherwise.
+ * @see Character#isLowSurrogate(char)
+ * @see Character.UnicodeBlock#of(int)
+ * @since 1.5
+ */
+ public static boolean isHighSurrogate(char ch) {
+ // Help VM constant-fold; MAX_HIGH_SURROGATE + 1 == MIN_LOW_SURROGATE
+ return ch >= MIN_HIGH_SURROGATE && ch < (MAX_HIGH_SURROGATE + 1);
+ }
+
+ /**
+ * Determines if the given {@code char} value is a
+ *
+ * Unicode low-surrogate code unit
+ * (also known as trailing-surrogate code unit).
+ *
+ * Such values do not represent characters by themselves,
+ * but are used in the representation of
+ * supplementary characters
+ * in the UTF-16 encoding.
+ *
+ * @param ch the {@code char} value to be tested.
+ * @return {@code true} if the {@code char} value is between
+ * {@link #MIN_LOW_SURROGATE} and
+ * {@link #MAX_LOW_SURROGATE} inclusive;
+ * {@code false} otherwise.
+ * @see Character#isHighSurrogate(char)
+ * @since 1.5
+ */
+ public static boolean isLowSurrogate(char ch) {
+ return ch >= MIN_LOW_SURROGATE && ch < (MAX_LOW_SURROGATE + 1);
+ }
+
+ /**
+ * Determines if the given {@code char} value is a Unicode
+ * surrogate code unit.
+ *
+ * Such values do not represent characters by themselves,
+ * but are used in the representation of
+ * supplementary characters
+ * in the UTF-16 encoding.
+ *
+ * A char value is a surrogate code unit if and only if it is either
+ * a {@linkplain #isLowSurrogate(char) low-surrogate code unit} or
+ * a {@linkplain #isHighSurrogate(char) high-surrogate code unit}.
+ *
+ * @param ch the {@code char} value to be tested.
+ * @return {@code true} if the {@code char} value is between
+ * {@link #MIN_SURROGATE} and
+ * {@link #MAX_SURROGATE} inclusive;
+ * {@code false} otherwise.
+ * @since 1.7
+ */
+ public static boolean isSurrogate(char ch) {
+ return ch >= MIN_SURROGATE && ch < (MAX_SURROGATE + 1);
+ }
+
+ /**
+ * Determines whether the specified pair of {@code char}
+ * values is a valid
+ *
+ * Unicode surrogate pair.
+
+ * This method is equivalent to the expression:
+ * This method doesn't validate the specified character to be a
+ * valid Unicode code point. The caller must validate the
+ * character value using {@link #isValidCodePoint(int) isValidCodePoint}
+ * if necessary.
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return 2 if the character is a valid supplementary character; 1 otherwise.
+ * @see Character#isSupplementaryCodePoint(int)
+ * @since 1.5
+ */
+ public static int charCount(int codePoint) {
+ return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT ? 2 : 1;
+ }
+
+ /**
+ * Converts the specified surrogate pair to its supplementary code
+ * point value. This method does not validate the specified
+ * surrogate pair. The caller must validate it using {@link
+ * #isSurrogatePair(char, char) isSurrogatePair} if necessary.
+ *
+ * @param high the high-surrogate code unit
+ * @param low the low-surrogate code unit
+ * @return the supplementary code point composed from the
+ * specified surrogate pair.
+ * @since 1.5
+ */
+ public static int toCodePoint(char high, char low) {
+ // Optimized form of:
+ // return ((high - MIN_HIGH_SURROGATE) << 10)
+ // + (low - MIN_LOW_SURROGATE)
+ // + MIN_SUPPLEMENTARY_CODE_POINT;
+ return ((high << 10) + low) + (MIN_SUPPLEMENTARY_CODE_POINT
+ - (MIN_HIGH_SURROGATE << 10)
+ - MIN_LOW_SURROGATE);
+ }
+
+ /**
+ * Returns the code point at the given index of the
+ * {@code CharSequence}. If the {@code char} value at
+ * the given index in the {@code CharSequence} is in the
+ * high-surrogate range, the following index is less than the
+ * length of the {@code CharSequence}, and the
+ * {@code char} value at the following index is in the
+ * low-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the {@code char} value at the given index is returned.
+ *
+ * @param seq a sequence of {@code char} values (Unicode code
+ * units)
+ * @param index the index to the {@code char} values (Unicode
+ * code units) in {@code seq} to be converted
+ * @return the Unicode code point at the given index
+ * @exception NullPointerException if {@code seq} is null.
+ * @exception IndexOutOfBoundsException if the value
+ * {@code index} is negative or not less than
+ * {@link CharSequence#length() seq.length()}.
+ * @since 1.5
+ */
+ public static int codePointAt(CharSequence seq, int index) {
+ char c1 = seq.charAt(index++);
+ if (isHighSurrogate(c1)) {
+ if (index < seq.length()) {
+ char c2 = seq.charAt(index);
+ if (isLowSurrogate(c2)) {
+ return toCodePoint(c1, c2);
+ }
+ }
+ }
+ return c1;
+ }
+
+ /**
+ * Returns the code point at the given index of the
+ * {@code char} array. If the {@code char} value at
+ * the given index in the {@code char} array is in the
+ * high-surrogate range, the following index is less than the
+ * length of the {@code char} array, and the
+ * {@code char} value at the following index is in the
+ * low-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the {@code char} value at the given index is returned.
+ *
+ * @param a the {@code char} array
+ * @param index the index to the {@code char} values (Unicode
+ * code units) in the {@code char} array to be converted
+ * @return the Unicode code point at the given index
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the value
+ * {@code index} is negative or not less than
+ * the length of the {@code char} array.
+ * @since 1.5
+ */
+ public static int codePointAt(char[] a, int index) {
+ return codePointAtImpl(a, index, a.length);
+ }
+
+ /**
+ * Returns the code point at the given index of the
+ * {@code char} array, where only array elements with
+ * {@code index} less than {@code limit} can be used. If
+ * the {@code char} value at the given index in the
+ * {@code char} array is in the high-surrogate range, the
+ * following index is less than the {@code limit}, and the
+ * {@code char} value at the following index is in the
+ * low-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the {@code char} value at the given index is returned.
+ *
+ * @param a the {@code char} array
+ * @param index the index to the {@code char} values (Unicode
+ * code units) in the {@code char} array to be converted
+ * @param limit the index after the last array element that
+ * can be used in the {@code char} array
+ * @return the Unicode code point at the given index
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
+ * argument is negative or not less than the {@code limit}
+ * argument, or if the {@code limit} argument is negative or
+ * greater than the length of the {@code char} array.
+ * @since 1.5
+ */
+ public static int codePointAt(char[] a, int index, int limit) {
+ if (index >= limit || limit < 0 || limit > a.length) {
+ throw new IndexOutOfBoundsException();
+ }
+ return codePointAtImpl(a, index, limit);
+ }
+
+ // throws ArrayIndexOutofBoundsException if index out of bounds
+ static int codePointAtImpl(char[] a, int index, int limit) {
+ char c1 = a[index++];
+ if (isHighSurrogate(c1)) {
+ if (index < limit) {
+ char c2 = a[index];
+ if (isLowSurrogate(c2)) {
+ return toCodePoint(c1, c2);
+ }
+ }
+ }
+ return c1;
+ }
+
+ /**
+ * Returns the code point preceding the given index of the
+ * {@code CharSequence}. If the {@code char} value at
+ * {@code (index - 1)} in the {@code CharSequence} is in
+ * the low-surrogate range, {@code (index - 2)} is not
+ * negative, and the {@code char} value at {@code (index - 2)}
+ * in the {@code CharSequence} is in the
+ * high-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the {@code char} value at {@code (index - 1)} is
+ * returned.
+ *
+ * @param seq the {@code CharSequence} instance
+ * @param index the index following the code point that should be returned
+ * @return the Unicode code point value before the given index.
+ * @exception NullPointerException if {@code seq} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
+ * argument is less than 1 or greater than {@link
+ * CharSequence#length() seq.length()}.
+ * @since 1.5
+ */
+ public static int codePointBefore(CharSequence seq, int index) {
+ char c2 = seq.charAt(--index);
+ if (isLowSurrogate(c2)) {
+ if (index > 0) {
+ char c1 = seq.charAt(--index);
+ if (isHighSurrogate(c1)) {
+ return toCodePoint(c1, c2);
+ }
+ }
+ }
+ return c2;
+ }
+
+ /**
+ * Returns the code point preceding the given index of the
+ * {@code char} array. If the {@code char} value at
+ * {@code (index - 1)} in the {@code char} array is in
+ * the low-surrogate range, {@code (index - 2)} is not
+ * negative, and the {@code char} value at {@code (index - 2)}
+ * in the {@code char} array is in the
+ * high-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the {@code char} value at {@code (index - 1)} is
+ * returned.
+ *
+ * @param a the {@code char} array
+ * @param index the index following the code point that should be returned
+ * @return the Unicode code point value before the given index.
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
+ * argument is less than 1 or greater than the length of the
+ * {@code char} array
+ * @since 1.5
+ */
+ public static int codePointBefore(char[] a, int index) {
+ return codePointBeforeImpl(a, index, 0);
+ }
+
+ /**
+ * Returns the code point preceding the given index of the
+ * {@code char} array, where only array elements with
+ * {@code index} greater than or equal to {@code start}
+ * can be used. If the {@code char} value at {@code (index - 1)}
+ * in the {@code char} array is in the
+ * low-surrogate range, {@code (index - 2)} is not less than
+ * {@code start}, and the {@code char} value at
+ * {@code (index - 2)} in the {@code char} array is in
+ * the high-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the {@code char} value at {@code (index - 1)} is
+ * returned.
+ *
+ * @param a the {@code char} array
+ * @param index the index following the code point that should be returned
+ * @param start the index of the first array element in the
+ * {@code char} array
+ * @return the Unicode code point value before the given index.
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if the {@code index}
+ * argument is not greater than the {@code start} argument or
+ * is greater than the length of the {@code char} array, or
+ * if the {@code start} argument is negative or not less than
+ * the length of the {@code char} array.
+ * @since 1.5
+ */
+ public static int codePointBefore(char[] a, int index, int start) {
+ if (index <= start || start < 0 || start >= a.length) {
+ throw new IndexOutOfBoundsException();
+ }
+ return codePointBeforeImpl(a, index, start);
+ }
+
+ // throws ArrayIndexOutofBoundsException if index-1 out of bounds
+ static int codePointBeforeImpl(char[] a, int index, int start) {
+ char c2 = a[--index];
+ if (isLowSurrogate(c2)) {
+ if (index > start) {
+ char c1 = a[--index];
+ if (isHighSurrogate(c1)) {
+ return toCodePoint(c1, c2);
+ }
+ }
+ }
+ return c2;
+ }
+
+ /**
+ * Returns the leading surrogate (a
+ *
+ * high surrogate code unit) of the
+ *
+ * surrogate pair
+ * representing the specified supplementary character (Unicode
+ * code point) in the UTF-16 encoding. If the specified character
+ * is not a
+ * supplementary character,
+ * an unspecified {@code char} is returned.
+ *
+ * If
+ * {@link #isSupplementaryCodePoint isSupplementaryCodePoint(x)}
+ * is {@code true}, then
+ * {@link #isHighSurrogate isHighSurrogate}{@code (highSurrogate(x))} and
+ * {@link #toCodePoint toCodePoint}{@code (highSurrogate(x), }{@link #lowSurrogate lowSurrogate}{@code (x)) == x}
+ * are also always {@code true}.
+ *
+ * @param codePoint a supplementary character (Unicode code point)
+ * @return the leading surrogate code unit used to represent the
+ * character in the UTF-16 encoding
+ * @since 1.7
+ */
+ public static char highSurrogate(int codePoint) {
+ return (char) ((codePoint >>> 10)
+ + (MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT >>> 10)));
+ }
+
+ /**
+ * Returns the trailing surrogate (a
+ *
+ * low surrogate code unit) of the
+ *
+ * surrogate pair
+ * representing the specified supplementary character (Unicode
+ * code point) in the UTF-16 encoding. If the specified character
+ * is not a
+ * supplementary character,
+ * an unspecified {@code char} is returned.
+ *
+ * If
+ * {@link #isSupplementaryCodePoint isSupplementaryCodePoint(x)}
+ * is {@code true}, then
+ * {@link #isLowSurrogate isLowSurrogate}{@code (lowSurrogate(x))} and
+ * {@link #toCodePoint toCodePoint}{@code (}{@link #highSurrogate highSurrogate}{@code (x), lowSurrogate(x)) == x}
+ * are also always {@code true}.
+ *
+ * @param codePoint a supplementary character (Unicode code point)
+ * @return the trailing surrogate code unit used to represent the
+ * character in the UTF-16 encoding
+ * @since 1.7
+ */
+ public static char lowSurrogate(int codePoint) {
+ return (char) ((codePoint & 0x3ff) + MIN_LOW_SURROGATE);
+ }
+
+ /**
+ * Converts the specified character (Unicode code point) to its
+ * UTF-16 representation. If the specified code point is a BMP
+ * (Basic Multilingual Plane or Plane 0) value, the same value is
+ * stored in {@code dst[dstIndex]}, and 1 is returned. If the
+ * specified code point is a supplementary character, its
+ * surrogate values are stored in {@code dst[dstIndex]}
+ * (high-surrogate) and {@code dst[dstIndex+1]}
+ * (low-surrogate), and 2 is returned.
+ *
+ * @param codePoint the character (Unicode code point) to be converted.
+ * @param dst an array of {@code char} in which the
+ * {@code codePoint}'s UTF-16 value is stored.
+ * @param dstIndex the start index into the {@code dst}
+ * array where the converted value is stored.
+ * @return 1 if the code point is a BMP code point, 2 if the
+ * code point is a supplementary code point.
+ * @exception IllegalArgumentException if the specified
+ * {@code codePoint} is not a valid Unicode code point.
+ * @exception NullPointerException if the specified {@code dst} is null.
+ * @exception IndexOutOfBoundsException if {@code dstIndex}
+ * is negative or not less than {@code dst.length}, or if
+ * {@code dst} at {@code dstIndex} doesn't have enough
+ * array element(s) to store the resulting {@code char}
+ * value(s). (If {@code dstIndex} is equal to
+ * {@code dst.length-1} and the specified
+ * {@code codePoint} is a supplementary character, the
+ * high-surrogate value is not stored in
+ * {@code dst[dstIndex]}.)
+ * @since 1.5
+ */
+ public static int toChars(int codePoint, char[] dst, int dstIndex) {
+ if (isBmpCodePoint(codePoint)) {
+ dst[dstIndex] = (char) codePoint;
+ return 1;
+ } else if (isValidCodePoint(codePoint)) {
+ toSurrogates(codePoint, dst, dstIndex);
+ return 2;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /**
+ * Converts the specified character (Unicode code point) to its
+ * UTF-16 representation stored in a {@code char} array. If
+ * the specified code point is a BMP (Basic Multilingual Plane or
+ * Plane 0) value, the resulting {@code char} array has
+ * the same value as {@code codePoint}. If the specified code
+ * point is a supplementary code point, the resulting
+ * {@code char} array has the corresponding surrogate pair.
+ *
+ * @param codePoint a Unicode code point
+ * @return a {@code char} array having
+ * {@code codePoint}'s UTF-16 representation.
+ * @exception IllegalArgumentException if the specified
+ * {@code codePoint} is not a valid Unicode code point.
+ * @since 1.5
+ */
+ public static char[] toChars(int codePoint) {
+ if (isBmpCodePoint(codePoint)) {
+ return new char[] { (char) codePoint };
+ } else if (isValidCodePoint(codePoint)) {
+ char[] result = new char[2];
+ toSurrogates(codePoint, result, 0);
+ return result;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ static void toSurrogates(int codePoint, char[] dst, int index) {
+ // We write elements "backwards" to guarantee all-or-nothing
+ dst[index+1] = lowSurrogate(codePoint);
+ dst[index] = highSurrogate(codePoint);
+ }
+
+ /**
+ * Returns the number of Unicode code points in the text range of
+ * the specified char sequence. The text range begins at the
+ * specified {@code beginIndex} and extends to the
+ * {@code char} at index {@code endIndex - 1}. Thus the
+ * length (in {@code char}s) of the text range is
+ * {@code endIndex-beginIndex}. Unpaired surrogates within
+ * the text range count as one code point each.
+ *
+ * @param seq the char sequence
+ * @param beginIndex the index to the first {@code char} of
+ * the text range.
+ * @param endIndex the index after the last {@code char} of
+ * the text range.
+ * @return the number of Unicode code points in the specified text
+ * range
+ * @exception NullPointerException if {@code seq} is null.
+ * @exception IndexOutOfBoundsException if the
+ * {@code beginIndex} is negative, or {@code endIndex}
+ * is larger than the length of the given sequence, or
+ * {@code beginIndex} is larger than {@code endIndex}.
+ * @since 1.5
+ */
+ public static int codePointCount(CharSequence seq, int beginIndex, int endIndex) {
+ int length = seq.length();
+ if (beginIndex < 0 || endIndex > length || beginIndex > endIndex) {
+ throw new IndexOutOfBoundsException();
+ }
+ int n = endIndex - beginIndex;
+ for (int i = beginIndex; i < endIndex; ) {
+ if (isHighSurrogate(seq.charAt(i++)) && i < endIndex &&
+ isLowSurrogate(seq.charAt(i))) {
+ n--;
+ i++;
+ }
+ }
+ return n;
+ }
+
+ /**
+ * Returns the number of Unicode code points in a subarray of the
+ * {@code char} array argument. The {@code offset}
+ * argument is the index of the first {@code char} of the
+ * subarray and the {@code count} argument specifies the
+ * length of the subarray in {@code char}s. Unpaired
+ * surrogates within the subarray count as one code point each.
+ *
+ * @param a the {@code char} array
+ * @param offset the index of the first {@code char} in the
+ * given {@code char} array
+ * @param count the length of the subarray in {@code char}s
+ * @return the number of Unicode code points in the specified subarray
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException if {@code offset} or
+ * {@code count} is negative, or if {@code offset +
+ * count} is larger than the length of the given array.
+ * @since 1.5
+ */
+ public static int codePointCount(char[] a, int offset, int count) {
+ if (count > a.length - offset || offset < 0 || count < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ return codePointCountImpl(a, offset, count);
+ }
+
+ static int codePointCountImpl(char[] a, int offset, int count) {
+ int endIndex = offset + count;
+ int n = count;
+ for (int i = offset; i < endIndex; ) {
+ if (isHighSurrogate(a[i++]) && i < endIndex &&
+ isLowSurrogate(a[i])) {
+ n--;
+ i++;
+ }
+ }
+ return n;
+ }
+
+ /**
+ * Returns the index within the given char sequence that is offset
+ * from the given {@code index} by {@code codePointOffset}
+ * code points. Unpaired surrogates within the text range given by
+ * {@code index} and {@code codePointOffset} count as
+ * one code point each.
+ *
+ * @param seq the char sequence
+ * @param index the index to be offset
+ * @param codePointOffset the offset in code points
+ * @return the index within the char sequence
+ * @exception NullPointerException if {@code seq} is null.
+ * @exception IndexOutOfBoundsException if {@code index}
+ * is negative or larger then the length of the char sequence,
+ * or if {@code codePointOffset} is positive and the
+ * subsequence starting with {@code index} has fewer than
+ * {@code codePointOffset} code points, or if
+ * {@code codePointOffset} is negative and the subsequence
+ * before {@code index} has fewer than the absolute value
+ * of {@code codePointOffset} code points.
+ * @since 1.5
+ */
+ public static int offsetByCodePoints(CharSequence seq, int index,
+ int codePointOffset) {
+ int length = seq.length();
+ if (index < 0 || index > length) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ int x = index;
+ if (codePointOffset >= 0) {
+ int i;
+ for (i = 0; x < length && i < codePointOffset; i++) {
+ if (isHighSurrogate(seq.charAt(x++)) && x < length &&
+ isLowSurrogate(seq.charAt(x))) {
+ x++;
+ }
+ }
+ if (i < codePointOffset) {
+ throw new IndexOutOfBoundsException();
+ }
+ } else {
+ int i;
+ for (i = codePointOffset; x > 0 && i < 0; i++) {
+ if (isLowSurrogate(seq.charAt(--x)) && x > 0 &&
+ isHighSurrogate(seq.charAt(x-1))) {
+ x--;
+ }
+ }
+ if (i < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+ return x;
+ }
+
+ /**
+ * Returns the index within the given {@code char} subarray
+ * that is offset from the given {@code index} by
+ * {@code codePointOffset} code points. The
+ * {@code start} and {@code count} arguments specify a
+ * subarray of the {@code char} array. Unpaired surrogates
+ * within the text range given by {@code index} and
+ * {@code codePointOffset} count as one code point each.
+ *
+ * @param a the {@code char} array
+ * @param start the index of the first {@code char} of the
+ * subarray
+ * @param count the length of the subarray in {@code char}s
+ * @param index the index to be offset
+ * @param codePointOffset the offset in code points
+ * @return the index within the subarray
+ * @exception NullPointerException if {@code a} is null.
+ * @exception IndexOutOfBoundsException
+ * if {@code start} or {@code count} is negative,
+ * or if {@code start + count} is larger than the length of
+ * the given array,
+ * or if {@code index} is less than {@code start} or
+ * larger then {@code start + count},
+ * or if {@code codePointOffset} is positive and the text range
+ * starting with {@code index} and ending with {@code start + count - 1}
+ * has fewer than {@code codePointOffset} code
+ * points,
+ * or if {@code codePointOffset} is negative and the text range
+ * starting with {@code start} and ending with {@code index - 1}
+ * has fewer than the absolute value of
+ * {@code codePointOffset} code points.
+ * @since 1.5
+ */
+ public static int offsetByCodePoints(char[] a, int start, int count,
+ int index, int codePointOffset) {
+ if (count > a.length-start || start < 0 || count < 0
+ || index < start || index > start+count) {
+ throw new IndexOutOfBoundsException();
+ }
+ return offsetByCodePointsImpl(a, start, count, index, codePointOffset);
+ }
+
+ static int offsetByCodePointsImpl(char[]a, int start, int count,
+ int index, int codePointOffset) {
+ int x = index;
+ if (codePointOffset >= 0) {
+ int limit = start + count;
+ int i;
+ for (i = 0; x < limit && i < codePointOffset; i++) {
+ if (isHighSurrogate(a[x++]) && x < limit &&
+ isLowSurrogate(a[x])) {
+ x++;
+ }
+ }
+ if (i < codePointOffset) {
+ throw new IndexOutOfBoundsException();
+ }
+ } else {
+ int i;
+ for (i = codePointOffset; x > start && i < 0; i++) {
+ if (isLowSurrogate(a[--x]) && x > start &&
+ isHighSurrogate(a[x-1])) {
+ x--;
+ }
+ }
+ if (i < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+ return x;
+ }
+
+ /**
+ * Determines if the specified character is a lowercase character.
+ *
+ * A character is lowercase if its general category type, provided
+ * by {@code Character.getType(ch)}, is
+ * {@code LOWERCASE_LETTER}, or it has contributory property
+ * Other_Lowercase as defined by the Unicode Standard.
+ *
+ * The following are examples of lowercase characters:
+ * Many other Unicode characters are lowercase too.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isLowerCase(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is lowercase;
+ * {@code false} otherwise.
+ * @see Character#isLowerCase(char)
+ * @see Character#isTitleCase(char)
+ * @see Character#toLowerCase(char)
+ * @see Character#getType(char)
+ */
+ public static boolean isLowerCase(char ch) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Determines if the specified character is an uppercase character.
+ *
+ * A character is uppercase if its general category type, provided by
+ * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
+ * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
+ *
+ * The following are examples of uppercase characters:
+ * Many other Unicode characters are uppercase too.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isUpperCase(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is uppercase;
+ * {@code false} otherwise.
+ * @see Character#isLowerCase(char)
+ * @see Character#isTitleCase(char)
+ * @see Character#toUpperCase(char)
+ * @see Character#getType(char)
+ * @since 1.0
+ */
+ public static boolean isUpperCase(char ch) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Determines if the specified character is a titlecase character.
+ *
+ * A character is a titlecase character if its general
+ * category type, provided by {@code Character.getType(ch)},
+ * is {@code TITLECASE_LETTER}.
+ *
+ * Some characters look like pairs of Latin letters. For example, there
+ * is an uppercase letter that looks like "LJ" and has a corresponding
+ * lowercase letter that looks like "lj". A third form, which looks like "Lj",
+ * is the appropriate form to use when rendering a word in lowercase
+ * with initial capitals, as for a book title.
+ *
+ * These are some of the Unicode characters for which this method returns
+ * {@code true}:
+ * Many other Unicode characters are titlecase too.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isTitleCase(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is titlecase;
+ * {@code false} otherwise.
+ * @see Character#isLowerCase(char)
+ * @see Character#isUpperCase(char)
+ * @see Character#toTitleCase(char)
+ * @see Character#getType(char)
+ * @since 1.0.2
+ */
+ public static boolean isTitleCase(char ch) {
+ return isTitleCase((int)ch);
+ }
+
+ /**
+ * Determines if the specified character (Unicode code point) is a titlecase character.
+ *
+ * A character is a titlecase character if its general
+ * category type, provided by {@link Character#getType(int) getType(codePoint)},
+ * is {@code TITLECASE_LETTER}.
+ *
+ * Some characters look like pairs of Latin letters. For example, there
+ * is an uppercase letter that looks like "LJ" and has a corresponding
+ * lowercase letter that looks like "lj". A third form, which looks like "Lj",
+ * is the appropriate form to use when rendering a word in lowercase
+ * with initial capitals, as for a book title.
+ *
+ * These are some of the Unicode characters for which this method returns
+ * {@code true}:
+ * Many other Unicode characters are titlecase too.
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character is titlecase;
+ * {@code false} otherwise.
+ * @see Character#isLowerCase(int)
+ * @see Character#isUpperCase(int)
+ * @see Character#toTitleCase(int)
+ * @see Character#getType(int)
+ * @since 1.5
+ */
+ public static boolean isTitleCase(int codePoint) {
+ return getType(codePoint) == Character.TITLECASE_LETTER;
+ }
+
+ /**
+ * Determines if the specified character is a digit.
+ *
+ * A character is a digit if its general category type, provided
+ * by {@code Character.getType(ch)}, is
+ * {@code DECIMAL_DIGIT_NUMBER}.
+ *
+ * Some Unicode character ranges that contain digits:
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isDigit(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is a digit;
+ * {@code false} otherwise.
+ * @see Character#digit(char, int)
+ * @see Character#forDigit(int, int)
+ * @see Character#getType(char)
+ */
+ public static boolean isDigit(char ch) {
+ return isDigit((int)ch);
+ }
+
+ /**
+ * Determines if the specified character (Unicode code point) is a digit.
+ *
+ * A character is a digit if its general category type, provided
+ * by {@link Character#getType(int) getType(codePoint)}, is
+ * {@code DECIMAL_DIGIT_NUMBER}.
+ *
+ * Some Unicode character ranges that contain digits:
+ *
+ * A character is defined if at least one of the following is true:
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isDefined(int)} method.
+ *
+ * @param ch the character to be tested
+ * @return {@code true} if the character has a defined meaning
+ * in Unicode; {@code false} otherwise.
+ * @see Character#isDigit(char)
+ * @see Character#isLetter(char)
+ * @see Character#isLetterOrDigit(char)
+ * @see Character#isLowerCase(char)
+ * @see Character#isTitleCase(char)
+ * @see Character#isUpperCase(char)
+ * @since 1.0.2
+ */
+ public static boolean isDefined(char ch) {
+ return isDefined((int)ch);
+ }
+
+ /**
+ * Determines if a character (Unicode code point) is defined in Unicode.
+ *
+ * A character is defined if at least one of the following is true:
+ *
+ * A character is considered to be a letter if its general
+ * category type, provided by {@code Character.getType(ch)},
+ * is any of the following:
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isLetter(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is a letter;
+ * {@code false} otherwise.
+ * @see Character#isDigit(char)
+ * @see Character#isJavaIdentifierStart(char)
+ * @see Character#isJavaLetter(char)
+ * @see Character#isJavaLetterOrDigit(char)
+ * @see Character#isLetterOrDigit(char)
+ * @see Character#isLowerCase(char)
+ * @see Character#isTitleCase(char)
+ * @see Character#isUnicodeIdentifierStart(char)
+ * @see Character#isUpperCase(char)
+ */
+ public static boolean isLetter(char ch) {
+ return isLetter((int)ch);
+ }
+
+ /**
+ * Determines if the specified character (Unicode code point) is a letter.
+ *
+ * A character is considered to be a letter if its general
+ * category type, provided by {@link Character#getType(int) getType(codePoint)},
+ * is any of the following:
+ *
+ * A character is considered to be a letter or digit if either
+ * {@code Character.isLetter(char ch)} or
+ * {@code Character.isDigit(char ch)} returns
+ * {@code true} for the character.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isLetterOrDigit(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is a letter or digit;
+ * {@code false} otherwise.
+ * @see Character#isDigit(char)
+ * @see Character#isJavaIdentifierPart(char)
+ * @see Character#isJavaLetter(char)
+ * @see Character#isJavaLetterOrDigit(char)
+ * @see Character#isLetter(char)
+ * @see Character#isUnicodeIdentifierPart(char)
+ * @since 1.0.2
+ */
+ public static boolean isLetterOrDigit(char ch) {
+ return isLetterOrDigit((int)ch);
+ }
+
+ /**
+ * Determines if the specified character (Unicode code point) is a letter or digit.
+ *
+ * A character is considered to be a letter or digit if either
+ * {@link #isLetter(int) isLetter(codePoint)} or
+ * {@link #isDigit(int) isDigit(codePoint)} returns
+ * {@code true} for the character.
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character is a letter or digit;
+ * {@code false} otherwise.
+ * @see Character#isDigit(int)
+ * @see Character#isJavaIdentifierPart(int)
+ * @see Character#isLetter(int)
+ * @see Character#isUnicodeIdentifierPart(int)
+ * @since 1.5
+ */
+ public static boolean isLetterOrDigit(int codePoint) {
+ return ((((1 << Character.UPPERCASE_LETTER) |
+ (1 << Character.LOWERCASE_LETTER) |
+ (1 << Character.TITLECASE_LETTER) |
+ (1 << Character.MODIFIER_LETTER) |
+ (1 << Character.OTHER_LETTER) |
+ (1 << Character.DECIMAL_DIGIT_NUMBER)) >> getType(codePoint)) & 1)
+ != 0;
+ }
+
+ static int getType(int x) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Converts the character argument to lowercase using case
+ * mapping information from the UnicodeData file.
+ *
+ * Note that
+ * {@code Character.isLowerCase(Character.toLowerCase(ch))}
+ * does not always return {@code true} for some ranges of
+ * characters, particularly those that are symbols or ideographs.
+ *
+ * In general, {@link String#toLowerCase()} should be used to map
+ * characters to lowercase. {@code String} case mapping methods
+ * have several benefits over {@code Character} case mapping methods.
+ * {@code String} case mapping methods can perform locale-sensitive
+ * mappings, context-sensitive mappings, and 1:M character mappings, whereas
+ * the {@code Character} case mapping methods cannot.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #toLowerCase(int)} method.
+ *
+ * @param ch the character to be converted.
+ * @return the lowercase equivalent of the character, if any;
+ * otherwise, the character itself.
+ * @see Character#isLowerCase(char)
+ * @see String#toLowerCase()
+ */
+ public static char toLowerCase(char ch) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Converts the character argument to uppercase using case mapping
+ * information from the UnicodeData file.
+ *
+ * Note that
+ * {@code Character.isUpperCase(Character.toUpperCase(ch))}
+ * does not always return {@code true} for some ranges of
+ * characters, particularly those that are symbols or ideographs.
+ *
+ * In general, {@link String#toUpperCase()} should be used to map
+ * characters to uppercase. {@code String} case mapping methods
+ * have several benefits over {@code Character} case mapping methods.
+ * {@code String} case mapping methods can perform locale-sensitive
+ * mappings, context-sensitive mappings, and 1:M character mappings, whereas
+ * the {@code Character} case mapping methods cannot.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #toUpperCase(int)} method.
+ *
+ * @param ch the character to be converted.
+ * @return the uppercase equivalent of the character, if any;
+ * otherwise, the character itself.
+ * @see Character#isUpperCase(char)
+ * @see String#toUpperCase()
+ */
+ public static char toUpperCase(char ch) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the numeric value of the character {@code ch} in the
+ * specified radix.
+ *
+ * If the radix is not in the range {@code MIN_RADIX} ≤
+ * {@code radix} ≤ {@code MAX_RADIX} or if the
+ * value of {@code ch} is not a valid digit in the specified
+ * radix, {@code -1} is returned. A character is a valid digit
+ * if at least one of the following is true:
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #digit(int, int)} method.
+ *
+ * @param ch the character to be converted.
+ * @param radix the radix.
+ * @return the numeric value represented by the character in the
+ * specified radix.
+ * @see Character#forDigit(int, int)
+ * @see Character#isDigit(char)
+ */
+ public static int digit(char ch, int radix) {
+ return digit((int)ch, radix);
+ }
+
+ /**
+ * Returns the numeric value of the specified character (Unicode
+ * code point) in the specified radix.
+ *
+ * If the radix is not in the range {@code MIN_RADIX} ≤
+ * {@code radix} ≤ {@code MAX_RADIX} or if the
+ * character is not a valid digit in the specified
+ * radix, {@code -1} is returned. A character is a valid digit
+ * if at least one of the following is true:
+ *
+ * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through
+ * {@code '\u005Cu005A'}), lowercase
+ * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and
+ * full width variant ({@code '\u005CuFF21'} through
+ * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through
+ * {@code '\u005CuFF5A'}) forms have numeric values from 10
+ * through 35. This is independent of the Unicode specification,
+ * which does not assign numeric values to these {@code char}
+ * values.
+ *
+ * If the character does not have a numeric value, then -1 is returned.
+ * If the character has a numeric value that cannot be represented as a
+ * nonnegative integer (for example, a fractional value), then -2
+ * is returned.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #getNumericValue(int)} method.
+ *
+ * @param ch the character to be converted.
+ * @return the numeric value of the character, as a nonnegative {@code int}
+ * value; -2 if the character has a numeric value that is not a
+ * nonnegative integer; -1 if the character has no numeric value.
+ * @see Character#forDigit(int, int)
+ * @see Character#isDigit(char)
+ * @since 1.1
+ */
+ public static int getNumericValue(char ch) {
+ return getNumericValue((int)ch);
+ }
+
+ /**
+ * Returns the {@code int} value that the specified
+ * character (Unicode code point) represents. For example, the character
+ * {@code '\u005Cu216C'} (the Roman numeral fifty) will return
+ * an {@code int} with a value of 50.
+ *
+ * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through
+ * {@code '\u005Cu005A'}), lowercase
+ * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and
+ * full width variant ({@code '\u005CuFF21'} through
+ * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through
+ * {@code '\u005CuFF5A'}) forms have numeric values from 10
+ * through 35. This is independent of the Unicode specification,
+ * which does not assign numeric values to these {@code char}
+ * values.
+ *
+ * If the character does not have a numeric value, then -1 is returned.
+ * If the character has a numeric value that cannot be represented as a
+ * nonnegative integer (for example, a fractional value), then -2
+ * is returned.
+ *
+ * @param codePoint the character (Unicode code point) to be converted.
+ * @return the numeric value of the character, as a nonnegative {@code int}
+ * value; -2 if the character has a numeric value that is not a
+ * nonnegative integer; -1 if the character has no numeric value.
+ * @see Character#forDigit(int, int)
+ * @see Character#isDigit(int)
+ * @since 1.5
+ */
+ public static int getNumericValue(int codePoint) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Determines if the specified character is ISO-LATIN-1 white space.
+ * This method returns {@code true} for the following five
+ * characters only:
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isWhitespace(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is a Java whitespace
+ * character; {@code false} otherwise.
+ * @see Character#isSpaceChar(char)
+ * @since 1.1
+ */
+ public static boolean isWhitespace(char ch) {
+ return isWhitespace((int)ch);
+ }
+
+ /**
+ * Determines if the specified character (Unicode code point) is
+ * white space according to Java. A character is a Java
+ * whitespace character if and only if it satisfies one of the
+ * following criteria:
+ *
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character is a Java whitespace
+ * character; {@code false} otherwise.
+ * @see Character#isSpaceChar(int)
+ * @since 1.5
+ */
+ public static boolean isWhitespace(int codePoint) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Determines if the specified character is an ISO control
+ * character. A character is considered to be an ISO control
+ * character if its code is in the range {@code '\u005Cu0000'}
+ * through {@code '\u005Cu001F'} or in the range
+ * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}.
+ *
+ * Note: This method cannot handle supplementary characters. To support
+ * all Unicode characters, including supplementary characters, use
+ * the {@link #isISOControl(int)} method.
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is an ISO control character;
+ * {@code false} otherwise.
+ *
+ * @see Character#isSpaceChar(char)
+ * @see Character#isWhitespace(char)
+ * @since 1.1
+ */
+ public static boolean isISOControl(char ch) {
+ return isISOControl((int)ch);
+ }
+
+ /**
+ * Determines if the referenced character (Unicode code point) is an ISO control
+ * character. A character is considered to be an ISO control
+ * character if its code is in the range {@code '\u005Cu0000'}
+ * through {@code '\u005Cu001F'} or in the range
+ * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}.
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character is an ISO control character;
+ * {@code false} otherwise.
+ * @see Character#isSpaceChar(int)
+ * @see Character#isWhitespace(int)
+ * @since 1.5
+ */
+ public static boolean isISOControl(int codePoint) {
+ // Optimized form of:
+ // (codePoint >= 0x00 && codePoint <= 0x1F) ||
+ // (codePoint >= 0x7F && codePoint <= 0x9F);
+ return codePoint <= 0x9F &&
+ (codePoint >= 0x7F || (codePoint >>> 5 == 0));
+ }
+
+ /**
+ * Determines the character representation for a specific digit in
+ * the specified radix. If the value of {@code radix} is not a
+ * valid radix, or the value of {@code digit} is not a valid
+ * digit in the specified radix, the null character
+ * ({@code '\u005Cu0000'}) is returned.
+ *
+ * The {@code radix} argument is valid if it is greater than or
+ * equal to {@code MIN_RADIX} and less than or equal to
+ * {@code MAX_RADIX}. The {@code digit} argument is valid if
+ * {@code 0 <= digit < radix}.
+ *
+ * If the digit is less than 10, then
+ * {@code '0' + digit} is returned. Otherwise, the value
+ * {@code 'a' + digit - 10} is returned.
+ *
+ * @param digit the number to convert to a character.
+ * @param radix the radix.
+ * @return the {@code char} representation of the specified digit
+ * in the specified radix.
+ * @see Character#MIN_RADIX
+ * @see Character#MAX_RADIX
+ * @see Character#digit(char, int)
+ */
+ public static char forDigit(int digit, int radix) {
+ if ((digit >= radix) || (digit < 0)) {
+ return '\0';
+ }
+ if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) {
+ return '\0';
+ }
+ if (digit < 10) {
+ return (char)('0' + digit);
+ }
+ return (char)('a' - 10 + digit);
+ }
+
+ /**
+ * Compares two {@code Character} objects numerically.
+ *
+ * @param anotherCharacter the {@code Character} to be compared.
+
+ * @return the value {@code 0} if the argument {@code Character}
+ * is equal to this {@code Character}; a value less than
+ * {@code 0} if this {@code Character} is numerically less
+ * than the {@code Character} argument; and a value greater than
+ * {@code 0} if this {@code Character} is numerically greater
+ * than the {@code Character} argument (unsigned comparison).
+ * Note that this is strictly a numerical comparison; it is not
+ * locale-dependent.
+ * @since 1.2
+ */
+ public int compareTo(Character anotherCharacter) {
+ return compare(this.value, anotherCharacter.value);
+ }
+
+ /**
+ * Compares two {@code char} values numerically.
+ * The value returned is identical to what would be returned by:
+ * {@code Class} has no public constructor. Instead {@code Class}
+ * objects are constructed automatically by the Java Virtual Machine as classes
+ * are loaded and by calls to the {@code defineClass} method in the class
+ * loader.
+ *
+ * The following example uses a {@code Class} object to print the
+ * class name of an object:
+ *
+ * It is also possible to get the {@code Class} object for a named
+ * type (or for void) using a class literal. See Section 15.8.2 of
+ * The Java™ Language Specification.
+ * For example:
+ *
+ * For example, the following code fragment returns the
+ * runtime {@code Class} descriptor for the class named
+ * {@code java.lang.Thread}:
+ *
+ *
+ * A call to {@code forName("X")} causes the class named
+ * {@code X} to be initialized.
+ *
+ * @param className the fully qualified name of the desired class.
+ * @return the {@code Class} object for the class with the
+ * specified name.
+ * @exception LinkageError if the linkage fails
+ * @exception ExceptionInInitializerError if the initialization provoked
+ * by this method fails
+ * @exception ClassNotFoundException if the class cannot be located
+ */
+ public static Class> forName(String className)
+ throws ClassNotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Creates a new instance of the class represented by this {@code Class}
+ * object. The class is instantiated as if by a {@code new}
+ * expression with an empty argument list. The class is initialized if it
+ * has not already been initialized.
+ *
+ * Note that this method propagates any exception thrown by the
+ * nullary constructor, including a checked exception. Use of
+ * this method effectively bypasses the compile-time exception
+ * checking that would otherwise be performed by the compiler.
+ * The {@link
+ * java.lang.reflect.Constructor#newInstance(java.lang.Object...)
+ * Constructor.newInstance} method avoids this problem by wrapping
+ * any exception thrown by the constructor in a (checked) {@link
+ * java.lang.reflect.InvocationTargetException}.
+ *
+ * @return a newly allocated instance of the class represented by this
+ * object.
+ * @exception IllegalAccessException if the class or its nullary
+ * constructor is not accessible.
+ * @exception InstantiationException
+ * if this {@code Class} represents an abstract class,
+ * an interface, an array class, a primitive type, or void;
+ * or if the class has no nullary constructor;
+ * or if the instantiation fails for some other reason.
+ * @exception ExceptionInInitializerError if the initialization
+ * provoked by this method fails.
+ * @exception SecurityException
+ * If a security manager, s, is present and any of the
+ * following conditions is met:
+ *
+ * Specifically, if this {@code Class} object represents a
+ * declared class, this method returns {@code true} if the specified
+ * {@code Object} argument is an instance of the represented class (or
+ * of any of its subclasses); it returns {@code false} otherwise. If
+ * this {@code Class} object represents an array class, this method
+ * returns {@code true} if the specified {@code Object} argument
+ * can be converted to an object of the array class by an identity
+ * conversion or by a widening reference conversion; it returns
+ * {@code false} otherwise. If this {@code Class} object
+ * represents an interface, this method returns {@code true} if the
+ * class or any superclass of the specified {@code Object} argument
+ * implements this interface; it returns {@code false} otherwise. If
+ * this {@code Class} object represents a primitive type, this method
+ * returns {@code false}.
+ *
+ * @param obj the object to check
+ * @return true if {@code obj} is an instance of this class
+ *
+ * @since JDK1.1
+ */
+ public native boolean isInstance(Object obj);
+
+
+ /**
+ * Determines if the class or interface represented by this
+ * {@code Class} object is either the same as, or is a superclass or
+ * superinterface of, the class or interface represented by the specified
+ * {@code Class} parameter. It returns {@code true} if so;
+ * otherwise it returns {@code false}. If this {@code Class}
+ * object represents a primitive type, this method returns
+ * {@code true} if the specified {@code Class} parameter is
+ * exactly this {@code Class} object; otherwise it returns
+ * {@code false}.
+ *
+ * Specifically, this method tests whether the type represented by the
+ * specified {@code Class} parameter can be converted to the type
+ * represented by this {@code Class} object via an identity conversion
+ * or via a widening reference conversion. See The Java Language
+ * Specification, sections 5.1.1 and 5.1.4 , for details.
+ *
+ * @param cls the {@code Class} object to be checked
+ * @return the {@code boolean} value indicating whether objects of the
+ * type {@code cls} can be assigned to objects of this class
+ * @exception NullPointerException if the specified Class parameter is
+ * null.
+ * @since JDK1.1
+ */
+ public native boolean isAssignableFrom(Class> cls);
+
+
+ /**
+ * Determines if the specified {@code Class} object represents an
+ * interface type.
+ *
+ * @return {@code true} if this object represents an interface;
+ * {@code false} otherwise.
+ */
+ public native boolean isInterface();
+
+
+ /**
+ * Determines if this {@code Class} object represents an array class.
+ *
+ * @return {@code true} if this object represents an array class;
+ * {@code false} otherwise.
+ * @since JDK1.1
+ */
+ public native boolean isArray();
+
+
+ /**
+ * Determines if the specified {@code Class} object represents a
+ * primitive type.
+ *
+ * There are nine predefined {@code Class} objects to represent
+ * the eight primitive types and void. These are created by the Java
+ * Virtual Machine, and have the same names as the primitive types that
+ * they represent, namely {@code boolean}, {@code byte},
+ * {@code char}, {@code short}, {@code int},
+ * {@code long}, {@code float}, and {@code double}.
+ *
+ * These objects may only be accessed via the following public static
+ * final variables, and are the only {@code Class} objects for which
+ * this method returns {@code true}.
+ *
+ * @return true if and only if this class represents a primitive type
+ *
+ * @see java.lang.Boolean#TYPE
+ * @see java.lang.Character#TYPE
+ * @see java.lang.Byte#TYPE
+ * @see java.lang.Short#TYPE
+ * @see java.lang.Integer#TYPE
+ * @see java.lang.Long#TYPE
+ * @see java.lang.Float#TYPE
+ * @see java.lang.Double#TYPE
+ * @see java.lang.Void#TYPE
+ * @since JDK1.1
+ */
+ public native boolean isPrimitive();
+
+ /**
+ * Returns true if this {@code Class} object represents an annotation
+ * type. Note that if this method returns true, {@link #isInterface()}
+ * would also return true, as all annotation types are also interfaces.
+ *
+ * @return {@code true} if this class object represents an annotation
+ * type; {@code false} otherwise
+ * @since 1.5
+ */
+ public boolean isAnnotation() {
+ return (getModifiers() & ANNOTATION) != 0;
+ }
+
+ /**
+ * Returns {@code true} if this class is a synthetic class;
+ * returns {@code false} otherwise.
+ * @return {@code true} if and only if this class is a synthetic class as
+ * defined by the Java Language Specification.
+ * @since 1.5
+ */
+ public boolean isSynthetic() {
+ return (getModifiers() & SYNTHETIC) != 0;
+ }
+
+ /**
+ * Returns the name of the entity (class, interface, array class,
+ * primitive type, or void) represented by this {@code Class} object,
+ * as a {@code String}.
+ *
+ * If this class object represents a reference type that is not an
+ * array type then the binary name of the class is returned, as specified
+ * by
+ * The Java™ Language Specification.
+ *
+ * If this class object represents a primitive type or void, then the
+ * name returned is a {@code String} equal to the Java language
+ * keyword corresponding to the primitive type or void.
+ *
+ * If this class object represents a class of arrays, then the internal
+ * form of the name consists of the name of the element type preceded by
+ * one or more '{@code [}' characters representing the depth of the array
+ * nesting. The encoding of element type names is as follows:
+ *
+ * The class or interface name classname is the binary name of
+ * the class specified above.
+ *
+ * Examples:
+ * If the underlying class is an array class, then its
+ * {@code public}, {@code private} and {@code protected}
+ * modifiers are the same as those of its component type. If this
+ * {@code Class} represents a primitive type or void, its
+ * {@code public} modifier is always {@code true}, and its
+ * {@code protected} and {@code private} modifiers are always
+ * {@code false}. If this object represents an array class, a
+ * primitive type or void, then its {@code final} modifier is always
+ * {@code true} and its interface modifier is always
+ * {@code false}. The values of its other modifiers are not determined
+ * by this specification.
+ *
+ * The modifier encodings are defined in The Java Virtual Machine
+ * Specification, table 4.1.
+ *
+ * @return the {@code int} representing the modifiers for this class
+ * @see java.lang.reflect.Modifier
+ * @since JDK1.1
+ */
+ public native int getModifiers();
+
+
+ /**
+ * Returns the simple name of the underlying class as given in the
+ * source code. Returns an empty string if the underlying class is
+ * anonymous.
+ *
+ * The simple name of an array is the simple name of the
+ * component type with "[]" appended. In particular the simple
+ * name of an array whose component type is anonymous is "[]".
+ *
+ * @return the simple name of the underlying class
+ * @since 1.5
+ */
+ public String getSimpleName() {
+ throw new UnsupportedOperationException();
+//// if (isArray())
+//// return getComponentType().getSimpleName()+"[]";
+////
+//// String simpleName = getSimpleBinaryName();
+//// if (simpleName == null) { // top level class
+//// simpleName = getName();
+//// return simpleName.substring(simpleName.lastIndexOf(".")+1); // strip the package name
+//// }
+//// // According to JLS3 "Binary Compatibility" (13.1) the binary
+//// // name of non-package classes (not top level) is the binary
+//// // name of the immediately enclosing class followed by a '$' followed by:
+//// // (for nested and inner classes): the simple name.
+//// // (for local classes): 1 or more digits followed by the simple name.
+//// // (for anonymous classes): 1 or more digits.
+////
+//// // Since getSimpleBinaryName() will strip the binary name of
+//// // the immediatly enclosing class, we are now looking at a
+//// // string that matches the regular expression "\$[0-9]*"
+//// // followed by a simple name (considering the simple of an
+//// // anonymous class to be the empty string).
+////
+//// // Remove leading "\$[0-9]*" from the name
+//// int length = simpleName.length();
+//// if (length < 1 || simpleName.charAt(0) != '$')
+//// throw new InternalError("Malformed class name");
+//// int index = 1;
+//// while (index < length && isAsciiDigit(simpleName.charAt(index)))
+//// index++;
+//// // Eventually, this is the empty string iff this is an anonymous class
+//// return simpleName.substring(index);
+ }
+
+ /**
+ * Character.isDigit answers {@code true} to some non-ascii
+ * digits. This one does not.
+ */
+ private static boolean isAsciiDigit(char c) {
+ return '0' <= c && c <= '9';
+ }
+
+ /**
+ * Returns the canonical name of the underlying class as
+ * defined by the Java Language Specification. Returns null if
+ * the underlying class does not have a canonical name (i.e., if
+ * it is a local or anonymous class or an array whose component
+ * type does not have a canonical name).
+ * @return the canonical name of the underlying class if it exists, and
+ * {@code null} otherwise.
+ * @since 1.5
+ */
+ public String getCanonicalName() {
+ throw new UnsupportedOperationException();
+// if (isArray()) {
+// String canonicalName = getComponentType().getCanonicalName();
+// if (canonicalName != null)
+// return canonicalName + "[]";
+// else
+// return null;
+// }
+// if (isLocalOrAnonymousClass())
+// return null;
+// Class> enclosingClass = getEnclosingClass();
+// if (enclosingClass == null) { // top level class
+// return getName();
+// } else {
+// String enclosingName = enclosingClass.getCanonicalName();
+// if (enclosingName == null)
+// return null;
+// return enclosingName + "." + getSimpleName();
+// }
+ }
+
+ /**
+ * Finds a resource with a given name. The rules for searching resources
+ * associated with a given class are implemented by the defining
+ * {@linkplain ClassLoader class loader} of the class. This method
+ * delegates to this object's class loader. If this object was loaded by
+ * the bootstrap class loader, the method delegates to {@link
+ * ClassLoader#getSystemResourceAsStream}.
+ *
+ * Before delegation, an absolute resource name is constructed from the
+ * given resource name using this algorithm:
+ *
+ * Where the {@code modified_package_name} is the package name of this
+ * object with {@code '/'} substituted for {@code '.'}
+ * ('\u002e').
+ *
+ * Before delegation, an absolute resource name is constructed from the
+ * given resource name using this algorithm:
+ *
+ * Where the {@code modified_package_name} is the package name of this
+ * object with {@code '/'} substituted for {@code '.'}
+ * ('\u002e').
+ *
+ * This method is useful when a client needs to "narrow" the type of
+ * a {@code Class} object to pass it to an API that restricts the
+ * {@code Class} objects that it is willing to accept. A cast would
+ * generate a compile-time warning, as the correctness of the cast
+ * could not be checked at runtime (because generic types are implemented
+ * by erasure).
+ *
+ * @return this {@code Class} object, cast to represent a subclass of
+ * the specified class object.
+ * @throws ClassCastException if this {@code Class} object does not
+ * represent a subclass of the specified class (here "subclass" includes
+ * the class itself).
+ * @since 1.5
+ */
+ public Class extends U> asSubclass(Class clazz) {
+ if (clazz.isAssignableFrom(this))
+ return (Class extends U>) this;
+ else
+ throw new ClassCastException(this.toString());
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.5
+ */
+ public A getAnnotation(Class annotationClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.5
+ */
+ public boolean isAnnotationPresent(
+ Class extends Annotation> annotationClass) {
+ if (annotationClass == null)
+ throw new NullPointerException();
+
+ return getAnnotation(annotationClass) != null;
+ }
+
+
+ /**
+ * @since 1.5
+ */
+ public Annotation[] getAnnotations() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @since 1.5
+ */
+ public Annotation[] getDeclaredAnnotations() {
+ throw new UnsupportedOperationException();
+ }
+
+ static Class getPrimitiveClass(String type) {
+ // XXX
+ return Object.class;
+ }
+
+ public boolean desiredAssertionStatus() {
+ return false;
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/ClassCastException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/ClassCastException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that the code has attempted to cast an object
+ * to a subclass of which it is not an instance. For example, the
+ * following code generates a
+ * but no definition for the class with the specified name could be found.
+ *
+ * As of release 1.4, this exception has been retrofitted to conform to
+ * the general purpose exception-chaining mechanism. The "optional exception
+ * that was raised while loading the class" that may be provided at
+ * construction time and accessed via the {@link #getException()} method is
+ * now known as the cause, and may be accessed via the {@link
+ * Throwable#getCause()} method, as well as the aforementioned "legacy method."
+ *
+ * @author unascribed
+ * @see java.lang.Class#forName(java.lang.String)
+ * @see java.lang.ClassLoader#findSystemClass(java.lang.String)
+ * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
+ * @since JDK1.0
+ */
+public class ClassNotFoundException extends ReflectiveOperationException {
+ /**
+ * use serialVersionUID from JDK 1.1.X for interoperability
+ */
+ private static final long serialVersionUID = 9176873029745254542L;
+
+ /**
+ * This field holds the exception ex if the
+ * ClassNotFoundException(String s, Throwable ex) constructor was
+ * used to instantiate the object
+ * @serial
+ * @since 1.2
+ */
+ private Throwable ex;
+
+ /**
+ * Constructs a This method predates the general-purpose exception chaining facility.
+ * The {@link Throwable#getCause()} method is now the preferred means of
+ * obtaining this information.
+ *
+ * @return the
+ * Applications that override the
+ *
+ * Lists (and arrays) of objects that implement this interface can be sorted
+ * automatically by {@link Collections#sort(List) Collections.sort} (and
+ * {@link Arrays#sort(Object[]) Arrays.sort}). Objects that implement this
+ * interface can be used as keys in a {@linkplain SortedMap sorted map} or as
+ * elements in a {@linkplain SortedSet sorted set}, without the need to
+ * specify a {@linkplain Comparator comparator}.
+ *
+ * The natural ordering for a class C is said to be consistent
+ * with equals if and only if e1.compareTo(e2) == 0 has
+ * the same boolean value as e1.equals(e2) for every
+ * e1 and e2 of class C. Note that null
+ * is not an instance of any class, and e.compareTo(null) should
+ * throw a NullPointerException even though e.equals(null)
+ * returns false.
+ *
+ * It is strongly recommended (though not required) that natural orderings be
+ * consistent with equals. This is so because sorted sets (and sorted maps)
+ * without explicit comparators behave "strangely" when they are used with
+ * elements (or keys) whose natural ordering is inconsistent with equals. In
+ * particular, such a sorted set (or sorted map) violates the general contract
+ * for set (or map), which is defined in terms of the equals
+ * method.
+ *
+ * For example, if one adds two keys a and b such that
+ * (!a.equals(b) && a.compareTo(b) == 0) to a sorted
+ * set that does not use an explicit comparator, the second add
+ * operation returns false (and the size of the sorted set does not increase)
+ * because a and b are equivalent from the sorted set's
+ * perspective.
+ *
+ * Virtually all Java core classes that implement Comparable have natural
+ * orderings that are consistent with equals. One exception is
+ * java.math.BigDecimal, whose natural ordering equates
+ * BigDecimal objects with equal values and different precisions
+ * (such as 4.0 and 4.00).
+ *
+ * For the mathematically inclined, the relation that defines
+ * the natural ordering on a given class C is:
+ *
+ * This interface is a member of the
+ *
+ * Java Collections Framework.
+ *
+ * @param The implementor must ensure sgn(x.compareTo(y)) ==
+ * -sgn(y.compareTo(x)) for all x and y. (This
+ * implies that x.compareTo(y) must throw an exception iff
+ * y.compareTo(x) throws an exception.)
+ *
+ * The implementor must also ensure that the relation is transitive:
+ * (x.compareTo(y)>0 && y.compareTo(z)>0) implies
+ * x.compareTo(z)>0.
+ *
+ * Finally, the implementor must ensure that x.compareTo(y)==0
+ * implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for
+ * all z.
+ *
+ * It is strongly recommended, but not strictly required that
+ * (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any
+ * class that implements the Comparable interface and violates
+ * this condition should clearly indicate this fact. The recommended
+ * language is "Note: this class has a natural ordering that is
+ * inconsistent with equals."
+ *
+ * In the foregoing description, the notation
+ * sgn(expression) designates the mathematical
+ * signum function, which is defined to return one of -1,
+ * 0, or 1 according to whether the value of
+ * expression is negative, zero or positive.
+ *
+ * @param o the object to be compared.
+ * @return a negative integer, zero, or a positive integer as this object
+ * is less than, equal to, or greater than the specified object.
+ *
+ * @throws NullPointerException if the specified object is null
+ * @throws ClassCastException if the specified object's type prevents it
+ * from being compared to this object.
+ */
+ public int compareTo(T o);
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Deprecated.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Deprecated.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+
+/**
+ * A program element annotated @Deprecated is one that programmers
+ * are discouraged from using, typically because it is dangerous,
+ * or because a better alternative exists. Compilers warn when a
+ * deprecated program element is used or overridden in non-deprecated code.
+ *
+ * @author Neal Gafter
+ * @since 1.5
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
+public @interface Deprecated {
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Double.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Double.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,988 @@
+/*
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The {@code Double} class wraps a value of the primitive type
+ * {@code double} in an object. An object of type
+ * {@code Double} contains a single field whose type is
+ * {@code double}.
+ *
+ * In addition, this class provides several methods for converting a
+ * {@code double} to a {@code String} and a
+ * {@code String} to a {@code double}, as well as other
+ * constants and methods useful when dealing with a
+ * {@code double}.
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Joseph D. Darcy
+ * @since JDK1.0
+ */
+public final class Double extends Number implements Comparable To create localized string representations of a floating-point
+ * value, use subclasses of {@link java.text.NumberFormat}.
+ *
+ * @param d the {@code double} to be converted.
+ * @return a string representation of the argument.
+ */
+ public static String toString(double d) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns a hexadecimal string representation of the
+ * {@code double} argument. All characters mentioned below
+ * are ASCII characters.
+ *
+ * If {@code s} is {@code null}, then a
+ * {@code NullPointerException} is thrown.
+ *
+ * Leading and trailing whitespace characters in {@code s}
+ * are ignored. Whitespace is removed as if by the {@link
+ * String#trim} method; that is, both ASCII space and control
+ * characters are removed. The rest of {@code s} should
+ * constitute a FloatValue as described by the lexical
+ * syntax rules:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To interpret localized string representations of a
+ * floating-point value, use subclasses of {@link
+ * java.text.NumberFormat}.
+ *
+ * Note that trailing format specifiers, specifiers that
+ * determine the type of a floating-point literal
+ * ({@code 1.0f} is a {@code float} value;
+ * {@code 1.0d} is a {@code double} value), do
+ * not influence the results of this method. In other
+ * words, the numerical value of the input string is converted
+ * directly to the target floating-point type. The two-step
+ * sequence of conversions, string to {@code float} followed
+ * by {@code float} to {@code double}, is not
+ * equivalent to converting a string directly to
+ * {@code double}. For example, the {@code float}
+ * literal {@code 0.1f} is equal to the {@code double}
+ * value {@code 0.10000000149011612}; the {@code float}
+ * literal {@code 0.1f} represents a different numerical
+ * value than the {@code double} literal
+ * {@code 0.1}. (The numerical value 0.1 cannot be exactly
+ * represented in a binary floating-point number.)
+ *
+ * To avoid calling this method on an invalid string and having
+ * a {@code NumberFormatException} be thrown, the regular
+ * expression below can be used to screen the input string:
+ *
+ * Note that in most cases, for two instances of class
+ * {@code Double}, {@code d1} and {@code d2}, the
+ * value of {@code d1.equals(d2)} is {@code true} if and
+ * only if
+ *
+ * also has the value {@code true}. However, there are two
+ * exceptions:
+ * Bit 63 (the bit that is selected by the mask
+ * {@code 0x8000000000000000L}) represents the sign of the
+ * floating-point number. Bits
+ * 62-52 (the bits that are selected by the mask
+ * {@code 0x7ff0000000000000L}) represent the exponent. Bits 51-0
+ * (the bits that are selected by the mask
+ * {@code 0x000fffffffffffffL}) represent the significand
+ * (sometimes called the mantissa) of the floating-point number.
+ *
+ * If the argument is positive infinity, the result is
+ * {@code 0x7ff0000000000000L}.
+ *
+ * If the argument is negative infinity, the result is
+ * {@code 0xfff0000000000000L}.
+ *
+ * If the argument is NaN, the result is
+ * {@code 0x7ff8000000000000L}.
+ *
+ * In all cases, the result is a {@code long} integer that, when
+ * given to the {@link #longBitsToDouble(long)} method, will produce a
+ * floating-point value the same as the argument to
+ * {@code doubleToLongBits} (except all NaN values are
+ * collapsed to a single "canonical" NaN value).
+ *
+ * @param value a {@code double} precision floating-point number.
+ * @return the bits that represent the floating-point number.
+ */
+ public static long doubleToLongBits(double value) {
+ throw new UnsupportedOperationException();
+// long result = doubleToRawLongBits(value);
+// // Check for NaN based on values of bit fields, maximum
+// // exponent and nonzero significand.
+// if ( ((result & DoubleConsts.EXP_BIT_MASK) ==
+// DoubleConsts.EXP_BIT_MASK) &&
+// (result & DoubleConsts.SIGNIF_BIT_MASK) != 0L)
+// result = 0x7ff8000000000000L;
+// return result;
+ }
+
+ /**
+ * Returns a representation of the specified floating-point value
+ * according to the IEEE 754 floating-point "double
+ * format" bit layout, preserving Not-a-Number (NaN) values.
+ *
+ * Bit 63 (the bit that is selected by the mask
+ * {@code 0x8000000000000000L}) represents the sign of the
+ * floating-point number. Bits
+ * 62-52 (the bits that are selected by the mask
+ * {@code 0x7ff0000000000000L}) represent the exponent. Bits 51-0
+ * (the bits that are selected by the mask
+ * {@code 0x000fffffffffffffL}) represent the significand
+ * (sometimes called the mantissa) of the floating-point number.
+ *
+ * If the argument is positive infinity, the result is
+ * {@code 0x7ff0000000000000L}.
+ *
+ * If the argument is negative infinity, the result is
+ * {@code 0xfff0000000000000L}.
+ *
+ * If the argument is NaN, the result is the {@code long}
+ * integer representing the actual NaN value. Unlike the
+ * {@code doubleToLongBits} method,
+ * {@code doubleToRawLongBits} does not collapse all the bit
+ * patterns encoding a NaN to a single "canonical" NaN
+ * value.
+ *
+ * In all cases, the result is a {@code long} integer that,
+ * when given to the {@link #longBitsToDouble(long)} method, will
+ * produce a floating-point value the same as the argument to
+ * {@code doubleToRawLongBits}.
+ *
+ * @param value a {@code double} precision floating-point number.
+ * @return the bits that represent the floating-point number.
+ * @since 1.3
+ */
+ public static native long doubleToRawLongBits(double value);
+
+ /**
+ * Returns the {@code double} value corresponding to a given
+ * bit representation.
+ * The argument is considered to be a representation of a
+ * floating-point value according to the IEEE 754 floating-point
+ * "double format" bit layout.
+ *
+ * If the argument is {@code 0x7ff0000000000000L}, the result
+ * is positive infinity.
+ *
+ * If the argument is {@code 0xfff0000000000000L}, the result
+ * is negative infinity.
+ *
+ * If the argument is any value in the range
+ * {@code 0x7ff0000000000001L} through
+ * {@code 0x7fffffffffffffffL} or in the range
+ * {@code 0xfff0000000000001L} through
+ * {@code 0xffffffffffffffffL}, the result is a NaN. No IEEE
+ * 754 floating-point operation provided by Java can distinguish
+ * between two NaN values of the same type with different bit
+ * patterns. Distinct values of NaN are only distinguishable by
+ * use of the {@code Double.doubleToRawLongBits} method.
+ *
+ * In all other cases, let s, e, and m be three
+ * values that can be computed from the argument:
+ *
+ * Note that this method may not be able to return a
+ * {@code double} NaN with exactly same bit pattern as the
+ * {@code long} argument. IEEE 754 distinguishes between two
+ * kinds of NaNs, quiet NaNs and signaling NaNs. The
+ * differences between the two kinds of NaN are generally not
+ * visible in Java. Arithmetic operations on signaling NaNs turn
+ * them into quiet NaNs with a different, but often similar, bit
+ * pattern. However, on some processors merely copying a
+ * signaling NaN also performs that conversion. In particular,
+ * copying a signaling NaN to return it to the calling method
+ * may perform this conversion. So {@code longBitsToDouble}
+ * may not be able to return a {@code double} with a
+ * signaling NaN bit pattern. Consequently, for some
+ * {@code long} values,
+ * {@code doubleToRawLongBits(longBitsToDouble(start))} may
+ * not equal {@code start}. Moreover, which
+ * particular bit patterns represent signaling NaNs is platform
+ * dependent; although all NaN bit patterns, quiet or signaling,
+ * must be in the NaN range identified above.
+ *
+ * @param bits any {@code long} integer.
+ * @return the {@code double} floating-point value with the same
+ * bit pattern.
+ */
+ public static native double longBitsToDouble(long bits);
+
+ /**
+ * Compares two {@code Double} objects numerically. There
+ * are two ways in which comparisons performed by this method
+ * differ from those performed by the Java language numerical
+ * comparison operators ({@code <, <=, ==, >=, >})
+ * when applied to primitive {@code double} values:
+ * Note that when using an enumeration type as the type of a set
+ * or as the type of the keys in a map, specialized and efficient
+ * {@linkplain java.util.EnumSet set} and {@linkplain
+ * java.util.EnumMap map} implementations are available.
+ *
+ * @param Note that for a particular enum type {@code T}, the
+ * implicitly declared {@code public static T valueOf(String)}
+ * method on that enum may be used instead of this method to map
+ * from a name to the corresponding enum constant. All the
+ * constants of an enum type can be obtained by calling the
+ * implicit {@code public static T[] values()} method of that
+ * type.
+ *
+ * @param
+ * A method is not required to declare in its {@code throws}
+ * clause any subclasses of {@code Error} that might be thrown
+ * during the execution of the method but not caught, since these
+ * errors are abnormal conditions that should never occur.
+ *
+ * That is, {@code Error} and its subclasses are regarded as unchecked
+ * exceptions for the purposes of compile-time checking of exceptions.
+ *
+ * @author Frank Yellin
+ * @see java.lang.ThreadDeath
+ * @jls 11.2 Compile-Time Checking of Exceptions
+ * @since JDK1.0
+ */
+public class Error extends Throwable {
+ static final long serialVersionUID = 4980196508277280342L;
+
+ /**
+ * Constructs a new error with {@code null} as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
+ public Error() {
+ super();
+ }
+
+ /**
+ * Constructs a new error with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public Error(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new error with the specified detail message and
+ * cause. Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this error's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public Error(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new error with the specified cause and a detail
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
+ * This constructor is useful for errors that are little more than
+ * wrappers for other throwables.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public Error(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new error with the specified detail message,
+ * cause, suppression enabled or disabled, and writable stack
+ * trace enabled or disabled.
+ *
+ * @param message the detail message.
+ * @param cause the cause. (A {@code null} value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @param enableSuppression whether or not suppression is enabled
+ * or disabled
+ * @param writableStackTrace whether or not the stack trace should
+ * be writable
+ *
+ * @since 1.7
+ */
+ protected Error(String message, Throwable cause,
+ boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Exception.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Exception.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The class {@code Exception} and its subclasses are a form of
+ * {@code Throwable} that indicates conditions that a reasonable
+ * application might want to catch.
+ *
+ * The class {@code Exception} and any subclasses that are not also
+ * subclasses of {@link RuntimeException} are checked
+ * exceptions. Checked exceptions need to be declared in a
+ * method or constructor's {@code throws} clause if they can be thrown
+ * by the execution of the method or constructor and propagate outside
+ * the method or constructor boundary.
+ *
+ * @author Frank Yellin
+ * @see java.lang.Error
+ * @jls 11.2 Compile-Time Checking of Exceptions
+ * @since JDK1.0
+ */
+public class Exception extends Throwable {
+ static final long serialVersionUID = -3387516993124229948L;
+
+ /**
+ * Constructs a new exception with {@code null} as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
+ public Exception() {
+ super();
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public Exception(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause. Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public Exception(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message,
+ * cause, suppression enabled or disabled, and writable stack
+ * trace enabled or disabled.
+ *
+ * @param message the detail message.
+ * @param cause the cause. (A {@code null} value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @param enableSuppression whether or not suppression is enabled
+ * or disabled
+ * @param writableStackTrace whether or not the stack trace should
+ * be writable
+ * @since 1.7
+ */
+ protected Exception(String message, Throwable cause,
+ boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Float.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Float.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,892 @@
+/*
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The {@code Float} class wraps a value of primitive type
+ * {@code float} in an object. An object of type
+ * {@code Float} contains a single field whose type is
+ * {@code float}.
+ *
+ * In addition, this class provides several methods for converting a
+ * {@code float} to a {@code String} and a
+ * {@code String} to a {@code float}, as well as other
+ * constants and methods useful when dealing with a
+ * {@code float}.
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Joseph D. Darcy
+ * @since JDK1.0
+ */
+public final class Float extends Number implements Comparable To create localized string representations of a floating-point
+ * value, use subclasses of {@link java.text.NumberFormat}.
+ *
+ * @param f the float to be converted.
+ * @return a string representation of the argument.
+ */
+ public static String toString(float f) {
+ throw new UnsupportedOperationException();
+// return new FloatingDecimal(f).toJavaFormatString();
+ }
+
+ /**
+ * Returns a hexadecimal string representation of the
+ * {@code float} argument. All characters mentioned below are
+ * ASCII characters.
+ *
+ * If {@code s} is {@code null}, then a
+ * {@code NullPointerException} is thrown.
+ *
+ * Leading and trailing whitespace characters in {@code s}
+ * are ignored. Whitespace is removed as if by the {@link
+ * String#trim} method; that is, both ASCII space and control
+ * characters are removed. The rest of {@code s} should
+ * constitute a FloatValue as described by the lexical
+ * syntax rules:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * To interpret localized string representations of a
+ * floating-point value, use subclasses of {@link
+ * java.text.NumberFormat}.
+ *
+ * Note that trailing format specifiers, specifiers that
+ * determine the type of a floating-point literal
+ * ({@code 1.0f} is a {@code float} value;
+ * {@code 1.0d} is a {@code double} value), do
+ * not influence the results of this method. In other
+ * words, the numerical value of the input string is converted
+ * directly to the target floating-point type. In general, the
+ * two-step sequence of conversions, string to {@code double}
+ * followed by {@code double} to {@code float}, is
+ * not equivalent to converting a string directly to
+ * {@code float}. For example, if first converted to an
+ * intermediate {@code double} and then to
+ * {@code float}, the string To avoid calling this method on an invalid string and having
+ * a {@code NumberFormatException} be thrown, the documentation
+ * for {@link Double#valueOf Double.valueOf} lists a regular
+ * expression which can be used to screen the input.
+ *
+ * @param s the string to be parsed.
+ * @return a {@code Float} object holding the value
+ * represented by the {@code String} argument.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable number.
+ */
+ public static Float valueOf(String s) throws NumberFormatException {
+ throw new UnsupportedOperationException();
+// return new Float(FloatingDecimal.readJavaFormatString(s).floatValue());
+ }
+
+ /**
+ * Returns a {@code Float} instance representing the specified
+ * {@code float} value.
+ * If a new {@code Float} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Float(float)}, as this method is likely to yield
+ * significantly better space and time performance by caching
+ * frequently requested values.
+ *
+ * @param f a float value.
+ * @return a {@code Float} instance representing {@code f}.
+ * @since 1.5
+ */
+ public static Float valueOf(float f) {
+ return new Float(f);
+ }
+
+ /**
+ * Returns a new {@code float} initialized to the value
+ * represented by the specified {@code String}, as performed
+ * by the {@code valueOf} method of class {@code Float}.
+ *
+ * @param s the string to be parsed.
+ * @return the {@code float} value represented by the string
+ * argument.
+ * @throws NullPointerException if the string is null
+ * @throws NumberFormatException if the string does not contain a
+ * parsable {@code float}.
+ * @see java.lang.Float#valueOf(String)
+ * @since 1.2
+ */
+ public static float parseFloat(String s) throws NumberFormatException {
+ throw new UnsupportedOperationException();
+// return FloatingDecimal.readJavaFormatString(s).floatValue();
+ }
+
+ /**
+ * Returns {@code true} if the specified number is a
+ * Not-a-Number (NaN) value, {@code false} otherwise.
+ *
+ * @param v the value to be tested.
+ * @return {@code true} if the argument is NaN;
+ * {@code false} otherwise.
+ */
+ static public boolean isNaN(float v) {
+ return (v != v);
+ }
+
+ /**
+ * Returns {@code true} if the specified number is infinitely
+ * large in magnitude, {@code false} otherwise.
+ *
+ * @param v the value to be tested.
+ * @return {@code true} if the argument is positive infinity or
+ * negative infinity; {@code false} otherwise.
+ */
+ static public boolean isInfinite(float v) {
+ return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
+ }
+
+ /**
+ * The value of the Float.
+ *
+ * @serial
+ */
+ private final float value;
+
+ /**
+ * Constructs a newly allocated {@code Float} object that
+ * represents the primitive {@code float} argument.
+ *
+ * @param value the value to be represented by the {@code Float}.
+ */
+ public Float(float value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Float} object that
+ * represents the argument converted to type {@code float}.
+ *
+ * @param value the value to be represented by the {@code Float}.
+ */
+ public Float(double value) {
+ this.value = (float)value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Float} object that
+ * represents the floating-point value of type {@code float}
+ * represented by the string. The string is converted to a
+ * {@code float} value as if by the {@code valueOf} method.
+ *
+ * @param s a string to be converted to a {@code Float}.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable number.
+ * @see java.lang.Float#valueOf(java.lang.String)
+ */
+ public Float(String s) throws NumberFormatException {
+ // REMIND: this is inefficient
+ this(valueOf(s).floatValue());
+ }
+
+ /**
+ * Returns {@code true} if this {@code Float} value is a
+ * Not-a-Number (NaN), {@code false} otherwise.
+ *
+ * @return {@code true} if the value represented by this object is
+ * NaN; {@code false} otherwise.
+ */
+ public boolean isNaN() {
+ return isNaN(value);
+ }
+
+ /**
+ * Returns {@code true} if this {@code Float} value is
+ * infinitely large in magnitude, {@code false} otherwise.
+ *
+ * @return {@code true} if the value represented by this object is
+ * positive infinity or negative infinity;
+ * {@code false} otherwise.
+ */
+ public boolean isInfinite() {
+ return isInfinite(value);
+ }
+
+ /**
+ * Returns a string representation of this {@code Float} object.
+ * The primitive {@code float} value represented by this object
+ * is converted to a {@code String} exactly as if by the method
+ * {@code toString} of one argument.
+ *
+ * @return a {@code String} representation of this object.
+ * @see java.lang.Float#toString(float)
+ */
+ public String toString() {
+ return Float.toString(value);
+ }
+
+ /**
+ * Returns the value of this {@code Float} as a {@code byte} (by
+ * casting to a {@code byte}).
+ *
+ * @return the {@code float} value represented by this object
+ * converted to type {@code byte}
+ */
+ public byte byteValue() {
+ return (byte)value;
+ }
+
+ /**
+ * Returns the value of this {@code Float} as a {@code short} (by
+ * casting to a {@code short}).
+ *
+ * @return the {@code float} value represented by this object
+ * converted to type {@code short}
+ * @since JDK1.1
+ */
+ public short shortValue() {
+ return (short)value;
+ }
+
+ /**
+ * Returns the value of this {@code Float} as an {@code int} (by
+ * casting to type {@code int}).
+ *
+ * @return the {@code float} value represented by this object
+ * converted to type {@code int}
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns value of this {@code Float} as a {@code long} (by
+ * casting to type {@code long}).
+ *
+ * @return the {@code float} value represented by this object
+ * converted to type {@code long}
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the {@code float} value of this {@code Float} object.
+ *
+ * @return the {@code float} value represented by this object
+ */
+ public float floatValue() {
+ return value;
+ }
+
+ /**
+ * Returns the {@code double} value of this {@code Float} object.
+ *
+ * @return the {@code float} value represented by this
+ * object is converted to type {@code double} and the
+ * result of the conversion is returned.
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a hash code for this {@code Float} object. The
+ * result is the integer bit representation, exactly as produced
+ * by the method {@link #floatToIntBits(float)}, of the primitive
+ * {@code float} value represented by this {@code Float}
+ * object.
+ *
+ * @return a hash code value for this object.
+ */
+ public int hashCode() {
+ return floatToIntBits(value);
+ }
+
+ /**
+
+ * Compares this object against the specified object. The result
+ * is {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Float} object that
+ * represents a {@code float} with the same value as the
+ * {@code float} represented by this object. For this
+ * purpose, two {@code float} values are considered to be the
+ * same if and only if the method {@link #floatToIntBits(float)}
+ * returns the identical {@code int} value when applied to
+ * each.
+ *
+ * Note that in most cases, for two instances of class
+ * {@code Float}, {@code f1} and {@code f2}, the value
+ * of {@code f1.equals(f2)} is {@code true} if and only if
+ *
+ * also has the value {@code true}. However, there are two exceptions:
+ * Bit 31 (the bit that is selected by the mask
+ * {@code 0x80000000}) represents the sign of the floating-point
+ * number.
+ * Bits 30-23 (the bits that are selected by the mask
+ * {@code 0x7f800000}) represent the exponent.
+ * Bits 22-0 (the bits that are selected by the mask
+ * {@code 0x007fffff}) represent the significand (sometimes called
+ * the mantissa) of the floating-point number.
+ *
+ * If the argument is positive infinity, the result is
+ * {@code 0x7f800000}.
+ *
+ * If the argument is negative infinity, the result is
+ * {@code 0xff800000}.
+ *
+ * If the argument is NaN, the result is {@code 0x7fc00000}.
+ *
+ * In all cases, the result is an integer that, when given to the
+ * {@link #intBitsToFloat(int)} method, will produce a floating-point
+ * value the same as the argument to {@code floatToIntBits}
+ * (except all NaN values are collapsed to a single
+ * "canonical" NaN value).
+ *
+ * @param value a floating-point number.
+ * @return the bits that represent the floating-point number.
+ */
+ public static int floatToIntBits(float value) {
+ throw new UnsupportedOperationException();
+// int result = floatToRawIntBits(value);
+// // Check for NaN based on values of bit fields, maximum
+// // exponent and nonzero significand.
+// if ( ((result & FloatConsts.EXP_BIT_MASK) ==
+// FloatConsts.EXP_BIT_MASK) &&
+// (result & FloatConsts.SIGNIF_BIT_MASK) != 0)
+// result = 0x7fc00000;
+// return result;
+ }
+
+ /**
+ * Returns a representation of the specified floating-point value
+ * according to the IEEE 754 floating-point "single format" bit
+ * layout, preserving Not-a-Number (NaN) values.
+ *
+ * Bit 31 (the bit that is selected by the mask
+ * {@code 0x80000000}) represents the sign of the floating-point
+ * number.
+ * Bits 30-23 (the bits that are selected by the mask
+ * {@code 0x7f800000}) represent the exponent.
+ * Bits 22-0 (the bits that are selected by the mask
+ * {@code 0x007fffff}) represent the significand (sometimes called
+ * the mantissa) of the floating-point number.
+ *
+ * If the argument is positive infinity, the result is
+ * {@code 0x7f800000}.
+ *
+ * If the argument is negative infinity, the result is
+ * {@code 0xff800000}.
+ *
+ * If the argument is NaN, the result is the integer representing
+ * the actual NaN value. Unlike the {@code floatToIntBits}
+ * method, {@code floatToRawIntBits} does not collapse all the
+ * bit patterns encoding a NaN to a single "canonical"
+ * NaN value.
+ *
+ * In all cases, the result is an integer that, when given to the
+ * {@link #intBitsToFloat(int)} method, will produce a
+ * floating-point value the same as the argument to
+ * {@code floatToRawIntBits}.
+ *
+ * @param value a floating-point number.
+ * @return the bits that represent the floating-point number.
+ * @since 1.3
+ */
+ public static native int floatToRawIntBits(float value);
+
+ /**
+ * Returns the {@code float} value corresponding to a given
+ * bit representation.
+ * The argument is considered to be a representation of a
+ * floating-point value according to the IEEE 754 floating-point
+ * "single format" bit layout.
+ *
+ * If the argument is {@code 0x7f800000}, the result is positive
+ * infinity.
+ *
+ * If the argument is {@code 0xff800000}, the result is negative
+ * infinity.
+ *
+ * If the argument is any value in the range
+ * {@code 0x7f800001} through {@code 0x7fffffff} or in
+ * the range {@code 0xff800001} through
+ * {@code 0xffffffff}, the result is a NaN. No IEEE 754
+ * floating-point operation provided by Java can distinguish
+ * between two NaN values of the same type with different bit
+ * patterns. Distinct values of NaN are only distinguishable by
+ * use of the {@code Float.floatToRawIntBits} method.
+ *
+ * In all other cases, let s, e, and m be three
+ * values that can be computed from the argument:
+ *
+ * Note that this method may not be able to return a
+ * {@code float} NaN with exactly same bit pattern as the
+ * {@code int} argument. IEEE 754 distinguishes between two
+ * kinds of NaNs, quiet NaNs and signaling NaNs. The
+ * differences between the two kinds of NaN are generally not
+ * visible in Java. Arithmetic operations on signaling NaNs turn
+ * them into quiet NaNs with a different, but often similar, bit
+ * pattern. However, on some processors merely copying a
+ * signaling NaN also performs that conversion. In particular,
+ * copying a signaling NaN to return it to the calling method may
+ * perform this conversion. So {@code intBitsToFloat} may
+ * not be able to return a {@code float} with a signaling NaN
+ * bit pattern. Consequently, for some {@code int} values,
+ * {@code floatToRawIntBits(intBitsToFloat(start))} may
+ * not equal {@code start}. Moreover, which
+ * particular bit patterns represent signaling NaNs is platform
+ * dependent; although all NaN bit patterns, quiet or signaling,
+ * must be in the NaN range identified above.
+ *
+ * @param bits an integer.
+ * @return the {@code float} floating-point value with the same bit
+ * pattern.
+ */
+ public static native float intBitsToFloat(int bits);
+
+ /**
+ * Compares two {@code Float} objects numerically. There are
+ * two ways in which comparisons performed by this method differ
+ * from those performed by the Java language numerical comparison
+ * operators ({@code <, <=, ==, >=, >}) when
+ * applied to primitive {@code float} values:
+ *
+ * Note that the detail message associated with Note that the detail message associated with
+ * Applications can subclass this class to indicate similar exceptions.
+ *
+ * @author Frank Yellin
+ * @since JDK1.0
+ */
+public
+class IndexOutOfBoundsException extends RuntimeException {
+ private static final long serialVersionUID = 234122996006267687L;
+
+ /**
+ * Constructs an In addition, this class provides several methods for converting
+ * an {@code int} to a {@code String} and a {@code String} to an
+ * {@code int}, as well as other constants and methods useful when
+ * dealing with an {@code int}.
+ *
+ * Implementation note: The implementations of the "bit twiddling"
+ * methods (such as {@link #highestOneBit(int) highestOneBit} and
+ * {@link #numberOfTrailingZeros(int) numberOfTrailingZeros}) are
+ * based on material from Henry S. Warren, Jr.'s Hacker's
+ * Delight, (Addison Wesley, 2002).
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Josh Bloch
+ * @author Joseph D. Darcy
+ * @since JDK1.0
+ */
+public final class Integer extends Number implements Comparable If the radix is smaller than {@code Character.MIN_RADIX}
+ * or larger than {@code Character.MAX_RADIX}, then the radix
+ * {@code 10} is used instead.
+ *
+ * If the first argument is negative, the first element of the
+ * result is the ASCII minus character {@code '-'}
+ * ( The remaining characters of the result represent the magnitude
+ * of the first argument. If the magnitude is zero, it is
+ * represented by a single zero character {@code '0'}
+ * ( The unsigned integer value is the argument plus 232
+ * if the argument is negative; otherwise, it is equal to the
+ * argument. This value is converted to a string of ASCII digits
+ * in hexadecimal (base 16) with no extra leading
+ * {@code 0}s. If the unsigned magnitude is zero, it is
+ * represented by a single zero character {@code '0'}
+ * ( The unsigned integer value is the argument plus 232
+ * if the argument is negative; otherwise, it is equal to the
+ * argument. This value is converted to a string of ASCII digits
+ * in octal (base 8) with no extra leading {@code 0}s.
+ *
+ * If the unsigned magnitude is zero, it is represented by a
+ * single zero character {@code '0'}
+ * ( The unsigned integer value is the argument plus 232
+ * if the argument is negative; otherwise it is equal to the
+ * argument. This value is converted to a string of ASCII digits
+ * in binary (base 2) with no extra leading {@code 0}s.
+ * If the unsigned magnitude is zero, it is represented by a
+ * single zero character {@code '0'}
+ * ( An exception of type {@code NumberFormatException} is
+ * thrown if any of the following situations occurs:
+ * Examples:
+ * In other words, this method returns an {@code Integer}
+ * object equal to the value of:
+ *
+ * In other words, this method returns an {@code Integer}
+ * object equal to the value of:
+ *
+ * The first argument is treated as the name of a system property.
+ * System properties are accessible through the
+ * {@link java.lang.System#getProperty(java.lang.String)} method. The
+ * string value of this property is then interpreted as an integer
+ * value and an {@code Integer} object representing this value is
+ * returned. Details of possible numeric formats can be found with
+ * the definition of {@code getProperty}.
+ *
+ * If there is no property with the specified name, if the specified name
+ * is empty or {@code null}, or if the property does not have
+ * the correct numeric format, then {@code null} is returned.
+ *
+ * In other words, this method returns an {@code Integer}
+ * object equal to the value of:
+ *
+ * The first argument is treated as the name of a system property.
+ * System properties are accessible through the {@link
+ * java.lang.System#getProperty(java.lang.String)} method. The
+ * string value of this property is then interpreted as an integer
+ * value and an {@code Integer} object representing this value is
+ * returned. Details of possible numeric formats can be found with
+ * the definition of {@code getProperty}.
+ *
+ * The second argument is the default value. An {@code Integer} object
+ * that represents the value of the second argument is returned if there
+ * is no property of the specified name, if the property does not have
+ * the correct numeric format, or if the specified name is empty or
+ * {@code null}.
+ *
+ * In other words, this method returns an {@code Integer} object
+ * equal to the value of:
+ *
+ * The second argument is the default value. The default value is
+ * returned if there is no property of the specified name, if the
+ * property does not have the correct numeric format, or if the
+ * specified name is empty or {@code null}.
+ *
+ * @param nm property name.
+ * @param val default value.
+ * @return the {@code Integer} value of the property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ * @see java.lang.Integer#decode
+ */
+ public static Integer getInteger(String nm, Integer val) {
+ String v = null;
+ try {
+ v = String.getProperty(nm);
+ } catch (IllegalArgumentException e) {
+ } catch (NullPointerException e) {
+ }
+ if (v != null) {
+ try {
+ return Integer.decode(v);
+ } catch (NumberFormatException e) {
+ }
+ }
+ return val;
+ }
+
+ /**
+ * Decodes a {@code String} into an {@code Integer}.
+ * Accepts decimal, hexadecimal, and octal numbers given
+ * by the following grammar:
+ *
+ *
+ * The sequence of characters following an optional
+ * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
+ * "{@code #}", or leading zero) is parsed as by the {@code
+ * Integer.parseInt} method with the indicated radix (10, 16, or
+ * 8). This sequence of characters must represent a positive
+ * value or a {@link NumberFormatException} will be thrown. The
+ * result is negated if first character of the specified {@code
+ * String} is the minus sign. No whitespace characters are
+ * permitted in the {@code String}.
+ *
+ * @param nm the {@code String} to decode.
+ * @return an {@code Integer} object holding the {@code int}
+ * value represented by {@code nm}
+ * @exception NumberFormatException if the {@code String} does not
+ * contain a parsable integer.
+ * @see java.lang.Integer#parseInt(java.lang.String, int)
+ */
+ public static Integer decode(String nm) throws NumberFormatException {
+ int radix = 10;
+ int index = 0;
+ boolean negative = false;
+ Integer result;
+
+ if (nm.length() == 0)
+ throw new NumberFormatException("Zero length string");
+ char firstChar = nm.charAt(0);
+ // Handle sign, if present
+ if (firstChar == '-') {
+ negative = true;
+ index++;
+ } else if (firstChar == '+')
+ index++;
+
+ // Handle radix specifier, if present
+ if (nm.startsWith("0x", index) || nm.startsWith("0X", index)) {
+ index += 2;
+ radix = 16;
+ }
+ else if (nm.startsWith("#", index)) {
+ index ++;
+ radix = 16;
+ }
+ else if (nm.startsWith("0", index) && nm.length() > 1 + index) {
+ index ++;
+ radix = 8;
+ }
+
+ if (nm.startsWith("-", index) || nm.startsWith("+", index))
+ throw new NumberFormatException("Sign character in wrong position");
+
+ try {
+ result = Integer.valueOf(nm.substring(index), radix);
+ result = negative ? Integer.valueOf(-result.intValue()) : result;
+ } catch (NumberFormatException e) {
+ // If number is Integer.MIN_VALUE, we'll end up here. The next line
+ // handles this case, and causes any genuine format error to be
+ // rethrown.
+ String constant = negative ? ("-" + nm.substring(index))
+ : nm.substring(index);
+ result = Integer.valueOf(constant, radix);
+ }
+ return result;
+ }
+
+ /**
+ * Compares two {@code Integer} objects numerically.
+ *
+ * @param anotherInteger the {@code Integer} to be compared.
+ * @return the value {@code 0} if this {@code Integer} is
+ * equal to the argument {@code Integer}; a value less than
+ * {@code 0} if this {@code Integer} is numerically less
+ * than the argument {@code Integer}; and a value greater
+ * than {@code 0} if this {@code Integer} is numerically
+ * greater than the argument {@code Integer} (signed
+ * comparison).
+ * @since 1.2
+ */
+ public int compareTo(Integer anotherInteger) {
+ return compare(this.value, anotherInteger.value);
+ }
+
+ /**
+ * Compares two {@code int} values numerically.
+ * The value returned is identical to what would be returned by:
+ * Note that this method is closely related to the logarithm base 2.
+ * For all positive {@code int} values x:
+ * Note that left rotation with a negative distance is equivalent to
+ * right rotation: {@code rotateLeft(val, -distance) == rotateRight(val,
+ * distance)}. Note also that rotation by any multiple of 32 is a
+ * no-op, so all but the last five bits of the rotation distance can be
+ * ignored, even if the distance is negative: {@code rotateLeft(val,
+ * distance) == rotateLeft(val, distance & 0x1F)}.
+ *
+ * @return the value obtained by rotating the two's complement binary
+ * representation of the specified {@code int} value left by the
+ * specified number of bits.
+ * @since 1.5
+ */
+ public static int rotateLeft(int i, int distance) {
+ return (i << distance) | (i >>> -distance);
+ }
+
+ /**
+ * Returns the value obtained by rotating the two's complement binary
+ * representation of the specified {@code int} value right by the
+ * specified number of bits. (Bits shifted out of the right hand, or
+ * low-order, side reenter on the left, or high-order.)
+ *
+ * Note that right rotation with a negative distance is equivalent to
+ * left rotation: {@code rotateRight(val, -distance) == rotateLeft(val,
+ * distance)}. Note also that rotation by any multiple of 32 is a
+ * no-op, so all but the last five bits of the rotation distance can be
+ * ignored, even if the distance is negative: {@code rotateRight(val,
+ * distance) == rotateRight(val, distance & 0x1F)}.
+ *
+ * @return the value obtained by rotating the two's complement binary
+ * representation of the specified {@code int} value right by the
+ * specified number of bits.
+ * @since 1.5
+ */
+ public static int rotateRight(int i, int distance) {
+ return (i >>> distance) | (i << -distance);
+ }
+
+ /**
+ * Returns the value obtained by reversing the order of the bits in the
+ * two's complement binary representation of the specified {@code int}
+ * value.
+ *
+ * @return the value obtained by reversing order of the bits in the
+ * specified {@code int} value.
+ * @since 1.5
+ */
+ public static int reverse(int i) {
+ // HD, Figure 7-1
+ i = (i & 0x55555555) << 1 | (i >>> 1) & 0x55555555;
+ i = (i & 0x33333333) << 2 | (i >>> 2) & 0x33333333;
+ i = (i & 0x0f0f0f0f) << 4 | (i >>> 4) & 0x0f0f0f0f;
+ i = (i << 24) | ((i & 0xff00) << 8) |
+ ((i >>> 8) & 0xff00) | (i >>> 24);
+ return i;
+ }
+
+ /**
+ * Returns the signum function of the specified {@code int} value. (The
+ * return value is -1 if the specified value is negative; 0 if the
+ * specified value is zero; and 1 if the specified value is positive.)
+ *
+ * @return the signum function of the specified {@code int} value.
+ * @since 1.5
+ */
+ public static int signum(int i) {
+ // HD, Section 2-7
+ return (i >> 31) | (-i >>> 31);
+ }
+
+ /**
+ * Returns the value obtained by reversing the order of the bytes in the
+ * two's complement representation of the specified {@code int} value.
+ *
+ * @return the value obtained by reversing the bytes in the specified
+ * {@code int} value.
+ * @since 1.5
+ */
+ public static int reverseBytes(int i) {
+ return ((i >>> 24) ) |
+ ((i >> 8) & 0xFF00) |
+ ((i << 8) & 0xFF0000) |
+ ((i << 24));
+ }
+
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ private static final long serialVersionUID = 1360826667806852920L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/InterruptedException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/InterruptedException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown when a thread is waiting, sleeping, or otherwise occupied,
+ * and the thread is interrupted, either before or during the activity.
+ * Occasionally a method may wish to test whether the current
+ * thread has been interrupted, and if so, to immediately throw
+ * this exception. The following code can be used to achieve
+ * this effect:
+ * In addition, this class provides several methods for converting
+ * a {@code long} to a {@code String} and a {@code String} to a {@code
+ * long}, as well as other constants and methods useful when dealing
+ * with a {@code long}.
+ *
+ * Implementation note: The implementations of the "bit twiddling"
+ * methods (such as {@link #highestOneBit(long) highestOneBit} and
+ * {@link #numberOfTrailingZeros(long) numberOfTrailingZeros}) are
+ * based on material from Henry S. Warren, Jr.'s Hacker's
+ * Delight, (Addison Wesley, 2002).
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Josh Bloch
+ * @author Joseph D. Darcy
+ * @since JDK1.0
+ */
+public final class Long extends Number implements Comparable If the radix is smaller than {@code Character.MIN_RADIX}
+ * or larger than {@code Character.MAX_RADIX}, then the radix
+ * {@code 10} is used instead.
+ *
+ * If the first argument is negative, the first element of the
+ * result is the ASCII minus sign {@code '-'}
+ * ( The remaining characters of the result represent the magnitude
+ * of the first argument. If the magnitude is zero, it is
+ * represented by a single zero character {@code '0'}
+ * ( The unsigned {@code long} value is the argument plus
+ * 264 if the argument is negative; otherwise, it is
+ * equal to the argument. This value is converted to a string of
+ * ASCII digits in hexadecimal (base 16) with no extra
+ * leading {@code 0}s. If the unsigned magnitude is zero, it
+ * is represented by a single zero character {@code '0'}
+ * ( The unsigned {@code long} value is the argument plus
+ * 264 if the argument is negative; otherwise, it is
+ * equal to the argument. This value is converted to a string of
+ * ASCII digits in octal (base 8) with no extra leading
+ * {@code 0}s.
+ *
+ * If the unsigned magnitude is zero, it is represented by a
+ * single zero character {@code '0'}
+ * ( The unsigned {@code long} value is the argument plus
+ * 264 if the argument is negative; otherwise, it is
+ * equal to the argument. This value is converted to a string of
+ * ASCII digits in binary (base 2) with no extra leading
+ * {@code 0}s. If the unsigned magnitude is zero, it is
+ * represented by a single zero character {@code '0'}
+ * ( Note that neither the character {@code L}
+ * ( An exception of type {@code NumberFormatException} is
+ * thrown if any of the following situations occurs:
+ * Examples:
+ * Note that neither the character {@code L}
+ * ( In other words, this method returns a {@code Long} object equal
+ * to the value of:
+ *
+ * In other words, this method returns a {@code Long} object
+ * equal to the value of:
+ *
+ *
+ * The sequence of characters following an optional
+ * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
+ * "{@code #}", or leading zero) is parsed as by the {@code
+ * Long.parseLong} method with the indicated radix (10, 16, or 8).
+ * This sequence of characters must represent a positive value or
+ * a {@link NumberFormatException} will be thrown. The result is
+ * negated if first character of the specified {@code String} is
+ * the minus sign. No whitespace characters are permitted in the
+ * {@code String}.
+ *
+ * @param nm the {@code String} to decode.
+ * @return a {@code Long} object holding the {@code long}
+ * value represented by {@code nm}
+ * @throws NumberFormatException if the {@code String} does not
+ * contain a parsable {@code long}.
+ * @see java.lang.Long#parseLong(String, int)
+ * @since 1.2
+ */
+ public static Long decode(String nm) throws NumberFormatException {
+ int radix = 10;
+ int index = 0;
+ boolean negative = false;
+ Long result;
+
+ if (nm.length() == 0)
+ throw new NumberFormatException("Zero length string");
+ char firstChar = nm.charAt(0);
+ // Handle sign, if present
+ if (firstChar == '-') {
+ negative = true;
+ index++;
+ } else if (firstChar == '+')
+ index++;
+
+ // Handle radix specifier, if present
+ if (nm.startsWith("0x", index) || nm.startsWith("0X", index)) {
+ index += 2;
+ radix = 16;
+ }
+ else if (nm.startsWith("#", index)) {
+ index ++;
+ radix = 16;
+ }
+ else if (nm.startsWith("0", index) && nm.length() > 1 + index) {
+ index ++;
+ radix = 8;
+ }
+
+ if (nm.startsWith("-", index) || nm.startsWith("+", index))
+ throw new NumberFormatException("Sign character in wrong position");
+
+ try {
+ result = Long.valueOf(nm.substring(index), radix);
+ result = negative ? Long.valueOf(-result.longValue()) : result;
+ } catch (NumberFormatException e) {
+ // If number is Long.MIN_VALUE, we'll end up here. The next line
+ // handles this case, and causes any genuine format error to be
+ // rethrown.
+ String constant = negative ? ("-" + nm.substring(index))
+ : nm.substring(index);
+ result = Long.valueOf(constant, radix);
+ }
+ return result;
+ }
+
+ /**
+ * The value of the {@code Long}.
+ *
+ * @serial
+ */
+ private final long value;
+
+ /**
+ * Constructs a newly allocated {@code Long} object that
+ * represents the specified {@code long} argument.
+ *
+ * @param value the value to be represented by the
+ * {@code Long} object.
+ */
+ public Long(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Long} object that
+ * represents the {@code long} value indicated by the
+ * {@code String} parameter. The string is converted to a
+ * {@code long} value in exactly the manner used by the
+ * {@code parseLong} method for radix 10.
+ *
+ * @param s the {@code String} to be converted to a
+ * {@code Long}.
+ * @throws NumberFormatException if the {@code String} does not
+ * contain a parsable {@code long}.
+ * @see java.lang.Long#parseLong(java.lang.String, int)
+ */
+ public Long(String s) throws NumberFormatException {
+ this.value = parseLong(s, 10);
+ }
+
+ /**
+ * Returns the value of this {@code Long} as a
+ * {@code byte}.
+ */
+ public byte byteValue() {
+ return (byte)value;
+ }
+
+ /**
+ * Returns the value of this {@code Long} as a
+ * {@code short}.
+ */
+ public short shortValue() {
+ return (short)value;
+ }
+
+ /**
+ * Returns the value of this {@code Long} as an
+ * {@code int}.
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns the value of this {@code Long} as a
+ * {@code long} value.
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the value of this {@code Long} as a
+ * {@code float}.
+ */
+ public float floatValue() {
+ return (float)value;
+ }
+
+ /**
+ * Returns the value of this {@code Long} as a
+ * {@code double}.
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a {@code String} object representing this
+ * {@code Long}'s value. The value is converted to signed
+ * decimal representation and returned as a string, exactly as if
+ * the {@code long} value were given as an argument to the
+ * {@link java.lang.Long#toString(long)} method.
+ *
+ * @return a string representation of the value of this object in
+ * base 10.
+ */
+ public String toString() {
+ return toString(value);
+ }
+
+ /**
+ * Returns a hash code for this {@code Long}. The result is
+ * the exclusive OR of the two halves of the primitive
+ * {@code long} value held by this {@code Long}
+ * object. That is, the hashcode is the value of the expression:
+ *
+ * The first argument is treated as the name of a system property.
+ * System properties are accessible through the {@link
+ * java.lang.System#getProperty(java.lang.String)} method. The
+ * string value of this property is then interpreted as a
+ * {@code long} value and a {@code Long} object
+ * representing this value is returned. Details of possible
+ * numeric formats can be found with the definition of
+ * {@code getProperty}.
+ *
+ * If there is no property with the specified name, if the
+ * specified name is empty or {@code null}, or if the
+ * property does not have the correct numeric format, then
+ * {@code null} is returned.
+ *
+ * In other words, this method returns a {@code Long} object equal to
+ * the value of:
+ *
+ * The first argument is treated as the name of a system property.
+ * System properties are accessible through the {@link
+ * java.lang.System#getProperty(java.lang.String)} method. The
+ * string value of this property is then interpreted as a
+ * {@code long} value and a {@code Long} object
+ * representing this value is returned. Details of possible
+ * numeric formats can be found with the definition of
+ * {@code getProperty}.
+ *
+ * The second argument is the default value. A {@code Long} object
+ * that represents the value of the second argument is returned if there
+ * is no property of the specified name, if the property does not have
+ * the correct numeric format, or if the specified name is empty or null.
+ *
+ * In other words, this method returns a {@code Long} object equal
+ * to the value of:
+ *
+ * Note that, in every case, neither {@code L}
+ * ( The second argument is the default value. The default value is
+ * returned if there is no property of the specified name, if the
+ * property does not have the correct numeric format, or if the
+ * specified name is empty or {@code null}.
+ *
+ * @param nm property name.
+ * @param val default value.
+ * @return the {@code Long} value of the property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ * @see java.lang.Long#decode
+ */
+ public static Long getLong(String nm, Long val) {
+ String v = null;
+ try {
+ v = String.getProperty(nm);
+ } catch (IllegalArgumentException e) {
+ } catch (NullPointerException e) {
+ }
+ if (v != null) {
+ try {
+ return Long.decode(v);
+ } catch (NumberFormatException e) {
+ }
+ }
+ return val;
+ }
+
+ /**
+ * Compares two {@code Long} objects numerically.
+ *
+ * @param anotherLong the {@code Long} to be compared.
+ * @return the value {@code 0} if this {@code Long} is
+ * equal to the argument {@code Long}; a value less than
+ * {@code 0} if this {@code Long} is numerically less
+ * than the argument {@code Long}; and a value greater
+ * than {@code 0} if this {@code Long} is numerically
+ * greater than the argument {@code Long} (signed
+ * comparison).
+ * @since 1.2
+ */
+ public int compareTo(Long anotherLong) {
+ return compare(this.value, anotherLong.value);
+ }
+
+ /**
+ * Compares two {@code long} values numerically.
+ * The value returned is identical to what would be returned by:
+ * Note that this method is closely related to the logarithm base 2.
+ * For all positive {@code long} values x:
+ * Note that left rotation with a negative distance is equivalent to
+ * right rotation: {@code rotateLeft(val, -distance) == rotateRight(val,
+ * distance)}. Note also that rotation by any multiple of 64 is a
+ * no-op, so all but the last six bits of the rotation distance can be
+ * ignored, even if the distance is negative: {@code rotateLeft(val,
+ * distance) == rotateLeft(val, distance & 0x3F)}.
+ *
+ * @return the value obtained by rotating the two's complement binary
+ * representation of the specified {@code long} value left by the
+ * specified number of bits.
+ * @since 1.5
+ */
+ public static long rotateLeft(long i, int distance) {
+ return (i << distance) | (i >>> -distance);
+ }
+
+ /**
+ * Returns the value obtained by rotating the two's complement binary
+ * representation of the specified {@code long} value right by the
+ * specified number of bits. (Bits shifted out of the right hand, or
+ * low-order, side reenter on the left, or high-order.)
+ *
+ * Note that right rotation with a negative distance is equivalent to
+ * left rotation: {@code rotateRight(val, -distance) == rotateLeft(val,
+ * distance)}. Note also that rotation by any multiple of 64 is a
+ * no-op, so all but the last six bits of the rotation distance can be
+ * ignored, even if the distance is negative: {@code rotateRight(val,
+ * distance) == rotateRight(val, distance & 0x3F)}.
+ *
+ * @return the value obtained by rotating the two's complement binary
+ * representation of the specified {@code long} value right by the
+ * specified number of bits.
+ * @since 1.5
+ */
+ public static long rotateRight(long i, int distance) {
+ return (i >>> distance) | (i << -distance);
+ }
+
+ /**
+ * Returns the value obtained by reversing the order of the bits in the
+ * two's complement binary representation of the specified {@code long}
+ * value.
+ *
+ * @return the value obtained by reversing order of the bits in the
+ * specified {@code long} value.
+ * @since 1.5
+ */
+ public static long reverse(long i) {
+ // HD, Figure 7-1
+ i = (i & 0x5555555555555555L) << 1 | (i >>> 1) & 0x5555555555555555L;
+ i = (i & 0x3333333333333333L) << 2 | (i >>> 2) & 0x3333333333333333L;
+ i = (i & 0x0f0f0f0f0f0f0f0fL) << 4 | (i >>> 4) & 0x0f0f0f0f0f0f0f0fL;
+ i = (i & 0x00ff00ff00ff00ffL) << 8 | (i >>> 8) & 0x00ff00ff00ff00ffL;
+ i = (i << 48) | ((i & 0xffff0000L) << 16) |
+ ((i >>> 16) & 0xffff0000L) | (i >>> 48);
+ return i;
+ }
+
+ /**
+ * Returns the signum function of the specified {@code long} value. (The
+ * return value is -1 if the specified value is negative; 0 if the
+ * specified value is zero; and 1 if the specified value is positive.)
+ *
+ * @return the signum function of the specified {@code long} value.
+ * @since 1.5
+ */
+ public static int signum(long i) {
+ // HD, Section 2-7
+ return (int) ((i >> 63) | (-i >>> 63));
+ }
+
+ /**
+ * Returns the value obtained by reversing the order of the bytes in the
+ * two's complement representation of the specified {@code long} value.
+ *
+ * @return the value obtained by reversing the bytes in the specified
+ * {@code long} value.
+ * @since 1.5
+ */
+ public static long reverseBytes(long i) {
+ i = (i & 0x00ff00ff00ff00ffL) << 8 | (i >>> 8) & 0x00ff00ff00ff00ffL;
+ return (i << 48) | ((i & 0xffff0000L) << 16) |
+ ((i >>> 16) & 0xffff0000L) | (i >>> 48);
+ }
+
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ private static final long serialVersionUID = 4290774380558885855L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Math.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Math.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,1523 @@
+/*
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+
+/**
+ * The class {@code Math} contains methods for performing basic
+ * numeric operations such as the elementary exponential, logarithm,
+ * square root, and trigonometric functions.
+ *
+ * Unlike some of the numeric methods of class
+ * {@code StrictMath}, all implementations of the equivalent
+ * functions of class {@code Math} are not defined to return the
+ * bit-for-bit same results. This relaxation permits
+ * better-performing implementations where strict reproducibility is
+ * not required.
+ *
+ * By default many of the {@code Math} methods simply call
+ * the equivalent method in {@code StrictMath} for their
+ * implementation. Code generators are encouraged to use
+ * platform-specific native libraries or microprocessor instructions,
+ * where available, to provide higher-performance implementations of
+ * {@code Math} methods. Such higher-performance
+ * implementations still must conform to the specification for
+ * {@code Math}.
+ *
+ * The quality of implementation specifications concern two
+ * properties, accuracy of the returned result and monotonicity of the
+ * method. Accuracy of the floating-point {@code Math} methods
+ * is measured in terms of ulps, units in the last place. For
+ * a given floating-point format, an ulp of a specific real number
+ * value is the distance between the two floating-point values
+ * bracketing that numerical value. When discussing the accuracy of a
+ * method as a whole rather than at a specific argument, the number of
+ * ulps cited is for the worst-case error at any argument. If a
+ * method always has an error less than 0.5 ulps, the method always
+ * returns the floating-point number nearest the exact result; such a
+ * method is correctly rounded. A correctly rounded method is
+ * generally the best a floating-point approximation can be; however,
+ * it is impractical for many floating-point methods to be correctly
+ * rounded. Instead, for the {@code Math} class, a larger error
+ * bound of 1 or 2 ulps is allowed for certain methods. Informally,
+ * with a 1 ulp error bound, when the exact result is a representable
+ * number, the exact result should be returned as the computed result;
+ * otherwise, either of the two floating-point values which bracket
+ * the exact result may be returned. For exact results large in
+ * magnitude, one of the endpoints of the bracket may be infinite.
+ * Besides accuracy at individual arguments, maintaining proper
+ * relations between the method at different arguments is also
+ * important. Therefore, most methods with more than 0.5 ulp errors
+ * are required to be semi-monotonic: whenever the mathematical
+ * function is non-decreasing, so is the floating-point approximation,
+ * likewise, whenever the mathematical function is non-increasing, so
+ * is the floating-point approximation. Not all approximations that
+ * have 1 ulp accuracy will automatically meet the monotonicity
+ * requirements.
+ *
+ * @author unascribed
+ * @author Joseph D. Darcy
+ * @since JDK1.0
+ */
+
+public final class Math {
+
+ /**
+ * Don't let anyone instantiate this class.
+ */
+ private Math() {}
+
+ /**
+ * The {@code double} value that is closer than any other to
+ * e, the base of the natural logarithms.
+ */
+ public static final double E = 2.7182818284590452354;
+
+ /**
+ * The {@code double} value that is closer than any other to
+ * pi, the ratio of the circumference of a circle to its
+ * diameter.
+ */
+ public static final double PI = 3.14159265358979323846;
+
+ /**
+ * Returns the trigonometric sine of an angle. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a an angle, in radians.
+ * @return the sine of the argument.
+ */
+ public static double sin(double a) {
+ return StrictMath.sin(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the trigonometric cosine of an angle. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a an angle, in radians.
+ * @return the cosine of the argument.
+ */
+ public static double cos(double a) {
+ return StrictMath.cos(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the trigonometric tangent of an angle. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a an angle, in radians.
+ * @return the tangent of the argument.
+ */
+ public static double tan(double a) {
+ return StrictMath.tan(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the arc sine of a value; the returned angle is in the
+ * range -pi/2 through pi/2. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a the value whose arc sine is to be returned.
+ * @return the arc sine of the argument.
+ */
+ public static double asin(double a) {
+ return StrictMath.asin(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the arc cosine of a value; the returned angle is in the
+ * range 0.0 through pi. Special case:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a the value whose arc cosine is to be returned.
+ * @return the arc cosine of the argument.
+ */
+ public static double acos(double a) {
+ return StrictMath.acos(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the arc tangent of a value; the returned angle is in the
+ * range -pi/2 through pi/2. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a the value whose arc tangent is to be returned.
+ * @return the arc tangent of the argument.
+ */
+ public static double atan(double a) {
+ return StrictMath.atan(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Converts an angle measured in degrees to an approximately
+ * equivalent angle measured in radians. The conversion from
+ * degrees to radians is generally inexact.
+ *
+ * @param angdeg an angle, in degrees
+ * @return the measurement of the angle {@code angdeg}
+ * in radians.
+ * @since 1.2
+ */
+ public static double toRadians(double angdeg) {
+ return angdeg / 180.0 * PI;
+ }
+
+ /**
+ * Converts an angle measured in radians to an approximately
+ * equivalent angle measured in degrees. The conversion from
+ * radians to degrees is generally inexact; users should
+ * not expect {@code cos(toRadians(90.0))} to exactly
+ * equal {@code 0.0}.
+ *
+ * @param angrad an angle, in radians
+ * @return the measurement of the angle {@code angrad}
+ * in degrees.
+ * @since 1.2
+ */
+ public static double toDegrees(double angrad) {
+ return angrad * 180.0 / PI;
+ }
+
+ /**
+ * Returns Euler's number e raised to the power of a
+ * {@code double} value. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a the exponent to raise e to.
+ * @return the value e{@code a},
+ * where e is the base of the natural logarithms.
+ */
+ public static double exp(double a) {
+ return StrictMath.exp(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the natural logarithm (base e) of a {@code double}
+ * value. Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a a value
+ * @return the value ln {@code a}, the natural logarithm of
+ * {@code a}.
+ */
+ public static double log(double a) {
+ return StrictMath.log(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the base 10 logarithm of a {@code double} value.
+ * Special cases:
+ *
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a a value
+ * @return the base 10 logarithm of {@code a}.
+ * @since 1.5
+ */
+ public static double log10(double a) {
+ return StrictMath.log10(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the correctly rounded positive square root of a
+ * {@code double} value.
+ * Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ *
+ * @param a a value.
+ * @return the cube root of {@code a}.
+ * @since 1.5
+ */
+ public static double cbrt(double a) {
+ return StrictMath.cbrt(a);
+ }
+
+ /**
+ * Computes the remainder operation on two arguments as prescribed
+ * by the IEEE 754 standard.
+ * The remainder value is mathematically equal to
+ * The computed result must be within 2 ulps of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param y the ordinate coordinate
+ * @param x the abscissa coordinate
+ * @return the theta component of the point
+ * (r, theta)
+ * in polar coordinates that corresponds to the point
+ * (x, y) in Cartesian coordinates.
+ */
+ public static double atan2(double y, double x) {
+ return StrictMath.atan2(y, x); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the value of the first argument raised to the power of the
+ * second argument. Special cases:
+ *
+ * (In the foregoing descriptions, a floating-point value is
+ * considered to be an integer if and only if it is finite and a
+ * fixed point of the method {@link #ceil ceil} or,
+ * equivalently, a fixed point of the method {@link #floor
+ * floor}. A value is a fixed point of a one-argument
+ * method if and only if the result of applying the method to the
+ * value is equal to the value.)
+ *
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param a the base.
+ * @param b the exponent.
+ * @return the value {@code a}{@code b}.
+ */
+ public static double pow(double a, double b) {
+ return StrictMath.pow(a, b); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the closest {@code int} to the argument, with ties
+ * rounding up.
+ *
+ *
+ * Special cases:
+ * Special cases:
+ * When this method is first called, it creates a single new
+ * pseudorandom-number generator, exactly as if by the expression
+ *
+ * This method is properly synchronized to allow correct use by
+ * more than one thread. However, if many threads need to generate
+ * pseudorandom numbers at a great rate, it may reduce contention
+ * for each thread to have its own pseudorandom-number generator.
+ *
+ * @return a pseudorandom {@code double} greater than or equal
+ * to {@code 0.0} and less than {@code 1.0}.
+ * @see Random#nextDouble()
+ */
+ public static double random() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the absolute value of an {@code int} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ *
+ * Note that if the argument is equal to the value of
+ * {@link Integer#MIN_VALUE}, the most negative representable
+ * {@code int} value, the result is that same value, which is
+ * negative.
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument.
+ */
+ public static int abs(int a) {
+ return (a < 0) ? -a : a;
+ }
+
+ /**
+ * Returns the absolute value of a {@code long} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ *
+ * Note that if the argument is equal to the value of
+ * {@link Long#MIN_VALUE}, the most negative representable
+ * {@code long} value, the result is that same value, which
+ * is negative.
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument.
+ */
+ public static long abs(long a) {
+ return (a < 0) ? -a : a;
+ }
+
+ /**
+ * Returns the absolute value of a {@code float} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ * Special cases:
+ * {@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument.
+ */
+ public static float abs(float a) {
+ return (a <= 0.0F) ? 0.0F - a : a;
+ }
+
+ /**
+ * Returns the absolute value of a {@code double} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ * Special cases:
+ * {@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument.
+ */
+ public static double abs(double a) {
+ return (a <= 0.0D) ? 0.0D - a : a;
+ }
+
+ /**
+ * Returns the greater of two {@code int} values. That is, the
+ * result is the argument closer to the value of
+ * {@link Integer#MAX_VALUE}. If the arguments have the same value,
+ * the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static int max(int a, int b) {
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the greater of two {@code long} values. That is, the
+ * result is the argument closer to the value of
+ * {@link Long#MAX_VALUE}. If the arguments have the same value,
+ * the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static long max(long a, long b) {
+ return (a >= b) ? a : b;
+ }
+
+ private static long negativeZeroFloatBits = Float.floatToIntBits(-0.0f);
+ private static long negativeZeroDoubleBits = Double.doubleToLongBits(-0.0d);
+
+ /**
+ * Returns the greater of two {@code float} values. That is,
+ * the result is the argument closer to positive infinity. If the
+ * arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If one
+ * argument is positive zero and the other negative zero, the
+ * result is positive zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static float max(float a, float b) {
+ if (a != a) return a; // a is NaN
+ if ((a == 0.0f) && (b == 0.0f)
+ && (Float.floatToIntBits(a) == negativeZeroFloatBits)) {
+ return b;
+ }
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the greater of two {@code double} values. That
+ * is, the result is the argument closer to positive infinity. If
+ * the arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If one
+ * argument is positive zero and the other negative zero, the
+ * result is positive zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static double max(double a, double b) {
+ if (a != a) return a; // a is NaN
+ if ((a == 0.0d) && (b == 0.0d)
+ && (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
+ return b;
+ }
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code int} values. That is,
+ * the result the argument closer to the value of
+ * {@link Integer#MIN_VALUE}. If the arguments have the same
+ * value, the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static int min(int a, int b) {
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code long} values. That is,
+ * the result is the argument closer to the value of
+ * {@link Long#MIN_VALUE}. If the arguments have the same
+ * value, the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static long min(long a, long b) {
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code float} values. That is,
+ * the result is the value closer to negative infinity. If the
+ * arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If
+ * one argument is positive zero and the other is negative zero,
+ * the result is negative zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static float min(float a, float b) {
+ if (a != a) return a; // a is NaN
+ if ((a == 0.0f) && (b == 0.0f)
+ && (Float.floatToIntBits(b) == negativeZeroFloatBits)) {
+ return b;
+ }
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code double} values. That
+ * is, the result is the value closer to negative infinity. If the
+ * arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If one
+ * argument is positive zero and the other is negative zero, the
+ * result is negative zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static double min(double a, double b) {
+ if (a != a) return a; // a is NaN
+ if ((a == 0.0d) && (b == 0.0d)
+ && (Double.doubleToLongBits(b) == negativeZeroDoubleBits)) {
+ return b;
+ }
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the size of an ulp of the argument. An ulp of a
+ * {@code double} value is the positive distance between this
+ * floating-point value and the {@code double} value next
+ * larger in magnitude. Note that for non-NaN x,
+ * Special Cases:
+ * Special Cases:
+ * Special Cases:
+ * Special Cases:
+ * Special cases:
+ * The computed result must be within 2.5 ulps of the exact result.
+ *
+ * @param x The number whose hyperbolic sine is to be returned.
+ * @return The hyperbolic sine of {@code x}.
+ * @since 1.5
+ */
+ public static double sinh(double x) {
+ return StrictMath.sinh(x);
+ }
+
+ /**
+ * Returns the hyperbolic cosine of a {@code double} value.
+ * The hyperbolic cosine of x is defined to be
+ * (ex + e-x)/2
+ * where e is {@linkplain Math#E Euler's number}.
+ *
+ * Special cases:
+ * The computed result must be within 2.5 ulps of the exact result.
+ *
+ * @param x The number whose hyperbolic cosine is to be returned.
+ * @return The hyperbolic cosine of {@code x}.
+ * @since 1.5
+ */
+ public static double cosh(double x) {
+ return StrictMath.cosh(x);
+ }
+
+ /**
+ * Returns the hyperbolic tangent of a {@code double} value.
+ * The hyperbolic tangent of x is defined to be
+ * (ex - e-x)/(ex + e-x),
+ * in other words, {@linkplain Math#sinh
+ * sinh(x)}/{@linkplain Math#cosh cosh(x)}. Note
+ * that the absolute value of the exact tanh is always less than
+ * 1.
+ *
+ * Special cases:
+ * The computed result must be within 2.5 ulps of the exact result.
+ * The result of {@code tanh} for any finite input must have
+ * an absolute value less than or equal to 1. Note that once the
+ * exact result of tanh is within 1/2 of an ulp of the limit value
+ * of ±1, correctly signed ±{@code 1.0} should
+ * be returned.
+ *
+ * @param x The number whose hyperbolic tangent is to be returned.
+ * @return The hyperbolic tangent of {@code x}.
+ * @since 1.5
+ */
+ public static double tanh(double x) {
+ return StrictMath.tanh(x);
+ }
+
+ /**
+ * Returns sqrt(x2 +y2)
+ * without intermediate overflow or underflow.
+ *
+ * Special cases:
+ * The computed result must be within 1 ulp of the exact
+ * result. If one parameter is held constant, the results must be
+ * semi-monotonic in the other parameter.
+ *
+ * @param x a value
+ * @param y a value
+ * @return sqrt(x2 +y2)
+ * without intermediate overflow or underflow
+ * @since 1.5
+ */
+ public static double hypot(double x, double y) {
+ return StrictMath.hypot(x, y);
+ }
+
+ /**
+ * Returns ex -1. Note that for values of
+ * x near 0, the exact sum of
+ * {@code expm1(x)} + 1 is much closer to the true
+ * result of ex than {@code exp(x)}.
+ *
+ * Special cases:
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic. The result of
+ * {@code expm1} for any finite input must be greater than or
+ * equal to {@code -1.0}. Note that once the exact result of
+ * e{@code x} - 1 is within 1/2
+ * ulp of the limit value -1, {@code -1.0} should be
+ * returned.
+ *
+ * @param x the exponent to raise e to in the computation of
+ * e{@code x} -1.
+ * @return the value e{@code x} - 1.
+ * @since 1.5
+ */
+ public static double expm1(double x) {
+ return StrictMath.expm1(x);
+ }
+
+ /**
+ * Returns the natural logarithm of the sum of the argument and 1.
+ * Note that for small values {@code x}, the result of
+ * {@code log1p(x)} is much closer to the true result of ln(1
+ * + {@code x}) than the floating-point evaluation of
+ * {@code log(1.0+x)}.
+ *
+ * Special cases:
+ *
+ * The computed result must be within 1 ulp of the exact result.
+ * Results must be semi-monotonic.
+ *
+ * @param x a value
+ * @return the value ln({@code x} + 1), the natural
+ * log of {@code x} + 1
+ * @since 1.5
+ */
+ public static double log1p(double x) {
+ return StrictMath.log1p(x);
+ }
+
+ /**
+ * Returns the first floating-point argument with the sign of the
+ * second floating-point argument. Note that unlike the {@link
+ * StrictMath#copySign(double, double) StrictMath.copySign}
+ * method, this method does not require NaN {@code sign}
+ * arguments to be treated as positive values; implementations are
+ * permitted to treat some NaN arguments as positive and other NaN
+ * arguments as negative to allow greater performance.
+ *
+ * @param magnitude the parameter providing the magnitude of the result
+ * @param sign the parameter providing the sign of the result
+ * @return a value with the magnitude of {@code magnitude}
+ * and the sign of {@code sign}.
+ * @since 1.6
+ */
+// public static double copySign(double magnitude, double sign) {
+// return sun.misc.FpUtils.rawCopySign(magnitude, sign);
+// }
+
+ /**
+ * Returns the first floating-point argument with the sign of the
+ * second floating-point argument. Note that unlike the {@link
+ * StrictMath#copySign(float, float) StrictMath.copySign}
+ * method, this method does not require NaN {@code sign}
+ * arguments to be treated as positive values; implementations are
+ * permitted to treat some NaN arguments as positive and other NaN
+ * arguments as negative to allow greater performance.
+ *
+ * @param magnitude the parameter providing the magnitude of the result
+ * @param sign the parameter providing the sign of the result
+ * @return a value with the magnitude of {@code magnitude}
+ * and the sign of {@code sign}.
+ * @since 1.6
+ */
+// public static float copySign(float magnitude, float sign) {
+// return sun.misc.FpUtils.rawCopySign(magnitude, sign);
+// }
+
+ /**
+ * Returns the unbiased exponent used in the representation of a
+ * {@code float}. Special cases:
+ *
+ *
+ * Special cases:
+ *
+ * Special cases:
+ * Special Cases:
+ * Special Cases:
+ * Special cases:
+ * Special cases:
+ *
+ * Applications should throw instances of this class to indicate
+ * other illegal uses of the {@code null} object.
+ *
+ * {@code NullPointerException} objects may be constructed by the
+ * virtual machine as if {@linkplain Throwable#Throwable(String,
+ * Throwable, boolean, boolean) suppression were disabled and/or the
+ * stack trace was not writable}.
+ *
+ * @author unascribed
+ * @since JDK1.0
+ */
+public
+class NullPointerException extends RuntimeException {
+ private static final long serialVersionUID = 5162710183389028792L;
+
+ /**
+ * Constructs a {@code NullPointerException} with no detail message.
+ */
+ public NullPointerException() {
+ super();
+ }
+
+ /**
+ * Constructs a {@code NullPointerException} with the specified
+ * detail message.
+ *
+ * @param s the detail message.
+ */
+ public NullPointerException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Number.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Number.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1994, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The abstract class
+ * Subclasses of The actual result type is {@code Class extends |X|>}
+ * where {@code |X|} is the erasure of the static type of the
+ * expression on which {@code getClass} is called. For
+ * example, no cast is required in this code fragment:
+ * {@code Number n = 0; }
+ * The general contract of {@code hashCode} is:
+ *
+ * As much as is reasonably practical, the hashCode method defined by
+ * class {@code Object} does return distinct integers for distinct
+ * objects. (This is typically implemented by converting the internal
+ * address of the object into an integer, but this implementation
+ * technique is not required by the
+ * JavaTM programming language.)
+ *
+ * @return a hash code value for this object.
+ * @see java.lang.Object#equals(java.lang.Object)
+ * @see java.lang.System#identityHashCode
+ */
+ public native int hashCode();
+
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * The {@code equals} method implements an equivalence relation
+ * on non-null object references:
+ *
+ * The {@code equals} method for class {@code Object} implements
+ * the most discriminating possible equivalence relation on objects;
+ * that is, for any non-null reference values {@code x} and
+ * {@code y}, this method returns {@code true} if and only
+ * if {@code x} and {@code y} refer to the same object
+ * ({@code x == y} has the value {@code true}).
+ *
+ * Note that it is generally necessary to override the {@code hashCode}
+ * method whenever this method is overridden, so as to maintain the
+ * general contract for the {@code hashCode} method, which states
+ * that equal objects must have equal hash codes.
+ *
+ * @param obj the reference object with which to compare.
+ * @return {@code true} if this object is the same as the obj
+ * argument; {@code false} otherwise.
+ * @see #hashCode()
+ * @see java.util.HashMap
+ */
+ public boolean equals(Object obj) {
+ return (this == obj);
+ }
+
+ /**
+ * Creates and returns a copy of this object. The precise meaning
+ * of "copy" may depend on the class of the object. The general
+ * intent is that, for any object {@code x}, the expression:
+ *
+ * By convention, the returned object should be obtained by calling
+ * {@code super.clone}. If a class and all of its superclasses (except
+ * {@code Object}) obey this convention, it will be the case that
+ * {@code x.clone().getClass() == x.getClass()}.
+ *
+ * By convention, the object returned by this method should be independent
+ * of this object (which is being cloned). To achieve this independence,
+ * it may be necessary to modify one or more fields of the object returned
+ * by {@code super.clone} before returning it. Typically, this means
+ * copying any mutable objects that comprise the internal "deep structure"
+ * of the object being cloned and replacing the references to these
+ * objects with references to the copies. If a class contains only
+ * primitive fields or references to immutable objects, then it is usually
+ * the case that no fields in the object returned by {@code super.clone}
+ * need to be modified.
+ *
+ * The method {@code clone} for class {@code Object} performs a
+ * specific cloning operation. First, if the class of this object does
+ * not implement the interface {@code Cloneable}, then a
+ * {@code CloneNotSupportedException} is thrown. Note that all arrays
+ * are considered to implement the interface {@code Cloneable} and that
+ * the return type of the {@code clone} method of an array type {@code T[]}
+ * is {@code T[]} where T is any reference or primitive type.
+ * Otherwise, this method creates a new instance of the class of this
+ * object and initializes all its fields with exactly the contents of
+ * the corresponding fields of this object, as if by assignment; the
+ * contents of the fields are not themselves cloned. Thus, this method
+ * performs a "shallow copy" of this object, not a "deep copy" operation.
+ *
+ * The class {@code Object} does not itself implement the interface
+ * {@code Cloneable}, so calling the {@code clone} method on an object
+ * whose class is {@code Object} will result in throwing an
+ * exception at run time.
+ *
+ * @return a clone of this instance.
+ * @exception CloneNotSupportedException if the object's class does not
+ * support the {@code Cloneable} interface. Subclasses
+ * that override the {@code clone} method can also
+ * throw this exception to indicate that an instance cannot
+ * be cloned.
+ * @see java.lang.Cloneable
+ */
+ protected native Object clone() throws CloneNotSupportedException;
+
+ /**
+ * Returns a string representation of the object. In general, the
+ * {@code toString} method returns a string that
+ * "textually represents" this object. The result should
+ * be a concise but informative representation that is easy for a
+ * person to read.
+ * It is recommended that all subclasses override this method.
+ *
+ * The {@code toString} method for class {@code Object}
+ * returns a string consisting of the name of the class of which the
+ * object is an instance, the at-sign character `{@code @}', and
+ * the unsigned hexadecimal representation of the hash code of the
+ * object. In other words, this method returns a string equal to the
+ * value of:
+ *
+ * The awakened thread will not be able to proceed until the current
+ * thread relinquishes the lock on this object. The awakened thread will
+ * compete in the usual manner with any other threads that might be
+ * actively competing to synchronize on this object; for example, the
+ * awakened thread enjoys no reliable privilege or disadvantage in being
+ * the next thread to lock this object.
+ *
+ * This method should only be called by a thread that is the owner
+ * of this object's monitor. A thread becomes the owner of the
+ * object's monitor in one of three ways:
+ *
+ * Only one thread at a time can own an object's monitor.
+ *
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of this object's monitor.
+ * @see java.lang.Object#notifyAll()
+ * @see java.lang.Object#wait()
+ */
+ public final native void notify();
+
+ /**
+ * Wakes up all threads that are waiting on this object's monitor. A
+ * thread waits on an object's monitor by calling one of the
+ * {@code wait} methods.
+ *
+ * The awakened threads will not be able to proceed until the current
+ * thread relinquishes the lock on this object. The awakened threads
+ * will compete in the usual manner with any other threads that might
+ * be actively competing to synchronize on this object; for example,
+ * the awakened threads enjoy no reliable privilege or disadvantage in
+ * being the next thread to lock this object.
+ *
+ * This method should only be called by a thread that is the owner
+ * of this object's monitor. See the {@code notify} method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of this object's monitor.
+ * @see java.lang.Object#notify()
+ * @see java.lang.Object#wait()
+ */
+ public final native void notifyAll();
+
+ /**
+ * Causes the current thread to wait until either another thread invokes the
+ * {@link java.lang.Object#notify()} method or the
+ * {@link java.lang.Object#notifyAll()} method for this object, or a
+ * specified amount of time has elapsed.
+ *
+ * The current thread must own this object's monitor.
+ *
+ * This method causes the current thread (call it T) to
+ * place itself in the wait set for this object and then to relinquish
+ * any and all synchronization claims on this object. Thread T
+ * becomes disabled for thread scheduling purposes and lies dormant
+ * until one of four things happens:
+ *
+ * A thread can also wake up without being notified, interrupted, or
+ * timing out, a so-called spurious wakeup. While this will rarely
+ * occur in practice, applications must guard against it by testing for
+ * the condition that should have caused the thread to be awakened, and
+ * continuing to wait if the condition is not satisfied. In other words,
+ * waits should always occur in loops, like this one:
+ * If the current thread is {@linkplain java.lang.Thread#interrupt()
+ * interrupted} by any thread before or while it is waiting, then an
+ * {@code InterruptedException} is thrown. This exception is not
+ * thrown until the lock status of this object has been restored as
+ * described above.
+ *
+ *
+ * Note that the {@code wait} method, as it places the current thread
+ * into the wait set for this object, unlocks only this object; any
+ * other objects on which the current thread may be synchronized remain
+ * locked while the thread waits.
+ *
+ * This method should only be called by a thread that is the owner
+ * of this object's monitor. See the {@code notify} method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @param timeout the maximum time to wait in milliseconds.
+ * @exception IllegalArgumentException if the value of timeout is
+ * negative.
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of the object's monitor.
+ * @exception InterruptedException if any thread interrupted the
+ * current thread before or while the current thread
+ * was waiting for a notification. The interrupted
+ * status of the current thread is cleared when
+ * this exception is thrown.
+ * @see java.lang.Object#notify()
+ * @see java.lang.Object#notifyAll()
+ */
+ public final native void wait(long timeout) throws InterruptedException;
+
+ /**
+ * Causes the current thread to wait until another thread invokes the
+ * {@link java.lang.Object#notify()} method or the
+ * {@link java.lang.Object#notifyAll()} method for this object, or
+ * some other thread interrupts the current thread, or a certain
+ * amount of real time has elapsed.
+ *
+ * This method is similar to the {@code wait} method of one
+ * argument, but it allows finer control over the amount of time to
+ * wait for a notification before giving up. The amount of real time,
+ * measured in nanoseconds, is given by:
+ *
+ * In all other respects, this method does the same thing as the
+ * method {@link #wait(long)} of one argument. In particular,
+ * {@code wait(0, 0)} means the same thing as {@code wait(0)}.
+ *
+ * The current thread must own this object's monitor. The thread
+ * releases ownership of this monitor and waits until either of the
+ * following two conditions has occurred:
+ *
+ * The thread then waits until it can re-obtain ownership of the
+ * monitor and resumes execution.
+ *
+ * As in the one argument version, interrupts and spurious wakeups are
+ * possible, and this method should always be used in a loop:
+ *
+ * The current thread must own this object's monitor. The thread
+ * releases ownership of this monitor and waits until another thread
+ * notifies threads waiting on this object's monitor to wake up
+ * either through a call to the {@code notify} method or the
+ * {@code notifyAll} method. The thread then waits until it can
+ * re-obtain ownership of the monitor and resumes execution.
+ *
+ * As in the one argument version, interrupts and spurious wakeups are
+ * possible, and this method should always be used in a loop:
+ *
+ * The general contract of {@code finalize} is that it is invoked
+ * if and when the JavaTM virtual
+ * machine has determined that there is no longer any
+ * means by which this object can be accessed by any thread that has
+ * not yet died, except as a result of an action taken by the
+ * finalization of some other object or class which is ready to be
+ * finalized. The {@code finalize} method may take any action, including
+ * making this object available again to other threads; the usual purpose
+ * of {@code finalize}, however, is to perform cleanup actions before
+ * the object is irrevocably discarded. For example, the finalize method
+ * for an object that represents an input/output connection might perform
+ * explicit I/O transactions to break the connection before the object is
+ * permanently discarded.
+ *
+ * The {@code finalize} method of class {@code Object} performs no
+ * special action; it simply returns normally. Subclasses of
+ * {@code Object} may override this definition.
+ *
+ * The Java programming language does not guarantee which thread will
+ * invoke the {@code finalize} method for any given object. It is
+ * guaranteed, however, that the thread that invokes finalize will not
+ * be holding any user-visible synchronization locks when finalize is
+ * invoked. If an uncaught exception is thrown by the finalize method,
+ * the exception is ignored and finalization of that object terminates.
+ *
+ * After the {@code finalize} method has been invoked for an object, no
+ * further action is taken until the Java virtual machine has again
+ * determined that there is no longer any means by which this object can
+ * be accessed by any thread that has not yet died, including possible
+ * actions by other objects or classes which are ready to be finalized,
+ * at which point the object may be discarded.
+ *
+ * The {@code finalize} method is never invoked more than once by a Java
+ * virtual machine for any given object.
+ *
+ * Any exception thrown by the {@code finalize} method causes
+ * the finalization of this object to be halted, but is otherwise
+ * ignored.
+ *
+ * @throws Throwable the {@code Exception} raised by this method
+ */
+ protected void finalize() throws Throwable { }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/OutOfMemoryError.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/OutOfMemoryError.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown when the Java Virtual Machine cannot allocate an object
+ * because it is out of memory, and no more memory could be made
+ * available by the garbage collector.
+ *
+ * {@code OutOfMemoryError} objects may be constructed by the virtual
+ * machine as if {@linkplain Throwable#Throwable(String, Throwable,
+ * boolean, boolean) suppression were disabled and/or the stack trace was not
+ * writable}.
+ *
+ * @author unascribed
+ * @since JDK1.0
+ */
+public class OutOfMemoryError extends VirtualMachineError {
+ private static final long serialVersionUID = 8228564086184010517L;
+
+ /**
+ * Constructs an {@code OutOfMemoryError} with no detail message.
+ */
+ public OutOfMemoryError() {
+ super();
+ }
+
+ /**
+ * Constructs an {@code OutOfMemoryError} with the specified
+ * detail message.
+ *
+ * @param s the detail message.
+ */
+ public OutOfMemoryError(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/ReflectiveOperationException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/ReflectiveOperationException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Common superclass of exceptions thrown by reflective operations in
+ * core reflection.
+ *
+ * @see LinkageError
+ * @since 1.7
+ */
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ /**
+ * Constructs a new exception with {@code null} as its detail
+ * message. The cause is not initialized, and may subsequently be
+ * initialized by a call to {@link #initCause}.
+ */
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message.
+ * The cause is not initialized, and may subsequently be
+ * initialized by a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message
+ * and cause.
+ *
+ * Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public ReflectiveOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public ReflectiveOperationException(Throwable cause) {
+ super(cause);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/RuntimeException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/RuntimeException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * {@code RuntimeException} is the superclass of those
+ * exceptions that can be thrown during the normal operation of the
+ * Java Virtual Machine.
+ *
+ * {@code RuntimeException} and its subclasses are unchecked
+ * exceptions. Unchecked exceptions do not need to be
+ * declared in a method or constructor's {@code throws} clause if they
+ * can be thrown by the execution of the method or constructor and
+ * propagate outside the method or constructor boundary.
+ *
+ * @author Frank Yellin
+ * @jls 11.2 Compile-Time Checking of Exceptions
+ * @since JDK1.0
+ */
+public class RuntimeException extends Exception {
+ static final long serialVersionUID = -7034897190745766939L;
+
+ /** Constructs a new runtime exception with {@code null} as its
+ * detail message. The cause is not initialized, and may subsequently be
+ * initialized by a call to {@link #initCause}.
+ */
+ public RuntimeException() {
+ super();
+ }
+
+ /** Constructs a new runtime exception with the specified detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public RuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail message and
+ * cause. Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this runtime exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public RuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /** Constructs a new runtime exception with the specified cause and a
+ * detail message of (cause==null ? null : cause.toString())
+ * (which typically contains the class and detail message of
+ * cause). This constructor is useful for runtime exceptions
+ * that are little more than wrappers for other throwables.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public RuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new runtime exception with the specified detail
+ * message, cause, suppression enabled or disabled, and writable
+ * stack trace enabled or disabled.
+ *
+ * @param message the detail message.
+ * @param cause the cause. (A {@code null} value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @param enableSuppression whether or not suppression is enabled
+ * or disabled
+ * @param writableStackTrace whether or not the stack trace should
+ * be writable
+ *
+ * @since 1.7
+ */
+ protected RuntimeException(String message, Throwable cause,
+ boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Short.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Short.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,468 @@
+/*
+ * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The {@code Short} class wraps a value of primitive type {@code
+ * short} in an object. An object of type {@code Short} contains a
+ * single field whose type is {@code short}.
+ *
+ * In addition, this class provides several methods for converting
+ * a {@code short} to a {@code String} and a {@code String} to a
+ * {@code short}, as well as other constants and methods useful when
+ * dealing with a {@code short}.
+ *
+ * @author Nakul Saraiya
+ * @author Joseph D. Darcy
+ * @see java.lang.Number
+ * @since JDK1.1
+ */
+public final class Short extends Number implements Comparable An exception of type {@code NumberFormatException} is
+ * thrown if any of the following situations occurs:
+ * In other words, this method returns a {@code Short} object
+ * equal to the value of:
+ *
+ * In other words, this method returns a {@code Short} object
+ * equal to the value of:
+ *
+ *
+ * The sequence of characters following an optional
+ * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
+ * "{@code #}", or leading zero) is parsed as by the {@code
+ * Short.parseShort} method with the indicated radix (10, 16, or
+ * 8). This sequence of characters must represent a positive
+ * value or a {@link NumberFormatException} will be thrown. The
+ * result is negated if first character of the specified {@code
+ * String} is the minus sign. No whitespace characters are
+ * permitted in the {@code String}.
+ *
+ * @param nm the {@code String} to decode.
+ * @return a {@code Short} object holding the {@code short}
+ * value represented by {@code nm}
+ * @throws NumberFormatException if the {@code String} does not
+ * contain a parsable {@code short}.
+ * @see java.lang.Short#parseShort(java.lang.String, int)
+ */
+ public static Short decode(String nm) throws NumberFormatException {
+ int i = Integer.decode(nm);
+ if (i < MIN_VALUE || i > MAX_VALUE)
+ throw new NumberFormatException(
+ "Value " + i + " out of range from input " + nm);
+ return valueOf((short)i);
+ }
+
+ /**
+ * The value of the {@code Short}.
+ *
+ * @serial
+ */
+ private final short value;
+
+ /**
+ * Constructs a newly allocated {@code Short} object that
+ * represents the specified {@code short} value.
+ *
+ * @param value the value to be represented by the
+ * {@code Short}.
+ */
+ public Short(short value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Short} object that
+ * represents the {@code short} value indicated by the
+ * {@code String} parameter. The string is converted to a
+ * {@code short} value in exactly the manner used by the
+ * {@code parseShort} method for radix 10.
+ *
+ * @param s the {@code String} to be converted to a
+ * {@code Short}
+ * @throws NumberFormatException If the {@code String}
+ * does not contain a parsable {@code short}.
+ * @see java.lang.Short#parseShort(java.lang.String, int)
+ */
+ public Short(String s) throws NumberFormatException {
+ this.value = parseShort(s, 10);
+ }
+
+ /**
+ * Returns the value of this {@code Short} as a
+ * {@code byte}.
+ */
+ public byte byteValue() {
+ return (byte)value;
+ }
+
+ /**
+ * Returns the value of this {@code Short} as a
+ * {@code short}.
+ */
+ public short shortValue() {
+ return value;
+ }
+
+ /**
+ * Returns the value of this {@code Short} as an
+ * {@code int}.
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns the value of this {@code Short} as a
+ * {@code long}.
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the value of this {@code Short} as a
+ * {@code float}.
+ */
+ public float floatValue() {
+ return (float)value;
+ }
+
+ /**
+ * Returns the value of this {@code Short} as a
+ * {@code double}.
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a {@code String} object representing this
+ * {@code Short}'s value. The value is converted to signed
+ * decimal representation and returned as a string, exactly as if
+ * the {@code short} value were given as an argument to the
+ * {@link java.lang.Short#toString(short)} method.
+ *
+ * @return a string representation of the value of this object in
+ * base 10.
+ */
+ public String toString() {
+ return Integer.toString((int)value);
+ }
+
+ /**
+ * Returns a hash code for this {@code Short}; equal to the result
+ * of invoking {@code intValue()}.
+ *
+ * @return a hash code value for this {@code Short}
+ */
+ public int hashCode() {
+ return (int)value;
+ }
+
+ /**
+ * Compares this object to the specified object. The result is
+ * {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Short} object that
+ * contains the same {@code short} value as this object.
+ *
+ * @param obj the object to compare with
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Short) {
+ return value == ((Short)obj).shortValue();
+ }
+ return false;
+ }
+
+ /**
+ * Compares two {@code Short} objects numerically.
+ *
+ * @param anotherShort the {@code Short} to be compared.
+ * @return the value {@code 0} if this {@code Short} is
+ * equal to the argument {@code Short}; a value less than
+ * {@code 0} if this {@code Short} is numerically less
+ * than the argument {@code Short}; and a value greater than
+ * {@code 0} if this {@code Short} is numerically
+ * greater than the argument {@code Short} (signed
+ * comparison).
+ * @since 1.2
+ */
+ public int compareTo(Short anotherShort) {
+ return compare(this.value, anotherShort.value);
+ }
+
+ /**
+ * Compares two {@code short} values numerically.
+ * The value returned is identical to what would be returned by:
+ * To help ensure portability of Java programs, the definitions of
+ * some of the numeric functions in this package require that they
+ * produce the same results as certain published algorithms. These
+ * algorithms are available from the well-known network library
+ * {@code netlib} as the package "Freely Distributable Math
+ * Library," {@code fdlibm}. These
+ * algorithms, which are written in the C programming language, are
+ * then to be understood as executed with all floating-point
+ * operations following the rules of Java floating-point arithmetic.
+ *
+ * The Java math library is defined with respect to
+ * {@code fdlibm} version 5.3. Where {@code fdlibm} provides
+ * more than one definition for a function (such as
+ * {@code acos}), use the "IEEE 754 core function" version
+ * (residing in a file whose name begins with the letter
+ * {@code e}). The methods which require {@code fdlibm}
+ * semantics are {@code sin}, {@code cos}, {@code tan},
+ * {@code asin}, {@code acos}, {@code atan},
+ * {@code exp}, {@code log}, {@code log10},
+ * {@code cbrt}, {@code atan2}, {@code pow},
+ * {@code sinh}, {@code cosh}, {@code tanh},
+ * {@code hypot}, {@code expm1}, and {@code log1p}.
+ *
+ * @author unascribed
+ * @author Joseph D. Darcy
+ * @since 1.3
+ */
+
+public final class StrictMath {
+
+ /**
+ * Don't let anyone instantiate this class.
+ */
+ private StrictMath() {}
+
+ /**
+ * The {@code double} value that is closer than any other to
+ * e, the base of the natural logarithms.
+ */
+ public static final double E = 2.7182818284590452354;
+
+ /**
+ * The {@code double} value that is closer than any other to
+ * pi, the ratio of the circumference of a circle to its
+ * diameter.
+ */
+ public static final double PI = 3.14159265358979323846;
+
+ /**
+ * Returns the trigonometric sine of an angle. Special cases:
+ * (In the foregoing descriptions, a floating-point value is
+ * considered to be an integer if and only if it is finite and a
+ * fixed point of the method {@link #ceil ceil} or,
+ * equivalently, a fixed point of the method {@link #floor
+ * floor}. A value is a fixed point of a one-argument
+ * method if and only if the result of applying the method to the
+ * value is equal to the value.)
+ *
+ * @param a base.
+ * @param b the exponent.
+ * @return the value {@code a}{@code b}.
+ */
+ public static native double pow(double a, double b);
+
+ /**
+ * Returns the closest {@code int} to the argument, with ties
+ * rounding up.
+ *
+ * Special cases:
+ * Special cases:
+ * When this method is first called, it creates a single new
+ * pseudorandom-number generator, exactly as if by the expression
+ *
+ * This method is properly synchronized to allow correct use by
+ * more than one thread. However, if many threads need to generate
+ * pseudorandom numbers at a great rate, it may reduce contention
+ * for each thread to have its own pseudorandom number generator.
+ *
+ * @return a pseudorandom {@code double} greater than or equal
+ * to {@code 0.0} and less than {@code 1.0}.
+ * @see Random#nextDouble()
+ */
+ public static double random() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the absolute value of an {@code int} value..
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ *
+ * Note that if the argument is equal to the value of
+ * {@link Integer#MIN_VALUE}, the most negative representable
+ * {@code int} value, the result is that same value, which is
+ * negative.
+ *
+ * @param a the argument whose absolute value is to be determined.
+ * @return the absolute value of the argument.
+ */
+ public static int abs(int a) {
+ return (a < 0) ? -a : a;
+ }
+
+ /**
+ * Returns the absolute value of a {@code long} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ *
+ * Note that if the argument is equal to the value of
+ * {@link Long#MIN_VALUE}, the most negative representable
+ * {@code long} value, the result is that same value, which
+ * is negative.
+ *
+ * @param a the argument whose absolute value is to be determined.
+ * @return the absolute value of the argument.
+ */
+ public static long abs(long a) {
+ return (a < 0) ? -a : a;
+ }
+
+ /**
+ * Returns the absolute value of a {@code float} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ * Special cases:
+ * {@code Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))}
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument.
+ */
+ public static float abs(float a) {
+ return (a <= 0.0F) ? 0.0F - a : a;
+ }
+
+ /**
+ * Returns the absolute value of a {@code double} value.
+ * If the argument is not negative, the argument is returned.
+ * If the argument is negative, the negation of the argument is returned.
+ * Special cases:
+ * {@code Double.longBitsToDouble((Double.doubleToLongBits(a)<<1)>>>1)}
+ *
+ * @param a the argument whose absolute value is to be determined
+ * @return the absolute value of the argument.
+ */
+ public static double abs(double a) {
+ return (a <= 0.0D) ? 0.0D - a : a;
+ }
+
+ /**
+ * Returns the greater of two {@code int} values. That is, the
+ * result is the argument closer to the value of
+ * {@link Integer#MAX_VALUE}. If the arguments have the same value,
+ * the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static int max(int a, int b) {
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the greater of two {@code long} values. That is, the
+ * result is the argument closer to the value of
+ * {@link Long#MAX_VALUE}. If the arguments have the same value,
+ * the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static long max(long a, long b) {
+ return (a >= b) ? a : b;
+ }
+
+ // Use raw bit-wise conversions on guaranteed non-NaN arguments.
+ private static long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
+ private static long negativeZeroDoubleBits = Double.doubleToRawLongBits(-0.0d);
+
+ /**
+ * Returns the greater of two {@code float} values. That is,
+ * the result is the argument closer to positive infinity. If the
+ * arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If one
+ * argument is positive zero and the other negative zero, the
+ * result is positive zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static float max(float a, float b) {
+ if (a != a)
+ return a; // a is NaN
+ if ((a == 0.0f) &&
+ (b == 0.0f) &&
+ (Float.floatToRawIntBits(a) == negativeZeroFloatBits)) {
+ // Raw conversion ok since NaN can't map to -0.0.
+ return b;
+ }
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the greater of two {@code double} values. That
+ * is, the result is the argument closer to positive infinity. If
+ * the arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If one
+ * argument is positive zero and the other negative zero, the
+ * result is positive zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ */
+ public static double max(double a, double b) {
+ if (a != a)
+ return a; // a is NaN
+ if ((a == 0.0d) &&
+ (b == 0.0d) &&
+ (Double.doubleToRawLongBits(a) == negativeZeroDoubleBits)) {
+ // Raw conversion ok since NaN can't map to -0.0.
+ return b;
+ }
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code int} values. That is,
+ * the result the argument closer to the value of
+ * {@link Integer#MIN_VALUE}. If the arguments have the same
+ * value, the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static int min(int a, int b) {
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code long} values. That is,
+ * the result is the argument closer to the value of
+ * {@link Long#MIN_VALUE}. If the arguments have the same
+ * value, the result is that same value.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static long min(long a, long b) {
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code float} values. That is,
+ * the result is the value closer to negative infinity. If the
+ * arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If
+ * one argument is positive zero and the other is negative zero,
+ * the result is negative zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b.}
+ */
+ public static float min(float a, float b) {
+ if (a != a)
+ return a; // a is NaN
+ if ((a == 0.0f) &&
+ (b == 0.0f) &&
+ (Float.floatToRawIntBits(b) == negativeZeroFloatBits)) {
+ // Raw conversion ok since NaN can't map to -0.0.
+ return b;
+ }
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the smaller of two {@code double} values. That
+ * is, the result is the value closer to negative infinity. If the
+ * arguments have the same value, the result is that same
+ * value. If either value is NaN, then the result is NaN. Unlike
+ * the numerical comparison operators, this method considers
+ * negative zero to be strictly smaller than positive zero. If one
+ * argument is positive zero and the other is negative zero, the
+ * result is negative zero.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the smaller of {@code a} and {@code b}.
+ */
+ public static double min(double a, double b) {
+ if (a != a)
+ return a; // a is NaN
+ if ((a == 0.0d) &&
+ (b == 0.0d) &&
+ (Double.doubleToRawLongBits(b) == negativeZeroDoubleBits)) {
+ // Raw conversion ok since NaN can't map to -0.0.
+ return b;
+ }
+ return (a <= b) ? a : b;
+ }
+
+ /**
+ * Returns the size of an ulp of the argument. An ulp of a
+ * {@code double} value is the positive distance between this
+ * floating-point value and the {@code double} value next
+ * larger in magnitude. Note that for non-NaN x,
+ * Special Cases:
+ * Special Cases:
+ * Special Cases:
+ * Special Cases:
+ * Special cases:
+ * Special cases:
+ * Special cases:
+ * Special cases:
+ * Special cases:
+ * Special cases:
+ * Special cases:
+ * Special cases:
+ * Special Cases:
+ * Special Cases:
+ * Special cases:
+ * Special cases:
+ *
+ * Strings are constant; their values cannot be changed after they
+ * are created. String buffers support mutable strings.
+ * Because String objects are immutable they can be shared. For example:
+ *
+ * is equivalent to:
+ *
+ * Here are some more examples of how strings can be used:
+ *
+ * The class
+ * The Java language provides special support for the string
+ * concatenation operator ( + ), and for conversion of
+ * other objects to strings. String concatenation is implemented
+ * through the Unless otherwise noted, passing a null argument to a constructor
+ * or method in this class will cause a {@link NullPointerException} to be
+ * thrown.
+ *
+ * A The The {@code offset} argument is the index of the first byte of the
+ * subarray, and the {@code count} argument specifies the length of the
+ * subarray.
+ *
+ * Each {@code byte} in the subarray is converted to a {@code char} as
+ * specified in the method above.
+ *
+ * @deprecated This method does not properly convert bytes into characters.
+ * As of JDK 1.1, the preferred way to do this is via the
+ * {@code String} constructors that take a {@link
+ * java.nio.charset.Charset}, charset name, or that use the platform's
+ * default charset.
+ *
+ * @param ascii
+ * The bytes to be converted to characters
+ *
+ * @param hibyte
+ * The top 8 bits of each 16-bit Unicode code unit
+ *
+ * @param offset
+ * The initial offset
+ * @param count
+ * The length
+ *
+ * @throws IndexOutOfBoundsException
+ * If the {@code offset} or {@code count} argument is invalid
+ *
+ * @see #String(byte[], int)
+ * @see #String(byte[], int, int, java.lang.String)
+ * @see #String(byte[], int, int, java.nio.charset.Charset)
+ * @see #String(byte[], int, int)
+ * @see #String(byte[], java.lang.String)
+ * @see #String(byte[], java.nio.charset.Charset)
+ * @see #String(byte[])
+ */
+ @Deprecated
+ public String(byte ascii[], int hibyte, int offset, int count) {
+ checkBounds(ascii, offset, count);
+ char value[] = new char[count];
+
+ if (hibyte == 0) {
+ for (int i = count ; i-- > 0 ;) {
+ value[i] = (char) (ascii[i + offset] & 0xff);
+ }
+ } else {
+ hibyte <<= 8;
+ for (int i = count ; i-- > 0 ;) {
+ value[i] = (char) (hibyte | (ascii[i + offset] & 0xff));
+ }
+ }
+ this.offset = 0;
+ this.count = count;
+ this.value = value;
+ }
+
+ /**
+ * Allocates a new {@code String} containing characters constructed from
+ * an array of 8-bit integer values. Each character cin the
+ * resulting string is constructed from the corresponding component
+ * b in the byte array such that:
+ *
+ * The behavior of this constructor when the given bytes are not valid
+ * in the given charset is unspecified. The {@link
+ * java.nio.charset.CharsetDecoder} class should be used when more control
+ * over the decoding process is required.
+ *
+ * @param bytes
+ * The bytes to be decoded into characters
+ *
+ * @param offset
+ * The index of the first byte to decode
+ *
+ * @param length
+ * The number of bytes to decode
+
+ * @param charsetName
+ * The name of a supported {@linkplain java.nio.charset.Charset
+ * charset}
+ *
+ * @throws UnsupportedEncodingException
+ * If the named charset is not supported
+ *
+ * @throws IndexOutOfBoundsException
+ * If the {@code offset} and {@code length} arguments index
+ * characters outside the bounds of the {@code bytes} array
+ *
+ * @since JDK1.1
+ */
+// public String(byte bytes[], int offset, int length, String charsetName)
+// throws UnsupportedEncodingException
+// {
+// if (charsetName == null)
+// throw new NullPointerException("charsetName");
+// checkBounds(bytes, offset, length);
+// char[] v = StringCoding.decode(charsetName, bytes, offset, length);
+// this.offset = 0;
+// this.count = v.length;
+// this.value = v;
+// }
+
+ /**
+ * Constructs a new {@code String} by decoding the specified subarray of
+ * bytes using the specified {@linkplain java.nio.charset.Charset charset}.
+ * The length of the new {@code String} is a function of the charset, and
+ * hence may not be equal to the length of the subarray.
+ *
+ * This method always replaces malformed-input and unmappable-character
+ * sequences with this charset's default replacement string. The {@link
+ * java.nio.charset.CharsetDecoder} class should be used when more control
+ * over the decoding process is required.
+ *
+ * @param bytes
+ * The bytes to be decoded into characters
+ *
+ * @param offset
+ * The index of the first byte to decode
+ *
+ * @param length
+ * The number of bytes to decode
+ *
+ * @param charset
+ * The {@linkplain java.nio.charset.Charset charset} to be used to
+ * decode the {@code bytes}
+ *
+ * @throws IndexOutOfBoundsException
+ * If the {@code offset} and {@code length} arguments index
+ * characters outside the bounds of the {@code bytes} array
+ *
+ * @since 1.6
+ */
+ /* don't want dependnecy on Charset
+ public String(byte bytes[], int offset, int length, Charset charset) {
+ if (charset == null)
+ throw new NullPointerException("charset");
+ checkBounds(bytes, offset, length);
+ char[] v = StringCoding.decode(charset, bytes, offset, length);
+ this.offset = 0;
+ this.count = v.length;
+ this.value = v;
+ }
+ */
+
+ /**
+ * Constructs a new {@code String} by decoding the specified array of bytes
+ * using the specified {@linkplain java.nio.charset.Charset charset}. The
+ * length of the new {@code String} is a function of the charset, and hence
+ * may not be equal to the length of the byte array.
+ *
+ * The behavior of this constructor when the given bytes are not valid
+ * in the given charset is unspecified. The {@link
+ * java.nio.charset.CharsetDecoder} class should be used when more control
+ * over the decoding process is required.
+ *
+ * @param bytes
+ * The bytes to be decoded into characters
+ *
+ * @param charsetName
+ * The name of a supported {@linkplain java.nio.charset.Charset
+ * charset}
+ *
+ * @throws UnsupportedEncodingException
+ * If the named charset is not supported
+ *
+ * @since JDK1.1
+ */
+// public String(byte bytes[], String charsetName)
+// throws UnsupportedEncodingException
+// {
+// this(bytes, 0, bytes.length, charsetName);
+// }
+
+ /**
+ * Constructs a new {@code String} by decoding the specified array of
+ * bytes using the specified {@linkplain java.nio.charset.Charset charset}.
+ * The length of the new {@code String} is a function of the charset, and
+ * hence may not be equal to the length of the byte array.
+ *
+ * This method always replaces malformed-input and unmappable-character
+ * sequences with this charset's default replacement string. The {@link
+ * java.nio.charset.CharsetDecoder} class should be used when more control
+ * over the decoding process is required.
+ *
+ * @param bytes
+ * The bytes to be decoded into characters
+ *
+ * @param charset
+ * The {@linkplain java.nio.charset.Charset charset} to be used to
+ * decode the {@code bytes}
+ *
+ * @since 1.6
+ */
+ /* don't want dep on Charset
+ public String(byte bytes[], Charset charset) {
+ this(bytes, 0, bytes.length, charset);
+ }
+ */
+
+ /**
+ * Constructs a new {@code String} by decoding the specified subarray of
+ * bytes using the platform's default charset. The length of the new
+ * {@code String} is a function of the charset, and hence may not be equal
+ * to the length of the subarray.
+ *
+ * The behavior of this constructor when the given bytes are not valid
+ * in the default charset is unspecified. The {@link
+ * java.nio.charset.CharsetDecoder} class should be used when more control
+ * over the decoding process is required.
+ *
+ * @param bytes
+ * The bytes to be decoded into characters
+ *
+ * @param offset
+ * The index of the first byte to decode
+ *
+ * @param length
+ * The number of bytes to decode
+ *
+ * @throws IndexOutOfBoundsException
+ * If the {@code offset} and the {@code length} arguments index
+ * characters outside the bounds of the {@code bytes} array
+ *
+ * @since JDK1.1
+ */
+ public String(byte bytes[], int offset, int length) {
+ checkBounds(bytes, offset, length);
+ char[] v = new char[length];
+ for (int i = 0; i < length; i++) {
+ v[i] = (char)bytes[offset++];
+ }
+ this.offset = 0;
+ this.count = v.length;
+ this.value = v;
+ }
+
+ /**
+ * Constructs a new {@code String} by decoding the specified array of bytes
+ * using the platform's default charset. The length of the new {@code
+ * String} is a function of the charset, and hence may not be equal to the
+ * length of the byte array.
+ *
+ * The behavior of this constructor when the given bytes are not valid
+ * in the default charset is unspecified. The {@link
+ * java.nio.charset.CharsetDecoder} class should be used when more control
+ * over the decoding process is required.
+ *
+ * @param bytes
+ * The bytes to be decoded into characters
+ *
+ * @since JDK1.1
+ */
+ public String(byte bytes[]) {
+ this(bytes, 0, bytes.length);
+ }
+
+ /**
+ * Allocates a new string that contains the sequence of characters
+ * currently contained in the string buffer argument. The contents of the
+ * string buffer are copied; subsequent modification of the string buffer
+ * does not affect the newly created string.
+ *
+ * @param buffer
+ * A {@code StringBuffer}
+ */
+ public String(StringBuffer buffer) {
+ String result = buffer.toString();
+ this.value = result.value;
+ this.count = result.count;
+ this.offset = result.offset;
+ }
+
+ /**
+ * Allocates a new string that contains the sequence of characters
+ * currently contained in the string builder argument. The contents of the
+ * string builder are copied; subsequent modification of the string builder
+ * does not affect the newly created string.
+ *
+ * This constructor is provided to ease migration to {@code
+ * StringBuilder}. Obtaining a string from a string builder via the {@code
+ * toString} method is likely to run faster and is generally preferred.
+ *
+ * @param builder
+ * A {@code StringBuilder}
+ *
+ * @since 1.5
+ */
+ public String(StringBuilder builder) {
+ String result = builder.toString();
+ this.value = result.value;
+ this.count = result.count;
+ this.offset = result.offset;
+ }
+
+
+ // Package private constructor which shares value array for speed.
+ String(int offset, int count, char value[]) {
+ this.value = value;
+ this.offset = offset;
+ this.count = count;
+ }
+
+ /**
+ * Returns the length of this string.
+ * The length is equal to the number of Unicode
+ * code units in the string.
+ *
+ * @return the length of the sequence of characters represented by this
+ * object.
+ */
+ public int length() {
+ return count;
+ }
+
+ /**
+ * Returns true if, and only if, {@link #length()} is 0.
+ *
+ * @return true if {@link #length()} is 0, otherwise
+ * false
+ *
+ * @since 1.6
+ */
+ public boolean isEmpty() {
+ return count == 0;
+ }
+
+ /**
+ * Returns the If the If the If the
+ * The first character to be copied is at index The first character to be copied is at index {@code srcBegin}; the
+ * last character to be copied is at index {@code srcEnd-1}. The total
+ * number of characters to be copied is {@code srcEnd-srcBegin}. The
+ * characters, converted to bytes, are copied into the subarray of {@code
+ * dst} starting at index {@code dstBegin} and ending at index:
+ *
+ * The behavior of this method when this string cannot be encoded in
+ * the given charset is unspecified. The {@link
+ * java.nio.charset.CharsetEncoder} class should be used when more control
+ * over the encoding process is required.
+ *
+ * @param charsetName
+ * The name of a supported {@linkplain java.nio.charset.Charset
+ * charset}
+ *
+ * @return The resultant byte array
+ *
+ * @throws UnsupportedEncodingException
+ * If the named charset is not supported
+ *
+ * @since JDK1.1
+ */
+// public byte[] getBytes(String charsetName)
+// throws UnsupportedEncodingException
+// {
+// if (charsetName == null) throw new NullPointerException();
+// return StringCoding.encode(charsetName, value, offset, count);
+// }
+
+ /**
+ * Encodes this {@code String} into a sequence of bytes using the given
+ * {@linkplain java.nio.charset.Charset charset}, storing the result into a
+ * new byte array.
+ *
+ * This method always replaces malformed-input and unmappable-character
+ * sequences with this charset's default replacement byte array. The
+ * {@link java.nio.charset.CharsetEncoder} class should be used when more
+ * control over the encoding process is required.
+ *
+ * @param charset
+ * The {@linkplain java.nio.charset.Charset} to be used to encode
+ * the {@code String}
+ *
+ * @return The resultant byte array
+ *
+ * @since 1.6
+ */
+ /* don't want dep on Charset
+ public byte[] getBytes(Charset charset) {
+ if (charset == null) throw new NullPointerException();
+ return StringCoding.encode(charset, value, offset, count);
+ }
+ */
+
+ /**
+ * Encodes this {@code String} into a sequence of bytes using the
+ * platform's default charset, storing the result into a new byte array.
+ *
+ * The behavior of this method when this string cannot be encoded in
+ * the default charset is unspecified. The {@link
+ * java.nio.charset.CharsetEncoder} class should be used when more control
+ * over the encoding process is required.
+ *
+ * @return The resultant byte array
+ *
+ * @since JDK1.1
+ */
+ public byte[] getBytes() {
+ byte[] arr = new byte[length()];
+ for (int i = 0; i < arr.length; i++) {
+ final char v = charAt(i);
+ arr[i] = (byte)v;
+ }
+ return arr;
+ }
+
+ /**
+ * Compares this string to the specified object. The result is {@code
+ * true} if and only if the argument is not {@code null} and is a {@code
+ * String} object that represents the same sequence of characters as this
+ * object.
+ *
+ * @param anObject
+ * The object to compare this {@code String} against
+ *
+ * @return {@code true} if the given object represents a {@code String}
+ * equivalent to this string, {@code false} otherwise
+ *
+ * @see #compareTo(String)
+ * @see #equalsIgnoreCase(String)
+ */
+ public boolean equals(Object anObject) {
+ if (this == anObject) {
+ return true;
+ }
+ if (anObject instanceof String) {
+ String anotherString = (String)anObject;
+ int n = count;
+ if (n == anotherString.count) {
+ char v1[] = value;
+ char v2[] = anotherString.value;
+ int i = offset;
+ int j = anotherString.offset;
+ while (n-- != 0) {
+ if (v1[i++] != v2[j++])
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Compares this string to the specified {@code StringBuffer}. The result
+ * is {@code true} if and only if this {@code String} represents the same
+ * sequence of characters as the specified {@code StringBuffer}.
+ *
+ * @param sb
+ * The {@code StringBuffer} to compare this {@code String} against
+ *
+ * @return {@code true} if this {@code String} represents the same
+ * sequence of characters as the specified {@code StringBuffer},
+ * {@code false} otherwise
+ *
+ * @since 1.4
+ */
+ public boolean contentEquals(StringBuffer sb) {
+ synchronized(sb) {
+ return contentEquals((CharSequence)sb);
+ }
+ }
+
+ /**
+ * Compares this string to the specified {@code CharSequence}. The result
+ * is {@code true} if and only if this {@code String} represents the same
+ * sequence of char values as the specified sequence.
+ *
+ * @param cs
+ * The sequence to compare this {@code String} against
+ *
+ * @return {@code true} if this {@code String} represents the same
+ * sequence of char values as the specified sequence, {@code
+ * false} otherwise
+ *
+ * @since 1.5
+ */
+ public boolean contentEquals(CharSequence cs) {
+ if (count != cs.length())
+ return false;
+ // Argument is a StringBuffer, StringBuilder
+ if (cs instanceof AbstractStringBuilder) {
+ char v1[] = value;
+ char v2[] = ((AbstractStringBuilder)cs).getValue();
+ int i = offset;
+ int j = 0;
+ int n = count;
+ while (n-- != 0) {
+ if (v1[i++] != v2[j++])
+ return false;
+ }
+ return true;
+ }
+ // Argument is a String
+ if (cs.equals(this))
+ return true;
+ // Argument is a generic CharSequence
+ char v1[] = value;
+ int i = offset;
+ int j = 0;
+ int n = count;
+ while (n-- != 0) {
+ if (v1[i++] != cs.charAt(j++))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Compares this {@code String} to another {@code String}, ignoring case
+ * considerations. Two strings are considered equal ignoring case if they
+ * are of the same length and corresponding characters in the two strings
+ * are equal ignoring case.
+ *
+ * Two characters {@code c1} and {@code c2} are considered the same
+ * ignoring case if at least one of the following is true:
+ *
+ * This is the definition of lexicographic ordering. If two strings are
+ * different, then either they have different characters at some index
+ * that is a valid index for both strings, or their lengths are different,
+ * or both. If they have different characters at one or more index
+ * positions, let k be the smallest such index; then the string
+ * whose character at position k has the smaller value, as
+ * determined by using the < operator, lexicographically precedes the
+ * other string. In this case,
+ * Note that this Comparator does not take locale into account,
+ * and will result in an unsatisfactory ordering for certain locales.
+ * The java.text package provides Collators to allow
+ * locale-sensitive ordering.
+ *
+ * @see java.text.Collator#compare(String, String)
+ * @since 1.2
+ */
+ public static final Comparator
+ * Note that this method does not take locale into account,
+ * and will result in an unsatisfactory ordering for certain locales.
+ * The java.text package provides collators to allow
+ * locale-sensitive ordering.
+ *
+ * @param str the
+ * A substring of this String object is compared to a substring
+ * of the argument other. The result is true if these substrings
+ * represent identical character sequences. The substring of this
+ * String object to be compared begins at index toffset
+ * and has length len. The substring of other to be compared
+ * begins at index ooffset and has length len. The
+ * result is false if and only if at least one of the following
+ * is true:
+ *
+ * A substring of this String object is compared to a substring
+ * of the argument other. The result is true if these
+ * substrings represent character sequences that are the same, ignoring
+ * case if and only if ignoreCase is true. The substring of
+ * this String object to be compared begins at index
+ * toffset and has length len. The substring of
+ * other to be compared begins at index ooffset and
+ * has length len. The result is false if and only if
+ * at least one of the following is true:
+ *
+ * If a character with value
+ * There is no restriction on the value of All indices are specified in All indices are specified in The returned index is the smallest value k for which:
+ * The returned index is the smallest value k for which:
+ * The returned index is the largest value k for which:
+ * The returned index is the largest value k for which:
+ *
+ * Examples:
+ *
+ * Examples:
+ * An invocation of this method of the form
+ *
+ *
+ * If the length of the argument string is
+ * Examples:
+ *
+ * If the character
+ * Examples:
+ * An invocation of this method of the form
+ * str.matches(regex) yields exactly the
+ * same result as the expression
+ *
+ * An invocation of this method of the form
+ * str.replaceFirst(regex, repl)
+ * yields exactly the same result as the expression
+ *
+ *
+ * Note that backslashes (\) and dollar signs ($) in the
+ * replacement string may cause the results to be different than if it were
+ * being treated as a literal replacement string; see
+ * {@link java.util.regex.Matcher#replaceFirst}.
+ * Use {@link java.util.regex.Matcher#quoteReplacement} to suppress the special
+ * meaning of these characters, if desired.
+ *
+ * @param regex
+ * the regular expression to which this string is to be matched
+ * @param replacement
+ * the string to be substituted for the first match
+ *
+ * @return The resulting String
+ *
+ * @throws PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see java.util.regex.Pattern
+ *
+ * @since 1.4
+ * @spec JSR-51
+ */
+ public String replaceFirst(String regex, String replacement) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replaces each substring of this string that matches the given regular expression with the
+ * given replacement.
+ *
+ * An invocation of this method of the form
+ * str.replaceAll(regex, repl)
+ * yields exactly the same result as the expression
+ *
+ *
+ * Note that backslashes (\) and dollar signs ($) in the
+ * replacement string may cause the results to be different than if it were
+ * being treated as a literal replacement string; see
+ * {@link java.util.regex.Matcher#replaceAll Matcher.replaceAll}.
+ * Use {@link java.util.regex.Matcher#quoteReplacement} to suppress the special
+ * meaning of these characters, if desired.
+ *
+ * @param regex
+ * the regular expression to which this string is to be matched
+ * @param replacement
+ * the string to be substituted for each match
+ *
+ * @return The resulting String
+ *
+ * @throws PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see java.util.regex.Pattern
+ *
+ * @since 1.4
+ * @spec JSR-51
+ */
+ public String replaceAll(String regex, String replacement) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replaces each substring of this string that matches the literal target
+ * sequence with the specified literal replacement sequence. The
+ * replacement proceeds from the beginning of the string to the end, for
+ * example, replacing "aa" with "b" in the string "aaa" will result in
+ * "ba" rather than "ab".
+ *
+ * @param target The sequence of char values to be replaced
+ * @param replacement The replacement sequence of char values
+ * @return The resulting string
+ * @throws NullPointerException if The array returned by this method contains each substring of this
+ * string that is terminated by another substring that matches the given
+ * expression or is terminated by the end of the string. The substrings in
+ * the array are in the order in which they occur in this string. If the
+ * expression does not match any part of the input then the resulting array
+ * has just one element, namely this string.
+ *
+ * The limit parameter controls the number of times the
+ * pattern is applied and therefore affects the length of the resulting
+ * array. If the limit n is greater than zero then the pattern
+ * will be applied at most n - 1 times, the array's
+ * length will be no greater than n, and the array's last entry
+ * will contain all input beyond the last matched delimiter. If n
+ * is non-positive then the pattern will be applied as many times as
+ * possible and the array can have any length. If n is zero then
+ * the pattern will be applied as many times as possible, the array can
+ * have any length, and trailing empty strings will be discarded.
+ *
+ * The string "boo:and:foo", for example, yields the
+ * following results with these parameters:
+ *
+ * An invocation of this method of the form
+ * str.split(regex, n)
+ * yields the same result as the expression
+ *
+ * This method works as if by invoking the two-argument {@link
+ * #split(String, int) split} method with the given expression and a limit
+ * argument of zero. Trailing empty strings are therefore not included in
+ * the resulting array.
+ *
+ * The string "boo:and:foo", for example, yields the following
+ * results with these expressions:
+ *
+ *
+ * Examples of lowercase mappings are in the following table:
+ *
+ * Note: This method is locale sensitive, and may produce unexpected
+ * results if used for strings that are intended to be interpreted locale
+ * independently.
+ * Examples are programming language identifiers, protocol keys, and HTML
+ * tags.
+ * For instance,
+ * @return the
+ * Examples of locale-sensitive and 1:M case mappings are in the following table.
+ *
+ *
+ * Note: This method is locale sensitive, and may produce unexpected
+ * results if used for strings that are intended to be interpreted locale
+ * independently.
+ * Examples are programming language identifiers, protocol keys, and HTML
+ * tags.
+ * For instance,
+ * @return the
+ * If this
+ * Otherwise, if there is no character with a code greater than
+ *
+ * Otherwise, let k be the index of the first character in the
+ * string whose code is greater than
+ * This method may be used to trim whitespace (as defined above) from
+ * the beginning and end of a string.
+ *
+ * @return A copy of this string with leading and trailing white
+ * space removed, or this string if it has no leading or
+ * trailing white space.
+ */
+ public String trim() {
+ int len = count;
+ int st = 0;
+ int off = offset; /* avoid getfield opcode */
+ char[] val = value; /* avoid getfield opcode */
+
+ while ((st < len) && (val[off + st] <= ' ')) {
+ st++;
+ }
+ while ((st < len) && (val[off + len - 1] <= ' ')) {
+ len--;
+ }
+ return ((st > 0) || (len < count)) ? substring(st, len) : this;
+ }
+
+ /**
+ * This object (which is already a string!) is itself returned.
+ *
+ * @return the string itself.
+ */
+ public String toString() {
+ return this;
+ }
+
+ /**
+ * Converts this string to a new character array.
+ *
+ * @return a newly allocated character array whose length is the length
+ * of this string and whose contents are initialized to contain
+ * the character sequence represented by this string.
+ */
+ public char[] toCharArray() {
+ char result[] = new char[count];
+ getChars(0, count, result, 0);
+ return result;
+ }
+
+ /**
+ * Returns a formatted string using the specified format string and
+ * arguments.
+ *
+ * The locale always used is the one returned by {@link
+ * java.util.Locale#getDefault() Locale.getDefault()}.
+ *
+ * @param format
+ * A format string
+ *
+ * @param args
+ * Arguments referenced by the format specifiers in the format
+ * string. If there are more arguments than format specifiers, the
+ * extra arguments are ignored. The number of arguments is
+ * variable and may be zero. The maximum number of arguments is
+ * limited by the maximum dimension of a Java array as defined by
+ * The Java™ Virtual Machine Specification.
+ * The behaviour on a
+ * null argument depends on the conversion.
+ *
+ * @throws IllegalFormatException
+ * If a format string contains an illegal syntax, a format
+ * specifier that is incompatible with the given arguments,
+ * insufficient arguments given the format string, or other
+ * illegal conditions. For specification of all possible
+ * formatting errors, see the Details section of the
+ * formatter class specification.
+ *
+ * @throws NullPointerException
+ * If the format is null
+ *
+ * @return A formatted string
+ *
+ * @see java.util.Formatter
+ * @since 1.5
+ */
+ public static String format(String format, Object ... args) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns a formatted string using the specified locale, format string,
+ * and arguments.
+ *
+ * @param l
+ * The {@linkplain java.util.Locale locale} to apply during
+ * formatting. If l is null then no localization
+ * is applied.
+ *
+ * @param format
+ * A format string
+ *
+ * @param args
+ * Arguments referenced by the format specifiers in the format
+ * string. If there are more arguments than format specifiers, the
+ * extra arguments are ignored. The number of arguments is
+ * variable and may be zero. The maximum number of arguments is
+ * limited by the maximum dimension of a Java array as defined by
+ * The Java™ Virtual Machine Specification.
+ * The behaviour on a
+ * null argument depends on the conversion.
+ *
+ * @throws IllegalFormatException
+ * If a format string contains an illegal syntax, a format
+ * specifier that is incompatible with the given arguments,
+ * insufficient arguments given the format string, or other
+ * illegal conditions. For specification of all possible
+ * formatting errors, see the Details section of the
+ * formatter class specification
+ *
+ * @throws NullPointerException
+ * If the format is null
+ *
+ * @return A formatted string
+ *
+ * @see java.util.Formatter
+ * @since 1.5
+ */
+// public static String format(Locale l, String format, Object ... args) {
+// return new Formatter(l).format(format, args).toString();
+// }
+
+ /**
+ * Returns the string representation of the
+ * The
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * The representation is exactly the one returned by the
+ *
+ * A pool of strings, initially empty, is maintained privately by the
+ * class
+ * When the intern method is invoked, if the pool already contains a
+ * string equal to this
+ * It follows that for any two strings
+ * All literal strings and string-valued constant expressions are
+ * interned. String literals are defined in section 3.10.5 of the
+ * The Java™ Language Specification.
+ *
+ * @return a string that has the same contents as this string, but is
+ * guaranteed to be from a pool of unique strings.
+ */
+ public native String intern();
+
+ static char[] copyOfRange(char[] original, int from, int to) {
+ int newLength = to - from;
+ if (newLength < 0) {
+ throw new IllegalArgumentException(from + " > " + to);
+ }
+ char[] copy = new char[newLength];
+ arraycopy(original, from, copy, 0,
+ Math.min(original.length - from, newLength));
+ return copy;
+ }
+ static char[] copyOf(char[] original, int newLength) {
+ char[] copy = new char[newLength];
+ arraycopy(original, 0, copy, 0,
+ Math.min(original.length, newLength));
+ return copy;
+ }
+ static void arraycopy(
+ char[] value, int srcBegin, char[] dst, int dstBegin, int count
+ ) {
+ while (count-- > 0) {
+ dst[dstBegin++] = value[srcBegin++];
+ }
+ }
+ // access system property
+ static String getProperty(String nm) {
+ return null;
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/StringBuffer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/StringBuffer.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,605 @@
+/*
+ * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+
+/**
+ * A thread-safe, mutable sequence of characters.
+ * A string buffer is like a {@link String}, but can be modified. At any
+ * point in time it contains some particular sequence of characters, but
+ * the length and content of the sequence can be changed through certain
+ * method calls.
+ *
+ * String buffers are safe for use by multiple threads. The methods
+ * are synchronized where necessary so that all the operations on any
+ * particular instance behave as if they occur in some serial order
+ * that is consistent with the order of the method calls made by each of
+ * the individual threads involved.
+ *
+ * The principal operations on a
+ * For example, if
+ * In general, if sb refers to an instance of a
+ * Whenever an operation occurs involving a source sequence (such as
+ * appending or inserting from a source sequence) this class synchronizes
+ * only on the string buffer performing the operation, not on the source.
+ *
+ * Every string buffer has a capacity. As long as the length of the
+ * character sequence contained in the string buffer does not exceed
+ * the capacity, it is not necessary to allocate a new internal
+ * buffer array. If the internal buffer overflows, it is
+ * automatically made larger.
+ *
+ * As of release JDK 5, this class has been supplemented with an equivalent
+ * class designed for use by a single thread, {@link StringBuilder}. The
+ * StringBuilder class should generally be used in preference to
+ * this one, as it supports all of the same operations but it is faster, as
+ * it performs no synchronization.
+ *
+ * @author Arthur van Hoff
+ * @see java.lang.StringBuilder
+ * @see java.lang.String
+ * @since JDK1.0
+ */
+ public final class StringBuffer
+ extends AbstractStringBuilder
+ implements java.io.Serializable, CharSequence
+{
+
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ static final long serialVersionUID = 3388685877147921107L;
+
+ /**
+ * Constructs a string buffer with no characters in it and an
+ * initial capacity of 16 characters.
+ */
+ public StringBuffer() {
+ super(16);
+ }
+
+ /**
+ * Constructs a string buffer with no characters in it and
+ * the specified initial capacity.
+ *
+ * @param capacity the initial capacity.
+ * @exception NegativeArraySizeException if the
+ * If the length of the specified
+ * The characters of the StringBuffer argument are appended,
+ * in order, to the contents of this StringBuffer, increasing the
+ * length of this StringBuffer by the length of the argument.
+ * If sb is null, then the four characters
+ * "null" are appended to this StringBuffer.
+ *
+ * Let n be the length of the old character sequence, the one
+ * contained in the StringBuffer just prior to execution of the
+ * append method. Then the character at index k in
+ * the new character sequence is equal to the character at index k
+ * in the old character sequence, if k is less than n;
+ * otherwise, it is equal to the character at index k-n in the
+ * argument
+ * This method synchronizes on
+ * The characters of the The result of this method is exactly the same as if it were an
+ * invocation of this.append(s, 0, s.length());
+ *
+ * This method synchronizes on this (the destination)
+ * object but does not synchronize on the source ( If The principal operations on a
+ * For example, if
+ * In general, if sb refers to an instance of a Instances of
+ * The characters of the StringBuffer argument are appended,
+ * in order, to this sequence, increasing the
+ * length of this sequence by the length of the argument.
+ * If sb is null, then the four characters
+ * "null" are appended to this sequence.
+ *
+ * Let n be the length of this character sequence just prior to
+ * execution of the append method. Then the character at index
+ * k in the new character sequence is equal to the character at
+ * index k in the old character sequence, if k is less than
+ * n; otherwise, it is equal to the character at index k-n
+ * in the argument Instances of two subclasses, {@link java.lang.Error} and
+ * {@link java.lang.Exception}, are conventionally used to indicate
+ * that exceptional situations have occurred. Typically, these instances
+ * are freshly created in the context of the exceptional situation so
+ * as to include relevant information (such as stack trace data).
+ *
+ * A throwable contains a snapshot of the execution stack of its
+ * thread at the time it was created. It can also contain a message
+ * string that gives more information about the error. Over time, a
+ * throwable can {@linkplain Throwable#addSuppressed suppress} other
+ * throwables from being propagated. Finally, the throwable can also
+ * contain a cause: another throwable that caused this
+ * throwable to be constructed. The recording of this causal information
+ * is referred to as the chained exception facility, as the
+ * cause can, itself, have a cause, and so on, leading to a "chain" of
+ * exceptions, each caused by another.
+ *
+ * One reason that a throwable may have a cause is that the class that
+ * throws it is built atop a lower layered abstraction, and an operation on
+ * the upper layer fails due to a failure in the lower layer. It would be bad
+ * design to let the throwable thrown by the lower layer propagate outward, as
+ * it is generally unrelated to the abstraction provided by the upper layer.
+ * Further, doing so would tie the API of the upper layer to the details of
+ * its implementation, assuming the lower layer's exception was a checked
+ * exception. Throwing a "wrapped exception" (i.e., an exception containing a
+ * cause) allows the upper layer to communicate the details of the failure to
+ * its caller without incurring either of these shortcomings. It preserves
+ * the flexibility to change the implementation of the upper layer without
+ * changing its API (in particular, the set of exceptions thrown by its
+ * methods).
+ *
+ * A second reason that a throwable may have a cause is that the method
+ * that throws it must conform to a general-purpose interface that does not
+ * permit the method to throw the cause directly. For example, suppose
+ * a persistent collection conforms to the {@link java.util.Collection
+ * Collection} interface, and that its persistence is implemented atop
+ * {@code java.io}. Suppose the internals of the {@code add} method
+ * can throw an {@link java.io.IOException IOException}. The implementation
+ * can communicate the details of the {@code IOException} to its caller
+ * while conforming to the {@code Collection} interface by wrapping the
+ * {@code IOException} in an appropriate unchecked exception. (The
+ * specification for the persistent collection should indicate that it is
+ * capable of throwing such exceptions.)
+ *
+ * A cause can be associated with a throwable in two ways: via a
+ * constructor that takes the cause as an argument, or via the
+ * {@link #initCause(Throwable)} method. New throwable classes that
+ * wish to allow causes to be associated with them should provide constructors
+ * that take a cause and delegate (perhaps indirectly) to one of the
+ * {@code Throwable} constructors that takes a cause.
+ *
+ * Because the {@code initCause} method is public, it allows a cause to be
+ * associated with any throwable, even a "legacy throwable" whose
+ * implementation predates the addition of the exception chaining mechanism to
+ * {@code Throwable}.
+ *
+ * By convention, class {@code Throwable} and its subclasses have two
+ * constructors, one that takes no arguments and one that takes a
+ * {@code String} argument that can be used to produce a detail message.
+ * Further, those subclasses that might likely have a cause associated with
+ * them should have two more constructors, one that takes a
+ * {@code Throwable} (the cause), and one that takes a
+ * {@code String} (the detail message) and a {@code Throwable} (the
+ * cause).
+ *
+ * @author unascribed
+ * @author Josh Bloch (Added exception chaining and programmatic access to
+ * stack trace in 1.4.)
+ * @jls 11.2 Compile-Time Checking of Exceptions
+ * @since JDK1.0
+ */
+public class Throwable implements Serializable {
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ private static final long serialVersionUID = -3042686055658047285L;
+
+ /**
+ * Native code saves some indication of the stack backtrace in this slot.
+ */
+ private transient Object backtrace;
+
+ /**
+ * Specific details about the Throwable. For example, for
+ * {@code FileNotFoundException}, this contains the name of
+ * the file that could not be found.
+ *
+ * @serial
+ */
+ private String detailMessage;
+
+
+ /**
+ * Holder class to defer initializing sentinel objects only used
+ * for serialization.
+ */
+ private static class SentinelHolder {
+ /**
+ * {@linkplain #setStackTrace(StackTraceElement[]) Setting the
+ * stack trace} to a one-element array containing this sentinel
+ * value indicates future attempts to set the stack trace will be
+ * ignored. The sentinal is equal to the result of calling: The {@link #fillInStackTrace()} method is called to initialize
+ * the stack trace data in the newly created throwable.
+ */
+ public Throwable() {
+ fillInStackTrace();
+ }
+
+ /**
+ * Constructs a new throwable with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * The {@link #fillInStackTrace()} method is called to initialize
+ * the stack trace data in the newly created throwable.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public Throwable(String message) {
+ fillInStackTrace();
+ detailMessage = message;
+ }
+
+ /**
+ * Constructs a new throwable with the specified detail message and
+ * cause. Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this throwable's detail message.
+ *
+ * The {@link #fillInStackTrace()} method is called to initialize
+ * the stack trace data in the newly created throwable.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public Throwable(String message, Throwable cause) {
+ fillInStackTrace();
+ detailMessage = message;
+ this.cause = cause;
+ }
+
+ /**
+ * Constructs a new throwable with the specified cause and a detail
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
+ * This constructor is useful for throwables that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * The {@link #fillInStackTrace()} method is called to initialize
+ * the stack trace data in the newly created throwable.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public Throwable(Throwable cause) {
+ fillInStackTrace();
+ detailMessage = (cause==null ? null : cause.toString());
+ this.cause = cause;
+ }
+
+ /**
+ * Constructs a new throwable with the specified detail message,
+ * cause, {@linkplain #addSuppressed suppression} enabled or
+ * disabled, and writable stack trace enabled or disabled. If
+ * suppression is disabled, {@link #getSuppressed} for this object
+ * will return a zero-length array and calls to {@link
+ * #addSuppressed} that would otherwise append an exception to the
+ * suppressed list will have no effect. If the writable stack
+ * trace is false, this constructor will not call {@link
+ * #fillInStackTrace()}, a {@code null} will be written to the
+ * {@code stackTrace} field, and subsequent calls to {@code
+ * fillInStackTrace} and {@link
+ * #setStackTrace(StackTraceElement[])} will not set the stack
+ * trace. If the writable stack trace is false, {@link
+ * #getStackTrace} will return a zero length array.
+ *
+ * Note that the other constructors of {@code Throwable} treat
+ * suppression as being enabled and the stack trace as being
+ * writable. Subclasses of {@code Throwable} should document any
+ * conditions under which suppression is disabled and document
+ * conditions under which the stack trace is not writable.
+ * Disabling of suppression should only occur in exceptional
+ * circumstances where special requirements exist, such as a
+ * virtual machine reusing exception objects under low-memory
+ * situations. Circumstances where a given exception object is
+ * repeatedly caught and rethrown, such as to implement control
+ * flow between two sub-systems, is another situation where
+ * immutable throwable objects would be appropriate.
+ *
+ * @param message the detail message.
+ * @param cause the cause. (A {@code null} value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @param enableSuppression whether or not suppression is enabled or disabled
+ * @param writableStackTrace whether or not the stack trace should be
+ * writable
+ *
+ * @see OutOfMemoryError
+ * @see NullPointerException
+ * @see ArithmeticException
+ * @since 1.7
+ */
+ protected Throwable(String message, Throwable cause,
+ boolean enableSuppression,
+ boolean writableStackTrace) {
+ if (writableStackTrace) {
+ fillInStackTrace();
+ } else {
+ stackTrace = null;
+ }
+ detailMessage = message;
+ this.cause = cause;
+// if (!enableSuppression)
+// suppressedExceptions = null;
+ }
+
+ /**
+ * Returns the detail message string of this throwable.
+ *
+ * @return the detail message string of this {@code Throwable} instance
+ * (which may be {@code null}).
+ */
+ public String getMessage() {
+ return detailMessage;
+ }
+
+ /**
+ * Creates a localized description of this throwable.
+ * Subclasses may override this method in order to produce a
+ * locale-specific message. For subclasses that do not override this
+ * method, the default implementation returns the same result as
+ * {@code getMessage()}.
+ *
+ * @return The localized description of this throwable.
+ * @since JDK1.1
+ */
+ public String getLocalizedMessage() {
+ return getMessage();
+ }
+
+ /**
+ * Returns the cause of this throwable or {@code null} if the
+ * cause is nonexistent or unknown. (The cause is the throwable that
+ * caused this throwable to get thrown.)
+ *
+ * This implementation returns the cause that was supplied via one of
+ * the constructors requiring a {@code Throwable}, or that was set after
+ * creation with the {@link #initCause(Throwable)} method. While it is
+ * typically unnecessary to override this method, a subclass can override
+ * it to return a cause set by some other means. This is appropriate for
+ * a "legacy chained throwable" that predates the addition of chained
+ * exceptions to {@code Throwable}. Note that it is not
+ * necessary to override any of the {@code PrintStackTrace} methods,
+ * all of which invoke the {@code getCause} method to determine the
+ * cause of a throwable.
+ *
+ * @return the cause of this throwable or {@code null} if the
+ * cause is nonexistent or unknown.
+ * @since 1.4
+ */
+ public synchronized Throwable getCause() {
+ return (cause==this ? null : cause);
+ }
+
+ /**
+ * Initializes the cause of this throwable to the specified value.
+ * (The cause is the throwable that caused this throwable to get thrown.)
+ *
+ * This method can be called at most once. It is generally called from
+ * within the constructor, or immediately after creating the
+ * throwable. If this throwable was created
+ * with {@link #Throwable(Throwable)} or
+ * {@link #Throwable(String,Throwable)}, this method cannot be called
+ * even once.
+ *
+ * An example of using this method on a legacy throwable type
+ * without other support for setting the cause is:
+ *
+ * An exception can have both a cause and one or more suppressed
+ * exceptions:
+ * If the stack trace of this {@code Throwable} {@linkplain
+ * Throwable#Throwable(String, Throwable, boolean, boolean) is not
+ * writable}, calling this method has no effect.
+ *
+ * @return a reference to this {@code Throwable} instance.
+ * @see java.lang.Throwable#printStackTrace()
+ */
+ public synchronized Throwable fillInStackTrace() {
+ if (stackTrace != null ||
+ backtrace != null /* Out of protocol state */ ) {
+ fillInStackTrace(0);
+ stackTrace = UNASSIGNED_STACK;
+ }
+ return this;
+ }
+
+ private native Throwable fillInStackTrace(int dummy);
+
+ /**
+ * Provides programmatic access to the stack trace information printed by
+ * {@link #printStackTrace()}. Returns an array of stack trace elements,
+ * each representing one stack frame. The zeroth element of the array
+ * (assuming the array's length is non-zero) represents the top of the
+ * stack, which is the last method invocation in the sequence. Typically,
+ * this is the point at which this throwable was created and thrown.
+ * The last element of the array (assuming the array's length is non-zero)
+ * represents the bottom of the stack, which is the first method invocation
+ * in the sequence.
+ *
+ * Some virtual machines may, under some circumstances, omit one
+ * or more stack frames from the stack trace. In the extreme case,
+ * a virtual machine that has no stack trace information concerning
+ * this throwable is permitted to return a zero-length array from this
+ * method. Generally speaking, the array returned by this method will
+ * contain one element for every frame that would be printed by
+ * {@code printStackTrace}. Writes to the returned array do not
+ * affect future calls to this method.
+ *
+ * @return an array of stack trace elements representing the stack trace
+ * pertaining to this throwable.
+ * @since 1.4
+ */
+ public StackTraceElement[] getStackTrace() {
+ return getOurStackTrace().clone();
+ }
+
+ private synchronized StackTraceElement[] getOurStackTrace() {
+ // Initialize stack trace field with information from
+ // backtrace if this is the first call to this method
+ if (stackTrace == UNASSIGNED_STACK ||
+ (stackTrace == null && backtrace != null) /* Out of protocol state */) {
+ int depth = getStackTraceDepth();
+ stackTrace = new StackTraceElement[depth];
+ for (int i=0; i < depth; i++)
+ stackTrace[i] = getStackTraceElement(i);
+ } else if (stackTrace == null) {
+ return UNASSIGNED_STACK;
+ }
+ return stackTrace;
+ }
+
+ /**
+ * Sets the stack trace elements that will be returned by
+ * {@link #getStackTrace()} and printed by {@link #printStackTrace()}
+ * and related methods.
+ *
+ * This method, which is designed for use by RPC frameworks and other
+ * advanced systems, allows the client to override the default
+ * stack trace that is either generated by {@link #fillInStackTrace()}
+ * when a throwable is constructed or deserialized when a throwable is
+ * read from a serialization stream.
+ *
+ * If the stack trace of this {@code Throwable} {@linkplain
+ * Throwable#Throwable(String, Throwable, boolean, boolean) is not
+ * writable}, calling this method has no effect other than
+ * validating its argument.
+ *
+ * @param stackTrace the stack trace elements to be associated with
+ * this {@code Throwable}. The specified array is copied by this
+ * call; changes in the specified array after the method invocation
+ * returns will have no affect on this {@code Throwable}'s stack
+ * trace.
+ *
+ * @throws NullPointerException if {@code stackTrace} is
+ * {@code null} or if any of the elements of
+ * {@code stackTrace} are {@code null}
+ *
+ * @since 1.4
+ */
+ public void setStackTrace(StackTraceElement[] stackTrace) {
+ // Validate argument
+ StackTraceElement[] defensiveCopy = stackTrace.clone();
+ for (int i = 0; i < defensiveCopy.length; i++) {
+ if (defensiveCopy[i] == null)
+ throw new NullPointerException("stackTrace[" + i + "]");
+ }
+
+ synchronized (this) {
+ if (this.stackTrace == null && // Immutable stack
+ backtrace == null) // Test for out of protocol state
+ return;
+ this.stackTrace = defensiveCopy;
+ }
+ }
+
+ /**
+ * Returns the number of elements in the stack trace (or 0 if the stack
+ * trace is unavailable).
+ *
+ * package-protection for use by SharedSecrets.
+ */
+ native int getStackTraceDepth();
+
+ /**
+ * Returns the specified element of the stack trace.
+ *
+ * package-protection for use by SharedSecrets.
+ *
+ * @param index index of the element to return.
+ * @throws IndexOutOfBoundsException if {@code index < 0 ||
+ * index >= getStackTraceDepth() }
+ */
+ native StackTraceElement getStackTraceElement(int index);
+
+ /**
+ * Reads a {@code Throwable} from a stream, enforcing
+ * well-formedness constraints on fields. Null entries and
+ * self-pointers are not allowed in the list of {@code
+ * suppressedExceptions}. Null entries are not allowed for stack
+ * trace elements. A null stack trace in the serial form results
+ * in a zero-length stack element array. A single-element stack
+ * trace whose entry is equal to {@code new StackTraceElement("",
+ * "", null, Integer.MIN_VALUE)} results in a {@code null} {@code
+ * stackTrace} field.
+ *
+ * Note that there are no constraints on the value the {@code
+ * cause} field can hold; both {@code null} and {@code this} are
+ * valid values for the field.
+ */
+// private void readObject(ObjectInputStream s)
+// throws IOException, ClassNotFoundException {
+// s.defaultReadObject(); // read in all fields
+// if (suppressedExceptions != null) {
+// List The suppression behavior is enabled unless disabled
+ * {@linkplain #Throwable(String, Throwable, boolean, boolean) via
+ * a constructor}. When suppression is disabled, this method does
+ * nothing other than to validate its argument.
+ *
+ * Note that when one exception {@linkplain
+ * #initCause(Throwable) causes} another exception, the first
+ * exception is usually caught and then the second exception is
+ * thrown in response. In other words, there is a causal
+ * connection between the two exceptions.
+ *
+ * In contrast, there are situations where two independent
+ * exceptions can be thrown in sibling code blocks, in particular
+ * in the {@code try} block of a {@code try}-with-resources
+ * statement and the compiler-generated {@code finally} block
+ * which closes the resource.
+ *
+ * In these situations, only one of the thrown exceptions can be
+ * propagated. In the {@code try}-with-resources statement, when
+ * there are two such exceptions, the exception originating from
+ * the {@code try} block is propagated and the exception from the
+ * {@code finally} block is added to the list of exceptions
+ * suppressed by the exception from the {@code try} block. As an
+ * exception unwinds the stack, it can accumulate multiple
+ * suppressed exceptions.
+ *
+ * An exception may have suppressed exceptions while also being
+ * caused by another exception. Whether or not an exception has a
+ * cause is semantically known at the time of its creation, unlike
+ * whether or not an exception will suppress other exceptions
+ * which is typically only determined after an exception is
+ * thrown.
+ *
+ * Note that programmer written code is also able to take
+ * advantage of calling this method in situations where there are
+ * multiple sibling exceptions and only one can be propagated.
+ *
+ * @param exception the exception to be added to the list of
+ * suppressed exceptions
+ * @throws IllegalArgumentException if {@code exception} is this
+ * throwable; a throwable cannot suppress itself.
+ * @throws NullPointerException if {@code exception} is {@code null}
+ * @since 1.7
+ */
+ public final synchronized void addSuppressed(Throwable exception) {
+ if (exception == this)
+ throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
+
+ if (exception == null)
+ throw new NullPointerException(NULL_CAUSE_MESSAGE);
+
+// if (suppressedExceptions == null) // Suppressed exceptions not recorded
+// return;
+//
+// if (suppressedExceptions == SUPPRESSED_SENTINEL)
+// suppressedExceptions = new ArrayList The hash code of an annotation is the sum of the hash codes
+ * of its members (including those with default values), as defined
+ * below:
+ *
+ * The hash code of an annotation member is (127 times the hash code
+ * of the member-name as computed by {@link String#hashCode()}) XOR
+ * the hash code of the member-value, as defined below:
+ *
+ * The hash code of a member-value depends on its type:
+ * These constants are used with the {@link Target} meta-annotation type
+ * to specify where it is legal to use an annotation type.
+ *
+ * @author Joshua Bloch
+ * @since 1.5
+ */
+public enum ElementType {
+ /** Class, interface (including annotation type), or enum declaration */
+ TYPE,
+
+ /** Field declaration (includes enum constants) */
+ FIELD,
+
+ /** Method declaration */
+ METHOD,
+
+ /** Parameter declaration */
+ PARAMETER,
+
+ /** Constructor declaration */
+ CONSTRUCTOR,
+
+ /** Local variable declaration */
+ LOCAL_VARIABLE,
+
+ /** Annotation type declaration */
+ ANNOTATION_TYPE,
+
+ /** Package declaration */
+ PACKAGE
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/Retention.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/Retention.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.annotation;
+
+/**
+ * Indicates how long annotations with the annotated type are to
+ * be retained. If no Retention annotation is present on
+ * an annotation type declaration, the retention policy defaults to
+ * {@code RetentionPolicy.CLASS}.
+ *
+ * A Retention meta-annotation has effect only if the
+ * meta-annotated type is used directly for annotation. It has no
+ * effect if the meta-annotated type is used as a member type in
+ * another annotation type.
+ *
+ * @author Joshua Bloch
+ * @since 1.5
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/RetentionPolicy.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/RetentionPolicy.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.annotation;
+
+/**
+ * Annotation retention policy. The constants of this enumerated type
+ * describe the various policies for retaining annotations. They are used
+ * in conjunction with the {@link Retention} meta-annotation type to specify
+ * how long annotations are to be retained.
+ *
+ * @author Joshua Bloch
+ * @since 1.5
+ */
+public enum RetentionPolicy {
+ /**
+ * Annotations are to be discarded by the compiler.
+ */
+ SOURCE,
+
+ /**
+ * Annotations are to be recorded in the class file by the compiler
+ * but need not be retained by the VM at run time. This is the default
+ * behavior.
+ */
+ CLASS,
+
+ /**
+ * Annotations are to be recorded in the class file by the compiler and
+ * retained by the VM at run time, so they may be read reflectively.
+ *
+ * @see java.lang.reflect.AnnotatedElement
+ */
+ RUNTIME
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/Target.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/Target.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.annotation;
+
+/**
+ * Indicates the kinds of program element to which an annotation type
+ * is applicable. If a Target meta-annotation is not present on an
+ * annotation type declaration, the declared type may be used on any
+ * program element. If such a meta-annotation is present, the compiler
+ * will enforce the specified usage restriction.
+ *
+ * For example, this meta-annotation indicates that the declared type is
+ * itself a meta-annotation type. It can only be used on annotation type
+ * declarations:
+ *
+ *
+ * This class is a member of the
+ *
+ * Java Collections Framework.
+ *
+ * @author Josh Bloch
+ * @since 1.2
+ */
+public class UnsupportedOperationException extends RuntimeException {
+ /**
+ * Constructs an UnsupportedOperationException with no detail message.
+ */
+ public UnsupportedOperationException() {
+ }
+
+ /**
+ * Constructs an UnsupportedOperationException with the specified
+ * detail message.
+ *
+ * @param message the detail message
+ */
+ public UnsupportedOperationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause.
+ *
+ * Note that the detail message associated with
+ *
+ * The ordering imposed by a comparator c on a set of elements
+ * S is said to be consistent with equals if and only if
+ * c.compare(e1, e2)==0 has the same boolean value as
+ * e1.equals(e2) for every e1 and e2 in
+ * S.
+ *
+ * Caution should be exercised when using a comparator capable of imposing an
+ * ordering inconsistent with equals to order a sorted set (or sorted map).
+ * Suppose a sorted set (or sorted map) with an explicit comparator c
+ * is used with elements (or keys) drawn from a set S. If the
+ * ordering imposed by c on S is inconsistent with equals,
+ * the sorted set (or sorted map) will behave "strangely." In particular the
+ * sorted set (or sorted map) will violate the general contract for set (or
+ * map), which is defined in terms of equals.
+ *
+ * For example, suppose one adds two elements {@code a} and {@code b} such that
+ * {@code (a.equals(b) && c.compare(a, b) != 0)}
+ * to an empty {@code TreeSet} with comparator {@code c}.
+ * The second {@code add} operation will return
+ * true (and the size of the tree set will increase) because {@code a} and
+ * {@code b} are not equivalent from the tree set's perspective, even though
+ * this is contrary to the specification of the
+ * {@link Set#add Set.add} method.
+ *
+ * Note: It is generally a good idea for comparators to also implement
+ * java.io.Serializable, as they may be used as ordering methods in
+ * serializable data structures (like {@link TreeSet}, {@link TreeMap}). In
+ * order for the data structure to serialize successfully, the comparator (if
+ * provided) must implement Serializable.
+ *
+ * For the mathematically inclined, the relation that defines the
+ * imposed ordering that a given comparator c imposes on a
+ * given set of objects S is: Unlike {@code Comparable}, a comparator may optionally permit
+ * comparison of null arguments, while maintaining the requirements for
+ * an equivalence relation.
+ *
+ * This interface is a member of the
+ *
+ * Java Collections Framework.
+ *
+ * @param
+ *
+ * In the foregoing description, the notation
+ * sgn(expression) designates the mathematical
+ * signum function, which is defined to return one of -1,
+ * 0, or 1 according to whether the value of
+ * expression is negative, zero or positive.
+ *
+ * The implementor must ensure that sgn(compare(x, y)) ==
+ * -sgn(compare(y, x)) for all x and y. (This
+ * implies that compare(x, y) must throw an exception if and only
+ * if compare(y, x) throws an exception.)
+ *
+ * The implementor must also ensure that the relation is transitive:
+ * ((compare(x, y)>0) && (compare(y, z)>0)) implies
+ * compare(x, z)>0.
+ *
+ * Finally, the implementor must ensure that compare(x, y)==0
+ * implies that sgn(compare(x, z))==sgn(compare(y, z)) for all
+ * z.
+ *
+ * It is generally the case, but not strictly required that
+ * (compare(x, y)==0) == (x.equals(y)). Generally speaking,
+ * any comparator that violates this condition should clearly indicate
+ * this fact. The recommended language is "Note: this comparator
+ * imposes orderings that are inconsistent with equals."
+ *
+ * @param o1 the first object to be compared.
+ * @param o2 the second object to be compared.
+ * @return a negative integer, zero, or a positive integer as the
+ * first argument is less than, equal to, or greater than the
+ * second.
+ * @throws NullPointerException if an argument is null and this
+ * comparator does not permit null arguments
+ * @throws ClassCastException if the arguments' types prevent them from
+ * being compared by this comparator.
+ */
+ int compare(T o1, T o2);
+
+ /**
+ * Indicates whether some other object is "equal to" this
+ * comparator. This method must obey the general contract of
+ * {@link Object#equals(Object)}. Additionally, this method can return
+ * true only if the specified object is also a comparator
+ * and it imposes the same ordering as this comparator. Thus,
+ *
+ *
+ * Note that it is always safe not to override
+ * Object.equals(Object). However, overriding this method may,
+ * in some cases, improve performance by allowing programs to determine
+ * that two distinct comparators impose the same order.
+ *
+ * @param obj the reference object with which to compare.
+ * @return
+ * Then use
+ * Everything is type-safe. As soon as somebody modifies the page and
+ * removes the IDs or re-assigns them to wrong elements. Java compiler
+ * will emit an error.
+ *
+ * Welcome to the type-safe HTML5 world!
+ *
+ * @author Jaroslav Tulach
+ *
+ * @param high the high-surrogate code value to be tested
+ * @param low the low-surrogate code value to be tested
+ * @return {@code true} if the specified high and
+ * low-surrogate code values represent a valid surrogate pair;
+ * {@code false} otherwise.
+ * @since 1.5
+ */
+ public static boolean isSurrogatePair(char high, char low) {
+ return isHighSurrogate(high) && isLowSurrogate(low);
+ }
+
+ /**
+ * Determines the number of {@code char} values needed to
+ * represent the specified character (Unicode code point). If the
+ * specified character is equal to or greater than 0x10000, then
+ * the method returns 2. Otherwise, the method returns 1.
+ *
+ *
+ * isHighSurrogate(high) && isLowSurrogate(low)
+ *
+ *
+ * a b c d e f g h i j k l m n o p q r s t u v w x y z
+ * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
+ * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
+ * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
+ * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
+ *
+ *
+ * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+ * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
+ * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
+ * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
+ * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * Many other character ranges contain digits as well.
+ *
+ *
+ *
+ *
+ * Many other character ranges contain digits as well.
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character is a digit;
+ * {@code false} otherwise.
+ * @see Character#forDigit(int, int)
+ * @see Character#getType(int)
+ * @since 1.5
+ */
+ public static boolean isDigit(int codePoint) {
+ return getType(codePoint) == Character.DECIMAL_DIGIT_NUMBER;
+ }
+
+ /**
+ * Determines if a character is defined in Unicode.
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character has a defined meaning
+ * in Unicode; {@code false} otherwise.
+ * @see Character#isDigit(int)
+ * @see Character#isLetter(int)
+ * @see Character#isLetterOrDigit(int)
+ * @see Character#isLowerCase(int)
+ * @see Character#isTitleCase(int)
+ * @see Character#isUpperCase(int)
+ * @since 1.5
+ */
+ public static boolean isDefined(int codePoint) {
+ return getType(codePoint) != Character.UNASSIGNED;
+ }
+
+ /**
+ * Determines if the specified character is a letter.
+ *
+ *
+ *
+ * Not all letters have case. Many characters are
+ * letters but are neither uppercase nor lowercase nor titlecase.
+ *
+ *
+ *
+ *
+ * Not all letters have case. Many characters are
+ * letters but are neither uppercase nor lowercase nor titlecase.
+ *
+ * @param codePoint the character (Unicode code point) to be tested.
+ * @return {@code true} if the character is a letter;
+ * {@code false} otherwise.
+ * @see Character#isDigit(int)
+ * @see Character#isJavaIdentifierStart(int)
+ * @see Character#isLetterOrDigit(int)
+ * @see Character#isLowerCase(int)
+ * @see Character#isTitleCase(int)
+ * @see Character#isUnicodeIdentifierStart(int)
+ * @see Character#isUpperCase(int)
+ * @since 1.5
+ */
+ public static boolean isLetter(int codePoint) {
+ return ((((1 << Character.UPPERCASE_LETTER) |
+ (1 << Character.LOWERCASE_LETTER) |
+ (1 << Character.TITLECASE_LETTER) |
+ (1 << Character.MODIFIER_LETTER) |
+ (1 << Character.OTHER_LETTER)) >> getType(codePoint)) & 1)
+ != 0;
+ }
+
+ /**
+ * Determines if the specified character is a letter or digit.
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param codePoint the character (Unicode code point) to be converted.
+ * @param radix the radix.
+ * @return the numeric value represented by the character in the
+ * specified radix.
+ * @see Character#forDigit(int, int)
+ * @see Character#isDigit(int)
+ * @since 1.5
+ */
+ public static int digit(int codePoint, int radix) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the {@code int} value that the specified Unicode
+ * character represents. For example, the character
+ * {@code '\u005Cu216C'} (the roman numeral fifty) will return
+ * an int with a value of 50.
+ *
+ *
+ *
+ * @param ch the character to be tested.
+ * @return {@code true} if the character is ISO-LATIN-1 white
+ * space; {@code false} otherwise.
+ * @see Character#isSpaceChar(char)
+ * @see Character#isWhitespace(char)
+ * @deprecated Replaced by isWhitespace(char).
+ */
+ @Deprecated
+ public static boolean isSpace(char ch) {
+ return (ch <= 0x0020) &&
+ (((((1L << 0x0009) |
+ (1L << 0x000A) |
+ (1L << 0x000C) |
+ (1L << 0x000D) |
+ (1L << 0x0020)) >> ch) & 1L) != 0);
+ }
+
+
+
+ /**
+ * Determines if the specified character is white space according to Java.
+ * A character is a Java whitespace character if and only if it satisfies
+ * one of the following criteria:
+ *
+ * {@code '\t'} {@code U+0009}
+ * {@code HORIZONTAL TABULATION}
+ * {@code '\n'} {@code U+000A}
+ * {@code NEW LINE}
+ * {@code '\f'} {@code U+000C}
+ * {@code FORM FEED}
+ * {@code '\r'} {@code U+000D}
+ * {@code CARRIAGE RETURN}
+ * {@code ' '} {@code U+0020}
+ * {@code SPACE}
+ *
+ *
+ *
+ *
+ *
+ * Character.valueOf(x).compareTo(Character.valueOf(y))
+ *
+ *
+ * @param x the first {@code char} to compare
+ * @param y the second {@code char} to compare
+ * @return the value {@code 0} if {@code x == y};
+ * a value less than {@code 0} if {@code x < y}; and
+ * a value greater than {@code 0} if {@code x > y}
+ * @since 1.7
+ */
+ public static int compare(char x, char y) {
+ return x - y;
+ }
+
+
+ /**
+ * The number of bits used to represent a char value in unsigned
+ * binary form, constant {@code 16}.
+ *
+ * @since 1.5
+ */
+ public static final int SIZE = 16;
+
+ /**
+ * Returns the value obtained by reversing the order of the bytes in the
+ * specified char value.
+ *
+ * @return the value obtained by reversing (or, equivalently, swapping)
+ * the bytes in the specified char value.
+ * @since 1.5
+ */
+ public static char reverseBytes(char ch) {
+ return (char) (((ch & 0xFF00) >> 8) | (ch << 8));
+ }
+
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Class.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Class.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,720 @@
+/*
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Instances of the class {@code Class} represent classes and
+ * interfaces in a running Java application. An enum is a kind of
+ * class and an annotation is a kind of interface. Every array also
+ * belongs to a class that is reflected as a {@code Class} object
+ * that is shared by all arrays with the same element type and number
+ * of dimensions. The primitive Java types ({@code boolean},
+ * {@code byte}, {@code char}, {@code short},
+ * {@code int}, {@code long}, {@code float}, and
+ * {@code double}), and the keyword {@code void} are also
+ * represented as {@code Class} objects.
+ *
+ *
+ *
+ *
+ * void printClassName(Object obj) {
+ * System.out.println("The class of " + obj +
+ * " is " + obj.getClass().getName());
+ * }
+ *
+ * {@code System.out.println("The name of class Foo is: "+Foo.class.getName());}
+ *
+ *
+ * @param
+ * {@code Class.forName(className, true, currentLoader)}
+ *
+ *
+ * where {@code currentLoader} denotes the defining class loader of
+ * the current class.
+ *
+ *
+ * {@code Class t = Class.forName("java.lang.Thread")}
+ *
+ *
+ *
+ *
+ *
+ */
+ public T newInstance()
+ throws InstantiationException, IllegalAccessException
+ {
+ throw new UnsupportedOperationException("Should be somehow supported");
+ }
+
+ /**
+ * Determines if the specified {@code Object} is assignment-compatible
+ * with the object represented by this {@code Class}. This method is
+ * the dynamic equivalent of the Java language {@code instanceof}
+ * operator. The method returns {@code true} if the specified
+ * {@code Object} argument is non-null and can be cast to the
+ * reference type represented by this {@code Class} object without
+ * raising a {@code ClassCastException.} It returns {@code false}
+ * otherwise.
+ *
+ *
+ *
+ *
+ *
Element Type Encoding
+ * boolean Z
+ * byte B
+ * char C
+ * class or interface
+ * Lclassname;
+ * double D
+ * float F
+ * int I
+ * long J
+ * short S
+ *
+ *
+ * @return the name of the class or interface
+ * represented by this object.
+ */
+ public String getName() {
+ throw new UnsupportedOperationException();
+// String name = this.name;
+// if (name == null)
+// this.name = name = getName0();
+// return name;
+ }
+
+ /**
+ * Returns the {@code Class} representing the superclass of the entity
+ * (class, interface, primitive type or void) represented by this
+ * {@code Class}. If this {@code Class} represents either the
+ * {@code Object} class, an interface, a primitive type, or void, then
+ * null is returned. If this object represents an array class then the
+ * {@code Class} object representing the {@code Object} class is
+ * returned.
+ *
+ * @return the superclass of the class represented by this object.
+ */
+ public native Class super T> getSuperclass();
+
+ /**
+ * Returns the Java language modifiers for this class or interface, encoded
+ * in an integer. The modifiers consist of the Java Virtual Machine's
+ * constants for {@code public}, {@code protected},
+ * {@code private}, {@code final}, {@code static},
+ * {@code abstract} and {@code interface}; they should be decoded
+ * using the methods of class {@code Modifier}.
+ *
+ *
+ * String.class.getName()
+ * returns "java.lang.String"
+ * byte.class.getName()
+ * returns "byte"
+ * (new Object[3]).getClass().getName()
+ * returns "[Ljava.lang.Object;"
+ * (new int[3][4][5][6][7][8][9]).getClass().getName()
+ * returns "[[[[[[[I"
+ *
+ *
+ *
+ *
+ * @param name name of the desired resource
+ * @return A {@link java.io.InputStream} object or {@code null} if
+ * no resource with this name is found
+ * @throws NullPointerException If {@code name} is {@code null}
+ * @since JDK1.1
+ */
+// public InputStream getResourceAsStream(String name) {
+// name = resolveName(name);
+// ClassLoader cl = getClassLoader0();
+// if (cl==null) {
+// // A system class.
+// return ClassLoader.getSystemResourceAsStream(name);
+// }
+// return cl.getResourceAsStream(name);
+// }
+
+ /**
+ * Finds a resource with a given name. The rules for searching resources
+ * associated with a given class are implemented by the defining
+ * {@linkplain ClassLoader class loader} of the class. This method
+ * delegates to this object's class loader. If this object was loaded by
+ * the bootstrap class loader, the method delegates to {@link
+ * ClassLoader#getSystemResource}.
+ *
+ *
+ * {@code modified_package_name/name}
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param name name of the desired resource
+ * @return A {@link java.net.URL} object or {@code null} if no
+ * resource with this name is found
+ * @since JDK1.1
+ */
+// public java.net.URL getResource(String name) {
+// name = resolveName(name);
+// ClassLoader cl = getClassLoader0();
+// if (cl==null) {
+// // A system class.
+// return ClassLoader.getSystemResource(name);
+// }
+// return cl.getResource(name);
+// }
+
+
+
+
+ /**
+ * Returns true if and only if this class was declared as an enum in the
+ * source code.
+ *
+ * @return true if and only if this class was declared as an enum in the
+ * source code
+ * @since 1.5
+ */
+ public boolean isEnum() {
+ // An enum must both directly extend java.lang.Enum and have
+ // the ENUM bit set; classes for specialized enum constants
+ // don't do the former.
+ return (this.getModifiers() & ENUM) != 0 &&
+ this.getSuperclass() == java.lang.Enum.class;
+ }
+
+ /**
+ * Casts an object to the class or interface represented
+ * by this {@code Class} object.
+ *
+ * @param obj the object to be cast
+ * @return the object after casting, or null if obj is null
+ *
+ * @throws ClassCastException if the object is not
+ * null and is not assignable to the type T.
+ *
+ * @since 1.5
+ */
+ public T cast(Object obj) {
+ if (obj != null && !isInstance(obj))
+ throw new ClassCastException(cannotCastMsg(obj));
+ return (T) obj;
+ }
+
+ private String cannotCastMsg(Object obj) {
+ return "Cannot cast " + obj.getClass().getName() + " to " + getName();
+ }
+
+ /**
+ * Casts this {@code Class} object to represent a subclass of the class
+ * represented by the specified class object. Checks that that the cast
+ * is valid, and throws a {@code ClassCastException} if it is not. If
+ * this method succeeds, it always returns a reference to this class object.
+ *
+ *
+ * {@code modified_package_name/name}
+ *
+ *
+ * ClassCastException
:
+ *
+ *
+ * @author unascribed
+ * @since JDK1.0
+ */
+public
+class ClassCastException extends RuntimeException {
+ private static final long serialVersionUID = -9223365651070458532L;
+
+ /**
+ * Constructs a
+ * Object x = new Integer(0);
+ * System.out.println((String)x);
+ *
ClassCastException
with no detail message.
+ */
+ public ClassCastException() {
+ super();
+ }
+
+ /**
+ * Constructs a ClassCastException
with the specified
+ * detail message.
+ *
+ * @param s the detail message.
+ */
+ public ClassCastException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/ClassNotFoundException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/ClassNotFoundException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown when an application tries to load in a class through its
+ * string name using:
+ *
+ *
+ * forName
method in class Class
.
+ * findSystemClass
method in class
+ * ClassLoader
.
+ * loadClass
method in class ClassLoader
.
+ * ClassNotFoundException
with no detail message.
+ */
+ public ClassNotFoundException() {
+ super((Throwable)null); // Disallow initCause
+ }
+
+ /**
+ * Constructs a ClassNotFoundException
with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public ClassNotFoundException(String s) {
+ super(s, null); // Disallow initCause
+ }
+
+ /**
+ * Constructs a ClassNotFoundException
with the
+ * specified detail message and optional exception that was
+ * raised while loading the class.
+ *
+ * @param s the detail message
+ * @param ex the exception that was raised while loading the class
+ * @since 1.2
+ */
+ public ClassNotFoundException(String s, Throwable ex) {
+ super(s, null); // Disallow initCause
+ this.ex = ex;
+ }
+
+ /**
+ * Returns the exception that was raised if an error occurred while
+ * attempting to load the class. Otherwise, returns null.
+ *
+ * Exception
that was raised while loading a class
+ * @since 1.2
+ */
+ public Throwable getException() {
+ return ex;
+ }
+
+ /**
+ * Returns the cause of this exception (the exception that was raised
+ * if an error occurred while attempting to load the class; otherwise
+ * null).
+ *
+ * @return the cause of this exception.
+ * @since 1.4
+ */
+ public Throwable getCause() {
+ return ex;
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/CloneNotSupportedException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/CloneNotSupportedException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that the clone
method in class
+ * Object
has been called to clone an object, but that
+ * the object's class does not implement the Cloneable
+ * interface.
+ * clone
method can also
+ * throw this exception to indicate that an object could not or
+ * should not be cloned.
+ *
+ * @author unascribed
+ * @see java.lang.Cloneable
+ * @see java.lang.Object#clone()
+ * @since JDK1.0
+ */
+
+public
+class CloneNotSupportedException extends Exception {
+ private static final long serialVersionUID = 5195511250079656443L;
+
+ /**
+ * Constructs a CloneNotSupportedException
with no
+ * detail message.
+ */
+ public CloneNotSupportedException() {
+ super();
+ }
+
+ /**
+ * Constructs a CloneNotSupportedException
with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public CloneNotSupportedException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Comparable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Comparable.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * This interface imposes a total ordering on the objects of each class that
+ * implements it. This ordering is referred to as the class's natural
+ * ordering, and the class's compareTo method is referred to as
+ * its natural comparison method.
+ * {(x, y) such that x.compareTo(y) <= 0}.
+ *
The quotient for this total order is:
+ * {(x, y) such that x.compareTo(y) == 0}.
+ *
+ *
+ * It follows immediately from the contract for compareTo that the
+ * quotient is an equivalence relation on C, and that the
+ * natural ordering is a total order on C. When we say that a
+ * class's natural ordering is consistent with equals, we mean that the
+ * quotient for the natural ordering is the equivalence relation defined by
+ * the class's {@link Object#equals(Object) equals(Object)} method:
+ * {(x, y) such that x.equals(y)}.
+ *
+ * How many digits must be printed for the fractional part of
+ * m or a? There must be at least one digit to represent
+ * the fractional part, and beyond that as many, but only as many, more
+ * digits as are needed to uniquely distinguish the argument value from
+ * adjacent values of type {@code double}. That is, suppose that
+ * x is the exact mathematical value represented by the decimal
+ * representation produced by this method for a finite nonzero argument
+ * d. Then d must be the {@code double} value nearest
+ * to x; or if two {@code double} values are equally close
+ * to x, then d must be one of them and the least
+ * significant bit of the significand of d must be {@code 0}.
+ *
+ * '\u002D'
); if the sign is positive, no sign character
+ * appears in the result. As for the magnitude m:
+ *
+ *
+ * '\u002E'
), followed by one or
+ * more decimal digits representing the fractional part of m.
+ *
+ * '\u002E'
), followed by decimal digits
+ * representing the fractional part of a, followed by the
+ * letter '{@code E}' ('\u0045'
), followed
+ * by a representation of n as a decimal integer, as
+ * produced by the method {@link Integer#toString(int)}.
+ *
+ *
+ *
+ * '\u002D'
); if the sign is positive, no sign
+ * character appears in the result. As for the magnitude m:
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param d the {@code double} to be converted.
+ * @return a hex string representation of the argument.
+ * @since 1.5
+ * @author Joseph D. Darcy
+ */
+ public static String toHexString(double d) {
+ throw new UnsupportedOperationException();
+// /*
+// * Modeled after the "a" conversion specifier in C99, section
+// * 7.19.6.1; however, the output of this method is more
+// * tightly specified.
+// */
+// if (!FpUtils.isFinite(d) )
+// // For infinity and NaN, use the decimal output.
+// return Double.toString(d);
+// else {
+// // Initialized to maximum size of output.
+// StringBuffer answer = new StringBuffer(24);
+//
+// if (FpUtils.rawCopySign(1.0, d) == -1.0) // value is negative,
+// answer.append("-"); // so append sign info
+//
+// answer.append("0x");
+//
+// d = Math.abs(d);
+//
+// if(d == 0.0) {
+// answer.append("0.0p0");
+// }
+// else {
+// boolean subnormal = (d < DoubleConsts.MIN_NORMAL);
+//
+// // Isolate significand bits and OR in a high-order bit
+// // so that the string representation has a known
+// // length.
+// long signifBits = (Double.doubleToLongBits(d)
+// & DoubleConsts.SIGNIF_BIT_MASK) |
+// 0x1000000000000000L;
+//
+// // Subnormal values have a 0 implicit bit; normal
+// // values have a 1 implicit bit.
+// answer.append(subnormal ? "0." : "1.");
+//
+// // Isolate the low-order 13 digits of the hex
+// // representation. If all the digits are zero,
+// // replace with a single 0; otherwise, remove all
+// // trailing zeros.
+// String signif = Long.toHexString(signifBits).substring(3,16);
+// answer.append(signif.equals("0000000000000") ? // 13 zeros
+// "0":
+// signif.replaceFirst("0{1,12}$", ""));
+//
+// // If the value is subnormal, use the E_min exponent
+// // value for double; otherwise, extract and report d's
+// // exponent (the representation of a subnormal uses
+// // E_min -1).
+// answer.append("p" + (subnormal ?
+// DoubleConsts.MIN_EXPONENT:
+// FpUtils.getExponent(d) ));
+// }
+// return answer.toString();
+// }
+ }
+
+ /**
+ * Returns a {@code Double} object holding the
+ * {@code double} value represented by the argument string
+ * {@code s}.
+ *
+ * Examples
Floating-point Value Hexadecimal String
+ * {@code 1.0} {@code 0x1.0p0}
+ * {@code -1.0} {@code -0x1.0p0}
+ * {@code 2.0} {@code 0x1.0p1}
+ * {@code 3.0} {@code 0x1.8p1}
+ * {@code 0.5} {@code 0x1.0p-1}
+ * {@code 0.25} {@code 0x1.0p-2}
+ * {@code Double.MAX_VALUE}
+ * {@code 0x1.fffffffffffffp1023}
+ * {@code Minimum Normal Value}
+ * {@code 0x1.0p-1022}
+ * {@code Maximum Subnormal Value}
+ * {@code 0x0.fffffffffffffp-1022}
+ * {@code Double.MIN_VALUE}
+ * {@code 0x0.0000000000001p-1022}
+ *
+ *
+ *
+ * where Sign, FloatingPointLiteral,
+ * HexNumeral, HexDigits, SignedInteger and
+ * FloatTypeSuffix are as defined in the lexical structure
+ * sections of
+ * The Java™ Language Specification,
+ * except that underscores are not accepted between digits.
+ * If {@code s} does not have the form of
+ * a FloatValue, then a {@code NumberFormatException}
+ * is thrown. Otherwise, {@code s} is regarded as
+ * representing an exact decimal value in the usual
+ * "computerized scientific notation" or as an exact
+ * hexadecimal value; this exact numerical value is then
+ * conceptually converted to an "infinitely precise"
+ * binary value that is then rounded to type {@code double}
+ * by the usual round-to-nearest rule of IEEE 754 floating-point
+ * arithmetic, which includes preserving the sign of a zero
+ * value.
+ *
+ * Note that the round-to-nearest rule also implies overflow and
+ * underflow behaviour; if the exact value of {@code s} is large
+ * enough in magnitude (greater than or equal to ({@link
+ * #MAX_VALUE} + {@link Math#ulp(double) ulp(MAX_VALUE)}/2),
+ * rounding to {@code double} will result in an infinity and if the
+ * exact value of {@code s} is small enough in magnitude (less
+ * than or equal to {@link #MIN_VALUE}/2), rounding to float will
+ * result in a zero.
+ *
+ * Finally, after rounding a {@code Double} object representing
+ * this {@code double} value is returned.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param s the string to be parsed.
+ * @return a {@code Double} object holding the value
+ * represented by the {@code String} argument.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable number.
+ */
+ public static Double valueOf(String s) throws NumberFormatException {
+ throw new UnsupportedOperationException();
+// return new Double(FloatingDecimal.readJavaFormatString(s).doubleValue());
+ }
+
+ /**
+ * Returns a {@code Double} instance representing the specified
+ * {@code double} value.
+ * If a new {@code Double} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Double(double)}, as this method is likely to yield
+ * significantly better space and time performance by caching
+ * frequently requested values.
+ *
+ * @param d a double value.
+ * @return a {@code Double} instance representing {@code d}.
+ * @since 1.5
+ */
+ public static Double valueOf(double d) {
+ return new Double(d);
+ }
+
+ /**
+ * Returns a new {@code double} initialized to the value
+ * represented by the specified {@code String}, as performed
+ * by the {@code valueOf} method of class
+ * {@code Double}.
+ *
+ * @param s the string to be parsed.
+ * @return the {@code double} value represented by the string
+ * argument.
+ * @throws NullPointerException if the string is null
+ * @throws NumberFormatException if the string does not contain
+ * a parsable {@code double}.
+ * @see java.lang.Double#valueOf(String)
+ * @since 1.2
+ */
+ public static double parseDouble(String s) throws NumberFormatException {
+ throw new UnsupportedOperationException();
+// return FloatingDecimal.readJavaFormatString(s).doubleValue();
+ }
+
+ /**
+ * Returns {@code true} if the specified number is a
+ * Not-a-Number (NaN) value, {@code false} otherwise.
+ *
+ * @param v the value to be tested.
+ * @return {@code true} if the value of the argument is NaN;
+ * {@code false} otherwise.
+ */
+ static public boolean isNaN(double v) {
+ return (v != v);
+ }
+
+ /**
+ * Returns {@code true} if the specified number is infinitely
+ * large in magnitude, {@code false} otherwise.
+ *
+ * @param v the value to be tested.
+ * @return {@code true} if the value of the argument is positive
+ * infinity or negative infinity; {@code false} otherwise.
+ */
+ static public boolean isInfinite(double v) {
+ return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
+ }
+
+ /**
+ * The value of the Double.
+ *
+ * @serial
+ */
+ private final double value;
+
+ /**
+ * Constructs a newly allocated {@code Double} object that
+ * represents the primitive {@code double} argument.
+ *
+ * @param value the value to be represented by the {@code Double}.
+ */
+ public Double(double value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Double} object that
+ * represents the floating-point value of type {@code double}
+ * represented by the string. The string is converted to a
+ * {@code double} value as if by the {@code valueOf} method.
+ *
+ * @param s a string to be converted to a {@code Double}.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable number.
+ * @see java.lang.Double#valueOf(java.lang.String)
+ */
+ public Double(String s) throws NumberFormatException {
+ // REMIND: this is inefficient
+ this(valueOf(s).doubleValue());
+ }
+
+ /**
+ * Returns {@code true} if this {@code Double} value is
+ * a Not-a-Number (NaN), {@code false} otherwise.
+ *
+ * @return {@code true} if the value represented by this object is
+ * NaN; {@code false} otherwise.
+ */
+ public boolean isNaN() {
+ return isNaN(value);
+ }
+
+ /**
+ * Returns {@code true} if this {@code Double} value is
+ * infinitely large in magnitude, {@code false} otherwise.
+ *
+ * @return {@code true} if the value represented by this object is
+ * positive infinity or negative infinity;
+ * {@code false} otherwise.
+ */
+ public boolean isInfinite() {
+ return isInfinite(value);
+ }
+
+ /**
+ * Returns a string representation of this {@code Double} object.
+ * The primitive {@code double} value represented by this
+ * object is converted to a string exactly as if by the method
+ * {@code toString} of one argument.
+ *
+ * @return a {@code String} representation of this object.
+ * @see java.lang.Double#toString(double)
+ */
+ public String toString() {
+ return toString(value);
+ }
+
+ /**
+ * Returns the value of this {@code Double} as a {@code byte} (by
+ * casting to a {@code byte}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code byte}
+ * @since JDK1.1
+ */
+ public byte byteValue() {
+ return (byte)value;
+ }
+
+ /**
+ * Returns the value of this {@code Double} as a
+ * {@code short} (by casting to a {@code short}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code short}
+ * @since JDK1.1
+ */
+ public short shortValue() {
+ return (short)value;
+ }
+
+ /**
+ * Returns the value of this {@code Double} as an
+ * {@code int} (by casting to type {@code int}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code int}
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns the value of this {@code Double} as a
+ * {@code long} (by casting to type {@code long}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code long}
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the {@code float} value of this
+ * {@code Double} object.
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code float}
+ * @since JDK1.0
+ */
+ public float floatValue() {
+ return (float)value;
+ }
+
+ /**
+ * Returns the {@code double} value of this
+ * {@code Double} object.
+ *
+ * @return the {@code double} value represented by this object
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a hash code for this {@code Double} object. The
+ * result is the exclusive OR of the two halves of the
+ * {@code long} integer bit representation, exactly as
+ * produced by the method {@link #doubleToLongBits(double)}, of
+ * the primitive {@code double} value represented by this
+ * {@code Double} object. That is, the hash code is the value
+ * of the expression:
+ *
+ *
+ * final String Digits = "(\\p{Digit}+)";
+ * final String HexDigits = "(\\p{XDigit}+)";
+ * // an exponent is 'e' or 'E' followed by an optionally
+ * // signed decimal integer.
+ * final String Exp = "[eE][+-]?"+Digits;
+ * final String fpRegex =
+ * ("[\\x00-\\x20]*"+ // Optional leading "whitespace"
+ * "[+-]?(" + // Optional sign character
+ * "NaN|" + // "NaN" string
+ * "Infinity|" + // "Infinity" string
+ *
+ * // A decimal floating-point string representing a finite positive
+ * // number without a leading sign has at most five basic pieces:
+ * // Digits . Digits ExponentPart FloatTypeSuffix
+ * //
+ * // Since this method allows integer-only strings as input
+ * // in addition to strings of floating-point literals, the
+ * // two sub-patterns below are simplifications of the grammar
+ * // productions from section 3.10.2 of
+ * // The Java™ Language Specification.
+ *
+ * // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
+ * "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
+ *
+ * // . Digits ExponentPart_opt FloatTypeSuffix_opt
+ * "(\\.("+Digits+")("+Exp+")?)|"+
+ *
+ * // Hexadecimal strings
+ * "((" +
+ * // 0[xX] HexDigits ._opt BinaryExponent FloatTypeSuffix_opt
+ * "(0[xX]" + HexDigits + "(\\.)?)|" +
+ *
+ * // 0[xX] HexDigits_opt . HexDigits BinaryExponent FloatTypeSuffix_opt
+ * "(0[xX]" + HexDigits + "?(\\.)" + HexDigits + ")" +
+ *
+ * ")[pP][+-]?" + Digits + "))" +
+ * "[fFdD]?))" +
+ * "[\\x00-\\x20]*");// Optional trailing "whitespace"
+ *
+ * if (Pattern.matches(fpRegex, myString))
+ * Double.valueOf(myString); // Will not throw NumberFormatException
+ * else {
+ * // Perform suitable alternative action
+ * }
+ *
+ *
+ * {@code (int)(v^(v>>>32))}
+ *
+ *
+ * where {@code v} is defined by:
+ *
+ *
+ * {@code long v = Double.doubleToLongBits(this.doubleValue());}
+ *
+ *
+ * @return a {@code hash code} value for this object.
+ */
+ public int hashCode() {
+ long bits = doubleToLongBits(value);
+ return (int)(bits ^ (bits >>> 32));
+ }
+
+ /**
+ * Compares this object against the specified object. The result
+ * is {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Double} object that
+ * represents a {@code double} that has the same value as the
+ * {@code double} represented by this object. For this
+ * purpose, two {@code double} values are considered to be
+ * the same if and only if the method {@link
+ * #doubleToLongBits(double)} returns the identical
+ * {@code long} value when applied to each.
+ *
+ *
+ * {@code d1.doubleValue() == d2.doubleValue()}
+ *
+ *
+ *
+ *
+ * This definition allows hash tables to operate properly.
+ * @param obj the object to compare with.
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ * @see java.lang.Double#doubleToLongBits(double)
+ */
+ public boolean equals(Object obj) {
+ return (obj instanceof Double)
+ && (doubleToLongBits(((Double)obj).value) ==
+ doubleToLongBits(value));
+ }
+
+ /**
+ * Returns a representation of the specified floating-point value
+ * according to the IEEE 754 floating-point "double
+ * format" bit layout.
+ *
+ *
+ *
+ * Then the floating-point result equals the value of the mathematical
+ * expression s·m·2e-1075.
+ *
+ *
+ * int s = ((bits >> 63) == 0) ? 1 : -1;
+ * int e = (int)((bits >> 52) & 0x7ffL);
+ * long m = (e == 0) ?
+ * (bits & 0xfffffffffffffL) << 1 :
+ * (bits & 0xfffffffffffffL) | 0x10000000000000L;
+ *
+ * This ensures that the natural ordering of
+ * {@code Double} objects imposed by this method is consistent
+ * with equals.
+ *
+ * @param anotherDouble the {@code Double} to be compared.
+ * @return the value {@code 0} if {@code anotherDouble} is
+ * numerically equal to this {@code Double}; a value
+ * less than {@code 0} if this {@code Double}
+ * is numerically less than {@code anotherDouble};
+ * and a value greater than {@code 0} if this
+ * {@code Double} is numerically greater than
+ * {@code anotherDouble}.
+ *
+ * @since 1.2
+ */
+ public int compareTo(Double anotherDouble) {
+ return Double.compare(value, anotherDouble.value);
+ }
+
+ /**
+ * Compares the two specified {@code double} values. The sign
+ * of the integer value returned is the same as that of the
+ * integer that would be returned by the call:
+ *
+ * new Double(d1).compareTo(new Double(d2))
+ *
+ *
+ * @param d1 the first {@code double} to compare
+ * @param d2 the second {@code double} to compare
+ * @return the value {@code 0} if {@code d1} is
+ * numerically equal to {@code d2}; a value less than
+ * {@code 0} if {@code d1} is numerically less than
+ * {@code d2}; and a value greater than {@code 0}
+ * if {@code d1} is numerically greater than
+ * {@code d2}.
+ * @since 1.4
+ */
+ public static int compare(double d1, double d2) {
+ if (d1 < d2)
+ return -1; // Neither val is NaN, thisVal is smaller
+ if (d1 > d2)
+ return 1; // Neither val is NaN, thisVal is larger
+
+ // Cannot use doubleToRawLongBits because of possibility of NaNs.
+ long thisBits = Double.doubleToLongBits(d1);
+ long anotherBits = Double.doubleToLongBits(d2);
+
+ return (thisBits == anotherBits ? 0 : // Values are equal
+ (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)
+ 1)); // (0.0, -0.0) or (NaN, !NaN)
+ }
+
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ private static final long serialVersionUID = -9172774392245257468L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Enum.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Enum.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import java.io.Serializable;
+import java.io.IOException;
+
+/**
+ * This is the common base class of all Java language enumeration types.
+ *
+ * More information about enums, including descriptions of the
+ * implicitly declared methods synthesized by the compiler, can be
+ * found in section 8.9 of
+ * The Java™ Language Specification.
+ *
+ *
+ *
+ * How many digits must be printed for the fractional part of
+ * m or a? There must be at least one digit
+ * to represent the fractional part, and beyond that as many, but
+ * only as many, more digits as are needed to uniquely distinguish
+ * the argument value from adjacent values of type
+ * {@code float}. That is, suppose that x is the
+ * exact mathematical value represented by the decimal
+ * representation produced by this method for a finite nonzero
+ * argument f. Then f must be the {@code float}
+ * value nearest to x; or, if two {@code float} values are
+ * equally close to x, then f must be one of
+ * them and the least significant bit of the significand of
+ * f must be {@code 0}.
+ *
+ * '\u002D'
); if the sign is
+ * positive, no sign character appears in the result. As for
+ * the magnitude m:
+ *
+ *
+ * '\u002E'
), followed by one or more
+ * decimal digits representing the fractional part of
+ * m.
+ * '\u002E'
), followed by
+ * decimal digits representing the fractional part of
+ * a, followed by the letter '{@code E}'
+ * ('\u0045'
), followed by a representation
+ * of n as a decimal integer, as produced by the
+ * method {@link java.lang.Integer#toString(int)}.
+ *
+ *
+ *
+ *
+ * '\u002D'
); if the sign is positive, no sign character
+ * appears in the result. As for the magnitude m:
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param f the {@code float} to be converted.
+ * @return a hex string representation of the argument.
+ * @since 1.5
+ * @author Joseph D. Darcy
+ */
+ public static String toHexString(float f) {
+ throw new UnsupportedOperationException();
+// if (Math.abs(f) < FloatConsts.MIN_NORMAL
+// && f != 0.0f ) {// float subnormal
+// // Adjust exponent to create subnormal double, then
+// // replace subnormal double exponent with subnormal float
+// // exponent
+// String s = Double.toHexString(FpUtils.scalb((double)f,
+// /* -1022+126 */
+// DoubleConsts.MIN_EXPONENT-
+// FloatConsts.MIN_EXPONENT));
+// return s.replaceFirst("p-1022$", "p-126");
+// }
+// else // double string will be the same as float string
+// return Double.toHexString(f);
+ }
+
+ /**
+ * Returns a {@code Float} object holding the
+ * {@code float} value represented by the argument string
+ * {@code s}.
+ *
+ * Examples
Floating-point Value Hexadecimal String
+ * {@code 1.0} {@code 0x1.0p0}
+ * {@code -1.0} {@code -0x1.0p0}
+ * {@code 2.0} {@code 0x1.0p1}
+ * {@code 3.0} {@code 0x1.8p1}
+ * {@code 0.5} {@code 0x1.0p-1}
+ * {@code 0.25} {@code 0x1.0p-2}
+ * {@code Float.MAX_VALUE}
+ * {@code 0x1.fffffep127}
+ * {@code Minimum Normal Value}
+ * {@code 0x1.0p-126}
+ * {@code Maximum Subnormal Value}
+ * {@code 0x0.fffffep-126}
+ * {@code Float.MIN_VALUE}
+ * {@code 0x0.000002p-126}
+ *
+ *
+ *
+ * where Sign, FloatingPointLiteral,
+ * HexNumeral, HexDigits, SignedInteger and
+ * FloatTypeSuffix are as defined in the lexical structure
+ * sections of
+ * The Java™ Language Specification,
+ * except that underscores are not accepted between digits.
+ * If {@code s} does not have the form of
+ * a FloatValue, then a {@code NumberFormatException}
+ * is thrown. Otherwise, {@code s} is regarded as
+ * representing an exact decimal value in the usual
+ * "computerized scientific notation" or as an exact
+ * hexadecimal value; this exact numerical value is then
+ * conceptually converted to an "infinitely precise"
+ * binary value that is then rounded to type {@code float}
+ * by the usual round-to-nearest rule of IEEE 754 floating-point
+ * arithmetic, which includes preserving the sign of a zero
+ * value.
+ *
+ * Note that the round-to-nearest rule also implies overflow and
+ * underflow behaviour; if the exact value of {@code s} is large
+ * enough in magnitude (greater than or equal to ({@link
+ * #MAX_VALUE} + {@link Math#ulp(float) ulp(MAX_VALUE)}/2),
+ * rounding to {@code float} will result in an infinity and if the
+ * exact value of {@code s} is small enough in magnitude (less
+ * than or equal to {@link #MIN_VALUE}/2), rounding to float will
+ * result in a zero.
+ *
+ * Finally, after rounding a {@code Float} object representing
+ * this {@code float} value is returned.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * {@code "1.00000017881393421514957253748434595763683319091796875001d"}
+ * results in the {@code float} value
+ * {@code 1.0000002f}; if the string is converted directly to
+ * {@code float}, 1.0000001f
results.
+ *
+ *
+ *
+ *
+ * f1.floatValue() == f2.floatValue()
+ *
+ *
+ *
+ * This definition allows hash tables to operate properly.
+ *
+ * @param obj the object to be compared
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ * @see java.lang.Float#floatToIntBits(float)
+ */
+ public boolean equals(Object obj) {
+ return (obj instanceof Float)
+ && (floatToIntBits(((Float)obj).value) == floatToIntBits(value));
+ }
+
+ /**
+ * Returns a representation of the specified floating-point value
+ * according to the IEEE 754 floating-point "single format" bit
+ * layout.
+ *
+ *
+ *
+ * Then the floating-point result equals the value of the mathematical
+ * expression s·m·2e-150.
+ *
+ *
+ * int s = ((bits >> 31) == 0) ? 1 : -1;
+ * int e = ((bits >> 23) & 0xff);
+ * int m = (e == 0) ?
+ * (bits & 0x7fffff) << 1 :
+ * (bits & 0x7fffff) | 0x800000;
+ *
+ *
+ * This ensures that the natural ordering of {@code Float}
+ * objects imposed by this method is consistent with equals.
+ *
+ * @param anotherFloat the {@code Float} to be compared.
+ * @return the value {@code 0} if {@code anotherFloat} is
+ * numerically equal to this {@code Float}; a value
+ * less than {@code 0} if this {@code Float}
+ * is numerically less than {@code anotherFloat};
+ * and a value greater than {@code 0} if this
+ * {@code Float} is numerically greater than
+ * {@code anotherFloat}.
+ *
+ * @since 1.2
+ * @see Comparable#compareTo(Object)
+ */
+ public int compareTo(Float anotherFloat) {
+ return Float.compare(value, anotherFloat.value);
+ }
+
+ /**
+ * Compares the two specified {@code float} values. The sign
+ * of the integer value returned is the same as that of the
+ * integer that would be returned by the call:
+ *
+ * new Float(f1).compareTo(new Float(f2))
+ *
+ *
+ * @param f1 the first {@code float} to compare.
+ * @param f2 the second {@code float} to compare.
+ * @return the value {@code 0} if {@code f1} is
+ * numerically equal to {@code f2}; a value less than
+ * {@code 0} if {@code f1} is numerically less than
+ * {@code f2}; and a value greater than {@code 0}
+ * if {@code f1} is numerically greater than
+ * {@code f2}.
+ * @since 1.4
+ */
+ public static int compare(float f1, float f2) {
+ if (f1 < f2)
+ return -1; // Neither val is NaN, thisVal is smaller
+ if (f1 > f2)
+ return 1; // Neither val is NaN, thisVal is larger
+
+ // Cannot use floatToRawIntBits because of possibility of NaNs.
+ int thisBits = Float.floatToIntBits(f1);
+ int anotherBits = Float.floatToIntBits(f2);
+
+ return (thisBits == anotherBits ? 0 : // Values are equal
+ (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN)
+ 1)); // (0.0, -0.0) or (NaN, !NaN)
+ }
+
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ private static final long serialVersionUID = -2671257302660747028L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/IllegalAccessException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/IllegalAccessException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * An IllegalAccessException is thrown when an application tries
+ * to reflectively create an instance (other than an array),
+ * set or get a field, or invoke a method, but the currently
+ * executing method does not have access to the definition of
+ * the specified class, field, method or constructor.
+ *
+ * @author unascribed
+ * @see Class#newInstance()
+ * @see java.lang.reflect.Field#set(Object, Object)
+ * @see java.lang.reflect.Field#setBoolean(Object, boolean)
+ * @see java.lang.reflect.Field#setByte(Object, byte)
+ * @see java.lang.reflect.Field#setShort(Object, short)
+ * @see java.lang.reflect.Field#setChar(Object, char)
+ * @see java.lang.reflect.Field#setInt(Object, int)
+ * @see java.lang.reflect.Field#setLong(Object, long)
+ * @see java.lang.reflect.Field#setFloat(Object, float)
+ * @see java.lang.reflect.Field#setDouble(Object, double)
+ * @see java.lang.reflect.Field#get(Object)
+ * @see java.lang.reflect.Field#getBoolean(Object)
+ * @see java.lang.reflect.Field#getByte(Object)
+ * @see java.lang.reflect.Field#getShort(Object)
+ * @see java.lang.reflect.Field#getChar(Object)
+ * @see java.lang.reflect.Field#getInt(Object)
+ * @see java.lang.reflect.Field#getLong(Object)
+ * @see java.lang.reflect.Field#getFloat(Object)
+ * @see java.lang.reflect.Field#getDouble(Object)
+ * @see java.lang.reflect.Method#invoke(Object, Object[])
+ * @see java.lang.reflect.Constructor#newInstance(Object[])
+ * @since JDK1.0
+ */
+public class IllegalAccessException extends ReflectiveOperationException {
+ private static final long serialVersionUID = 6616958222490762034L;
+
+ /**
+ * Constructs an IllegalAccessException
without a
+ * detail message.
+ */
+ public IllegalAccessException() {
+ super();
+ }
+
+ /**
+ * Constructs an IllegalAccessException
with a detail message.
+ *
+ * @param s the detail message.
+ */
+ public IllegalAccessException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/IllegalArgumentException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/IllegalArgumentException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that a method has been passed an illegal or
+ * inappropriate argument.
+ *
+ * @author unascribed
+ * @see java.lang.Thread#setPriority(int)
+ * @since JDK1.0
+ */
+public
+class IllegalArgumentException extends RuntimeException {
+ /**
+ * Constructs an IllegalArgumentException
with no
+ * detail message.
+ */
+ public IllegalArgumentException() {
+ super();
+ }
+
+ /**
+ * Constructs an IllegalArgumentException
with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public IllegalArgumentException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause.
+ *
+ * cause
is
+ * not automatically incorporated in this exception's detail
+ * message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link Throwable#getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link Throwable#getCause()} method). (A null value
+ * is permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.5
+ */
+ public IllegalArgumentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link Throwable#getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.5
+ */
+ public IllegalArgumentException(Throwable cause) {
+ super(cause);
+ }
+
+ private static final long serialVersionUID = -5365630128856068164L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/IllegalStateException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/IllegalStateException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Signals that a method has been invoked at an illegal or
+ * inappropriate time. In other words, the Java environment or
+ * Java application is not in an appropriate state for the requested
+ * operation.
+ *
+ * @author Jonni Kanerva
+ * @since JDK1.1
+ */
+public
+class IllegalStateException extends RuntimeException {
+ /**
+ * Constructs an IllegalStateException with no detail message.
+ * A detail message is a String that describes this particular exception.
+ */
+ public IllegalStateException() {
+ super();
+ }
+
+ /**
+ * Constructs an IllegalStateException with the specified detail
+ * message. A detail message is a String that describes this particular
+ * exception.
+ *
+ * @param s the String that contains a detailed message
+ */
+ public IllegalStateException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause.
+ *
+ * cause
is
+ * not automatically incorporated in this exception's detail
+ * message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link Throwable#getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link Throwable#getCause()} method). (A null value
+ * is permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.5
+ */
+ public IllegalStateException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link Throwable#getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.5
+ */
+ public IllegalStateException(Throwable cause) {
+ super(cause);
+ }
+
+ static final long serialVersionUID = -1848914673093119416L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/IndexOutOfBoundsException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/IndexOutOfBoundsException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that an index of some sort (such as to an array, to a
+ * string, or to a vector) is out of range.
+ * IndexOutOfBoundsException
with no
+ * detail message.
+ */
+ public IndexOutOfBoundsException() {
+ super();
+ }
+
+ /**
+ * Constructs an IndexOutOfBoundsException
with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public IndexOutOfBoundsException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/InstantiationException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/InstantiationException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown when an application tries to create an instance of a class
+ * using the {@code newInstance} method in class
+ * {@code Class}, but the specified class object cannot be
+ * instantiated. The instantiation can fail for a variety of
+ * reasons including but not limited to:
+ *
+ *
+ *
+ *
+ * @author unascribed
+ * @see java.lang.Class#newInstance()
+ * @since JDK1.0
+ */
+public
+class InstantiationException extends ReflectiveOperationException {
+ private static final long serialVersionUID = -8441929162975509110L;
+
+ /**
+ * Constructs an {@code InstantiationException} with no detail message.
+ */
+ public InstantiationException() {
+ super();
+ }
+
+ /**
+ * Constructs an {@code InstantiationException} with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public InstantiationException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Integer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Integer.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,1242 @@
+/*
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The {@code Integer} class wraps a value of the primitive type
+ * {@code int} in an object. An object of type {@code Integer}
+ * contains a single field whose type is {@code int}.
+ *
+ * '\u002D'
). If the first argument is not
+ * negative, no sign character appears in the result.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the magnitude will not be the zero
+ * character. The following ASCII characters are used as digits:
+ *
+ *
+ * {@code 0123456789abcdefghijklmnopqrstuvwxyz}
+ *
+ *
+ * These are '\u0030'
through
+ * '\u0039'
and '\u0061'
through
+ * '\u007A'
. If {@code radix} is
+ * N, then the first N of these characters
+ * are used as radix-N digits in the order shown. Thus,
+ * the digits for hexadecimal (radix 16) are
+ * {@code 0123456789abcdef}. If uppercase letters are
+ * desired, the {@link java.lang.String#toUpperCase()} method may
+ * be called on the result:
+ *
+ *
+ * {@code Integer.toString(n, 16).toUpperCase()}
+ *
+ *
+ * @param i an integer to be converted to a string.
+ * @param radix the radix to use in the string representation.
+ * @return a string representation of the argument in the specified radix.
+ * @see java.lang.Character#MAX_RADIX
+ * @see java.lang.Character#MIN_RADIX
+ */
+ public static String toString(int i, int radix) {
+
+ if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+ radix = 10;
+
+ /* Use the faster version */
+ if (radix == 10) {
+ return toString(i);
+ }
+
+ char buf[] = new char[33];
+ boolean negative = (i < 0);
+ int charPos = 32;
+
+ if (!negative) {
+ i = -i;
+ }
+
+ while (i <= -radix) {
+ buf[charPos--] = digits[-(i % radix)];
+ i = i / radix;
+ }
+ buf[charPos] = digits[-i];
+
+ if (negative) {
+ buf[--charPos] = '-';
+ }
+
+ return new String(buf, charPos, (33 - charPos));
+ }
+
+ /**
+ * Returns a string representation of the integer argument as an
+ * unsigned integer in base 16.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the unsigned magnitude will not be the
+ * zero character. The following characters are used as
+ * hexadecimal digits:
+ *
+ *
+ * {@code 0123456789abcdef}
+ *
+ *
+ * These are the characters '\u0030'
through
+ * '\u0039'
and '\u0061'
through
+ * '\u0066'
. If uppercase letters are
+ * desired, the {@link java.lang.String#toUpperCase()} method may
+ * be called on the result:
+ *
+ *
+ * {@code Integer.toHexString(n).toUpperCase()}
+ *
+ *
+ * @param i an integer to be converted to a string.
+ * @return the string representation of the unsigned integer value
+ * represented by the argument in hexadecimal (base 16).
+ * @since JDK1.0.2
+ */
+ public static String toHexString(int i) {
+ return toUnsignedString(i, 4);
+ }
+
+ /**
+ * Returns a string representation of the integer argument as an
+ * unsigned integer in base 8.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the unsigned magnitude will not be the
+ * zero character. The following characters are used as octal
+ * digits:
+ *
+ *
+ * {@code 01234567}
+ *
+ *
+ * These are the characters '\u0030'
through
+ * '\u0037'
.
+ *
+ * @param i an integer to be converted to a string.
+ * @return the string representation of the unsigned integer value
+ * represented by the argument in octal (base 8).
+ * @since JDK1.0.2
+ */
+ public static String toOctalString(int i) {
+ return toUnsignedString(i, 3);
+ }
+
+ /**
+ * Returns a string representation of the integer argument as an
+ * unsigned integer in base 2.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the unsigned magnitude will not be the
+ * zero character. The characters {@code '0'}
+ * ('\u0030'
) and {@code '1'}
+ * ('\u0031'
) are used as binary digits.
+ *
+ * @param i an integer to be converted to a string.
+ * @return the string representation of the unsigned integer value
+ * represented by the argument in binary (base 2).
+ * @since JDK1.0.2
+ */
+ public static String toBinaryString(int i) {
+ return toUnsignedString(i, 1);
+ }
+
+ /**
+ * Convert the integer to an unsigned number.
+ */
+ private static String toUnsignedString(int i, int shift) {
+ char[] buf = new char[32];
+ int charPos = 32;
+ int radix = 1 << shift;
+ int mask = radix - 1;
+ do {
+ buf[--charPos] = digits[i & mask];
+ i >>>= shift;
+ } while (i != 0);
+
+ return new String(buf, charPos, (32 - charPos));
+ }
+
+
+ final static char [] DigitTens = {
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
+ '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
+ '3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
+ '4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
+ '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
+ '6', '6', '6', '6', '6', '6', '6', '6', '6', '6',
+ '7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
+ '8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
+ '9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
+ } ;
+
+ final static char [] DigitOnes = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ } ;
+
+ // I use the "invariant division by multiplication" trick to
+ // accelerate Integer.toString. In particular we want to
+ // avoid division by 10.
+ //
+ // The "trick" has roughly the same performance characteristics
+ // as the "classic" Integer.toString code on a non-JIT VM.
+ // The trick avoids .rem and .div calls but has a longer code
+ // path and is thus dominated by dispatch overhead. In the
+ // JIT case the dispatch overhead doesn't exist and the
+ // "trick" is considerably faster than the classic code.
+ //
+ // TODO-FIXME: convert (x * 52429) into the equiv shift-add
+ // sequence.
+ //
+ // RE: Division by Invariant Integers using Multiplication
+ // T Gralund, P Montgomery
+ // ACM PLDI 1994
+ //
+
+ /**
+ * Returns a {@code String} object representing the
+ * specified integer. The argument is converted to signed decimal
+ * representation and returned as a string, exactly as if the
+ * argument and radix 10 were given as arguments to the {@link
+ * #toString(int, int)} method.
+ *
+ * @param i an integer to be converted.
+ * @return a string representation of the argument in base 10.
+ */
+ public static String toString(int i) {
+ if (i == Integer.MIN_VALUE)
+ return "-2147483648";
+ int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i);
+ char[] buf = new char[size];
+ getChars(i, size, buf);
+ return new String(0, size, buf);
+ }
+
+ /**
+ * Places characters representing the integer i into the
+ * character array buf. The characters are placed into
+ * the buffer backwards starting with the least significant
+ * digit at the specified index (exclusive), and working
+ * backwards from there.
+ *
+ * Will fail if i == Integer.MIN_VALUE
+ */
+ static void getChars(int i, int index, char[] buf) {
+ int q, r;
+ int charPos = index;
+ char sign = 0;
+
+ if (i < 0) {
+ sign = '-';
+ i = -i;
+ }
+
+ // Generate two digits per iteration
+ while (i >= 65536) {
+ q = i / 100;
+ // really: r = i - (q * 100);
+ r = i - ((q << 6) + (q << 5) + (q << 2));
+ i = q;
+ buf [--charPos] = DigitOnes[r];
+ buf [--charPos] = DigitTens[r];
+ }
+
+ // Fall thru to fast mode for smaller numbers
+ // assert(i <= 65536, i);
+ for (;;) {
+ q = (i * 52429) >>> (16+3);
+ r = i - ((q << 3) + (q << 1)); // r = i-(q*10) ...
+ buf [--charPos] = digits [r];
+ i = q;
+ if (i == 0) break;
+ }
+ if (sign != 0) {
+ buf [--charPos] = sign;
+ }
+ }
+
+ final static int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
+ 99999999, 999999999, Integer.MAX_VALUE };
+
+ // Requires positive x
+ static int stringSize(int x) {
+ for (int i=0; ; i++)
+ if (x <= sizeTable[i])
+ return i+1;
+ }
+
+ /**
+ * Parses the string argument as a signed integer in the radix
+ * specified by the second argument. The characters in the string
+ * must all be digits of the specified radix (as determined by
+ * whether {@link java.lang.Character#digit(char, int)} returns a
+ * nonnegative value), except that the first character may be an
+ * ASCII minus sign {@code '-'} ('\u002D'
) to
+ * indicate a negative value or an ASCII plus sign {@code '+'}
+ * ('\u002B'
) to indicate a positive value. The
+ * resulting integer value is returned.
+ *
+ *
+ *
+ *
+ * '\u002D'
) or plus sign
+ * {@code '+'} ('\u002B'
) provided that the
+ * string is longer than length 1.
+ *
+ *
+ *
+ * @param s the {@code String} containing the integer
+ * representation to be parsed
+ * @param radix the radix to be used while parsing {@code s}.
+ * @return the integer represented by the string argument in the
+ * specified radix.
+ * @exception NumberFormatException if the {@code String}
+ * does not contain a parsable {@code int}.
+ */
+ public static int parseInt(String s, int radix)
+ throws NumberFormatException
+ {
+ /*
+ * WARNING: This method may be invoked early during VM initialization
+ * before IntegerCache is initialized. Care must be taken to not use
+ * the valueOf method.
+ */
+
+ if (s == null) {
+ throw new NumberFormatException("null");
+ }
+
+ if (radix < Character.MIN_RADIX) {
+ throw new NumberFormatException("radix " + radix +
+ " less than Character.MIN_RADIX");
+ }
+
+ if (radix > Character.MAX_RADIX) {
+ throw new NumberFormatException("radix " + radix +
+ " greater than Character.MAX_RADIX");
+ }
+
+ int result = 0;
+ boolean negative = false;
+ int i = 0, len = s.length();
+ int limit = -Integer.MAX_VALUE;
+ int multmin;
+ int digit;
+
+ if (len > 0) {
+ char firstChar = s.charAt(0);
+ if (firstChar < '0') { // Possible leading "+" or "-"
+ if (firstChar == '-') {
+ negative = true;
+ limit = Integer.MIN_VALUE;
+ } else if (firstChar != '+')
+ throw NumberFormatException.forInputString(s);
+
+ if (len == 1) // Cannot have lone "+" or "-"
+ throw NumberFormatException.forInputString(s);
+ i++;
+ }
+ multmin = limit / radix;
+ while (i < len) {
+ // Accumulating negatively avoids surprises near MAX_VALUE
+ digit = Character.digit(s.charAt(i++),radix);
+ if (digit < 0) {
+ throw NumberFormatException.forInputString(s);
+ }
+ if (result < multmin) {
+ throw NumberFormatException.forInputString(s);
+ }
+ result *= radix;
+ if (result < limit + digit) {
+ throw NumberFormatException.forInputString(s);
+ }
+ result -= digit;
+ }
+ } else {
+ throw NumberFormatException.forInputString(s);
+ }
+ return negative ? result : -result;
+ }
+
+ /**
+ * Parses the string argument as a signed decimal integer. The
+ * characters in the string must all be decimal digits, except
+ * that the first character may be an ASCII minus sign {@code '-'}
+ * (
+ * parseInt("0", 10) returns 0
+ * parseInt("473", 10) returns 473
+ * parseInt("+42", 10) returns 42
+ * parseInt("-0", 10) returns 0
+ * parseInt("-FF", 16) returns -255
+ * parseInt("1100110", 2) returns 102
+ * parseInt("2147483647", 10) returns 2147483647
+ * parseInt("-2147483648", 10) returns -2147483648
+ * parseInt("2147483648", 10) throws a NumberFormatException
+ * parseInt("99", 8) throws a NumberFormatException
+ * parseInt("Kona", 10) throws a NumberFormatException
+ * parseInt("Kona", 27) returns 411787
+ *
'\u002D'
) to indicate a negative value or an
+ * ASCII plus sign {@code '+'} ('\u002B'
) to
+ * indicate a positive value. The resulting integer value is
+ * returned, exactly as if the argument and the radix 10 were
+ * given as arguments to the {@link #parseInt(java.lang.String,
+ * int)} method.
+ *
+ * @param s a {@code String} containing the {@code int}
+ * representation to be parsed
+ * @return the integer value represented by the argument in decimal.
+ * @exception NumberFormatException if the string does not contain a
+ * parsable integer.
+ */
+ public static int parseInt(String s) throws NumberFormatException {
+ return parseInt(s,10);
+ }
+
+ /**
+ * Returns an {@code Integer} object holding the value
+ * extracted from the specified {@code String} when parsed
+ * with the radix given by the second argument. The first argument
+ * is interpreted as representing a signed integer in the radix
+ * specified by the second argument, exactly as if the arguments
+ * were given to the {@link #parseInt(java.lang.String, int)}
+ * method. The result is an {@code Integer} object that
+ * represents the integer value specified by the string.
+ *
+ *
+ * {@code new Integer(Integer.parseInt(s, radix))}
+ *
+ *
+ * @param s the string to be parsed.
+ * @param radix the radix to be used in interpreting {@code s}
+ * @return an {@code Integer} object holding the value
+ * represented by the string argument in the specified
+ * radix.
+ * @exception NumberFormatException if the {@code String}
+ * does not contain a parsable {@code int}.
+ */
+ public static Integer valueOf(String s, int radix) throws NumberFormatException {
+ return Integer.valueOf(parseInt(s,radix));
+ }
+
+ /**
+ * Returns an {@code Integer} object holding the
+ * value of the specified {@code String}. The argument is
+ * interpreted as representing a signed decimal integer, exactly
+ * as if the argument were given to the {@link
+ * #parseInt(java.lang.String)} method. The result is an
+ * {@code Integer} object that represents the integer value
+ * specified by the string.
+ *
+ *
+ * {@code new Integer(Integer.parseInt(s))}
+ *
+ *
+ * @param s the string to be parsed.
+ * @return an {@code Integer} object holding the value
+ * represented by the string argument.
+ * @exception NumberFormatException if the string cannot be parsed
+ * as an integer.
+ */
+ public static Integer valueOf(String s) throws NumberFormatException {
+ return Integer.valueOf(parseInt(s, 10));
+ }
+
+ /**
+ * Cache to support the object identity semantics of autoboxing for values between
+ * -128 and 127 (inclusive) as required by JLS.
+ *
+ * The cache is initialized on first usage. The size of the cache
+ * may be controlled by the -XX:AutoBoxCacheMax=
+ * {@code getInteger(nm, null)}
+ *
+ *
+ * @param nm property name.
+ * @return the {@code Integer} value of the property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ */
+ public static Integer getInteger(String nm) {
+ return getInteger(nm, null);
+ }
+
+ /**
+ * Determines the integer value of the system property with the
+ * specified name.
+ *
+ *
+ * {@code getInteger(nm, new Integer(val))}
+ *
+ *
+ * but in practice it may be implemented in a manner such as:
+ *
+ *
+ *
+ * to avoid the unnecessary allocation of an {@code Integer}
+ * object when the default value is not needed.
+ *
+ * @param nm property name.
+ * @param val default value.
+ * @return the {@code Integer} value of the property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ */
+ public static Integer getInteger(String nm, int val) {
+ Integer result = getInteger(nm, null);
+ return (result == null) ? Integer.valueOf(val) : result;
+ }
+
+ /**
+ * Returns the integer value of the system property with the
+ * specified name. The first argument is treated as the name of a
+ * system property. System properties are accessible through the
+ * {@link java.lang.System#getProperty(java.lang.String)} method.
+ * The string value of this property is then interpreted as an
+ * integer value, as per the {@code Integer.decode} method,
+ * and an {@code Integer} object representing this value is
+ * returned.
+ *
+ *
+ * Integer result = getInteger(nm, null);
+ * return (result == null) ? new Integer(val) : result;
+ *
+ *
+ *
+ *
+ *
+ * DecimalNumeral, HexDigits, and OctalDigits
+ * are as defined in section 3.10.1 of
+ * The Java™ Language Specification,
+ * except that underscores are not accepted between digits.
+ *
+ *
+ *
+ *
+ * Integer.valueOf(x).compareTo(Integer.valueOf(y))
+ *
+ *
+ * @param x the first {@code int} to compare
+ * @param y the second {@code int} to compare
+ * @return the value {@code 0} if {@code x == y};
+ * a value less than {@code 0} if {@code x < y}; and
+ * a value greater than {@code 0} if {@code x > y}
+ * @since 1.7
+ */
+ public static int compare(int x, int y) {
+ return (x < y) ? -1 : ((x == y) ? 0 : 1);
+ }
+
+
+ // Bit twiddling
+
+ /**
+ * The number of bits used to represent an {@code int} value in two's
+ * complement binary form.
+ *
+ * @since 1.5
+ */
+ public static final int SIZE = 32;
+
+ /**
+ * Returns an {@code int} value with at most a single one-bit, in the
+ * position of the highest-order ("leftmost") one-bit in the specified
+ * {@code int} value. Returns zero if the specified value has no
+ * one-bits in its two's complement binary representation, that is, if it
+ * is equal to zero.
+ *
+ * @return an {@code int} value with a single one-bit, in the position
+ * of the highest-order one-bit in the specified value, or zero if
+ * the specified value is itself equal to zero.
+ * @since 1.5
+ */
+ public static int highestOneBit(int i) {
+ // HD, Figure 3-1
+ i |= (i >> 1);
+ i |= (i >> 2);
+ i |= (i >> 4);
+ i |= (i >> 8);
+ i |= (i >> 16);
+ return i - (i >>> 1);
+ }
+
+ /**
+ * Returns an {@code int} value with at most a single one-bit, in the
+ * position of the lowest-order ("rightmost") one-bit in the specified
+ * {@code int} value. Returns zero if the specified value has no
+ * one-bits in its two's complement binary representation, that is, if it
+ * is equal to zero.
+ *
+ * @return an {@code int} value with a single one-bit, in the position
+ * of the lowest-order one-bit in the specified value, or zero if
+ * the specified value is itself equal to zero.
+ * @since 1.5
+ */
+ public static int lowestOneBit(int i) {
+ // HD, Section 2-1
+ return i & -i;
+ }
+
+ /**
+ * Returns the number of zero bits preceding the highest-order
+ * ("leftmost") one-bit in the two's complement binary representation
+ * of the specified {@code int} value. Returns 32 if the
+ * specified value has no one-bits in its two's complement representation,
+ * in other words if it is equal to zero.
+ *
+ *
+ *
+ *
+ * @return the number of zero bits preceding the highest-order
+ * ("leftmost") one-bit in the two's complement binary representation
+ * of the specified {@code int} value, or 32 if the value
+ * is equal to zero.
+ * @since 1.5
+ */
+ public static int numberOfLeadingZeros(int i) {
+ // HD, Figure 5-6
+ if (i == 0)
+ return 32;
+ int n = 1;
+ if (i >>> 16 == 0) { n += 16; i <<= 16; }
+ if (i >>> 24 == 0) { n += 8; i <<= 8; }
+ if (i >>> 28 == 0) { n += 4; i <<= 4; }
+ if (i >>> 30 == 0) { n += 2; i <<= 2; }
+ n -= i >>> 31;
+ return n;
+ }
+
+ /**
+ * Returns the number of zero bits following the lowest-order ("rightmost")
+ * one-bit in the two's complement binary representation of the specified
+ * {@code int} value. Returns 32 if the specified value has no
+ * one-bits in its two's complement representation, in other words if it is
+ * equal to zero.
+ *
+ * @return the number of zero bits following the lowest-order ("rightmost")
+ * one-bit in the two's complement binary representation of the
+ * specified {@code int} value, or 32 if the value is equal
+ * to zero.
+ * @since 1.5
+ */
+ public static int numberOfTrailingZeros(int i) {
+ // HD, Figure 5-14
+ int y;
+ if (i == 0) return 32;
+ int n = 31;
+ y = i <<16; if (y != 0) { n = n -16; i = y; }
+ y = i << 8; if (y != 0) { n = n - 8; i = y; }
+ y = i << 4; if (y != 0) { n = n - 4; i = y; }
+ y = i << 2; if (y != 0) { n = n - 2; i = y; }
+ return n - ((i << 1) >>> 31);
+ }
+
+ /**
+ * Returns the number of one-bits in the two's complement binary
+ * representation of the specified {@code int} value. This function is
+ * sometimes referred to as the population count.
+ *
+ * @return the number of one-bits in the two's complement binary
+ * representation of the specified {@code int} value.
+ * @since 1.5
+ */
+ public static int bitCount(int i) {
+ // HD, Figure 5-2
+ i = i - ((i >>> 1) & 0x55555555);
+ i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
+ i = (i + (i >>> 4)) & 0x0f0f0f0f;
+ i = i + (i >>> 8);
+ i = i + (i >>> 16);
+ return i & 0x3f;
+ }
+
+ /**
+ * Returns the value obtained by rotating the two's complement binary
+ * representation of the specified {@code int} value left by the
+ * specified number of bits. (Bits shifted out of the left hand, or
+ * high-order, side reenter on the right, or low-order.)
+ *
+ *
+ * if (Thread.interrupted()) // Clears interrupted status!
+ * throw new InterruptedException();
+ *
+ *
+ * @author Frank Yellin
+ * @see java.lang.Object#wait()
+ * @see java.lang.Object#wait(long)
+ * @see java.lang.Object#wait(long, int)
+ * @see java.lang.Thread#sleep(long)
+ * @see java.lang.Thread#interrupt()
+ * @see java.lang.Thread#interrupted()
+ * @since JDK1.0
+ */
+public
+class InterruptedException extends Exception {
+ private static final long serialVersionUID = 6700697376100628473L;
+
+ /**
+ * Constructs an InterruptedException
with no detail message.
+ */
+ public InterruptedException() {
+ super();
+ }
+
+ /**
+ * Constructs an InterruptedException
with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public InterruptedException(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Long.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Long.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,1199 @@
+/*
+ * Copyright (c) 1994, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The {@code Long} class wraps a value of the primitive type {@code
+ * long} in an object. An object of type {@code Long} contains a
+ * single field whose type is {@code long}.
+ *
+ * '\u002d'
). If the first argument is not
+ * negative, no sign character appears in the result.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the magnitude will not be the zero
+ * character. The following ASCII characters are used as digits:
+ *
+ *
+ * {@code 0123456789abcdefghijklmnopqrstuvwxyz}
+ *
+ *
+ * These are '\u0030'
through
+ * '\u0039'
and '\u0061'
through
+ * '\u007a'
. If {@code radix} is
+ * N, then the first N of these characters
+ * are used as radix-N digits in the order shown. Thus,
+ * the digits for hexadecimal (radix 16) are
+ * {@code 0123456789abcdef}. If uppercase letters are
+ * desired, the {@link java.lang.String#toUpperCase()} method may
+ * be called on the result:
+ *
+ *
+ * {@code Long.toString(n, 16).toUpperCase()}
+ *
+ *
+ * @param i a {@code long} to be converted to a string.
+ * @param radix the radix to use in the string representation.
+ * @return a string representation of the argument in the specified radix.
+ * @see java.lang.Character#MAX_RADIX
+ * @see java.lang.Character#MIN_RADIX
+ */
+ public static String toString(long i, int radix) {
+ if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+ radix = 10;
+ if (radix == 10)
+ return toString(i);
+ char[] buf = new char[65];
+ int charPos = 64;
+ boolean negative = (i < 0);
+
+ if (!negative) {
+ i = -i;
+ }
+
+ while (i <= -radix) {
+ buf[charPos--] = Integer.digits[(int)(-(i % radix))];
+ i = i / radix;
+ }
+ buf[charPos] = Integer.digits[(int)(-i)];
+
+ if (negative) {
+ buf[--charPos] = '-';
+ }
+
+ return new String(buf, charPos, (65 - charPos));
+ }
+
+ /**
+ * Returns a string representation of the {@code long}
+ * argument as an unsigned integer in base 16.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the unsigned magnitude will not be the
+ * zero character. The following characters are used as
+ * hexadecimal digits:
+ *
+ *
+ * {@code 0123456789abcdef}
+ *
+ *
+ * These are the characters '\u0030'
through
+ * '\u0039'
and '\u0061'
through
+ * '\u0066'
. If uppercase letters are desired,
+ * the {@link java.lang.String#toUpperCase()} method may be called
+ * on the result:
+ *
+ *
+ * {@code Long.toHexString(n).toUpperCase()}
+ *
+ *
+ * @param i a {@code long} to be converted to a string.
+ * @return the string representation of the unsigned {@code long}
+ * value represented by the argument in hexadecimal
+ * (base 16).
+ * @since JDK 1.0.2
+ */
+ public static String toHexString(long i) {
+ return toUnsignedString(i, 4);
+ }
+
+ /**
+ * Returns a string representation of the {@code long}
+ * argument as an unsigned integer in base 8.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the unsigned magnitude will not be the
+ * zero character. The following characters are used as octal
+ * digits:
+ *
+ *
+ * {@code 01234567}
+ *
+ *
+ * These are the characters '\u0030'
through
+ * '\u0037'
.
+ *
+ * @param i a {@code long} to be converted to a string.
+ * @return the string representation of the unsigned {@code long}
+ * value represented by the argument in octal (base 8).
+ * @since JDK 1.0.2
+ */
+ public static String toOctalString(long i) {
+ return toUnsignedString(i, 3);
+ }
+
+ /**
+ * Returns a string representation of the {@code long}
+ * argument as an unsigned integer in base 2.
+ *
+ * '\u0030'
); otherwise, the first character of
+ * the representation of the unsigned magnitude will not be the
+ * zero character. The characters {@code '0'}
+ * ('\u0030'
) and {@code '1'}
+ * ('\u0031'
) are used as binary digits.
+ *
+ * @param i a {@code long} to be converted to a string.
+ * @return the string representation of the unsigned {@code long}
+ * value represented by the argument in binary (base 2).
+ * @since JDK 1.0.2
+ */
+ public static String toBinaryString(long i) {
+ return toUnsignedString(i, 1);
+ }
+
+ /**
+ * Convert the integer to an unsigned number.
+ */
+ private static String toUnsignedString(long i, int shift) {
+ char[] buf = new char[64];
+ int charPos = 64;
+ int radix = 1 << shift;
+ long mask = radix - 1;
+ do {
+ buf[--charPos] = Integer.digits[(int)(i & mask)];
+ i >>>= shift;
+ } while (i != 0);
+ return new String(buf, charPos, (64 - charPos));
+ }
+
+ /**
+ * Returns a {@code String} object representing the specified
+ * {@code long}. The argument is converted to signed decimal
+ * representation and returned as a string, exactly as if the
+ * argument and the radix 10 were given as arguments to the {@link
+ * #toString(long, int)} method.
+ *
+ * @param i a {@code long} to be converted.
+ * @return a string representation of the argument in base 10.
+ */
+ public static String toString(long i) {
+ if (i == Long.MIN_VALUE)
+ return "-9223372036854775808";
+ int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i);
+ char[] buf = new char[size];
+ getChars(i, size, buf);
+ return new String(0, size, buf);
+ }
+
+ /**
+ * Places characters representing the integer i into the
+ * character array buf. The characters are placed into
+ * the buffer backwards starting with the least significant
+ * digit at the specified index (exclusive), and working
+ * backwards from there.
+ *
+ * Will fail if i == Long.MIN_VALUE
+ */
+ static void getChars(long i, int index, char[] buf) {
+ long q;
+ int r;
+ int charPos = index;
+ char sign = 0;
+
+ if (i < 0) {
+ sign = '-';
+ i = -i;
+ }
+
+ // Get 2 digits/iteration using longs until quotient fits into an int
+ while (i > Integer.MAX_VALUE) {
+ q = i / 100;
+ // really: r = i - (q * 100);
+ r = (int)(i - ((q << 6) + (q << 5) + (q << 2)));
+ i = q;
+ buf[--charPos] = Integer.DigitOnes[r];
+ buf[--charPos] = Integer.DigitTens[r];
+ }
+
+ // Get 2 digits/iteration using ints
+ int q2;
+ int i2 = (int)i;
+ while (i2 >= 65536) {
+ q2 = i2 / 100;
+ // really: r = i2 - (q * 100);
+ r = i2 - ((q2 << 6) + (q2 << 5) + (q2 << 2));
+ i2 = q2;
+ buf[--charPos] = Integer.DigitOnes[r];
+ buf[--charPos] = Integer.DigitTens[r];
+ }
+
+ // Fall thru to fast mode for smaller numbers
+ // assert(i2 <= 65536, i2);
+ for (;;) {
+ q2 = (i2 * 52429) >>> (16+3);
+ r = i2 - ((q2 << 3) + (q2 << 1)); // r = i2-(q2*10) ...
+ buf[--charPos] = Integer.digits[r];
+ i2 = q2;
+ if (i2 == 0) break;
+ }
+ if (sign != 0) {
+ buf[--charPos] = sign;
+ }
+ }
+
+ // Requires positive x
+ static int stringSize(long x) {
+ long p = 10;
+ for (int i=1; i<19; i++) {
+ if (x < p)
+ return i;
+ p = 10*p;
+ }
+ return 19;
+ }
+
+ /**
+ * Parses the string argument as a signed {@code long} in the
+ * radix specified by the second argument. The characters in the
+ * string must all be digits of the specified radix (as determined
+ * by whether {@link java.lang.Character#digit(char, int)} returns
+ * a nonnegative value), except that the first character may be an
+ * ASCII minus sign {@code '-'} ('\u002D'
) to
+ * indicate a negative value or an ASCII plus sign {@code '+'}
+ * ('\u002B'
) to indicate a positive value. The
+ * resulting {@code long} value is returned.
+ *
+ * '\u004C'
) nor {@code l}
+ * ('\u006C'
) is permitted to appear at the end
+ * of the string as a type indicator, as would be permitted in
+ * Java programming language source code - except that either
+ * {@code L} or {@code l} may appear as a digit for a
+ * radix greater than 22.
+ *
+ *
+ *
+ *
+ *
+ * '\u002d'
) or plus sign {@code
+ * '+'} ('\u002B'
) provided that the string is
+ * longer than length 1.
+ *
+ *
+ *
+ * @param s the {@code String} containing the
+ * {@code long} representation to be parsed.
+ * @param radix the radix to be used while parsing {@code s}.
+ * @return the {@code long} represented by the string argument in
+ * the specified radix.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable {@code long}.
+ */
+ public static long parseLong(String s, int radix)
+ throws NumberFormatException
+ {
+ if (s == null) {
+ throw new NumberFormatException("null");
+ }
+
+ if (radix < Character.MIN_RADIX) {
+ throw new NumberFormatException("radix " + radix +
+ " less than Character.MIN_RADIX");
+ }
+ if (radix > Character.MAX_RADIX) {
+ throw new NumberFormatException("radix " + radix +
+ " greater than Character.MAX_RADIX");
+ }
+
+ long result = 0;
+ boolean negative = false;
+ int i = 0, len = s.length();
+ long limit = -Long.MAX_VALUE;
+ long multmin;
+ int digit;
+
+ if (len > 0) {
+ char firstChar = s.charAt(0);
+ if (firstChar < '0') { // Possible leading "+" or "-"
+ if (firstChar == '-') {
+ negative = true;
+ limit = Long.MIN_VALUE;
+ } else if (firstChar != '+')
+ throw NumberFormatException.forInputString(s);
+
+ if (len == 1) // Cannot have lone "+" or "-"
+ throw NumberFormatException.forInputString(s);
+ i++;
+ }
+ multmin = limit / radix;
+ while (i < len) {
+ // Accumulating negatively avoids surprises near MAX_VALUE
+ digit = Character.digit(s.charAt(i++),radix);
+ if (digit < 0) {
+ throw NumberFormatException.forInputString(s);
+ }
+ if (result < multmin) {
+ throw NumberFormatException.forInputString(s);
+ }
+ result *= radix;
+ if (result < limit + digit) {
+ throw NumberFormatException.forInputString(s);
+ }
+ result -= digit;
+ }
+ } else {
+ throw NumberFormatException.forInputString(s);
+ }
+ return negative ? result : -result;
+ }
+
+ /**
+ * Parses the string argument as a signed decimal {@code long}.
+ * The characters in the string must all be decimal digits, except
+ * that the first character may be an ASCII minus sign {@code '-'}
+ * (
+ * parseLong("0", 10) returns 0L
+ * parseLong("473", 10) returns 473L
+ * parseLong("+42", 10) returns 42L
+ * parseLong("-0", 10) returns 0L
+ * parseLong("-FF", 16) returns -255L
+ * parseLong("1100110", 2) returns 102L
+ * parseLong("99", 8) throws a NumberFormatException
+ * parseLong("Hazelnut", 10) throws a NumberFormatException
+ * parseLong("Hazelnut", 36) returns 1356099454469L
+ *
\u002D'
) to indicate a negative value or an
+ * ASCII plus sign {@code '+'} ('\u002B'
) to
+ * indicate a positive value. The resulting {@code long} value is
+ * returned, exactly as if the argument and the radix {@code 10}
+ * were given as arguments to the {@link
+ * #parseLong(java.lang.String, int)} method.
+ *
+ * '\u004C'
) nor {@code l}
+ * ('\u006C'
) is permitted to appear at the end
+ * of the string as a type indicator, as would be permitted in
+ * Java programming language source code.
+ *
+ * @param s a {@code String} containing the {@code long}
+ * representation to be parsed
+ * @return the {@code long} represented by the argument in
+ * decimal.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable {@code long}.
+ */
+ public static long parseLong(String s) throws NumberFormatException {
+ return parseLong(s, 10);
+ }
+
+ /**
+ * Returns a {@code Long} object holding the value
+ * extracted from the specified {@code String} when parsed
+ * with the radix given by the second argument. The first
+ * argument is interpreted as representing a signed
+ * {@code long} in the radix specified by the second
+ * argument, exactly as if the arguments were given to the {@link
+ * #parseLong(java.lang.String, int)} method. The result is a
+ * {@code Long} object that represents the {@code long}
+ * value specified by the string.
+ *
+ *
+ * {@code new Long(Long.parseLong(s, radix))}
+ *
+ *
+ * @param s the string to be parsed
+ * @param radix the radix to be used in interpreting {@code s}
+ * @return a {@code Long} object holding the value
+ * represented by the string argument in the specified
+ * radix.
+ * @throws NumberFormatException If the {@code String} does not
+ * contain a parsable {@code long}.
+ */
+ public static Long valueOf(String s, int radix) throws NumberFormatException {
+ return Long.valueOf(parseLong(s, radix));
+ }
+
+ /**
+ * Returns a {@code Long} object holding the value
+ * of the specified {@code String}. The argument is
+ * interpreted as representing a signed decimal {@code long},
+ * exactly as if the argument were given to the {@link
+ * #parseLong(java.lang.String)} method. The result is a
+ * {@code Long} object that represents the integer value
+ * specified by the string.
+ *
+ *
+ * {@code new Long(Long.parseLong(s))}
+ *
+ *
+ * @param s the string to be parsed.
+ * @return a {@code Long} object holding the value
+ * represented by the string argument.
+ * @throws NumberFormatException If the string cannot be parsed
+ * as a {@code long}.
+ */
+ public static Long valueOf(String s) throws NumberFormatException
+ {
+ return Long.valueOf(parseLong(s, 10));
+ }
+
+ private static class LongCache {
+ private LongCache(){}
+
+ static final Long cache[] = new Long[-(-128) + 127 + 1];
+
+ static {
+ for(int i = 0; i < cache.length; i++)
+ cache[i] = new Long(i - 128);
+ }
+ }
+
+ /**
+ * Returns a {@code Long} instance representing the specified
+ * {@code long} value.
+ * If a new {@code Long} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Long(long)}, as this method is likely to yield
+ * significantly better space and time performance by caching
+ * frequently requested values.
+ *
+ * Note that unlike the {@linkplain Integer#valueOf(int)
+ * corresponding method} in the {@code Integer} class, this method
+ * is not required to cache values within a particular
+ * range.
+ *
+ * @param l a long value.
+ * @return a {@code Long} instance representing {@code l}.
+ * @since 1.5
+ */
+ public static Long valueOf(long l) {
+ final int offset = 128;
+ if (l >= -128 && l <= 127) { // will cache
+ return LongCache.cache[(int)l + offset];
+ }
+ return new Long(l);
+ }
+
+ /**
+ * Decodes a {@code String} into a {@code Long}.
+ * Accepts decimal, hexadecimal, and octal numbers given by the
+ * following grammar:
+ *
+ *
+ *
+ *
+ * DecimalNumeral, HexDigits, and OctalDigits
+ * are as defined in section 3.10.1 of
+ * The Java™ Language Specification,
+ * except that underscores are not accepted between digits.
+ *
+ *
+ *
+ *
+ * {@code (int)(this.longValue()^(this.longValue()>>>32))}
+ *
+ *
+ * @return a hash code value for this object.
+ */
+ public int hashCode() {
+ return (int)(value ^ (value >>> 32));
+ }
+
+ /**
+ * Compares this object to the specified object. The result is
+ * {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Long} object that
+ * contains the same {@code long} value as this object.
+ *
+ * @param obj the object to compare with.
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Long) {
+ return value == ((Long)obj).longValue();
+ }
+ return false;
+ }
+
+ /**
+ * Determines the {@code long} value of the system property
+ * with the specified name.
+ *
+ *
+ * {@code getLong(nm, null)}
+ *
+ *
+ * @param nm property name.
+ * @return the {@code Long} value of the property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ */
+ public static Long getLong(String nm) {
+ return getLong(nm, null);
+ }
+
+ /**
+ * Determines the {@code long} value of the system property
+ * with the specified name.
+ *
+ *
+ * {@code getLong(nm, new Long(val))}
+ *
+ *
+ * but in practice it may be implemented in a manner such as:
+ *
+ *
+ *
+ * to avoid the unnecessary allocation of a {@code Long} object when
+ * the default value is not needed.
+ *
+ * @param nm property name.
+ * @param val default value.
+ * @return the {@code Long} value of the property.
+ * @see java.lang.System#getProperty(java.lang.String)
+ * @see java.lang.System#getProperty(java.lang.String, java.lang.String)
+ */
+ public static Long getLong(String nm, long val) {
+ Long result = Long.getLong(nm, null);
+ return (result == null) ? Long.valueOf(val) : result;
+ }
+
+ /**
+ * Returns the {@code long} value of the system property with
+ * the specified name. The first argument is treated as the name
+ * of a system property. System properties are accessible through
+ * the {@link java.lang.System#getProperty(java.lang.String)}
+ * method. The string value of this property is then interpreted
+ * as a {@code long} value, as per the
+ * {@code Long.decode} method, and a {@code Long} object
+ * representing this value is returned.
+ *
+ *
+ * Long result = getLong(nm, null);
+ * return (result == null) ? new Long(val) : result;
+ *
+ *
+ *
+ * '\u004C'
) nor {@code l}
+ * ('\u006C'
) is permitted to appear at the end
+ * of the property value as a type indicator, as would be
+ * permitted in Java programming language source code.
+ *
+ *
+ * Long.valueOf(x).compareTo(Long.valueOf(y))
+ *
+ *
+ * @param x the first {@code long} to compare
+ * @param y the second {@code long} to compare
+ * @return the value {@code 0} if {@code x == y};
+ * a value less than {@code 0} if {@code x < y}; and
+ * a value greater than {@code 0} if {@code x > y}
+ * @since 1.7
+ */
+ public static int compare(long x, long y) {
+ return (x < y) ? -1 : ((x == y) ? 0 : 1);
+ }
+
+
+ // Bit Twiddling
+
+ /**
+ * The number of bits used to represent a {@code long} value in two's
+ * complement binary form.
+ *
+ * @since 1.5
+ */
+ public static final int SIZE = 64;
+
+ /**
+ * Returns a {@code long} value with at most a single one-bit, in the
+ * position of the highest-order ("leftmost") one-bit in the specified
+ * {@code long} value. Returns zero if the specified value has no
+ * one-bits in its two's complement binary representation, that is, if it
+ * is equal to zero.
+ *
+ * @return a {@code long} value with a single one-bit, in the position
+ * of the highest-order one-bit in the specified value, or zero if
+ * the specified value is itself equal to zero.
+ * @since 1.5
+ */
+ public static long highestOneBit(long i) {
+ // HD, Figure 3-1
+ i |= (i >> 1);
+ i |= (i >> 2);
+ i |= (i >> 4);
+ i |= (i >> 8);
+ i |= (i >> 16);
+ i |= (i >> 32);
+ return i - (i >>> 1);
+ }
+
+ /**
+ * Returns a {@code long} value with at most a single one-bit, in the
+ * position of the lowest-order ("rightmost") one-bit in the specified
+ * {@code long} value. Returns zero if the specified value has no
+ * one-bits in its two's complement binary representation, that is, if it
+ * is equal to zero.
+ *
+ * @return a {@code long} value with a single one-bit, in the position
+ * of the lowest-order one-bit in the specified value, or zero if
+ * the specified value is itself equal to zero.
+ * @since 1.5
+ */
+ public static long lowestOneBit(long i) {
+ // HD, Section 2-1
+ return i & -i;
+ }
+
+ /**
+ * Returns the number of zero bits preceding the highest-order
+ * ("leftmost") one-bit in the two's complement binary representation
+ * of the specified {@code long} value. Returns 64 if the
+ * specified value has no one-bits in its two's complement representation,
+ * in other words if it is equal to zero.
+ *
+ *
+ *
+ *
+ * @return the number of zero bits preceding the highest-order
+ * ("leftmost") one-bit in the two's complement binary representation
+ * of the specified {@code long} value, or 64 if the value
+ * is equal to zero.
+ * @since 1.5
+ */
+ public static int numberOfLeadingZeros(long i) {
+ // HD, Figure 5-6
+ if (i == 0)
+ return 64;
+ int n = 1;
+ int x = (int)(i >>> 32);
+ if (x == 0) { n += 32; x = (int)i; }
+ if (x >>> 16 == 0) { n += 16; x <<= 16; }
+ if (x >>> 24 == 0) { n += 8; x <<= 8; }
+ if (x >>> 28 == 0) { n += 4; x <<= 4; }
+ if (x >>> 30 == 0) { n += 2; x <<= 2; }
+ n -= x >>> 31;
+ return n;
+ }
+
+ /**
+ * Returns the number of zero bits following the lowest-order ("rightmost")
+ * one-bit in the two's complement binary representation of the specified
+ * {@code long} value. Returns 64 if the specified value has no
+ * one-bits in its two's complement representation, in other words if it is
+ * equal to zero.
+ *
+ * @return the number of zero bits following the lowest-order ("rightmost")
+ * one-bit in the two's complement binary representation of the
+ * specified {@code long} value, or 64 if the value is equal
+ * to zero.
+ * @since 1.5
+ */
+ public static int numberOfTrailingZeros(long i) {
+ // HD, Figure 5-14
+ int x, y;
+ if (i == 0) return 64;
+ int n = 63;
+ y = (int)i; if (y != 0) { n = n -32; x = y; } else x = (int)(i>>>32);
+ y = x <<16; if (y != 0) { n = n -16; x = y; }
+ y = x << 8; if (y != 0) { n = n - 8; x = y; }
+ y = x << 4; if (y != 0) { n = n - 4; x = y; }
+ y = x << 2; if (y != 0) { n = n - 2; x = y; }
+ return n - ((x << 1) >>> 31);
+ }
+
+ /**
+ * Returns the number of one-bits in the two's complement binary
+ * representation of the specified {@code long} value. This function is
+ * sometimes referred to as the population count.
+ *
+ * @return the number of one-bits in the two's complement binary
+ * representation of the specified {@code long} value.
+ * @since 1.5
+ */
+ public static int bitCount(long i) {
+ // HD, Figure 5-14
+ i = i - ((i >>> 1) & 0x5555555555555555L);
+ i = (i & 0x3333333333333333L) + ((i >>> 2) & 0x3333333333333333L);
+ i = (i + (i >>> 4)) & 0x0f0f0f0f0f0f0f0fL;
+ i = i + (i >>> 8);
+ i = i + (i >>> 16);
+ i = i + (i >>> 32);
+ return (int)i & 0x7f;
+ }
+
+ /**
+ * Returns the value obtained by rotating the two's complement binary
+ * representation of the specified {@code long} value left by the
+ * specified number of bits. (Bits shifted out of the left hand, or
+ * high-order, side reenter on the right, or low-order.)
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * Otherwise, the result is the {@code double} value closest to
+ * the true mathematical square root of the argument value.
+ *
+ * @param a a value.
+ * @return the positive square root of {@code a}.
+ * If the argument is NaN or less than zero, the result is NaN.
+ */
+ public static double sqrt(double a) {
+ return StrictMath.sqrt(a); // default impl. delegates to StrictMath
+ // Note that hardware sqrt instructions
+ // frequently can be directly used by JITs
+ // and should be much faster than doing
+ // Math.sqrt in software.
+ }
+
+
+ /**
+ * Returns the cube root of a {@code double} value. For
+ * positive finite {@code x}, {@code cbrt(-x) ==
+ * -cbrt(x)}; that is, the cube root of a negative value is
+ * the negative of the cube root of that value's magnitude.
+ *
+ * Special cases:
+ *
+ *
+ *
+ *
+ *
+ * f1 - f2
× n,
+ * where n is the mathematical integer closest to the exact
+ * mathematical value of the quotient {@code f1/f2}, and if two
+ * mathematical integers are equally close to {@code f1/f2},
+ * then n is the integer that is even. If the remainder is
+ * zero, its sign is the same as the sign of the first argument.
+ * Special cases:
+ *
+ *
+ * @param f1 the dividend.
+ * @param f2 the divisor.
+ * @return the remainder when {@code f1} is divided by
+ * {@code f2}.
+ */
+ public static double IEEEremainder(double f1, double f2) {
+ return StrictMath.IEEEremainder(f1, f2); // delegate to StrictMath
+ }
+
+ /**
+ * Returns the smallest (closest to negative infinity)
+ * {@code double} value that is greater than or equal to the
+ * argument and is equal to a mathematical integer. Special cases:
+ *
Note
+ * that the value of {@code Math.ceil(x)} is exactly the
+ * value of {@code -Math.floor(-x)}.
+ *
+ *
+ * @param a a value.
+ * @return the smallest (closest to negative infinity)
+ * floating-point value that is greater than or equal to
+ * the argument and is equal to a mathematical integer.
+ */
+ public static double ceil(double a) {
+ return StrictMath.ceil(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the largest (closest to positive infinity)
+ * {@code double} value that is less than or equal to the
+ * argument and is equal to a mathematical integer. Special cases:
+ *
+ *
+ * @param a a value.
+ * @return the largest (closest to positive infinity)
+ * floating-point value that less than or equal to the argument
+ * and is equal to a mathematical integer.
+ */
+ public static double floor(double a) {
+ return StrictMath.floor(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the {@code double} value that is closest in value
+ * to the argument and is equal to a mathematical integer. If two
+ * {@code double} values that are mathematical integers are
+ * equally close, the result is the integer value that is
+ * even. Special cases:
+ *
+ *
+ * @param a a {@code double} value.
+ * @return the closest floating-point value to {@code a} that is
+ * equal to a mathematical integer.
+ */
+ public static double rint(double a) {
+ return StrictMath.rint(a); // default impl. delegates to StrictMath
+ }
+
+ /**
+ * Returns the angle theta from the conversion of rectangular
+ * coordinates ({@code x}, {@code y}) to polar
+ * coordinates (r, theta).
+ * This method computes the phase theta by computing an arc tangent
+ * of {@code y/x} in the range of -pi to pi. Special
+ * cases:
+ *
+ *
+ *
+ *
+ *
+ *
+ * then the result is positive infinity.
+ *
+ *
+ *
+ * then the result is positive zero.
+ *
+ *
+ *
+ * then the result is positive zero.
+ *
+ *
+ *
+ * then the result is positive infinity.
+ *
+ *
+ *
+ * then the result is positive zero.
+ *
+ *
+ *
+ * then the result is negative zero.
+ *
+ *
+ *
+ * then the result is positive infinity.
+ *
+ *
+ *
+ * then the result is negative infinity.
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param a a floating-point value to be rounded to an integer.
+ * @return the value of the argument rounded to the nearest
+ * {@code int} value.
+ * @see java.lang.Integer#MAX_VALUE
+ * @see java.lang.Integer#MIN_VALUE
+ */
+ public static int round(float a) {
+ if (a != 0x1.fffffep-2f) // greatest float value less than 0.5
+ return (int)floor(a + 0.5f);
+ else
+ return 0;
+ }
+
+ /**
+ * Returns the closest {@code long} to the argument, with ties
+ * rounding up.
+ *
+ *
+ *
+ * @param a a floating-point value to be rounded to a
+ * {@code long}.
+ * @return the value of the argument rounded to the nearest
+ * {@code long} value.
+ * @see java.lang.Long#MAX_VALUE
+ * @see java.lang.Long#MIN_VALUE
+ */
+ public static long round(double a) {
+ if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5
+ return (long)floor(a + 0.5d);
+ else
+ return 0;
+ }
+
+// private static Random randomNumberGenerator;
+//
+// private static synchronized Random initRNG() {
+// Random rnd = randomNumberGenerator;
+// return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
+// }
+
+ /**
+ * Returns a {@code double} value with a positive sign, greater
+ * than or equal to {@code 0.0} and less than {@code 1.0}.
+ * Returned values are chosen pseudorandomly with (approximately)
+ * uniform distribution from that range.
+ *
+ * {@code new java.util.Random()}
+ *
+ * This new pseudorandom-number generator is used thereafter for
+ * all calls to this method and is used nowhere else.
+ *
+ *
+ * In other words, the result is the same as the value of the expression:
+ *
+ * In other words, the result is the same as the value of the expression:
+ * ulp(-x) == ulp(x)
.
+ *
+ *
+ *
+ *
+ * @param d the floating-point value whose ulp is to be returned
+ * @return the size of an ulp of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+// public static double ulp(double d) {
+// return sun.misc.FpUtils.ulp(d);
+// }
+
+ /**
+ * Returns the size of an ulp of the argument. An ulp of a
+ * {@code float} value is the positive distance between this
+ * floating-point value and the {@code float} value next
+ * larger in magnitude. Note that for non-NaN x,
+ * ulp(-x) == ulp(x)
.
+ *
+ *
+ *
+ *
+ * @param f the floating-point value whose ulp is to be returned
+ * @return the size of an ulp of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+// public static float ulp(float f) {
+// return sun.misc.FpUtils.ulp(f);
+// }
+
+ /**
+ * Returns the signum function of the argument; zero if the argument
+ * is zero, 1.0 if the argument is greater than zero, -1.0 if the
+ * argument is less than zero.
+ *
+ *
+ *
+ *
+ * @param d the floating-point value whose signum is to be returned
+ * @return the signum function of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+// public static double signum(double d) {
+// return sun.misc.FpUtils.signum(d);
+// }
+
+ /**
+ * Returns the signum function of the argument; zero if the argument
+ * is zero, 1.0f if the argument is greater than zero, -1.0f if the
+ * argument is less than zero.
+ *
+ *
+ *
+ *
+ * @param f the floating-point value whose signum is to be returned
+ * @return the signum function of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+// public static float signum(float f) {
+// return sun.misc.FpUtils.signum(f);
+// }
+
+ /**
+ * Returns the hyperbolic sine of a {@code double} value.
+ * The hyperbolic sine of x is defined to be
+ * (ex - e-x)/2
+ * where e is {@linkplain Math#E Euler's number}.
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param f a {@code float} value
+ * @return the unbiased exponent of the argument
+ * @since 1.6
+ */
+// public static int getExponent(float f) {
+// return sun.misc.FpUtils.getExponent(f);
+// }
+
+ /**
+ * Returns the unbiased exponent used in the representation of a
+ * {@code double}. Special cases:
+ *
+ *
+ *
+ * @param d a {@code double} value
+ * @return the unbiased exponent of the argument
+ * @since 1.6
+ */
+// public static int getExponent(double d) {
+// return sun.misc.FpUtils.getExponent(d);
+// }
+
+ /**
+ * Returns the floating-point number adjacent to the first
+ * argument in the direction of the second argument. If both
+ * arguments compare as equal the second argument is returned.
+ *
+ *
+ *
+ *
+ * @param start starting floating-point value
+ * @param direction value indicating which of
+ * {@code start}'s neighbors or {@code start} should
+ * be returned
+ * @return The floating-point number adjacent to {@code start} in the
+ * direction of {@code direction}.
+ * @since 1.6
+ */
+// public static double nextAfter(double start, double direction) {
+// return sun.misc.FpUtils.nextAfter(start, direction);
+// }
+
+ /**
+ * Returns the floating-point number adjacent to the first
+ * argument in the direction of the second argument. If both
+ * arguments compare as equal a value equivalent to the second argument
+ * is returned.
+ *
+ *
+ *
+ *
+ * @param start starting floating-point value
+ * @param direction value indicating which of
+ * {@code start}'s neighbors or {@code start} should
+ * be returned
+ * @return The floating-point number adjacent to {@code start} in the
+ * direction of {@code direction}.
+ * @since 1.6
+ */
+// public static float nextAfter(float start, double direction) {
+// return sun.misc.FpUtils.nextAfter(start, direction);
+// }
+
+ /**
+ * Returns the floating-point value adjacent to {@code d} in
+ * the direction of positive infinity. This method is
+ * semantically equivalent to {@code nextAfter(d,
+ * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
+ * implementation may run faster than its equivalent
+ * {@code nextAfter} call.
+ *
+ *
+ *
+ *
+ * @param d starting floating-point value
+ * @return The adjacent floating-point value closer to positive
+ * infinity.
+ * @since 1.6
+ */
+// public static double nextUp(double d) {
+// return sun.misc.FpUtils.nextUp(d);
+// }
+
+ /**
+ * Returns the floating-point value adjacent to {@code f} in
+ * the direction of positive infinity. This method is
+ * semantically equivalent to {@code nextAfter(f,
+ * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
+ * implementation may run faster than its equivalent
+ * {@code nextAfter} call.
+ *
+ *
+ *
+ *
+ * @param f starting floating-point value
+ * @return The adjacent floating-point value closer to positive
+ * infinity.
+ * @since 1.6
+ */
+// public static float nextUp(float f) {
+// return sun.misc.FpUtils.nextUp(f);
+// }
+
+
+ /**
+ * Return {@code d} ×
+ * 2{@code scaleFactor} rounded as if performed
+ * by a single correctly rounded floating-point multiply to a
+ * member of the double value set. See the Java
+ * Language Specification for a discussion of floating-point
+ * value sets. If the exponent of the result is between {@link
+ * Double#MIN_EXPONENT} and {@link Double#MAX_EXPONENT}, the
+ * answer is calculated exactly. If the exponent of the result
+ * would be larger than {@code Double.MAX_EXPONENT}, an
+ * infinity is returned. Note that if the result is subnormal,
+ * precision may be lost; that is, when {@code scalb(x, n)}
+ * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
+ * x. When the result is non-NaN, the result has the same
+ * sign as {@code d}.
+ *
+ *
+ *
+ *
+ * @param d number to be scaled by a power of two.
+ * @param scaleFactor power of 2 used to scale {@code d}
+ * @return {@code d} × 2{@code scaleFactor}
+ * @since 1.6
+ */
+// public static double scalb(double d, int scaleFactor) {
+// return sun.misc.FpUtils.scalb(d, scaleFactor);
+// }
+
+ /**
+ * Return {@code f} ×
+ * 2{@code scaleFactor} rounded as if performed
+ * by a single correctly rounded floating-point multiply to a
+ * member of the float value set. See the Java
+ * Language Specification for a discussion of floating-point
+ * value sets. If the exponent of the result is between {@link
+ * Float#MIN_EXPONENT} and {@link Float#MAX_EXPONENT}, the
+ * answer is calculated exactly. If the exponent of the result
+ * would be larger than {@code Float.MAX_EXPONENT}, an
+ * infinity is returned. Note that if the result is subnormal,
+ * precision may be lost; that is, when {@code scalb(x, n)}
+ * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
+ * x. When the result is non-NaN, the result has the same
+ * sign as {@code f}.
+ *
+ *
+ *
+ *
+ * @param f number to be scaled by a power of two.
+ * @param scaleFactor power of 2 used to scale {@code f}
+ * @return {@code f} × 2{@code scaleFactor}
+ * @since 1.6
+ */
+// public static float scalb(float f, int scaleFactor) {
+// return sun.misc.FpUtils.scalb(f, scaleFactor);
+// }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/NullPointerException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/NullPointerException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown when an application attempts to use {@code null} in a
+ * case where an object is required. These include:
+ *
+ *
+ * Number
is the superclass of classes
+ * BigDecimal
, BigInteger
,
+ * Byte
, Double
, Float
,
+ * Integer
, Long
, and Short
.
+ * Number
must provide methods to convert
+ * the represented numeric value to byte
, double
,
+ * float
, int
, long
, and
+ * short
.
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @see java.lang.Byte
+ * @see java.lang.Double
+ * @see java.lang.Float
+ * @see java.lang.Integer
+ * @see java.lang.Long
+ * @see java.lang.Short
+ * @since JDK1.0
+ */
+public abstract class Number implements java.io.Serializable {
+ /**
+ * Returns the value of the specified number as an int
.
+ * This may involve rounding or truncation.
+ *
+ * @return the numeric value represented by this object after conversion
+ * to type int
.
+ */
+ public abstract int intValue();
+
+ /**
+ * Returns the value of the specified number as a long
.
+ * This may involve rounding or truncation.
+ *
+ * @return the numeric value represented by this object after conversion
+ * to type long
.
+ */
+ public abstract long longValue();
+
+ /**
+ * Returns the value of the specified number as a float
.
+ * This may involve rounding.
+ *
+ * @return the numeric value represented by this object after conversion
+ * to type float
.
+ */
+ public abstract float floatValue();
+
+ /**
+ * Returns the value of the specified number as a double
.
+ * This may involve rounding.
+ *
+ * @return the numeric value represented by this object after conversion
+ * to type double
.
+ */
+ public abstract double doubleValue();
+
+ /**
+ * Returns the value of the specified number as a byte
.
+ * This may involve rounding or truncation.
+ *
+ * @return the numeric value represented by this object after conversion
+ * to type byte
.
+ * @since JDK1.1
+ */
+ public byte byteValue() {
+ return (byte)intValue();
+ }
+
+ /**
+ * Returns the value of the specified number as a short
.
+ * This may involve rounding or truncation.
+ *
+ * @return the numeric value represented by this object after conversion
+ * to type short
.
+ * @since JDK1.1
+ */
+ public short shortValue() {
+ return (short)intValue();
+ }
+
+ /** use serialVersionUID from JDK 1.0.2 for interoperability */
+ private static final long serialVersionUID = -8742448824652078965L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/NumberFormatException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/NumberFormatException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 1994, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that the application has attempted to convert
+ * a string to one of the numeric types, but that the string does not
+ * have the appropriate format.
+ *
+ * @author unascribed
+ * @see java.lang.Integer#toString()
+ * @since JDK1.0
+ */
+public
+class NumberFormatException extends IllegalArgumentException {
+ static final long serialVersionUID = -2848938806368998894L;
+
+ /**
+ * Constructs a NumberFormatException
with no detail message.
+ */
+ public NumberFormatException () {
+ super();
+ }
+
+ /**
+ * Constructs a NumberFormatException
with the
+ * specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public NumberFormatException (String s) {
+ super (s);
+ }
+
+ /**
+ * Factory method for making a NumberFormatException
+ * given the specified input which caused the error.
+ *
+ * @param s the input causing the error
+ */
+ static NumberFormatException forInputString(String s) {
+ return new NumberFormatException("For input string: \"" + s + "\"");
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Object.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Object.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,554 @@
+/*
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Class {@code Object} is the root of the class hierarchy.
+ * Every class has {@code Object} as a superclass. All objects,
+ * including arrays, implement the methods of this class.
+ *
+ * @author unascribed
+ * @see java.lang.Class
+ * @since JDK1.0
+ */
+public class Object {
+
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ /**
+ * Returns the runtime class of this {@code Object}. The returned
+ * {@code Class} object is the object that is locked by {@code
+ * static synchronized} methods of the represented class.
+ *
+ *
+ * {@code Class extends Number> c = n.getClass(); }
+ *
+ *
+ *
+ *
+ *
+ *
+ * will be true, and that the expression:
+ *
+ * x.clone() != x
+ *
+ * will be {@code true}, but these are not absolute requirements.
+ * While it is typically the case that:
+ *
+ * x.clone().getClass() == x.getClass()
+ *
+ * will be {@code true}, this is not an absolute requirement.
+ *
+ * x.clone().equals(x)
+ *
+ *
+ * @return a string representation of the object.
+ */
+ public String toString() {
+ return getClass().getName() + "@" + Integer.toHexString(hashCode());
+ }
+
+ /**
+ * Wakes up a single thread that is waiting on this object's
+ * monitor. If any threads are waiting on this object, one of them
+ * is chosen to be awakened. The choice is arbitrary and occurs at
+ * the discretion of the implementation. A thread waits on an object's
+ * monitor by calling one of the {@code wait} methods.
+ *
+ * getClass().getName() + '@' + Integer.toHexString(hashCode())
+ *
+ *
+ *
+ *
+ * The thread T is then removed from the wait set for this
+ * object and re-enabled for thread scheduling. It then competes in the
+ * usual manner with other threads for the right to synchronize on the
+ * object; once it has gained control of the object, all its
+ * synchronization claims on the object are restored to the status quo
+ * ante - that is, to the situation as of the time that the {@code wait}
+ * method was invoked. Thread T then returns from the
+ * invocation of the {@code wait} method. Thus, on return from the
+ * {@code wait} method, the synchronization state of the object and of
+ * thread {@code T} is exactly as it was when the {@code wait} method
+ * was invoked.
+ *
+ * synchronized (obj) {
+ * while (<condition does not hold>)
+ * obj.wait(timeout);
+ * ... // Perform action appropriate to condition
+ * }
+ *
+ * (For more information on this topic, see Section 3.2.3 in Doug Lea's
+ * "Concurrent Programming in Java (Second Edition)" (Addison-Wesley,
+ * 2000), or Item 50 in Joshua Bloch's "Effective Java Programming
+ * Language Guide" (Addison-Wesley, 2001).
+ *
+ *
+ *
+ *
+ * 1000000*timeout+nanos
+ *
+ *
+ * synchronized (obj) {
+ * while (<condition does not hold>)
+ * obj.wait(timeout, nanos);
+ * ... // Perform action appropriate to condition
+ * }
+ *
+ * This method should only be called by a thread that is the owner
+ * of this object's monitor. See the {@code notify} method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @param timeout the maximum time to wait in milliseconds.
+ * @param nanos additional time, in nanoseconds range
+ * 0-999999.
+ * @exception IllegalArgumentException if the value of timeout is
+ * negative or the value of nanos is
+ * not in the range 0-999999.
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of this object's monitor.
+ * @exception InterruptedException if any thread interrupted the
+ * current thread before or while the current thread
+ * was waiting for a notification. The interrupted
+ * status of the current thread is cleared when
+ * this exception is thrown.
+ */
+ public final void wait(long timeout, int nanos) throws InterruptedException {
+ if (timeout < 0) {
+ throw new IllegalArgumentException("timeout value is negative");
+ }
+
+ if (nanos < 0 || nanos > 999999) {
+ throw new IllegalArgumentException(
+ "nanosecond timeout value out of range");
+ }
+
+ if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
+ timeout++;
+ }
+
+ wait(timeout);
+ }
+
+ /**
+ * Causes the current thread to wait until another thread invokes the
+ * {@link java.lang.Object#notify()} method or the
+ * {@link java.lang.Object#notifyAll()} method for this object.
+ * In other words, this method behaves exactly as if it simply
+ * performs the call {@code wait(0)}.
+ *
+ * synchronized (obj) {
+ * while (<condition does not hold>)
+ * obj.wait();
+ * ... // Perform action appropriate to condition
+ * }
+ *
+ * This method should only be called by a thread that is the owner
+ * of this object's monitor. See the {@code notify} method for a
+ * description of the ways in which a thread can become the owner of
+ * a monitor.
+ *
+ * @exception IllegalMonitorStateException if the current thread is not
+ * the owner of the object's monitor.
+ * @exception InterruptedException if any thread interrupted the
+ * current thread before or while the current thread
+ * was waiting for a notification. The interrupted
+ * status of the current thread is cleared when
+ * this exception is thrown.
+ * @see java.lang.Object#notify()
+ * @see java.lang.Object#notifyAll()
+ */
+ public final void wait() throws InterruptedException {
+ wait(0);
+ }
+
+ /**
+ * Called by the garbage collector on an object when garbage collection
+ * determines that there are no more references to the object.
+ * A subclass overrides the {@code finalize} method to dispose of
+ * system resources or to perform other cleanup.
+ * '\u002D'
) to indicate a negative value or an
+ * ASCII plus sign {@code '+'} ('\u002B'
) to
+ * indicate a positive value. The resulting {@code short} value
+ * is returned.
+ *
+ *
+ *
+ *
+ * @param s the {@code String} containing the
+ * {@code short} representation to be parsed
+ * @param radix the radix to be used while parsing {@code s}
+ * @return the {@code short} represented by the string
+ * argument in the specified radix.
+ * @throws NumberFormatException If the {@code String}
+ * does not contain a parsable {@code short}.
+ */
+ public static short parseShort(String s, int radix)
+ throws NumberFormatException {
+ int i = Integer.parseInt(s, radix);
+ if (i < MIN_VALUE || i > MAX_VALUE)
+ throw new NumberFormatException(
+ "Value out of range. Value:\"" + s + "\" Radix:" + radix);
+ return (short)i;
+ }
+
+ /**
+ * Parses the string argument as a signed decimal {@code
+ * short}. The characters in the string must all be decimal
+ * digits, except that the first character may be an ASCII minus
+ * sign {@code '-'} ('\u002D'
) or plus sign
+ * {@code '+'} ('\u002B'
) provided that the
+ * string is longer than length 1.
+ *
+ * '\u002D'
) to indicate a
+ * negative value or an ASCII plus sign {@code '+'}
+ * ('\u002B'
) to indicate a positive value. The
+ * resulting {@code short} value is returned, exactly as if the
+ * argument and the radix 10 were given as arguments to the {@link
+ * #parseShort(java.lang.String, int)} method.
+ *
+ * @param s a {@code String} containing the {@code short}
+ * representation to be parsed
+ * @return the {@code short} value represented by the
+ * argument in decimal.
+ * @throws NumberFormatException If the string does not
+ * contain a parsable {@code short}.
+ */
+ public static short parseShort(String s) throws NumberFormatException {
+ return parseShort(s, 10);
+ }
+
+ /**
+ * Returns a {@code Short} object holding the value
+ * extracted from the specified {@code String} when parsed
+ * with the radix given by the second argument. The first argument
+ * is interpreted as representing a signed {@code short} in
+ * the radix specified by the second argument, exactly as if the
+ * argument were given to the {@link #parseShort(java.lang.String,
+ * int)} method. The result is a {@code Short} object that
+ * represents the {@code short} value specified by the string.
+ *
+ *
+ * {@code new Short(Short.parseShort(s, radix))}
+ *
+ *
+ * @param s the string to be parsed
+ * @param radix the radix to be used in interpreting {@code s}
+ * @return a {@code Short} object holding the value
+ * represented by the string argument in the
+ * specified radix.
+ * @throws NumberFormatException If the {@code String} does
+ * not contain a parsable {@code short}.
+ */
+ public static Short valueOf(String s, int radix)
+ throws NumberFormatException {
+ return valueOf(parseShort(s, radix));
+ }
+
+ /**
+ * Returns a {@code Short} object holding the
+ * value given by the specified {@code String}. The argument
+ * is interpreted as representing a signed decimal
+ * {@code short}, exactly as if the argument were given to
+ * the {@link #parseShort(java.lang.String)} method. The result is
+ * a {@code Short} object that represents the
+ * {@code short} value specified by the string.
+ *
+ *
+ * {@code new Short(Short.parseShort(s))}
+ *
+ *
+ * @param s the string to be parsed
+ * @return a {@code Short} object holding the value
+ * represented by the string argument
+ * @throws NumberFormatException If the {@code String} does
+ * not contain a parsable {@code short}.
+ */
+ public static Short valueOf(String s) throws NumberFormatException {
+ return valueOf(s, 10);
+ }
+
+ private static class ShortCache {
+ private ShortCache(){}
+
+ static final Short cache[] = new Short[-(-128) + 127 + 1];
+
+ static {
+ for(int i = 0; i < cache.length; i++)
+ cache[i] = new Short((short)(i - 128));
+ }
+ }
+
+ /**
+ * Returns a {@code Short} instance representing the specified
+ * {@code short} value.
+ * If a new {@code Short} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Short(short)}, as this method is likely to yield
+ * significantly better space and time performance by caching
+ * frequently requested values.
+ *
+ * This method will always cache values in the range -128 to 127,
+ * inclusive, and may cache other values outside of this range.
+ *
+ * @param s a short value.
+ * @return a {@code Short} instance representing {@code s}.
+ * @since 1.5
+ */
+ public static Short valueOf(short s) {
+ final int offset = 128;
+ int sAsInt = s;
+ if (sAsInt >= -128 && sAsInt <= 127) { // must cache
+ return ShortCache.cache[sAsInt + offset];
+ }
+ return new Short(s);
+ }
+
+ /**
+ * Decodes a {@code String} into a {@code Short}.
+ * Accepts decimal, hexadecimal, and octal numbers given by
+ * the following grammar:
+ *
+ *
+ *
+ *
+ * DecimalNumeral, HexDigits, and OctalDigits
+ * are as defined in section 3.10.1 of
+ * The Java™ Language Specification,
+ * except that underscores are not accepted between digits.
+ *
+ *
+ *
+ *
+ * Short.valueOf(x).compareTo(Short.valueOf(y))
+ *
+ *
+ * @param x the first {@code short} to compare
+ * @param y the second {@code short} to compare
+ * @return the value {@code 0} if {@code x == y};
+ * a value less than {@code 0} if {@code x < y}; and
+ * a value greater than {@code 0} if {@code x > y}
+ * @since 1.7
+ */
+ public static int compare(short x, short y) {
+ return x - y;
+ }
+
+ /**
+ * The number of bits used to represent a {@code short} value in two's
+ * complement binary form.
+ * @since 1.5
+ */
+ public static final int SIZE = 16;
+
+ /**
+ * Returns the value obtained by reversing the order of the bytes in the
+ * two's complement representation of the specified {@code short} value.
+ *
+ * @return the value obtained by reversing (or, equivalently, swapping)
+ * the bytes in the specified {@code short} value.
+ * @since 1.5
+ */
+ public static short reverseBytes(short i) {
+ return (short) (((i & 0xFF00) >> 8) | (i << 8));
+ }
+
+ /** use serialVersionUID from JDK 1.1. for interoperability */
+ private static final long serialVersionUID = 7515723908773894738L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/StackTraceElement.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/StackTraceElement.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * An element in a stack trace, as returned by {@link
+ * Throwable#getStackTrace()}. Each element represents a single stack frame.
+ * All stack frames except for the one at the top of the stack represent
+ * a method invocation. The frame at the top of the stack represents the
+ * execution point at which the stack trace was generated. Typically,
+ * this is the point at which the throwable corresponding to the stack trace
+ * was created.
+ *
+ * @since 1.4
+ * @author Josh Bloch
+ */
+public final class StackTraceElement implements java.io.Serializable {
+ // Normally initialized by VM (public constructor added in 1.5)
+ private String declaringClass;
+ private String methodName;
+ private String fileName;
+ private int lineNumber;
+
+ /**
+ * Creates a stack trace element representing the specified execution
+ * point.
+ *
+ * @param declaringClass the fully qualified name of the class containing
+ * the execution point represented by the stack trace element
+ * @param methodName the name of the method containing the execution point
+ * represented by the stack trace element
+ * @param fileName the name of the file containing the execution point
+ * represented by the stack trace element, or {@code null} if
+ * this information is unavailable
+ * @param lineNumber the line number of the source line containing the
+ * execution point represented by this stack trace element, or
+ * a negative number if this information is unavailable. A value
+ * of -2 indicates that the method containing the execution point
+ * is a native method
+ * @throws NullPointerException if {@code declaringClass} or
+ * {@code methodName} is null
+ * @since 1.5
+ */
+ public StackTraceElement(String declaringClass, String methodName,
+ String fileName, int lineNumber) {
+ this.declaringClass = declaringClass;
+ this.methodName = methodName;
+ this.fileName = fileName;
+ this.lineNumber = lineNumber;
+ }
+
+ /**
+ * Returns the name of the source file containing the execution point
+ * represented by this stack trace element. Generally, this corresponds
+ * to the {@code SourceFile} attribute of the relevant {@code class}
+ * file (as per The Java Virtual Machine Specification, Section
+ * 4.7.7). In some systems, the name may refer to some source code unit
+ * other than a file, such as an entry in source repository.
+ *
+ * @return the name of the file containing the execution point
+ * represented by this stack trace element, or {@code null} if
+ * this information is unavailable.
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Returns the line number of the source line containing the execution
+ * point represented by this stack trace element. Generally, this is
+ * derived from the {@code LineNumberTable} attribute of the relevant
+ * {@code class} file (as per The Java Virtual Machine
+ * Specification, Section 4.7.8).
+ *
+ * @return the line number of the source line containing the execution
+ * point represented by this stack trace element, or a negative
+ * number if this information is unavailable.
+ */
+ public int getLineNumber() {
+ return lineNumber;
+ }
+
+ /**
+ * Returns the fully qualified name of the class containing the
+ * execution point represented by this stack trace element.
+ *
+ * @return the fully qualified name of the {@code Class} containing
+ * the execution point represented by this stack trace element.
+ */
+ public String getClassName() {
+ return declaringClass;
+ }
+
+ /**
+ * Returns the name of the method containing the execution point
+ * represented by this stack trace element. If the execution point is
+ * contained in an instance or class initializer, this method will return
+ * the appropriate special method name, {@code
+ *
+ * @see Throwable#printStackTrace()
+ */
+ public String toString() {
+ return getClassName() + "." + methodName +
+ (isNativeMethod() ? "(Native Method)" :
+ (fileName != null && lineNumber >= 0 ?
+ "(" + fileName + ":" + lineNumber + ")" :
+ (fileName != null ? "("+fileName+")" : "(Unknown Source)")));
+ }
+
+ /**
+ * Returns true if the specified object is another
+ * {@code StackTraceElement} instance representing the same execution
+ * point as this instance. Two stack trace elements {@code a} and
+ * {@code b} are equal if and only if:
+ *
+ * equals(a.getFileName(), b.getFileName()) &&
+ * a.getLineNumber() == b.getLineNumber()) &&
+ * equals(a.getClassName(), b.getClassName()) &&
+ * equals(a.getMethodName(), b.getMethodName())
+ *
+ * where {@code equals} has the semantics of {@link
+ * java.util.Objects#equals(Object, Object) Objects.equals}.
+ *
+ * @param obj the object to be compared with this stack trace element.
+ * @return true if the specified object is another
+ * {@code StackTraceElement} instance representing the same
+ * execution point as this instance.
+ */
+ public boolean equals(Object obj) {
+ if (obj==this)
+ return true;
+ if (!(obj instanceof StackTraceElement))
+ return false;
+ StackTraceElement e = (StackTraceElement)obj;
+ return e.declaringClass.equals(declaringClass) &&
+ e.lineNumber == lineNumber &&
+ equals(methodName, e.methodName) &&
+ equals(fileName, e.fileName);
+ }
+
+ /**
+ * Returns a hash code value for this stack trace element.
+ */
+ public int hashCode() {
+ int result = 31*declaringClass.hashCode() + methodName.hashCode();
+ result = 31*result + (fileName == null ? 0 : fileName.hashCode());
+ result = 31*result + lineNumber;
+ return result;
+ }
+
+ private static boolean equals(Object a, Object b) {
+ return (a == b) || (a != null && a.equals(b));
+ }
+
+ private static final long serialVersionUID = 6992337162326171013L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/StrictMath.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/StrictMath.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,1457 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * The class {@code StrictMath} contains methods for performing basic
+ * numeric operations such as the elementary exponential, logarithm,
+ * square root, and trigonometric functions.
+ *
+ *
+ *
+ * @param a an angle, in radians.
+ * @return the sine of the argument.
+ */
+ public static native double sin(double a);
+
+ /**
+ * Returns the trigonometric cosine of an angle. Special cases:
+ *
+ *
+ * @param a an angle, in radians.
+ * @return the cosine of the argument.
+ */
+ public static native double cos(double a);
+
+ /**
+ * Returns the trigonometric tangent of an angle. Special cases:
+ *
+ *
+ * @param a an angle, in radians.
+ * @return the tangent of the argument.
+ */
+ public static native double tan(double a);
+
+ /**
+ * Returns the arc sine of a value; the returned angle is in the
+ * range -pi/2 through pi/2. Special cases:
+ *
+ *
+ * @param a the value whose arc sine is to be returned.
+ * @return the arc sine of the argument.
+ */
+ public static native double asin(double a);
+
+ /**
+ * Returns the arc cosine of a value; the returned angle is in the
+ * range 0.0 through pi. Special case:
+ *
+ *
+ * @param a the value whose arc cosine is to be returned.
+ * @return the arc cosine of the argument.
+ */
+ public static native double acos(double a);
+
+ /**
+ * Returns the arc tangent of a value; the returned angle is in the
+ * range -pi/2 through pi/2. Special cases:
+ *
+ *
+ * @param a the value whose arc tangent is to be returned.
+ * @return the arc tangent of the argument.
+ */
+ public static native double atan(double a);
+
+ /**
+ * Converts an angle measured in degrees to an approximately
+ * equivalent angle measured in radians. The conversion from
+ * degrees to radians is generally inexact.
+ *
+ * @param angdeg an angle, in degrees
+ * @return the measurement of the angle {@code angdeg}
+ * in radians.
+ */
+ public static strictfp double toRadians(double angdeg) {
+ return angdeg / 180.0 * PI;
+ }
+
+ /**
+ * Converts an angle measured in radians to an approximately
+ * equivalent angle measured in degrees. The conversion from
+ * radians to degrees is generally inexact; users should
+ * not expect {@code cos(toRadians(90.0))} to exactly
+ * equal {@code 0.0}.
+ *
+ * @param angrad an angle, in radians
+ * @return the measurement of the angle {@code angrad}
+ * in degrees.
+ */
+ public static strictfp double toDegrees(double angrad) {
+ return angrad * 180.0 / PI;
+ }
+
+ /**
+ * Returns Euler's number e raised to the power of a
+ * {@code double} value. Special cases:
+ *
+ *
+ * @param a the exponent to raise e to.
+ * @return the value e{@code a},
+ * where e is the base of the natural logarithms.
+ */
+ public static native double exp(double a);
+
+ /**
+ * Returns the natural logarithm (base e) of a {@code double}
+ * value. Special cases:
+ *
+ *
+ * @param a a value
+ * @return the value ln {@code a}, the natural logarithm of
+ * {@code a}.
+ */
+ public static native double log(double a);
+
+
+ /**
+ * Returns the base 10 logarithm of a {@code double} value.
+ * Special cases:
+ *
+ *
+ *
+ * @param a a value
+ * @return the base 10 logarithm of {@code a}.
+ * @since 1.5
+ */
+ public static native double log10(double a);
+
+ /**
+ * Returns the correctly rounded positive square root of a
+ * {@code double} value.
+ * Special cases:
+ *
+ * Otherwise, the result is the {@code double} value closest to
+ * the true mathematical square root of the argument value.
+ *
+ * @param a a value.
+ * @return the positive square root of {@code a}.
+ */
+ public static native double sqrt(double a);
+
+ /**
+ * Returns the cube root of a {@code double} value. For
+ * positive finite {@code x}, {@code cbrt(-x) ==
+ * -cbrt(x)}; that is, the cube root of a negative value is
+ * the negative of the cube root of that value's magnitude.
+ * Special cases:
+ *
+ *
+ *
+ *
+ *
+ * @param a a value.
+ * @return the cube root of {@code a}.
+ * @since 1.5
+ */
+ public static native double cbrt(double a);
+
+ /**
+ * Computes the remainder operation on two arguments as prescribed
+ * by the IEEE 754 standard.
+ * The remainder value is mathematically equal to
+ * f1 - f2
× n,
+ * where n is the mathematical integer closest to the exact
+ * mathematical value of the quotient {@code f1/f2}, and if two
+ * mathematical integers are equally close to {@code f1/f2},
+ * then n is the integer that is even. If the remainder is
+ * zero, its sign is the same as the sign of the first argument.
+ * Special cases:
+ *
+ *
+ * @param f1 the dividend.
+ * @param f2 the divisor.
+ * @return the remainder when {@code f1} is divided by
+ * {@code f2}.
+ */
+ public static native double IEEEremainder(double f1, double f2);
+
+ /**
+ * Returns the smallest (closest to negative infinity)
+ * {@code double} value that is greater than or equal to the
+ * argument and is equal to a mathematical integer. Special cases:
+ *
Note
+ * that the value of {@code StrictMath.ceil(x)} is exactly the
+ * value of {@code -StrictMath.floor(-x)}.
+ *
+ * @param a a value.
+ * @return the smallest (closest to negative infinity)
+ * floating-point value that is greater than or equal to
+ * the argument and is equal to a mathematical integer.
+ */
+ public static double ceil(double a) {
+ return floorOrCeil(a, -0.0, 1.0, 1.0);
+ }
+
+ /**
+ * Returns the largest (closest to positive infinity)
+ * {@code double} value that is less than or equal to the
+ * argument and is equal to a mathematical integer. Special cases:
+ *
+ *
+ * @param a a value.
+ * @return the largest (closest to positive infinity)
+ * floating-point value that less than or equal to the argument
+ * and is equal to a mathematical integer.
+ */
+ public static double floor(double a) {
+ return floorOrCeil(a, -1.0, 0.0, -1.0);
+ }
+
+ /**
+ * Internal method to share logic between floor and ceil.
+ *
+ * @param a the value to be floored or ceiled
+ * @param negativeBoundary result for values in (-1, 0)
+ * @param positiveBoundary result for values in (0, 1)
+ * @param increment value to add when the argument is non-integral
+ */
+ private static double floorOrCeil(double a,
+ double negativeBoundary,
+ double positiveBoundary,
+ double sign) {
+ int exponent = getExponent(a);
+
+ if (exponent < 0) {
+ /*
+ * Absolute value of argument is less than 1.
+ * floorOrceil(-0.0) => -0.0
+ * floorOrceil(+0.0) => +0.0
+ */
+ return ((a == 0.0) ? a :
+ ( (a < 0.0) ? negativeBoundary : positiveBoundary) );
+ } else if (exponent >= 52) {
+ /*
+ * Infinity, NaN, or a value so large it must be integral.
+ */
+ return a;
+ }
+ // Else the argument is either an integral value already XOR it
+ // has to be rounded to one.
+ assert exponent >= 0 && exponent <= 51;
+
+ long doppel = Double.doubleToRawLongBits(a);
+ long mask = 0; // DoubleConsts.SIGNIF_BIT_MASK >> exponent;
+
+ if ( (mask & doppel) == 0L )
+ return a; // integral value
+ else {
+ double result = Double.longBitsToDouble(doppel & (~mask));
+ if (sign*a > 0.0)
+ result = result + sign;
+ return result;
+ }
+ }
+
+ /**
+ * Returns the {@code double} value that is closest in value
+ * to the argument and is equal to a mathematical integer. If two
+ * {@code double} values that are mathematical integers are
+ * equally close to the value of the argument, the result is the
+ * integer value that is even. Special cases:
+ *
+ *
+ * @param a a value.
+ * @return the closest floating-point value to {@code a} that is
+ * equal to a mathematical integer.
+ * @author Joseph D. Darcy
+ */
+ public static double rint(double a) {
+ throw new UnsupportedOperationException();
+ /*
+ * If the absolute value of a is not less than 2^52, it
+ * is either a finite integer (the double format does not have
+ * enough significand bits for a number that large to have any
+ * fractional portion), an infinity, or a NaN. In any of
+ * these cases, rint of the argument is the argument.
+ *
+ * Otherwise, the sum (twoToThe52 + a ) will properly round
+ * away any fractional portion of a since ulp(twoToThe52) ==
+ * 1.0; subtracting out twoToThe52 from this sum will then be
+ * exact and leave the rounded integer portion of a.
+ *
+ * This method does *not* need to be declared strictfp to get
+ * fully reproducible results. Whether or not a method is
+ * declared strictfp can only make a difference in the
+ * returned result if some operation would overflow or
+ * underflow with strictfp semantics. The operation
+ * (twoToThe52 + a ) cannot overflow since large values of a
+ * are screened out; the add cannot underflow since twoToThe52
+ * is too large. The subtraction ((twoToThe52 + a ) -
+ * twoToThe52) will be exact as discussed above and thus
+ * cannot overflow or meaningfully underflow. Finally, the
+ * last multiply in the return statement is by plus or minus
+ * 1.0, which is exact too.
+ */
+// double twoToThe52 = (double)(1L << 52); // 2^52
+// double sign = FpUtils.rawCopySign(1.0, a); // preserve sign info
+// a = Math.abs(a);
+//
+// if (a < twoToThe52) { // E_min <= ilogb(a) <= 51
+// a = ((twoToThe52 + a ) - twoToThe52);
+// }
+//
+// return sign * a; // restore original sign
+ }
+
+ /**
+ * Returns the angle theta from the conversion of rectangular
+ * coordinates ({@code x}, {@code y}) to polar
+ * coordinates (r, theta).
+ * This method computes the phase theta by computing an arc tangent
+ * of {@code y/x} in the range of -pi to pi. Special
+ * cases:
+ *
+ *
+ * @param y the ordinate coordinate
+ * @param x the abscissa coordinate
+ * @return the theta component of the point
+ * (r, theta)
+ * in polar coordinates that corresponds to the point
+ * (x, y) in Cartesian coordinates.
+ */
+ public static native double atan2(double y, double x);
+
+
+ /**
+ * Returns the value of the first argument raised to the power of the
+ * second argument. Special cases:
+ *
+ *
+ *
+ *
+ *
+ * then the result is positive infinity.
+ *
+ *
+ *
+ * then the result is positive zero.
+ *
+ *
+ *
+ * then the result is positive zero.
+ *
+ *
+ *
+ * then the result is positive infinity.
+ *
+ *
+ *
+ * then the result is positive zero.
+ *
+ *
+ *
+ * then the result is negative zero.
+ *
+ *
+ *
+ * then the result is positive infinity.
+ *
+ *
+ *
+ * then the result is negative infinity.
+ *
+ *
+ *
+ *
+ *
+ *
+ * @param a a floating-point value to be rounded to an integer.
+ * @return the value of the argument rounded to the nearest
+ * {@code int} value.
+ * @see java.lang.Integer#MAX_VALUE
+ * @see java.lang.Integer#MIN_VALUE
+ */
+ public static int round(float a) {
+ return Math.round(a);
+ }
+
+ /**
+ * Returns the closest {@code long} to the argument, with ties
+ * rounding up.
+ *
+ *
+ *
+ * @param a a floating-point value to be rounded to a
+ * {@code long}.
+ * @return the value of the argument rounded to the nearest
+ * {@code long} value.
+ * @see java.lang.Long#MAX_VALUE
+ * @see java.lang.Long#MIN_VALUE
+ */
+ public static long round(double a) {
+ return Math.round(a);
+ }
+
+ /**
+ * Returns a {@code double} value with a positive sign, greater
+ * than or equal to {@code 0.0} and less than {@code 1.0}.
+ * Returned values are chosen pseudorandomly with (approximately)
+ * uniform distribution from that range.
+ *
+ * {@code new java.util.Random()}
+ *
+ * This new pseudorandom-number generator is used thereafter for
+ * all calls to this method and is used nowhere else.
+ *
+ *
+ * In other words, the result is the same as the value of the expression:
+ *
+ * In other words, the result is the same as the value of the expression:
+ * ulp(-x) == ulp(x)
.
+ *
+ *
+ *
+ *
+ * @param d the floating-point value whose ulp is to be returned
+ * @return the size of an ulp of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+ public static double ulp(double d) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the size of an ulp of the argument. An ulp of a
+ * {@code float} value is the positive distance between this
+ * floating-point value and the {@code float} value next
+ * larger in magnitude. Note that for non-NaN x,
+ * ulp(-x) == ulp(x)
.
+ *
+ *
+ *
+ *
+ * @param f the floating-point value whose ulp is to be returned
+ * @return the size of an ulp of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+ public static float ulp(float f) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the signum function of the argument; zero if the argument
+ * is zero, 1.0 if the argument is greater than zero, -1.0 if the
+ * argument is less than zero.
+ *
+ *
+ *
+ *
+ * @param d the floating-point value whose signum is to be returned
+ * @return the signum function of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+ public static double signum(double d) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the signum function of the argument; zero if the argument
+ * is zero, 1.0f if the argument is greater than zero, -1.0f if the
+ * argument is less than zero.
+ *
+ *
+ *
+ *
+ * @param f the floating-point value whose signum is to be returned
+ * @return the signum function of the argument
+ * @author Joseph D. Darcy
+ * @since 1.5
+ */
+ public static float signum(float f) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the hyperbolic sine of a {@code double} value.
+ * The hyperbolic sine of x is defined to be
+ * (ex - e-x)/2
+ * where e is {@linkplain Math#E Euler's number}.
+ *
+ *
+ *
+ *
+ *
+ * @param x The number whose hyperbolic sine is to be returned.
+ * @return The hyperbolic sine of {@code x}.
+ * @since 1.5
+ */
+ public static native double sinh(double x);
+
+ /**
+ * Returns the hyperbolic cosine of a {@code double} value.
+ * The hyperbolic cosine of x is defined to be
+ * (ex + e-x)/2
+ * where e is {@linkplain Math#E Euler's number}.
+ *
+ *
+ *
+ *
+ *
+ * @param x The number whose hyperbolic cosine is to be returned.
+ * @return The hyperbolic cosine of {@code x}.
+ * @since 1.5
+ */
+ public static native double cosh(double x);
+
+ /**
+ * Returns the hyperbolic tangent of a {@code double} value.
+ * The hyperbolic tangent of x is defined to be
+ * (ex - e-x)/(ex + e-x),
+ * in other words, {@linkplain Math#sinh
+ * sinh(x)}/{@linkplain Math#cosh cosh(x)}. Note
+ * that the absolute value of the exact tanh is always less than
+ * 1.
+ *
+ *
+ *
+ *
+ *
+ * @param x The number whose hyperbolic tangent is to be returned.
+ * @return The hyperbolic tangent of {@code x}.
+ * @since 1.5
+ */
+ public static native double tanh(double x);
+
+ /**
+ * Returns sqrt(x2 +y2)
+ * without intermediate overflow or underflow.
+ *
+ *
+ *
+ *
+ *
+ * @param x a value
+ * @param y a value
+ * @return sqrt(x2 +y2)
+ * without intermediate overflow or underflow
+ * @since 1.5
+ */
+ public static native double hypot(double x, double y);
+
+ /**
+ * Returns ex -1. Note that for values of
+ * x near 0, the exact sum of
+ * {@code expm1(x)} + 1 is much closer to the true
+ * result of ex than {@code exp(x)}.
+ *
+ *
+ *
+ *
+ * @param x the exponent to raise e to in the computation of
+ * e{@code x} -1.
+ * @return the value e{@code x} - 1.
+ * @since 1.5
+ */
+ public static native double expm1(double x);
+
+ /**
+ * Returns the natural logarithm of the sum of the argument and 1.
+ * Note that for small values {@code x}, the result of
+ * {@code log1p(x)} is much closer to the true result of ln(1
+ * + {@code x}) than the floating-point evaluation of
+ * {@code log(1.0+x)}.
+ *
+ *
+ *
+ *
+ *
+ * @param x a value
+ * @return the value ln({@code x} + 1), the natural
+ * log of {@code x} + 1
+ * @since 1.5
+ */
+ public static native double log1p(double x);
+
+ /**
+ * Returns the first floating-point argument with the sign of the
+ * second floating-point argument. For this method, a NaN
+ * {@code sign} argument is always treated as if it were
+ * positive.
+ *
+ * @param magnitude the parameter providing the magnitude of the result
+ * @param sign the parameter providing the sign of the result
+ * @return a value with the magnitude of {@code magnitude}
+ * and the sign of {@code sign}.
+ * @since 1.6
+ */
+ public static double copySign(double magnitude, double sign) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the first floating-point argument with the sign of the
+ * second floating-point argument. For this method, a NaN
+ * {@code sign} argument is always treated as if it were
+ * positive.
+ *
+ * @param magnitude the parameter providing the magnitude of the result
+ * @param sign the parameter providing the sign of the result
+ * @return a value with the magnitude of {@code magnitude}
+ * and the sign of {@code sign}.
+ * @since 1.6
+ */
+ public static float copySign(float magnitude, float sign) {
+ throw new UnsupportedOperationException();
+ }
+ /**
+ * Returns the unbiased exponent used in the representation of a
+ * {@code float}. Special cases:
+ *
+ *
+ *
+ * @param f a {@code float} value
+ * @since 1.6
+ */
+ public static int getExponent(float f) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the unbiased exponent used in the representation of a
+ * {@code double}. Special cases:
+ *
+ *
+ *
+ * @param d a {@code double} value
+ * @since 1.6
+ */
+ public static int getExponent(double d) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the floating-point number adjacent to the first
+ * argument in the direction of the second argument. If both
+ * arguments compare as equal the second argument is returned.
+ *
+ *
+ *
+ *
+ * @param start starting floating-point value
+ * @param direction value indicating which of
+ * {@code start}'s neighbors or {@code start} should
+ * be returned
+ * @return The floating-point number adjacent to {@code start} in the
+ * direction of {@code direction}.
+ * @since 1.6
+ */
+ public static double nextAfter(double start, double direction) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the floating-point number adjacent to the first
+ * argument in the direction of the second argument. If both
+ * arguments compare as equal a value equivalent to the second argument
+ * is returned.
+ *
+ *
+ *
+ *
+ * @param start starting floating-point value
+ * @param direction value indicating which of
+ * {@code start}'s neighbors or {@code start} should
+ * be returned
+ * @return The floating-point number adjacent to {@code start} in the
+ * direction of {@code direction}.
+ * @since 1.6
+ */
+ public static float nextAfter(float start, double direction) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the floating-point value adjacent to {@code d} in
+ * the direction of positive infinity. This method is
+ * semantically equivalent to {@code nextAfter(d,
+ * Double.POSITIVE_INFINITY)}; however, a {@code nextUp}
+ * implementation may run faster than its equivalent
+ * {@code nextAfter} call.
+ *
+ *
+ *
+ *
+ * @param d starting floating-point value
+ * @return The adjacent floating-point value closer to positive
+ * infinity.
+ * @since 1.6
+ */
+ public static double nextUp(double d) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the floating-point value adjacent to {@code f} in
+ * the direction of positive infinity. This method is
+ * semantically equivalent to {@code nextAfter(f,
+ * Float.POSITIVE_INFINITY)}; however, a {@code nextUp}
+ * implementation may run faster than its equivalent
+ * {@code nextAfter} call.
+ *
+ *
+ *
+ *
+ * @param f starting floating-point value
+ * @return The adjacent floating-point value closer to positive
+ * infinity.
+ * @since 1.6
+ */
+ public static float nextUp(float f) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Return {@code d} ×
+ * 2{@code scaleFactor} rounded as if performed
+ * by a single correctly rounded floating-point multiply to a
+ * member of the double value set. See the Java
+ * Language Specification for a discussion of floating-point
+ * value sets. If the exponent of the result is between {@link
+ * Double#MIN_EXPONENT} and {@link Double#MAX_EXPONENT}, the
+ * answer is calculated exactly. If the exponent of the result
+ * would be larger than {@code Double.MAX_EXPONENT}, an
+ * infinity is returned. Note that if the result is subnormal,
+ * precision may be lost; that is, when {@code scalb(x, n)}
+ * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
+ * x. When the result is non-NaN, the result has the same
+ * sign as {@code d}.
+ *
+ *
+ *
+ *
+ * @param d number to be scaled by a power of two.
+ * @param scaleFactor power of 2 used to scale {@code d}
+ * @return {@code d} × 2{@code scaleFactor}
+ * @since 1.6
+ */
+ public static double scalb(double d, int scaleFactor) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Return {@code f} ×
+ * 2{@code scaleFactor} rounded as if performed
+ * by a single correctly rounded floating-point multiply to a
+ * member of the float value set. See the Java
+ * Language Specification for a discussion of floating-point
+ * value sets. If the exponent of the result is between {@link
+ * Float#MIN_EXPONENT} and {@link Float#MAX_EXPONENT}, the
+ * answer is calculated exactly. If the exponent of the result
+ * would be larger than {@code Float.MAX_EXPONENT}, an
+ * infinity is returned. Note that if the result is subnormal,
+ * precision may be lost; that is, when {@code scalb(x, n)}
+ * is subnormal, {@code scalb(scalb(x, n), -n)} may not equal
+ * x. When the result is non-NaN, the result has the same
+ * sign as {@code f}.
+ *
+ *
+ *
+ *
+ * @param f number to be scaled by a power of two.
+ * @param scaleFactor power of 2 used to scale {@code f}
+ * @return {@code f} × 2{@code scaleFactor}
+ * @since 1.6
+ */
+ public static float scalb(float f, int scaleFactor) {
+ throw new UnsupportedOperationException();
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/String.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/String.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,3065 @@
+/*
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+import org.apidesign.bck2brwsr.core.ExtraJavaScript;
+import java.util.Comparator;
+
+/**
+ * The String
class represents character strings. All
+ * string literals in Java programs, such as "abc"
, are
+ * implemented as instances of this class.
+ *
+ * String str = "abc";
+ *
+ * char data[] = {'a', 'b', 'c'};
+ * String str = new String(data);
+ *
+ *
+ * System.out.println("abc");
+ * String cde = "cde";
+ * System.out.println("abc" + cde);
+ * String c = "abc".substring(2,3);
+ * String d = cde.substring(1, 2);
+ *
String
includes methods for examining
+ * individual characters of the sequence, for comparing strings, for
+ * searching strings, for extracting substrings, and for creating a
+ * copy of a string with all characters translated to uppercase or to
+ * lowercase. Case mapping is based on the Unicode Standard version
+ * specified by the {@link java.lang.Character Character} class.
+ * StringBuilder
(or StringBuffer
)
+ * class and its append
method.
+ * String conversions are implemented through the method
+ * toString
, defined by Object
and
+ * inherited by all classes in Java. For additional information on
+ * string concatenation and conversion, see Gosling, Joy, and Steele,
+ * The Java Language Specification.
+ *
+ * String
represents a string in the UTF-16 format
+ * in which supplementary characters are represented by surrogate
+ * pairs (see the section Unicode
+ * Character Representations in the Character
class for
+ * more information).
+ * Index values refer to char
code units, so a supplementary
+ * character uses two positions in a String
.
+ * String
class provides methods for dealing with
+ * Unicode code points (i.e., characters), in addition to those for
+ * dealing with Unicode code units (i.e., char
values).
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Martin Buchholz
+ * @author Ulf Zibis
+ * @see java.lang.Object#toString()
+ * @see java.lang.StringBuffer
+ * @see java.lang.StringBuilder
+ * @see java.nio.charset.Charset
+ * @since JDK1.0
+ */
+
+@ExtraJavaScript(
+ resource="/org/apidesign/vm4brwsr/emul/java_lang_String.js",
+ processByteCode=false
+)
+public final class String
+ implements java.io.Serializable, Comparable
+ *
+ * The String is written by method TC_STRING
(utf String)
+ * DataOutput.writeUTF
.
+ * A new handle is generated to refer to all future references to the
+ * string instance within the stream.
+ */
+// private static final ObjectStreamField[] serialPersistentFields =
+// new ObjectStreamField[0];
+
+ /**
+ * Initializes a newly created {@code String} object so that it represents
+ * an empty character sequence. Note that use of this constructor is
+ * unnecessary since Strings are immutable.
+ */
+ public String() {
+ this.offset = 0;
+ this.count = 0;
+ this.value = new char[0];
+ }
+
+ /**
+ * Initializes a newly created {@code String} object so that it represents
+ * the same sequence of characters as the argument; in other words, the
+ * newly created string is a copy of the argument string. Unless an
+ * explicit copy of {@code original} is needed, use of this constructor is
+ * unnecessary since Strings are immutable.
+ *
+ * @param original
+ * A {@code String}
+ */
+ public String(String original) {
+ int size = original.count;
+ char[] originalValue = original.value;
+ char[] v;
+ if (originalValue.length > size) {
+ // The array representing the String is bigger than the new
+ // String itself. Perhaps this constructor is being called
+ // in order to trim the baggage, so make a copy of the array.
+ int off = original.offset;
+ v = copyOfRange(originalValue, off, off+size);
+ } else {
+ // The array representing the String is the same
+ // size as the String, so no point in making a copy.
+ v = originalValue;
+ }
+ this.offset = 0;
+ this.count = size;
+ this.value = v;
+ }
+
+ /**
+ * Allocates a new {@code String} so that it represents the sequence of
+ * characters currently contained in the character array argument. The
+ * contents of the character array are copied; subsequent modification of
+ * the character array does not affect the newly created string.
+ *
+ * @param value
+ * The initial value of the string
+ */
+ public String(char value[]) {
+ int size = value.length;
+ this.offset = 0;
+ this.count = size;
+ this.value = copyOf(value, size);
+ }
+
+ /**
+ * Allocates a new {@code String} that contains characters from a subarray
+ * of the character array argument. The {@code offset} argument is the
+ * index of the first character of the subarray and the {@code count}
+ * argument specifies the length of the subarray. The contents of the
+ * subarray are copied; subsequent modification of the character array does
+ * not affect the newly created string.
+ *
+ * @param value
+ * Array that is the source of characters
+ *
+ * @param offset
+ * The initial offset
+ *
+ * @param count
+ * The length
+ *
+ * @throws IndexOutOfBoundsException
+ * If the {@code offset} and {@code count} arguments index
+ * characters outside the bounds of the {@code value} array
+ */
+ public String(char value[], int offset, int count) {
+ if (offset < 0) {
+ throw new StringIndexOutOfBoundsException(offset);
+ }
+ if (count < 0) {
+ throw new StringIndexOutOfBoundsException(count);
+ }
+ // Note: offset or count might be near -1>>>1.
+ if (offset > value.length - count) {
+ throw new StringIndexOutOfBoundsException(offset + count);
+ }
+ this.offset = 0;
+ this.count = count;
+ this.value = copyOfRange(value, offset, offset+count);
+ }
+
+ /**
+ * Allocates a new {@code String} that contains characters from a subarray
+ * of the Unicode code point array
+ * argument. The {@code offset} argument is the index of the first code
+ * point of the subarray and the {@code count} argument specifies the
+ * length of the subarray. The contents of the subarray are converted to
+ * {@code char}s; subsequent modification of the {@code int} array does not
+ * affect the newly created string.
+ *
+ * @param codePoints
+ * Array that is the source of Unicode code points
+ *
+ * @param offset
+ * The initial offset
+ *
+ * @param count
+ * The length
+ *
+ * @throws IllegalArgumentException
+ * If any invalid Unicode code point is found in {@code
+ * codePoints}
+ *
+ * @throws IndexOutOfBoundsException
+ * If the {@code offset} and {@code count} arguments index
+ * characters outside the bounds of the {@code codePoints} array
+ *
+ * @since 1.5
+ */
+ public String(int[] codePoints, int offset, int count) {
+ if (offset < 0) {
+ throw new StringIndexOutOfBoundsException(offset);
+ }
+ if (count < 0) {
+ throw new StringIndexOutOfBoundsException(count);
+ }
+ // Note: offset or count might be near -1>>>1.
+ if (offset > codePoints.length - count) {
+ throw new StringIndexOutOfBoundsException(offset + count);
+ }
+
+ final int end = offset + count;
+
+ // Pass 1: Compute precise size of char[]
+ int n = count;
+ for (int i = offset; i < end; i++) {
+ int c = codePoints[i];
+ if (Character.isBmpCodePoint(c))
+ continue;
+ else if (Character.isValidCodePoint(c))
+ n++;
+ else throw new IllegalArgumentException(Integer.toString(c));
+ }
+
+ // Pass 2: Allocate and fill in char[]
+ final char[] v = new char[n];
+
+ for (int i = offset, j = 0; i < end; i++, j++) {
+ int c = codePoints[i];
+ if (Character.isBmpCodePoint(c))
+ v[j] = (char) c;
+ else
+ Character.toSurrogates(c, v, j++);
+ }
+
+ this.value = v;
+ this.count = n;
+ this.offset = 0;
+ }
+
+ /**
+ * Allocates a new {@code String} constructed from a subarray of an array
+ * of 8-bit integer values.
+ *
+ *
+ *
+ * @deprecated This method does not properly convert bytes into
+ * characters. As of JDK 1.1, the preferred way to do this is via the
+ * {@code String} constructors that take a {@link
+ * java.nio.charset.Charset}, charset name, or that use the platform's
+ * default charset.
+ *
+ * @param ascii
+ * The bytes to be converted to characters
+ *
+ * @param hibyte
+ * The top 8 bits of each 16-bit Unicode code unit
+ *
+ * @see #String(byte[], int, int, java.lang.String)
+ * @see #String(byte[], int, int, java.nio.charset.Charset)
+ * @see #String(byte[], int, int)
+ * @see #String(byte[], java.lang.String)
+ * @see #String(byte[], java.nio.charset.Charset)
+ * @see #String(byte[])
+ */
+ @Deprecated
+ public String(byte ascii[], int hibyte) {
+ this(ascii, hibyte, 0, ascii.length);
+ }
+
+ /* Common private utility method used to bounds check the byte array
+ * and requested offset & length values used by the String(byte[],..)
+ * constructors.
+ */
+ private static void checkBounds(byte[] bytes, int offset, int length) {
+ if (length < 0)
+ throw new StringIndexOutOfBoundsException(length);
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException(offset);
+ if (offset > bytes.length - length)
+ throw new StringIndexOutOfBoundsException(offset + length);
+ }
+
+ /**
+ * Constructs a new {@code String} by decoding the specified subarray of
+ * bytes using the specified charset. The length of the new {@code String}
+ * is a function of the charset, and hence may not be equal to the length
+ * of the subarray.
+ *
+ *
+ * c == (char)(((hibyte & 0xff) << 8)
+ * | (b & 0xff))
+ *
char
value at the
+ * specified index. An index ranges from 0
to
+ * length() - 1
. The first char
value of the sequence
+ * is at index 0
, the next at index 1
,
+ * and so on, as for array indexing.
+ *
+ * char
value specified by the index is a
+ * surrogate, the surrogate
+ * value is returned.
+ *
+ * @param index the index of the char
value.
+ * @return the char
value at the specified index of this string.
+ * The first char
value is at index 0
.
+ * @exception IndexOutOfBoundsException if the index
+ * argument is negative or not less than the length of this
+ * string.
+ */
+ public char charAt(int index) {
+ if ((index < 0) || (index >= count)) {
+ throw new StringIndexOutOfBoundsException(index);
+ }
+ return value[index + offset];
+ }
+
+ /**
+ * Returns the character (Unicode code point) at the specified
+ * index. The index refers to char
values
+ * (Unicode code units) and ranges from 0
to
+ * {@link #length()} - 1
.
+ *
+ * char
value specified at the given index
+ * is in the high-surrogate range, the following index is less
+ * than the length of this String
, and the
+ * char
value at the following index is in the
+ * low-surrogate range, then the supplementary code point
+ * corresponding to this surrogate pair is returned. Otherwise,
+ * the char
value at the given index is returned.
+ *
+ * @param index the index to the char
values
+ * @return the code point value of the character at the
+ * index
+ * @exception IndexOutOfBoundsException if the index
+ * argument is negative or not less than the length of this
+ * string.
+ * @since 1.5
+ */
+ public int codePointAt(int index) {
+ if ((index < 0) || (index >= count)) {
+ throw new StringIndexOutOfBoundsException(index);
+ }
+ return Character.codePointAtImpl(value, offset + index, offset + count);
+ }
+
+ /**
+ * Returns the character (Unicode code point) before the specified
+ * index. The index refers to char
values
+ * (Unicode code units) and ranges from 1
to {@link
+ * CharSequence#length() length}.
+ *
+ * char
value at (index - 1)
+ * is in the low-surrogate range, (index - 2)
is not
+ * negative, and the char
value at (index -
+ * 2)
is in the high-surrogate range, then the
+ * supplementary code point value of the surrogate pair is
+ * returned. If the char
value at index -
+ * 1
is an unpaired low-surrogate or a high-surrogate, the
+ * surrogate value is returned.
+ *
+ * @param index the index following the code point that should be returned
+ * @return the Unicode code point value before the given index.
+ * @exception IndexOutOfBoundsException if the index
+ * argument is less than 1 or greater than the length
+ * of this string.
+ * @since 1.5
+ */
+ public int codePointBefore(int index) {
+ int i = index - 1;
+ if ((i < 0) || (i >= count)) {
+ throw new StringIndexOutOfBoundsException(index);
+ }
+ return Character.codePointBeforeImpl(value, offset + index, offset);
+ }
+
+ /**
+ * Returns the number of Unicode code points in the specified text
+ * range of this String
. The text range begins at the
+ * specified beginIndex
and extends to the
+ * char
at index endIndex - 1
. Thus the
+ * length (in char
s) of the text range is
+ * endIndex-beginIndex
. Unpaired surrogates within
+ * the text range count as one code point each.
+ *
+ * @param beginIndex the index to the first char
of
+ * the text range.
+ * @param endIndex the index after the last char
of
+ * the text range.
+ * @return the number of Unicode code points in the specified text
+ * range
+ * @exception IndexOutOfBoundsException if the
+ * beginIndex
is negative, or endIndex
+ * is larger than the length of this String
, or
+ * beginIndex
is larger than endIndex
.
+ * @since 1.5
+ */
+ public int codePointCount(int beginIndex, int endIndex) {
+ if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) {
+ throw new IndexOutOfBoundsException();
+ }
+ return Character.codePointCountImpl(value, offset+beginIndex, endIndex-beginIndex);
+ }
+
+ /**
+ * Returns the index within this String
that is
+ * offset from the given index
by
+ * codePointOffset
code points. Unpaired surrogates
+ * within the text range given by index
and
+ * codePointOffset
count as one code point each.
+ *
+ * @param index the index to be offset
+ * @param codePointOffset the offset in code points
+ * @return the index within this String
+ * @exception IndexOutOfBoundsException if index
+ * is negative or larger then the length of this
+ * String
, or if codePointOffset
is positive
+ * and the substring starting with index
has fewer
+ * than codePointOffset
code points,
+ * or if codePointOffset
is negative and the substring
+ * before index
has fewer than the absolute value
+ * of codePointOffset
code points.
+ * @since 1.5
+ */
+ public int offsetByCodePoints(int index, int codePointOffset) {
+ if (index < 0 || index > count) {
+ throw new IndexOutOfBoundsException();
+ }
+ return Character.offsetByCodePointsImpl(value, offset, count,
+ offset+index, codePointOffset) - offset;
+ }
+
+ /**
+ * Copy characters from this string into dst starting at dstBegin.
+ * This method doesn't perform any range checking.
+ */
+ void getChars(char dst[], int dstBegin) {
+ arraycopy(value, offset, dst, dstBegin, count);
+ }
+
+ /**
+ * Copies characters from this string into the destination character
+ * array.
+ * srcBegin
;
+ * the last character to be copied is at index srcEnd-1
+ * (thus the total number of characters to be copied is
+ * srcEnd-srcBegin
). The characters are copied into the
+ * subarray of dst
starting at index dstBegin
+ * and ending at index:
+ *
+ *
+ * @param srcBegin index of the first character in the string
+ * to copy.
+ * @param srcEnd index after the last character in the string
+ * to copy.
+ * @param dst the destination array.
+ * @param dstBegin the start offset in the destination array.
+ * @exception IndexOutOfBoundsException If any of the following
+ * is true:
+ *
+ * dstbegin + (srcEnd-srcBegin) - 1
+ *
+ */
+ public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
+ if (srcBegin < 0) {
+ throw new StringIndexOutOfBoundsException(srcBegin);
+ }
+ if (srcEnd > count) {
+ throw new StringIndexOutOfBoundsException(srcEnd);
+ }
+ if (srcBegin > srcEnd) {
+ throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
+ }
+ arraycopy(value, offset + srcBegin, dst, dstBegin,
+ srcEnd - srcBegin);
+ }
+
+ /**
+ * Copies characters from this string into the destination byte array. Each
+ * byte receives the 8 low-order bits of the corresponding character. The
+ * eight high-order bits of each character are not copied and do not
+ * participate in the transfer in any way.
+ *
+ * srcBegin
is negative.
+ * srcBegin
is greater than srcEnd
+ * srcEnd
is greater than the length of this
+ * string
+ * dstBegin
is negative
+ * dstBegin+(srcEnd-srcBegin)
is larger than
+ * dst.length
+ *
+ * @deprecated This method does not properly convert characters into
+ * bytes. As of JDK 1.1, the preferred way to do this is via the
+ * {@link #getBytes()} method, which uses the platform's default charset.
+ *
+ * @param srcBegin
+ * Index of the first character in the string to copy
+ *
+ * @param srcEnd
+ * Index after the last character in the string to copy
+ *
+ * @param dst
+ * The destination array
+ *
+ * @param dstBegin
+ * The start offset in the destination array
+ *
+ * @throws IndexOutOfBoundsException
+ * If any of the following is true:
+ *
+ * dstbegin + (srcEnd-srcBegin) - 1
+ *
+ *
+ */
+ @Deprecated
+ public void getBytes(int srcBegin, int srcEnd, byte dst[], int dstBegin) {
+ if (srcBegin < 0) {
+ throw new StringIndexOutOfBoundsException(srcBegin);
+ }
+ if (srcEnd > count) {
+ throw new StringIndexOutOfBoundsException(srcEnd);
+ }
+ if (srcBegin > srcEnd) {
+ throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
+ }
+ int j = dstBegin;
+ int n = offset + srcEnd;
+ int i = offset + srcBegin;
+ char[] val = value; /* avoid getfield opcode */
+
+ while (i < n) {
+ dst[j++] = (byte)val[i++];
+ }
+ }
+
+ /**
+ * Encodes this {@code String} into a sequence of bytes using the named
+ * charset, storing the result into a new byte array.
+ *
+ *
+ *
+ *
+ * @param anotherString
+ * The {@code String} to compare this {@code String} against
+ *
+ * @return {@code true} if the argument is not {@code null} and it
+ * represents an equivalent {@code String} ignoring case; {@code
+ * false} otherwise
+ *
+ * @see #equals(Object)
+ */
+ public boolean equalsIgnoreCase(String anotherString) {
+ return (this == anotherString) ? true :
+ (anotherString != null) && (anotherString.count == count) &&
+ regionMatches(true, 0, anotherString, 0, count);
+ }
+
+ /**
+ * Compares two strings lexicographically.
+ * The comparison is based on the Unicode value of each character in
+ * the strings. The character sequence represented by this
+ * String
object is compared lexicographically to the
+ * character sequence represented by the argument string. The result is
+ * a negative integer if this String
object
+ * lexicographically precedes the argument string. The result is a
+ * positive integer if this String
object lexicographically
+ * follows the argument string. The result is zero if the strings
+ * are equal; compareTo
returns 0
exactly when
+ * the {@link #equals(Object)} method would return true
.
+ * compareTo
returns the
+ * difference of the two character values at position k
in
+ * the two string -- that is, the value:
+ *
+ * If there is no index position at which they differ, then the shorter
+ * string lexicographically precedes the longer string. In this case,
+ *
+ * this.charAt(k)-anotherString.charAt(k)
+ *
compareTo
returns the difference of the lengths of the
+ * strings -- that is, the value:
+ *
+ *
+ * @param anotherString the
+ * this.length()-anotherString.length()
+ *
String
to be compared.
+ * @return the value 0
if the argument string is equal to
+ * this string; a value less than 0
if this string
+ * is lexicographically less than the string argument; and a
+ * value greater than 0
if this string is
+ * lexicographically greater than the string argument.
+ */
+ public int compareTo(String anotherString) {
+ int len1 = count;
+ int len2 = anotherString.count;
+ int n = Math.min(len1, len2);
+ char v1[] = value;
+ char v2[] = anotherString.value;
+ int i = offset;
+ int j = anotherString.offset;
+
+ if (i == j) {
+ int k = i;
+ int lim = n + i;
+ while (k < lim) {
+ char c1 = v1[k];
+ char c2 = v2[k];
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ k++;
+ }
+ } else {
+ while (n-- != 0) {
+ char c1 = v1[i++];
+ char c2 = v2[j++];
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ }
+ }
+ return len1 - len2;
+ }
+
+ /**
+ * A Comparator that orders String
objects as by
+ * compareToIgnoreCase
. This comparator is serializable.
+ * compareTo
with normalized versions of the strings
+ * where case differences have been eliminated by calling
+ * Character.toLowerCase(Character.toUpperCase(character))
on
+ * each character.
+ * String
to be compared.
+ * @return a negative integer, zero, or a positive integer as the
+ * specified String is greater than, equal to, or less
+ * than this String, ignoring case considerations.
+ * @see java.text.Collator#compare(String, String)
+ * @since 1.2
+ */
+ public int compareToIgnoreCase(String str) {
+ return CASE_INSENSITIVE_ORDER.compare(this, str);
+ }
+
+ /**
+ * Tests if two string regions are equal.
+ *
+ *
+ * @param toffset the starting offset of the subregion in this string.
+ * @param other the string argument.
+ * @param ooffset the starting offset of the subregion in the string
+ * argument.
+ * @param len the number of characters to compare.
+ * @return true
if the specified subregion of this string
+ * exactly matches the specified subregion of the string argument;
+ * false
otherwise.
+ */
+ public boolean regionMatches(int toffset, String other, int ooffset,
+ int len) {
+ char ta[] = value;
+ int to = offset + toffset;
+ char pa[] = other.value;
+ int po = other.offset + ooffset;
+ // Note: toffset, ooffset, or len might be near -1>>>1.
+ if ((ooffset < 0) || (toffset < 0) || (toffset > (long)count - len)
+ || (ooffset > (long)other.count - len)) {
+ return false;
+ }
+ while (len-- > 0) {
+ if (ta[to++] != pa[po++]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Tests if two string regions are equal.
+ *
+ *
+ * @param ignoreCase if
+ *
+ * this.charAt(toffset+k) != other.charAt(ooffset+k)
+ *
+ * and:
+ *
+ * Character.toLowerCase(this.charAt(toffset+k)) !=
+ Character.toLowerCase(other.charAt(ooffset+k))
+ *
+ *
+ * Character.toUpperCase(this.charAt(toffset+k)) !=
+ * Character.toUpperCase(other.charAt(ooffset+k))
+ *
true
, ignore case when comparing
+ * characters.
+ * @param toffset the starting offset of the subregion in this
+ * string.
+ * @param other the string argument.
+ * @param ooffset the starting offset of the subregion in the string
+ * argument.
+ * @param len the number of characters to compare.
+ * @return true
if the specified subregion of this string
+ * matches the specified subregion of the string argument;
+ * false
otherwise. Whether the matching is exact
+ * or case insensitive depends on the ignoreCase
+ * argument.
+ */
+ public boolean regionMatches(boolean ignoreCase, int toffset,
+ String other, int ooffset, int len) {
+ char ta[] = value;
+ int to = offset + toffset;
+ char pa[] = other.value;
+ int po = other.offset + ooffset;
+ // Note: toffset, ooffset, or len might be near -1>>>1.
+ if ((ooffset < 0) || (toffset < 0) || (toffset > (long)count - len) ||
+ (ooffset > (long)other.count - len)) {
+ return false;
+ }
+ while (len-- > 0) {
+ char c1 = ta[to++];
+ char c2 = pa[po++];
+ if (c1 == c2) {
+ continue;
+ }
+ if (ignoreCase) {
+ // If characters don't match but case may be ignored,
+ // try converting both characters to uppercase.
+ // If the results match, then the comparison scan should
+ // continue.
+ char u1 = Character.toUpperCase(c1);
+ char u2 = Character.toUpperCase(c2);
+ if (u1 == u2) {
+ continue;
+ }
+ // Unfortunately, conversion to uppercase does not work properly
+ // for the Georgian alphabet, which has strange rules about case
+ // conversion. So we need to make one last check before
+ // exiting.
+ if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) {
+ continue;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Tests if the substring of this string beginning at the
+ * specified index starts with the specified prefix.
+ *
+ * @param prefix the prefix.
+ * @param toffset where to begin looking in this string.
+ * @return true
if the character sequence represented by the
+ * argument is a prefix of the substring of this object starting
+ * at index toffset
; false
otherwise.
+ * The result is false
if toffset
is
+ * negative or greater than the length of this
+ * String
object; otherwise the result is the same
+ * as the result of the expression
+ *
+ * this.substring(toffset).startsWith(prefix)
+ *
+ */
+ public boolean startsWith(String prefix, int toffset) {
+ char ta[] = value;
+ int to = offset + toffset;
+ char pa[] = prefix.value;
+ int po = prefix.offset;
+ int pc = prefix.count;
+ // Note: toffset might be near -1>>>1.
+ if ((toffset < 0) || (toffset > count - pc)) {
+ return false;
+ }
+ while (--pc >= 0) {
+ if (ta[to++] != pa[po++]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Tests if this string starts with the specified prefix.
+ *
+ * @param prefix the prefix.
+ * @return true
if the character sequence represented by the
+ * argument is a prefix of the character sequence represented by
+ * this string; false
otherwise.
+ * Note also that true
will be returned if the
+ * argument is an empty string or is equal to this
+ * String
object as determined by the
+ * {@link #equals(Object)} method.
+ * @since 1. 0
+ */
+ public boolean startsWith(String prefix) {
+ return startsWith(prefix, 0);
+ }
+
+ /**
+ * Tests if this string ends with the specified suffix.
+ *
+ * @param suffix the suffix.
+ * @return true
if the character sequence represented by the
+ * argument is a suffix of the character sequence represented by
+ * this object; false
otherwise. Note that the
+ * result will be true
if the argument is the
+ * empty string or is equal to this String
object
+ * as determined by the {@link #equals(Object)} method.
+ */
+ public boolean endsWith(String suffix) {
+ return startsWith(suffix, count - suffix.count);
+ }
+
+ /**
+ * Returns a hash code for this string. The hash code for a
+ * String
object is computed as
+ *
+ * using
+ * s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
+ *
int
arithmetic, where s[i]
is the
+ * ith character of the string, n
is the length of
+ * the string, and ^
indicates exponentiation.
+ * (The hash value of the empty string is zero.)
+ *
+ * @return a hash code value for this object.
+ */
+ public int hashCode() {
+ int h = hash;
+ if (h == 0 && count > 0) {
+ int off = offset;
+ char val[] = value;
+ int len = count;
+
+ for (int i = 0; i < len; i++) {
+ h = 31*h + val[off++];
+ }
+ hash = h;
+ }
+ return h;
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of
+ * the specified character. If a character with value
+ * ch
occurs in the character sequence represented by
+ * this String
object, then the index (in Unicode
+ * code units) of the first such occurrence is returned. For
+ * values of ch
in the range from 0 to 0xFFFF
+ * (inclusive), this is the smallest value k such that:
+ *
+ * is true. For other values of
+ * this.charAt(k) == ch
+ *
ch
, it is the
+ * smallest value k such that:
+ *
+ * is true. In either case, if no such character occurs in this
+ * string, then
+ * this.codePointAt(k) == ch
+ *
-1
is returned.
+ *
+ * @param ch a character (Unicode code point).
+ * @return the index of the first occurrence of the character in the
+ * character sequence represented by this object, or
+ * -1
if the character does not occur.
+ */
+ public int indexOf(int ch) {
+ return indexOf(ch, 0);
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of the
+ * specified character, starting the search at the specified index.
+ * ch
occurs in the
+ * character sequence represented by this String
+ * object at an index no smaller than fromIndex
, then
+ * the index of the first such occurrence is returned. For values
+ * of ch
in the range from 0 to 0xFFFF (inclusive),
+ * this is the smallest value k such that:
+ *
+ * is true. For other values of
+ * (this.charAt(k) == ch) && (k >= fromIndex)
+ *
ch
, it is the
+ * smallest value k such that:
+ *
+ * is true. In either case, if no such character occurs in this
+ * string at or after position
+ * (this.codePointAt(k) == ch) && (k >= fromIndex)
+ *
fromIndex
, then
+ * -1
is returned.
+ *
+ * fromIndex
. If it
+ * is negative, it has the same effect as if it were zero: this entire
+ * string may be searched. If it is greater than the length of this
+ * string, it has the same effect as if it were equal to the length of
+ * this string: -1
is returned.
+ *
+ * char
values
+ * (Unicode code units).
+ *
+ * @param ch a character (Unicode code point).
+ * @param fromIndex the index to start the search from.
+ * @return the index of the first occurrence of the character in the
+ * character sequence represented by this object that is greater
+ * than or equal to fromIndex
, or -1
+ * if the character does not occur.
+ */
+ public int indexOf(int ch, int fromIndex) {
+ if (fromIndex < 0) {
+ fromIndex = 0;
+ } else if (fromIndex >= count) {
+ // Note: fromIndex might be near -1>>>1.
+ return -1;
+ }
+
+ if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
+ // handle most cases here (ch is a BMP code point or a
+ // negative value (invalid code point))
+ final char[] value = this.value;
+ final int offset = this.offset;
+ final int max = offset + count;
+ for (int i = offset + fromIndex; i < max ; i++) {
+ if (value[i] == ch) {
+ return i - offset;
+ }
+ }
+ return -1;
+ } else {
+ return indexOfSupplementary(ch, fromIndex);
+ }
+ }
+
+ /**
+ * Handles (rare) calls of indexOf with a supplementary character.
+ */
+ private int indexOfSupplementary(int ch, int fromIndex) {
+ if (Character.isValidCodePoint(ch)) {
+ final char[] value = this.value;
+ final int offset = this.offset;
+ final char hi = Character.highSurrogate(ch);
+ final char lo = Character.lowSurrogate(ch);
+ final int max = offset + count - 1;
+ for (int i = offset + fromIndex; i < max; i++) {
+ if (value[i] == hi && value[i+1] == lo) {
+ return i - offset;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of
+ * the specified character. For values of ch
in the
+ * range from 0 to 0xFFFF (inclusive), the index (in Unicode code
+ * units) returned is the largest value k such that:
+ *
+ * is true. For other values of
+ * this.charAt(k) == ch
+ *
ch
, it is the
+ * largest value k such that:
+ *
+ * is true. In either case, if no such character occurs in this
+ * string, then
+ * this.codePointAt(k) == ch
+ *
-1
is returned. The
+ * String
is searched backwards starting at the last
+ * character.
+ *
+ * @param ch a character (Unicode code point).
+ * @return the index of the last occurrence of the character in the
+ * character sequence represented by this object, or
+ * -1
if the character does not occur.
+ */
+ public int lastIndexOf(int ch) {
+ return lastIndexOf(ch, count - 1);
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of
+ * the specified character, searching backward starting at the
+ * specified index. For values of ch
in the range
+ * from 0 to 0xFFFF (inclusive), the index returned is the largest
+ * value k such that:
+ *
+ * is true. For other values of
+ * (this.charAt(k) == ch) && (k <= fromIndex)
+ *
ch
, it is the
+ * largest value k such that:
+ *
+ * is true. In either case, if no such character occurs in this
+ * string at or before position
+ * (this.codePointAt(k) == ch) && (k <= fromIndex)
+ *
fromIndex
, then
+ * -1
is returned.
+ *
+ * char
values
+ * (Unicode code units).
+ *
+ * @param ch a character (Unicode code point).
+ * @param fromIndex the index to start the search from. There is no
+ * restriction on the value of fromIndex
. If it is
+ * greater than or equal to the length of this string, it has
+ * the same effect as if it were equal to one less than the
+ * length of this string: this entire string may be searched.
+ * If it is negative, it has the same effect as if it were -1:
+ * -1 is returned.
+ * @return the index of the last occurrence of the character in the
+ * character sequence represented by this object that is less
+ * than or equal to fromIndex
, or -1
+ * if the character does not occur before that point.
+ */
+ public int lastIndexOf(int ch, int fromIndex) {
+ if (ch < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
+ // handle most cases here (ch is a BMP code point or a
+ // negative value (invalid code point))
+ final char[] value = this.value;
+ final int offset = this.offset;
+ int i = offset + Math.min(fromIndex, count - 1);
+ for (; i >= offset ; i--) {
+ if (value[i] == ch) {
+ return i - offset;
+ }
+ }
+ return -1;
+ } else {
+ return lastIndexOfSupplementary(ch, fromIndex);
+ }
+ }
+
+ /**
+ * Handles (rare) calls of lastIndexOf with a supplementary character.
+ */
+ private int lastIndexOfSupplementary(int ch, int fromIndex) {
+ if (Character.isValidCodePoint(ch)) {
+ final char[] value = this.value;
+ final int offset = this.offset;
+ char hi = Character.highSurrogate(ch);
+ char lo = Character.lowSurrogate(ch);
+ int i = offset + Math.min(fromIndex, count - 2);
+ for (; i >= offset; i--) {
+ if (value[i] == hi && value[i+1] == lo) {
+ return i - offset;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of the
+ * specified substring.
+ *
+ *
+ * If no such value of k exists, then {@code -1} is returned.
+ *
+ * @param str the substring to search for.
+ * @return the index of the first occurrence of the specified substring,
+ * or {@code -1} if there is no such occurrence.
+ */
+ public int indexOf(String str) {
+ return indexOf(str, 0);
+ }
+
+ /**
+ * Returns the index within this string of the first occurrence of the
+ * specified substring, starting at the specified index.
+ *
+ *
+ * this.startsWith(str, k)
+ *
+ * If no such value of k exists, then {@code -1} is returned.
+ *
+ * @param str the substring to search for.
+ * @param fromIndex the index from which to start the search.
+ * @return the index of the first occurrence of the specified substring,
+ * starting at the specified index,
+ * or {@code -1} if there is no such occurrence.
+ */
+ public int indexOf(String str, int fromIndex) {
+ return indexOf(value, offset, count,
+ str.value, str.offset, str.count, fromIndex);
+ }
+
+ /**
+ * Code shared by String and StringBuffer to do searches. The
+ * source is the character array being searched, and the target
+ * is the string being searched for.
+ *
+ * @param source the characters being searched.
+ * @param sourceOffset offset of the source string.
+ * @param sourceCount count of the source string.
+ * @param target the characters being searched for.
+ * @param targetOffset offset of the target string.
+ * @param targetCount count of the target string.
+ * @param fromIndex the index to begin searching from.
+ */
+ static int indexOf(char[] source, int sourceOffset, int sourceCount,
+ char[] target, int targetOffset, int targetCount,
+ int fromIndex) {
+ if (fromIndex >= sourceCount) {
+ return (targetCount == 0 ? sourceCount : -1);
+ }
+ if (fromIndex < 0) {
+ fromIndex = 0;
+ }
+ if (targetCount == 0) {
+ return fromIndex;
+ }
+
+ char first = target[targetOffset];
+ int max = sourceOffset + (sourceCount - targetCount);
+
+ for (int i = sourceOffset + fromIndex; i <= max; i++) {
+ /* Look for first character. */
+ if (source[i] != first) {
+ while (++i <= max && source[i] != first);
+ }
+
+ /* Found first character, now look at the rest of v2 */
+ if (i <= max) {
+ int j = i + 1;
+ int end = j + targetCount - 1;
+ for (int k = targetOffset + 1; j < end && source[j] ==
+ target[k]; j++, k++);
+
+ if (j == end) {
+ /* Found whole string. */
+ return i - sourceOffset;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of the
+ * specified substring. The last occurrence of the empty string ""
+ * is considered to occur at the index value {@code this.length()}.
+ *
+ *
+ * k >= fromIndex && this.startsWith(str, k)
+ *
+ * If no such value of k exists, then {@code -1} is returned.
+ *
+ * @param str the substring to search for.
+ * @return the index of the last occurrence of the specified substring,
+ * or {@code -1} if there is no such occurrence.
+ */
+ public int lastIndexOf(String str) {
+ return lastIndexOf(str, count);
+ }
+
+ /**
+ * Returns the index within this string of the last occurrence of the
+ * specified substring, searching backward starting at the specified index.
+ *
+ *
+ * this.startsWith(str, k)
+ *
+ * If no such value of k exists, then {@code -1} is returned.
+ *
+ * @param str the substring to search for.
+ * @param fromIndex the index to start the search from.
+ * @return the index of the last occurrence of the specified substring,
+ * searching backward from the specified index,
+ * or {@code -1} if there is no such occurrence.
+ */
+ public int lastIndexOf(String str, int fromIndex) {
+ return lastIndexOf(value, offset, count,
+ str.value, str.offset, str.count, fromIndex);
+ }
+
+ /**
+ * Code shared by String and StringBuffer to do searches. The
+ * source is the character array being searched, and the target
+ * is the string being searched for.
+ *
+ * @param source the characters being searched.
+ * @param sourceOffset offset of the source string.
+ * @param sourceCount count of the source string.
+ * @param target the characters being searched for.
+ * @param targetOffset offset of the target string.
+ * @param targetCount count of the target string.
+ * @param fromIndex the index to begin searching from.
+ */
+ static int lastIndexOf(char[] source, int sourceOffset, int sourceCount,
+ char[] target, int targetOffset, int targetCount,
+ int fromIndex) {
+ /*
+ * Check arguments; return immediately where possible. For
+ * consistency, don't check for null str.
+ */
+ int rightIndex = sourceCount - targetCount;
+ if (fromIndex < 0) {
+ return -1;
+ }
+ if (fromIndex > rightIndex) {
+ fromIndex = rightIndex;
+ }
+ /* Empty string always matches. */
+ if (targetCount == 0) {
+ return fromIndex;
+ }
+
+ int strLastIndex = targetOffset + targetCount - 1;
+ char strLastChar = target[strLastIndex];
+ int min = sourceOffset + targetCount - 1;
+ int i = min + fromIndex;
+
+ startSearchForLastChar:
+ while (true) {
+ while (i >= min && source[i] != strLastChar) {
+ i--;
+ }
+ if (i < min) {
+ return -1;
+ }
+ int j = i - 1;
+ int start = j - (targetCount - 1);
+ int k = strLastIndex - 1;
+
+ while (j > start) {
+ if (source[j--] != target[k--]) {
+ i--;
+ continue startSearchForLastChar;
+ }
+ }
+ return start - sourceOffset + 1;
+ }
+ }
+
+ /**
+ * Returns a new string that is a substring of this string. The
+ * substring begins with the character at the specified index and
+ * extends to the end of this string.
+ * k <= fromIndex && this.startsWith(str, k)
+ *
+ *
+ * @param beginIndex the beginning index, inclusive.
+ * @return the specified substring.
+ * @exception IndexOutOfBoundsException if
+ *
+ * "unhappy".substring(2) returns "happy"
+ * "Harbison".substring(3) returns "bison"
+ * "emptiness".substring(9) returns "" (an empty string)
+ *
beginIndex
is negative or larger than the
+ * length of this String
object.
+ */
+ public String substring(int beginIndex) {
+ return substring(beginIndex, count);
+ }
+
+ /**
+ * Returns a new string that is a substring of this string. The
+ * substring begins at the specified beginIndex
and
+ * extends to the character at index endIndex - 1
.
+ * Thus the length of the substring is endIndex-beginIndex
.
+ *
+ *
+ * @param beginIndex the beginning index, inclusive.
+ * @param endIndex the ending index, exclusive.
+ * @return the specified substring.
+ * @exception IndexOutOfBoundsException if the
+ *
+ * "hamburger".substring(4, 8) returns "urge"
+ * "smiles".substring(1, 5) returns "mile"
+ *
beginIndex
is negative, or
+ * endIndex
is larger than the length of
+ * this String
object, or
+ * beginIndex
is larger than
+ * endIndex
.
+ */
+ public String substring(int beginIndex, int endIndex) {
+ if (beginIndex < 0) {
+ throw new StringIndexOutOfBoundsException(beginIndex);
+ }
+ if (endIndex > count) {
+ throw new StringIndexOutOfBoundsException(endIndex);
+ }
+ if (beginIndex > endIndex) {
+ throw new StringIndexOutOfBoundsException(endIndex - beginIndex);
+ }
+ return ((beginIndex == 0) && (endIndex == count)) ? this :
+ new String(offset + beginIndex, endIndex - beginIndex, value);
+ }
+
+ /**
+ * Returns a new character sequence that is a subsequence of this sequence.
+ *
+ *
+ *
+ * behaves in exactly the same way as the invocation
+ *
+ *
+ * str.subSequence(begin, end)
+ *
+ * This method is defined so that the String class can implement
+ * the {@link CharSequence} interface.
+ * str.substring(begin, end)
0
, then this
+ * String
object is returned. Otherwise, a new
+ * String
object is created, representing a character
+ * sequence that is the concatenation of the character sequence
+ * represented by this String
object and the character
+ * sequence represented by the argument string.
+ *
+ * @param str the
+ * "cares".concat("s") returns "caress"
+ * "to".concat("get").concat("her") returns "together"
+ *
String
that is concatenated to the end
+ * of this String
.
+ * @return a string that represents the concatenation of this object's
+ * characters followed by the string argument's characters.
+ */
+ public String concat(String str) {
+ int otherLen = str.length();
+ if (otherLen == 0) {
+ return this;
+ }
+ char buf[] = new char[count + otherLen];
+ getChars(0, count, buf, 0);
+ str.getChars(0, otherLen, buf, count);
+ return new String(0, count + otherLen, buf);
+ }
+
+ /**
+ * Returns a new string resulting from replacing all occurrences of
+ * oldChar
in this string with newChar
.
+ * oldChar
does not occur in the
+ * character sequence represented by this String
object,
+ * then a reference to this String
object is returned.
+ * Otherwise, a new String
object is created that
+ * represents a character sequence identical to the character sequence
+ * represented by this String
object, except that every
+ * occurrence of oldChar
is replaced by an occurrence
+ * of newChar
.
+ *
+ *
+ * @param oldChar the old character.
+ * @param newChar the new character.
+ * @return a string derived from this string by replacing every
+ * occurrence of
+ * "mesquite in your cellar".replace('e', 'o')
+ * returns "mosquito in your collar"
+ * "the war of baronets".replace('r', 'y')
+ * returns "the way of bayonets"
+ * "sparring with a purple porpoise".replace('p', 't')
+ * returns "starring with a turtle tortoise"
+ * "JonL".replace('q', 'x') returns "JonL" (no change)
+ *
oldChar
with newChar
.
+ */
+ public String replace(char oldChar, char newChar) {
+ if (oldChar != newChar) {
+ int len = count;
+ int i = -1;
+ char[] val = value; /* avoid getfield opcode */
+ int off = offset; /* avoid getfield opcode */
+
+ while (++i < len) {
+ if (val[off + i] == oldChar) {
+ break;
+ }
+ }
+ if (i < len) {
+ char buf[] = new char[len];
+ for (int j = 0 ; j < i ; j++) {
+ buf[j] = val[off+j];
+ }
+ while (i < len) {
+ char c = val[off + i];
+ buf[i] = (c == oldChar) ? newChar : c;
+ i++;
+ }
+ return new String(0, len, buf);
+ }
+ }
+ return this;
+ }
+
+ /**
+ * Tells whether or not this string matches the given regular expression.
+ *
+ * {@link java.util.regex.Pattern}.{@link
+ * java.util.regex.Pattern#matches(String,CharSequence)
+ * matches}(regex, str)
+ *
+ * @param regex
+ * the regular expression to which this string is to be matched
+ *
+ * @return true if, and only if, this string matches the
+ * given regular expression
+ *
+ * @throws PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see java.util.regex.Pattern
+ *
+ * @since 1.4
+ * @spec JSR-51
+ */
+ public boolean matches(String regex) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns true if and only if this string contains the specified
+ * sequence of char values.
+ *
+ * @param s the sequence to search for
+ * @return true if this string contains s
, false otherwise
+ * @throws NullPointerException if s
is null
+ * @since 1.5
+ */
+ public boolean contains(CharSequence s) {
+ return indexOf(s.toString()) > -1;
+ }
+
+ /**
+ * Replaces the first substring of this string that matches the given regular expression with the
+ * given replacement.
+ *
+ *
+ * {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#compile
+ * compile}(regex).{@link
+ * java.util.regex.Pattern#matcher(java.lang.CharSequence)
+ * matcher}(str).{@link java.util.regex.Matcher#replaceFirst
+ * replaceFirst}(repl)
+ *
+ *
+ * {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#compile
+ * compile}(regex).{@link
+ * java.util.regex.Pattern#matcher(java.lang.CharSequence)
+ * matcher}(str).{@link java.util.regex.Matcher#replaceAll
+ * replaceAll}(repl)
+ *
+ *target
or
+ * replacement
is null
.
+ * @since 1.5
+ */
+ public String replace(CharSequence target, CharSequence replacement) {
+ throw new UnsupportedOperationException("This one should be supported, but without dep on rest of regexp");
+ }
+
+ /**
+ * Splits this string around matches of the given
+ * regular expression.
+ *
+ *
+ *
+ *
+ *
+ *
+ * Regex
+ * Limit
+ * Result
+ *
+ * :
+ * 2
+ * { "boo", "and:foo" }
+ * :
+ * 5
+ * { "boo", "and", "foo" }
+ * :
+ * -2
+ * { "boo", "and", "foo" }
+ * o
+ * 5
+ * { "b", "", ":and:f", "", "" }
+ * o
+ * -2
+ * { "b", "", ":and:f", "", "" }
+ * o
+ * 0
+ * { "b", "", ":and:f" }
+ * {@link java.util.regex.Pattern}.{@link java.util.regex.Pattern#compile
+ * compile}(regex).{@link
+ * java.util.regex.Pattern#split(java.lang.CharSequence,int)
+ * split}(str, n)
+ *
+ *
+ *
+ * @param regex
+ * the delimiting regular expression
+ *
+ * @param limit
+ * the result threshold, as described above
+ *
+ * @return the array of strings computed by splitting this string
+ * around matches of the given regular expression
+ *
+ * @throws PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see java.util.regex.Pattern
+ *
+ * @since 1.4
+ * @spec JSR-51
+ */
+ public String[] split(String regex, int limit) {
+ throw new UnsupportedOperationException("Needs regexp");
+ }
+
+ /**
+ * Splits this string around matches of the given regular expression.
+ *
+ *
+ *
+ *
+ * @param regex
+ * the delimiting regular expression
+ *
+ * @return the array of strings computed by splitting this string
+ * around matches of the given regular expression
+ *
+ * @throws PatternSyntaxException
+ * if the regular expression's syntax is invalid
+ *
+ * @see java.util.regex.Pattern
+ *
+ * @since 1.4
+ * @spec JSR-51
+ */
+ public String[] split(String regex) {
+ return split(regex, 0);
+ }
+
+ /**
+ * Converts all of the characters in this
+ *
+ *
+ * Regex
+ * Result
+ *
+ * :
+ * { "boo", "and", "foo" }
+ * o
+ * { "b", "", ":and:f" } String
to lower
+ * case using the rules of the given Locale
. Case mapping is based
+ * on the Unicode Standard version specified by the {@link java.lang.Character Character}
+ * class. Since case mappings are not always 1:1 char mappings, the resulting
+ * String
may be a different length than the original String
.
+ *
+ *
+ *
+ * @param locale use the case transformation rules for this locale
+ * @return the
+ *
+ * Language Code of Locale
+ * Upper Case
+ * Lower Case
+ * Description
+ *
+ *
+ * tr (Turkish)
+ * \u0130
+ * \u0069
+ * capital letter I with dot above -> small letter i
+ *
+ *
+ * tr (Turkish)
+ * \u0049
+ * \u0131
+ * capital letter I -> small letter dotless i
+ *
+ *
+ * (all)
+ * French Fries
+ * french fries
+ * lowercased all chars in String
+ *
+ *
+ * (all)
+ *
+ *
+ *
+ *
+ *
+ *
+ * lowercased all chars in String
+ * String
, converted to lowercase.
+ * @see java.lang.String#toLowerCase()
+ * @see java.lang.String#toUpperCase()
+ * @see java.lang.String#toUpperCase(Locale)
+ * @since 1.1
+ */
+// public String toLowerCase(Locale locale) {
+// if (locale == null) {
+// throw new NullPointerException();
+// }
+//
+// int firstUpper;
+//
+// /* Now check if there are any characters that need to be changed. */
+// scan: {
+// for (firstUpper = 0 ; firstUpper < count; ) {
+// char c = value[offset+firstUpper];
+// if ((c >= Character.MIN_HIGH_SURROGATE) &&
+// (c <= Character.MAX_HIGH_SURROGATE)) {
+// int supplChar = codePointAt(firstUpper);
+// if (supplChar != Character.toLowerCase(supplChar)) {
+// break scan;
+// }
+// firstUpper += Character.charCount(supplChar);
+// } else {
+// if (c != Character.toLowerCase(c)) {
+// break scan;
+// }
+// firstUpper++;
+// }
+// }
+// return this;
+// }
+//
+// char[] result = new char[count];
+// int resultOffset = 0; /* result may grow, so i+resultOffset
+// * is the write location in result */
+//
+// /* Just copy the first few lowerCase characters. */
+// arraycopy(value, offset, result, 0, firstUpper);
+//
+// String lang = locale.getLanguage();
+// boolean localeDependent =
+// (lang == "tr" || lang == "az" || lang == "lt");
+// char[] lowerCharArray;
+// int lowerChar;
+// int srcChar;
+// int srcCount;
+// for (int i = firstUpper; i < count; i += srcCount) {
+// srcChar = (int)value[offset+i];
+// if ((char)srcChar >= Character.MIN_HIGH_SURROGATE &&
+// (char)srcChar <= Character.MAX_HIGH_SURROGATE) {
+// srcChar = codePointAt(i);
+// srcCount = Character.charCount(srcChar);
+// } else {
+// srcCount = 1;
+// }
+// if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
+// lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
+// } else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
+// lowerChar = Character.ERROR;
+// } else {
+// lowerChar = Character.toLowerCase(srcChar);
+// }
+// if ((lowerChar == Character.ERROR) ||
+// (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
+// if (lowerChar == Character.ERROR) {
+// if (!localeDependent && srcChar == '\u0130') {
+// lowerCharArray =
+// ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
+// } else {
+// lowerCharArray =
+// ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
+// }
+// } else if (srcCount == 2) {
+// resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
+// continue;
+// } else {
+// lowerCharArray = Character.toChars(lowerChar);
+// }
+//
+// /* Grow result if needed */
+// int mapLen = lowerCharArray.length;
+// if (mapLen > srcCount) {
+// char[] result2 = new char[result.length + mapLen - srcCount];
+// arraycopy(result, 0, result2, 0,
+// i + resultOffset);
+// result = result2;
+// }
+// for (int x=0; xtoLowerCase(Locale.getDefault())
.
+ * "TITLE".toLowerCase()
in a Turkish locale
+ * returns "t\u005Cu0131tle"
, where '\u005Cu0131' is the
+ * LATIN SMALL LETTER DOTLESS I character.
+ * To obtain correct results for locale insensitive strings, use
+ * toLowerCase(Locale.ENGLISH)
.
+ * String
, converted to lowercase.
+ * @see java.lang.String#toLowerCase(Locale)
+ */
+ public String toLowerCase() {
+ throw new UnsupportedOperationException("Should be supported but without connection to locale");
+ }
+
+ /**
+ * Converts all of the characters in this String
to upper
+ * case using the rules of the given Locale
. Case mapping is based
+ * on the Unicode Standard version specified by the {@link java.lang.Character Character}
+ * class. Since case mappings are not always 1:1 char mappings, the resulting
+ * String
may be a different length than the original String
.
+ *
+ *
+ * @param locale use the case transformation rules for this locale
+ * @return the
+ *
+ * Language Code of Locale
+ * Lower Case
+ * Upper Case
+ * Description
+ *
+ *
+ * tr (Turkish)
+ * \u0069
+ * \u0130
+ * small letter i -> capital letter I with dot above
+ *
+ *
+ * tr (Turkish)
+ * \u0131
+ * \u0049
+ * small letter dotless i -> capital letter I
+ *
+ *
+ * (all)
+ * \u00df
+ * \u0053 \u0053
+ * small letter sharp s -> two letters: SS
+ *
+ *
+ * (all)
+ * Fahrvergnügen
+ * FAHRVERGNÜGEN
+ *
+ * String
, converted to uppercase.
+ * @see java.lang.String#toUpperCase()
+ * @see java.lang.String#toLowerCase()
+ * @see java.lang.String#toLowerCase(Locale)
+ * @since 1.1
+ */
+ /* not for javascript
+ public String toUpperCase(Locale locale) {
+ if (locale == null) {
+ throw new NullPointerException();
+ }
+
+ int firstLower;
+
+ // Now check if there are any characters that need to be changed.
+ scan: {
+ for (firstLower = 0 ; firstLower < count; ) {
+ int c = (int)value[offset+firstLower];
+ int srcCount;
+ if ((c >= Character.MIN_HIGH_SURROGATE) &&
+ (c <= Character.MAX_HIGH_SURROGATE)) {
+ c = codePointAt(firstLower);
+ srcCount = Character.charCount(c);
+ } else {
+ srcCount = 1;
+ }
+ int upperCaseChar = Character.toUpperCaseEx(c);
+ if ((upperCaseChar == Character.ERROR) ||
+ (c != upperCaseChar)) {
+ break scan;
+ }
+ firstLower += srcCount;
+ }
+ return this;
+ }
+
+ char[] result = new char[count]; /* may grow *
+ int resultOffset = 0; /* result may grow, so i+resultOffset
+ * is the write location in result *
+
+ /* Just copy the first few upperCase characters. *
+ arraycopy(value, offset, result, 0, firstLower);
+
+ String lang = locale.getLanguage();
+ boolean localeDependent =
+ (lang == "tr" || lang == "az" || lang == "lt");
+ char[] upperCharArray;
+ int upperChar;
+ int srcChar;
+ int srcCount;
+ for (int i = firstLower; i < count; i += srcCount) {
+ srcChar = (int)value[offset+i];
+ if ((char)srcChar >= Character.MIN_HIGH_SURROGATE &&
+ (char)srcChar <= Character.MAX_HIGH_SURROGATE) {
+ srcChar = codePointAt(i);
+ srcCount = Character.charCount(srcChar);
+ } else {
+ srcCount = 1;
+ }
+ if (localeDependent) {
+ upperChar = ConditionalSpecialCasing.toUpperCaseEx(this, i, locale);
+ } else {
+ upperChar = Character.toUpperCaseEx(srcChar);
+ }
+ if ((upperChar == Character.ERROR) ||
+ (upperChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
+ if (upperChar == Character.ERROR) {
+ if (localeDependent) {
+ upperCharArray =
+ ConditionalSpecialCasing.toUpperCaseCharArray(this, i, locale);
+ } else {
+ upperCharArray = Character.toUpperCaseCharArray(srcChar);
+ }
+ } else if (srcCount == 2) {
+ resultOffset += Character.toChars(upperChar, result, i + resultOffset) - srcCount;
+ continue;
+ } else {
+ upperCharArray = Character.toChars(upperChar);
+ }
+
+ /* Grow result if needed *
+ int mapLen = upperCharArray.length;
+ if (mapLen > srcCount) {
+ char[] result2 = new char[result.length + mapLen - srcCount];
+ arraycopy(result, 0, result2, 0,
+ i + resultOffset);
+ result = result2;
+ }
+ for (int x=0; xtoUpperCase(Locale.getDefault())
.
+ * "title".toUpperCase()
in a Turkish locale
+ * returns "T\u005Cu0130TLE"
, where '\u005Cu0130' is the
+ * LATIN CAPITAL LETTER I WITH DOT ABOVE character.
+ * To obtain correct results for locale insensitive strings, use
+ * toUpperCase(Locale.ENGLISH)
.
+ * String
, converted to uppercase.
+ * @see java.lang.String#toUpperCase(Locale)
+ */
+ public String toUpperCase() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns a copy of the string, with leading and trailing whitespace
+ * omitted.
+ * String
object represents an empty character
+ * sequence, or the first and last characters of character sequence
+ * represented by this String
object both have codes
+ * greater than '\u0020'
(the space character), then a
+ * reference to this String
object is returned.
+ * '\u0020'
in the string, then a new
+ * String
object representing an empty string is created
+ * and returned.
+ * '\u0020'
, and let
+ * m be the index of the last character in the string whose code
+ * is greater than '\u0020'
. A new String
+ * object is created, representing the substring of this string that
+ * begins with the character at index k and ends with the
+ * character at index m-that is, the result of
+ * this.substring(k, m+1)
.
+ * Object
argument.
+ *
+ * @param obj an Object
.
+ * @return if the argument is null
, then a string equal to
+ * "null"
; otherwise, the value of
+ * obj.toString()
is returned.
+ * @see java.lang.Object#toString()
+ */
+ public static String valueOf(Object obj) {
+ return (obj == null) ? "null" : obj.toString();
+ }
+
+ /**
+ * Returns the string representation of the char
array
+ * argument. The contents of the character array are copied; subsequent
+ * modification of the character array does not affect the newly
+ * created string.
+ *
+ * @param data a char
array.
+ * @return a newly allocated string representing the same sequence of
+ * characters contained in the character array argument.
+ */
+ public static String valueOf(char data[]) {
+ return new String(data);
+ }
+
+ /**
+ * Returns the string representation of a specific subarray of the
+ * char
array argument.
+ * offset
argument is the index of the first
+ * character of the subarray. The count
argument
+ * specifies the length of the subarray. The contents of the subarray
+ * are copied; subsequent modification of the character array does not
+ * affect the newly created string.
+ *
+ * @param data the character array.
+ * @param offset the initial offset into the value of the
+ * String
.
+ * @param count the length of the value of the String
.
+ * @return a string representing the sequence of characters contained
+ * in the subarray of the character array argument.
+ * @exception IndexOutOfBoundsException if offset
is
+ * negative, or count
is negative, or
+ * offset+count
is larger than
+ * data.length
.
+ */
+ public static String valueOf(char data[], int offset, int count) {
+ return new String(data, offset, count);
+ }
+
+ /**
+ * Returns a String that represents the character sequence in the
+ * array specified.
+ *
+ * @param data the character array.
+ * @param offset initial offset of the subarray.
+ * @param count length of the subarray.
+ * @return a String
that contains the characters of the
+ * specified subarray of the character array.
+ */
+ public static String copyValueOf(char data[], int offset, int count) {
+ // All public String constructors now copy the data.
+ return new String(data, offset, count);
+ }
+
+ /**
+ * Returns a String that represents the character sequence in the
+ * array specified.
+ *
+ * @param data the character array.
+ * @return a String
that contains the characters of the
+ * character array.
+ */
+ public static String copyValueOf(char data[]) {
+ return copyValueOf(data, 0, data.length);
+ }
+
+ /**
+ * Returns the string representation of the boolean
argument.
+ *
+ * @param b a boolean
.
+ * @return if the argument is true
, a string equal to
+ * "true"
is returned; otherwise, a string equal to
+ * "false"
is returned.
+ */
+ public static String valueOf(boolean b) {
+ return b ? "true" : "false";
+ }
+
+ /**
+ * Returns the string representation of the char
+ * argument.
+ *
+ * @param c a char
.
+ * @return a string of length 1
containing
+ * as its single character the argument c
.
+ */
+ public static String valueOf(char c) {
+ char data[] = {c};
+ return new String(0, 1, data);
+ }
+
+ /**
+ * Returns the string representation of the int
argument.
+ * Integer.toString
method of one argument.
+ *
+ * @param i an int
.
+ * @return a string representation of the int
argument.
+ * @see java.lang.Integer#toString(int, int)
+ */
+ public static String valueOf(int i) {
+ return Integer.toString(i);
+ }
+
+ /**
+ * Returns the string representation of the long
argument.
+ * Long.toString
method of one argument.
+ *
+ * @param l a long
.
+ * @return a string representation of the long
argument.
+ * @see java.lang.Long#toString(long)
+ */
+ public static String valueOf(long l) {
+ return Long.toString(l);
+ }
+
+ /**
+ * Returns the string representation of the float
argument.
+ * Float.toString
method of one argument.
+ *
+ * @param f a float
.
+ * @return a string representation of the float
argument.
+ * @see java.lang.Float#toString(float)
+ */
+ public static String valueOf(float f) {
+ return Float.toString(f);
+ }
+
+ /**
+ * Returns the string representation of the double
argument.
+ * Double.toString
method of one argument.
+ *
+ * @param d a double
.
+ * @return a string representation of the double
argument.
+ * @see java.lang.Double#toString(double)
+ */
+ public static String valueOf(double d) {
+ return Double.toString(d);
+ }
+
+ /**
+ * Returns a canonical representation for the string object.
+ * String
.
+ * String
object as determined by
+ * the {@link #equals(Object)} method, then the string from the pool is
+ * returned. Otherwise, this String
object is added to the
+ * pool and a reference to this String
object is returned.
+ * s
and t
,
+ * s.intern() == t.intern()
is true
+ * if and only if s.equals(t)
is true
.
+ * StringBuffer
are the
+ * append
and insert
methods, which are
+ * overloaded so as to accept data of any type. Each effectively
+ * converts a given datum to a string and then appends or inserts the
+ * characters of that string to the string buffer. The
+ * append
method always adds these characters at the end
+ * of the buffer; the insert
method adds the characters at
+ * a specified point.
+ * z
refers to a string buffer object
+ * whose current contents are "start
", then
+ * the method call z.append("le")
would cause the string
+ * buffer to contain "startle
", whereas
+ * z.insert(4, "le")
would alter the string buffer to
+ * contain "starlet
".
+ * StringBuffer
,
+ * then sb.append(x)
has the same effect as
+ * sb.insert(sb.length(), x)
.
+ * capacity
+ * argument is less than 0
.
+ */
+ public StringBuffer(int capacity) {
+ super(capacity);
+ }
+
+ /**
+ * Constructs a string buffer initialized to the contents of the
+ * specified string. The initial capacity of the string buffer is
+ * 16
plus the length of the string argument.
+ *
+ * @param str the initial contents of the buffer.
+ * @exception NullPointerException if str
is null
+ */
+ public StringBuffer(String str) {
+ super(str.length() + 16);
+ append(str);
+ }
+
+ /**
+ * Constructs a string buffer that contains the same characters
+ * as the specified CharSequence
. The initial capacity of
+ * the string buffer is 16
plus the length of the
+ * CharSequence
argument.
+ * CharSequence
is
+ * less than or equal to zero, then an empty buffer of capacity
+ * 16
is returned.
+ *
+ * @param seq the sequence to copy.
+ * @exception NullPointerException if seq
is null
+ * @since 1.5
+ */
+ public StringBuffer(CharSequence seq) {
+ this(seq.length() + 16);
+ append(seq);
+ }
+
+ public synchronized int length() {
+ return count;
+ }
+
+ public synchronized int capacity() {
+ return value.length;
+ }
+
+
+ public synchronized void ensureCapacity(int minimumCapacity) {
+ if (minimumCapacity > value.length) {
+ expandCapacity(minimumCapacity);
+ }
+ }
+
+ /**
+ * @since 1.5
+ */
+ public synchronized void trimToSize() {
+ super.trimToSize();
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @see #length()
+ */
+ public synchronized void setLength(int newLength) {
+ super.setLength(newLength);
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @see #length()
+ */
+ public synchronized char charAt(int index) {
+ if ((index < 0) || (index >= count))
+ throw new StringIndexOutOfBoundsException(index);
+ return value[index];
+ }
+
+ /**
+ * @since 1.5
+ */
+ public synchronized int codePointAt(int index) {
+ return super.codePointAt(index);
+ }
+
+ /**
+ * @since 1.5
+ */
+ public synchronized int codePointBefore(int index) {
+ return super.codePointBefore(index);
+ }
+
+ /**
+ * @since 1.5
+ */
+ public synchronized int codePointCount(int beginIndex, int endIndex) {
+ return super.codePointCount(beginIndex, endIndex);
+ }
+
+ /**
+ * @since 1.5
+ */
+ public synchronized int offsetByCodePoints(int index, int codePointOffset) {
+ return super.offsetByCodePoints(index, codePointOffset);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public synchronized void getChars(int srcBegin, int srcEnd, char[] dst,
+ int dstBegin)
+ {
+ super.getChars(srcBegin, srcEnd, dst, dstBegin);
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @see #length()
+ */
+ public synchronized void setCharAt(int index, char ch) {
+ if ((index < 0) || (index >= count))
+ throw new StringIndexOutOfBoundsException(index);
+ value[index] = ch;
+ }
+
+ public synchronized StringBuffer append(Object obj) {
+ super.append(String.valueOf(obj));
+ return this;
+ }
+
+ public synchronized StringBuffer append(String str) {
+ super.append(str);
+ return this;
+ }
+
+ /**
+ * Appends the specified StringBuffer to this sequence.
+ * sb
.
+ * this
(the destination)
+ * object but does not synchronize on the source (sb
).
+ *
+ * @param sb the StringBuffer to append.
+ * @return a reference to this object.
+ * @since 1.4
+ */
+ public synchronized StringBuffer append(StringBuffer sb) {
+ super.append(sb);
+ return this;
+ }
+
+
+ /**
+ * Appends the specified CharSequence
to this
+ * sequence.
+ * CharSequence
argument are appended,
+ * in order, increasing the length of this sequence by the length of the
+ * argument.
+ *
+ * s
).
+ *
+ * s
is null
, then the four characters
+ * "null"
are appended.
+ *
+ * @param s the CharSequence
to append.
+ * @return a reference to this object.
+ * @since 1.5
+ */
+ public StringBuffer append(CharSequence s) {
+ // Note, synchronization achieved via other invocations
+ if (s == null)
+ s = "null";
+ if (s instanceof String)
+ return this.append((String)s);
+ if (s instanceof StringBuffer)
+ return this.append((StringBuffer)s);
+ return this.append(s, 0, s.length());
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @since 1.5
+ */
+ public synchronized StringBuffer append(CharSequence s, int start, int end)
+ {
+ super.append(s, start, end);
+ return this;
+ }
+
+ public synchronized StringBuffer append(char[] str) {
+ super.append(str);
+ return this;
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public synchronized StringBuffer append(char[] str, int offset, int len) {
+ super.append(str, offset, len);
+ return this;
+ }
+
+ public synchronized StringBuffer append(boolean b) {
+ super.append(b);
+ return this;
+ }
+
+ public synchronized StringBuffer append(char c) {
+ super.append(c);
+ return this;
+ }
+
+ public synchronized StringBuffer append(int i) {
+ super.append(i);
+ return this;
+ }
+
+ /**
+ * @since 1.5
+ */
+ public synchronized StringBuffer appendCodePoint(int codePoint) {
+ super.appendCodePoint(codePoint);
+ return this;
+ }
+
+ public synchronized StringBuffer append(long lng) {
+ super.append(lng);
+ return this;
+ }
+
+ public synchronized StringBuffer append(float f) {
+ super.append(f);
+ return this;
+ }
+
+ public synchronized StringBuffer append(double d) {
+ super.append(d);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ * @since 1.2
+ */
+ public synchronized StringBuffer delete(int start, int end) {
+ super.delete(start, end);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ * @since 1.2
+ */
+ public synchronized StringBuffer deleteCharAt(int index) {
+ super.deleteCharAt(index);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ * @since 1.2
+ */
+ public synchronized StringBuffer replace(int start, int end, String str) {
+ super.replace(start, end, str);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ * @since 1.2
+ */
+ public synchronized String substring(int start) {
+ return substring(start, count);
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @since 1.4
+ */
+ public synchronized CharSequence subSequence(int start, int end) {
+ return super.substring(start, end);
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ * @since 1.2
+ */
+ public synchronized String substring(int start, int end) {
+ return super.substring(start, end);
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ * @since 1.2
+ */
+ public synchronized StringBuffer insert(int index, char[] str, int offset,
+ int len)
+ {
+ super.insert(index, str, offset, len);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public synchronized StringBuffer insert(int offset, Object obj) {
+ super.insert(offset, String.valueOf(obj));
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public synchronized StringBuffer insert(int offset, String str) {
+ super.insert(offset, str);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public synchronized StringBuffer insert(int offset, char[] str) {
+ super.insert(offset, str);
+ return this;
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @since 1.5
+ */
+ public StringBuffer insert(int dstOffset, CharSequence s) {
+ // Note, synchronization achieved via other invocations
+ if (s == null)
+ s = "null";
+ if (s instanceof String)
+ return this.insert(dstOffset, (String)s);
+ return this.insert(dstOffset, s, 0, s.length());
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ * @since 1.5
+ */
+ public synchronized StringBuffer insert(int dstOffset, CharSequence s,
+ int start, int end)
+ {
+ super.insert(dstOffset, s, start, end);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuffer insert(int offset, boolean b) {
+ return insert(offset, String.valueOf(b));
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public synchronized StringBuffer insert(int offset, char c) {
+ super.insert(offset, c);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuffer insert(int offset, int i) {
+ return insert(offset, String.valueOf(i));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuffer insert(int offset, long l) {
+ return insert(offset, String.valueOf(l));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuffer insert(int offset, float f) {
+ return insert(offset, String.valueOf(f));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuffer insert(int offset, double d) {
+ return insert(offset, String.valueOf(d));
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.4
+ */
+ public int indexOf(String str) {
+ return indexOf(str, 0);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.4
+ */
+ public synchronized int indexOf(String str, int fromIndex) {
+ return String.indexOf(value, 0, count,
+ str.toCharArray(), 0, str.length(), fromIndex);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.4
+ */
+ public int lastIndexOf(String str) {
+ // Note, synchronization achieved via other invocations
+ return lastIndexOf(str, count);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ * @since 1.4
+ */
+ public synchronized int lastIndexOf(String str, int fromIndex) {
+ return String.lastIndexOf(value, 0, count,
+ str.toCharArray(), 0, str.length(), fromIndex);
+ }
+
+ /**
+ * @since JDK1.0.2
+ */
+ public synchronized StringBuffer reverse() {
+ super.reverse();
+ return this;
+ }
+
+ public synchronized String toString() {
+ return new String(value, 0, count);
+ }
+
+// /**
+// * Serializable fields for StringBuffer.
+// *
+// * @serialField value char[]
+// * The backing character array of this StringBuffer.
+// * @serialField count int
+// * The number of characters in this StringBuffer.
+// * @serialField shared boolean
+// * A flag indicating whether the backing array is shared.
+// * The value is ignored upon deserialization.
+// */
+// private static final java.io.ObjectStreamField[] serialPersistentFields =
+// {
+// new java.io.ObjectStreamField("value", char[].class),
+// new java.io.ObjectStreamField("count", Integer.TYPE),
+// new java.io.ObjectStreamField("shared", Boolean.TYPE),
+// };
+//
+// /**
+// * readObject is called to restore the state of the StringBuffer from
+// * a stream.
+// */
+// private synchronized void writeObject(java.io.ObjectOutputStream s)
+// throws java.io.IOException {
+// java.io.ObjectOutputStream.PutField fields = s.putFields();
+// fields.put("value", value);
+// fields.put("count", count);
+// fields.put("shared", false);
+// s.writeFields();
+// }
+//
+// /**
+// * readObject is called to restore the state of the StringBuffer from
+// * a stream.
+// */
+// private void readObject(java.io.ObjectInputStream s)
+// throws java.io.IOException, ClassNotFoundException {
+// java.io.ObjectInputStream.GetField fields = s.readFields();
+// value = (char[])fields.get("value", null);
+// count = fields.get("count", 0);
+// }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/StringBuilder.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/StringBuilder.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,437 @@
+/*
+ * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+
+/**
+ * A mutable sequence of characters. This class provides an API compatible
+ * with StringBuffer
, but with no guarantee of synchronization.
+ * This class is designed for use as a drop-in replacement for
+ * StringBuffer
in places where the string buffer was being
+ * used by a single thread (as is generally the case). Where possible,
+ * it is recommended that this class be used in preference to
+ * StringBuffer
as it will be faster under most implementations.
+ *
+ * StringBuilder
are the
+ * append
and insert
methods, which are
+ * overloaded so as to accept data of any type. Each effectively
+ * converts a given datum to a string and then appends or inserts the
+ * characters of that string to the string builder. The
+ * append
method always adds these characters at the end
+ * of the builder; the insert
method adds the characters at
+ * a specified point.
+ * z
refers to a string builder object
+ * whose current contents are "start
", then
+ * the method call z.append("le")
would cause the string
+ * builder to contain "startle
", whereas
+ * z.insert(4, "le")
would alter the string builder to
+ * contain "starlet
".
+ * StringBuilder
,
+ * then sb.append(x)
has the same effect as
+ * sb.insert(sb.length(), x)
.
+ *
+ * Every string builder has a capacity. As long as the length of the
+ * character sequence contained in the string builder does not exceed
+ * the capacity, it is not necessary to allocate a new internal
+ * buffer. If the internal buffer overflows, it is automatically made larger.
+ *
+ * StringBuilder
are not safe for
+ * use by multiple threads. If such synchronization is required then it is
+ * recommended that {@link java.lang.StringBuffer} be used.
+ *
+ * @author Michael McCloskey
+ * @see java.lang.StringBuffer
+ * @see java.lang.String
+ * @since 1.5
+ */
+public final class StringBuilder
+ extends AbstractStringBuilder
+ implements java.io.Serializable, CharSequence
+{
+
+ /** use serialVersionUID for interoperability */
+ static final long serialVersionUID = 4383685877147921099L;
+
+ /**
+ * Constructs a string builder with no characters in it and an
+ * initial capacity of 16 characters.
+ */
+ public StringBuilder() {
+ super(16);
+ }
+
+ /**
+ * Constructs a string builder with no characters in it and an
+ * initial capacity specified by the capacity
argument.
+ *
+ * @param capacity the initial capacity.
+ * @throws NegativeArraySizeException if the capacity
+ * argument is less than 0
.
+ */
+ public StringBuilder(int capacity) {
+ super(capacity);
+ }
+
+ /**
+ * Constructs a string builder initialized to the contents of the
+ * specified string. The initial capacity of the string builder is
+ * 16
plus the length of the string argument.
+ *
+ * @param str the initial contents of the buffer.
+ * @throws NullPointerException if str
is null
+ */
+ public StringBuilder(String str) {
+ super(str.length() + 16);
+ append(str);
+ }
+
+ /**
+ * Constructs a string builder that contains the same characters
+ * as the specified CharSequence
. The initial capacity of
+ * the string builder is 16
plus the length of the
+ * CharSequence
argument.
+ *
+ * @param seq the sequence to copy.
+ * @throws NullPointerException if seq
is null
+ */
+ public StringBuilder(CharSequence seq) {
+ this(seq.length() + 16);
+ append(seq);
+ }
+
+ public StringBuilder append(Object obj) {
+ return append(String.valueOf(obj));
+ }
+
+ public StringBuilder append(String str) {
+ super.append(str);
+ return this;
+ }
+
+ // Appends the specified string builder to this sequence.
+ private StringBuilder append(StringBuilder sb) {
+ if (sb == null)
+ return append("null");
+ int len = sb.length();
+ int newcount = count + len;
+ if (newcount > value.length)
+ expandCapacity(newcount);
+ sb.getChars(0, len, value, count);
+ count = newcount;
+ return this;
+ }
+
+ /**
+ * Appends the specified StringBuffer to this sequence.
+ * sb
.
+ *
+ * @param sb the StringBuffer to append.
+ * @return a reference to this object.
+ */
+ public StringBuilder append(StringBuffer sb) {
+ super.append(sb);
+ return this;
+ }
+
+ /**
+ */
+ public StringBuilder append(CharSequence s) {
+ if (s == null)
+ s = "null";
+ if (s instanceof String)
+ return this.append((String)s);
+ if (s instanceof StringBuffer)
+ return this.append((StringBuffer)s);
+ if (s instanceof StringBuilder)
+ return this.append((StringBuilder)s);
+ return this.append(s, 0, s.length());
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder append(CharSequence s, int start, int end) {
+ super.append(s, start, end);
+ return this;
+ }
+
+ public StringBuilder append(char[] str) {
+ super.append(str);
+ return this;
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder append(char[] str, int offset, int len) {
+ super.append(str, offset, len);
+ return this;
+ }
+
+ public StringBuilder append(boolean b) {
+ super.append(b);
+ return this;
+ }
+
+ public StringBuilder append(char c) {
+ super.append(c);
+ return this;
+ }
+
+ public StringBuilder append(int i) {
+ super.append(i);
+ return this;
+ }
+
+ public StringBuilder append(long lng) {
+ super.append(lng);
+ return this;
+ }
+
+ public StringBuilder append(float f) {
+ super.append(f);
+ return this;
+ }
+
+ public StringBuilder append(double d) {
+ super.append(d);
+ return this;
+ }
+
+ /**
+ * @since 1.5
+ */
+ public StringBuilder appendCodePoint(int codePoint) {
+ super.appendCodePoint(codePoint);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder delete(int start, int end) {
+ super.delete(start, end);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder deleteCharAt(int index) {
+ super.deleteCharAt(index);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder replace(int start, int end, String str) {
+ super.replace(start, end, str);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int index, char[] str, int offset,
+ int len)
+ {
+ super.insert(index, str, offset, len);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, Object obj) {
+ return insert(offset, String.valueOf(obj));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, String str) {
+ super.insert(offset, str);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, char[] str) {
+ super.insert(offset, str);
+ return this;
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int dstOffset, CharSequence s) {
+ if (s == null)
+ s = "null";
+ if (s instanceof String)
+ return this.insert(dstOffset, (String)s);
+ return this.insert(dstOffset, s, 0, s.length());
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int dstOffset, CharSequence s,
+ int start, int end)
+ {
+ super.insert(dstOffset, s, start, end);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, boolean b) {
+ super.insert(offset, b);
+ return this;
+ }
+
+ /**
+ * @throws IndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, char c) {
+ super.insert(offset, c);
+ return this;
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, int i) {
+ return insert(offset, String.valueOf(i));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, long l) {
+ return insert(offset, String.valueOf(l));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, float f) {
+ return insert(offset, String.valueOf(f));
+ }
+
+ /**
+ * @throws StringIndexOutOfBoundsException {@inheritDoc}
+ */
+ public StringBuilder insert(int offset, double d) {
+ return insert(offset, String.valueOf(d));
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public int indexOf(String str) {
+ return indexOf(str, 0);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public int indexOf(String str, int fromIndex) {
+ return String.indexOf(value, 0, count,
+ str.toCharArray(), 0, str.length(), fromIndex);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public int lastIndexOf(String str) {
+ return lastIndexOf(str, count);
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public int lastIndexOf(String str, int fromIndex) {
+ return String.lastIndexOf(value, 0, count,
+ str.toCharArray(), 0, str.length(), fromIndex);
+ }
+
+ public StringBuilder reverse() {
+ super.reverse();
+ return this;
+ }
+
+ public String toString() {
+ // Create a copy, don't share the array
+ return new String(value, 0, count);
+ }
+
+ /**
+ * Save the state of the StringBuilder instance to a stream
+ * (that is, serialize it).
+ *
+ * @serialData the number of characters currently stored in the string
+ * builder (int), followed by the characters in the
+ * string builder (char[]). The length of the
+ * char array may be greater than the number of
+ * characters currently stored in the string builder, in which
+ * case extra characters are ignored.
+ */
+// private void writeObject(java.io.ObjectOutputStream s)
+// throws java.io.IOException {
+// s.defaultWriteObject();
+// s.writeInt(count);
+// s.writeObject(value);
+// }
+
+ /**
+ * readObject is called to restore the state of the StringBuffer from
+ * a stream.
+ */
+// private void readObject(java.io.ObjectInputStream s)
+// throws java.io.IOException, ClassNotFoundException {
+// s.defaultReadObject();
+// count = s.readInt();
+// value = (char[]) s.readObject();
+// }
+
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/StringIndexOutOfBoundsException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/StringIndexOutOfBoundsException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown by String
methods to indicate that an index
+ * is either negative or greater than the size of the string. For
+ * some methods such as the charAt method, this exception also is
+ * thrown when the index is equal to the size of the string.
+ *
+ * @author unascribed
+ * @see java.lang.String#charAt(int)
+ * @since JDK1.0
+ */
+public
+class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
+ private static final long serialVersionUID = -6762910422159637258L;
+
+ /**
+ * Constructs a StringIndexOutOfBoundsException
with no
+ * detail message.
+ *
+ * @since JDK1.0.
+ */
+ public StringIndexOutOfBoundsException() {
+ super();
+ }
+
+ /**
+ * Constructs a StringIndexOutOfBoundsException
with
+ * the specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public StringIndexOutOfBoundsException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructs a new StringIndexOutOfBoundsException
+ * class with an argument indicating the illegal index.
+ *
+ * @param index the illegal index.
+ */
+ public StringIndexOutOfBoundsException(int index) {
+ super("String index out of range: " + index);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/Throwable.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/Throwable.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,1078 @@
+/*
+ * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+import java.io.*;
+
+/**
+ * The {@code Throwable} class is the superclass of all errors and
+ * exceptions in the Java language. Only objects that are instances of this
+ * class (or one of its subclasses) are thrown by the Java Virtual Machine or
+ * can be thrown by the Java {@code throw} statement. Similarly, only
+ * this class or one of its subclasses can be the argument type in a
+ * {@code catch} clause.
+ *
+ * For the purposes of compile-time checking of exceptions, {@code
+ * Throwable} and any subclass of {@code Throwable} that is not also a
+ * subclass of either {@link RuntimeException} or {@link Error} are
+ * regarded as checked exceptions.
+ *
+ *
+ * {@code new StackTraceElement("", "", null, Integer.MIN_VALUE)}
+ */
+ public static final StackTraceElement STACK_TRACE_ELEMENT_SENTINEL =
+ new StackTraceElement("", "", null, Integer.MIN_VALUE);
+
+ /**
+ * Sentinel value used in the serial form to indicate an immutable
+ * stack trace.
+ */
+ public static final StackTraceElement[] STACK_TRACE_SENTINEL =
+ new StackTraceElement[] {STACK_TRACE_ELEMENT_SENTINEL};
+ }
+
+ /**
+ * A shared value for an empty stack.
+ */
+ private static final StackTraceElement[] UNASSIGNED_STACK = new StackTraceElement[0];
+
+ /*
+ * To allow Throwable objects to be made immutable and safely
+ * reused by the JVM, such as OutOfMemoryErrors, fields of
+ * Throwable that are writable in response to user actions, cause,
+ * stackTrace, and suppressedExceptions obey the following
+ * protocol:
+ *
+ * 1) The fields are initialized to a non-null sentinel value
+ * which indicates the value has logically not been set.
+ *
+ * 2) Writing a null to the field indicates further writes
+ * are forbidden
+ *
+ * 3) The sentinel value may be replaced with another non-null
+ * value.
+ *
+ * For example, implementations of the HotSpot JVM have
+ * preallocated OutOfMemoryError objects to provide for better
+ * diagnosability of that situation. These objects are created
+ * without calling the constructor for that class and the fields
+ * in question are initialized to null. To support this
+ * capability, any new fields added to Throwable that require
+ * being initialized to a non-null value require a coordinated JVM
+ * change.
+ */
+
+ /**
+ * The throwable that caused this throwable to get thrown, or null if this
+ * throwable was not caused by another throwable, or if the causative
+ * throwable is unknown. If this field is equal to this throwable itself,
+ * it indicates that the cause of this throwable has not yet been
+ * initialized.
+ *
+ * @serial
+ * @since 1.4
+ */
+ private Throwable cause = this;
+
+ /**
+ * The stack trace, as returned by {@link #getStackTrace()}.
+ *
+ * The field is initialized to a zero-length array. A {@code
+ * null} value of this field indicates subsequent calls to {@link
+ * #setStackTrace(StackTraceElement[])} and {@link
+ * #fillInStackTrace()} will be be no-ops.
+ *
+ * @serial
+ * @since 1.4
+ */
+ private StackTraceElement[] stackTrace = UNASSIGNED_STACK;
+
+ // Setting this static field introduces an acceptable
+ // initialization dependency on a few java.util classes.
+// I don't think this dependency is acceptable
+// private static final List
+ * try {
+ * lowLevelOp();
+ * } catch (LowLevelException le) {
+ * throw (HighLevelException)
+ * new HighLevelException().initCause(le); // Legacy constructor
+ * }
+ *
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A {@code null} value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @return a reference to this {@code Throwable} instance.
+ * @throws IllegalArgumentException if {@code cause} is this
+ * throwable. (A throwable cannot be its own cause.)
+ * @throws IllegalStateException if this throwable was
+ * created with {@link #Throwable(Throwable)} or
+ * {@link #Throwable(String,Throwable)}, or this method has already
+ * been called on this throwable.
+ * @since 1.4
+ */
+ public synchronized Throwable initCause(Throwable cause) {
+ if (this.cause != this)
+ throw new IllegalStateException("Can't overwrite cause");
+ if (cause == this)
+ throw new IllegalArgumentException("Self-causation not permitted");
+ this.cause = cause;
+ return this;
+ }
+
+ /**
+ * Returns a short description of this throwable.
+ * The result is the concatenation of:
+ *
+ *
+ * If {@code getLocalizedMessage} returns {@code null}, then just
+ * the class name is returned.
+ *
+ * @return a string representation of this throwable.
+ */
+ public String toString() {
+ String s = getClass().getName();
+ String message = getLocalizedMessage();
+ return (message != null) ? (s + ": " + message) : s;
+ }
+
+ /**
+ * Prints this throwable and its backtrace to the
+ * standard error stream. This method prints a stack trace for this
+ * {@code Throwable} object on the error output stream that is
+ * the value of the field {@code System.err}. The first line of
+ * output contains the result of the {@link #toString()} method for
+ * this object. Remaining lines represent data previously recorded by
+ * the method {@link #fillInStackTrace()}. The format of this
+ * information depends on the implementation, but the following
+ * example may be regarded as typical:
+ *
+ * This example was produced by running the program:
+ *
+ * java.lang.NullPointerException
+ * at MyClass.mash(MyClass.java:9)
+ * at MyClass.crunch(MyClass.java:6)
+ * at MyClass.main(MyClass.java:3)
+ *
+ * class MyClass {
+ * public static void main(String[] args) {
+ * crunch(null);
+ * }
+ * static void crunch(int[] a) {
+ * mash(a);
+ * }
+ * static void mash(int[] b) {
+ * System.out.println(b[0]);
+ * }
+ * }
+ *
+ * The backtrace for a throwable with an initialized, non-null cause
+ * should generally include the backtrace for the cause. The format
+ * of this information depends on the implementation, but the following
+ * example may be regarded as typical:
+ *
+ * HighLevelException: MidLevelException: LowLevelException
+ * at Junk.a(Junk.java:13)
+ * at Junk.main(Junk.java:4)
+ * Caused by: MidLevelException: LowLevelException
+ * at Junk.c(Junk.java:23)
+ * at Junk.b(Junk.java:17)
+ * at Junk.a(Junk.java:11)
+ * ... 1 more
+ * Caused by: LowLevelException
+ * at Junk.e(Junk.java:30)
+ * at Junk.d(Junk.java:27)
+ * at Junk.c(Junk.java:21)
+ * ... 3 more
+ *
+ * Note the presence of lines containing the characters {@code "..."}.
+ * These lines indicate that the remainder of the stack trace for this
+ * exception matches the indicated number of frames from the bottom of the
+ * stack trace of the exception that was caused by this exception (the
+ * "enclosing" exception). This shorthand can greatly reduce the length
+ * of the output in the common case where a wrapped exception is thrown
+ * from same method as the "causative exception" is caught. The above
+ * example was produced by running the program:
+ *
+ * public class Junk {
+ * public static void main(String args[]) {
+ * try {
+ * a();
+ * } catch(HighLevelException e) {
+ * e.printStackTrace();
+ * }
+ * }
+ * static void a() throws HighLevelException {
+ * try {
+ * b();
+ * } catch(MidLevelException e) {
+ * throw new HighLevelException(e);
+ * }
+ * }
+ * static void b() throws MidLevelException {
+ * c();
+ * }
+ * static void c() throws MidLevelException {
+ * try {
+ * d();
+ * } catch(LowLevelException e) {
+ * throw new MidLevelException(e);
+ * }
+ * }
+ * static void d() throws LowLevelException {
+ * e();
+ * }
+ * static void e() throws LowLevelException {
+ * throw new LowLevelException();
+ * }
+ * }
+ *
+ * class HighLevelException extends Exception {
+ * HighLevelException(Throwable cause) { super(cause); }
+ * }
+ *
+ * class MidLevelException extends Exception {
+ * MidLevelException(Throwable cause) { super(cause); }
+ * }
+ *
+ * class LowLevelException extends Exception {
+ * }
+ *
+ * As of release 7, the platform supports the notion of
+ * suppressed exceptions (in conjunction with the {@code
+ * try}-with-resources statement). Any exceptions that were
+ * suppressed in order to deliver an exception are printed out
+ * beneath the stack trace. The format of this information
+ * depends on the implementation, but the following example may be
+ * regarded as typical:
+ *
+ *
+ * Exception in thread "main" java.lang.Exception: Something happened
+ * at Foo.bar(Foo.java:10)
+ * at Foo.main(Foo.java:5)
+ * Suppressed: Resource$CloseFailException: Resource ID = 0
+ * at Resource.close(Resource.java:26)
+ * at Foo.bar(Foo.java:9)
+ * ... 1 more
+ *
+ * Note that the "... n more" notation is used on suppressed exceptions
+ * just at it is used on causes. Unlike causes, suppressed exceptions are
+ * indented beyond their "containing exceptions."
+ *
+ *
+ * Exception in thread "main" java.lang.Exception: Main block
+ * at Foo3.main(Foo3.java:7)
+ * Suppressed: Resource$CloseFailException: Resource ID = 2
+ * at Resource.close(Resource.java:26)
+ * at Foo3.main(Foo3.java:5)
+ * Suppressed: Resource$CloseFailException: Resource ID = 1
+ * at Resource.close(Resource.java:26)
+ * at Foo3.main(Foo3.java:5)
+ * Caused by: java.lang.Exception: I did it
+ * at Foo3.main(Foo3.java:8)
+ *
+ * Likewise, a suppressed exception can have a cause:
+ *
+ * Exception in thread "main" java.lang.Exception: Main block
+ * at Foo4.main(Foo4.java:6)
+ * Suppressed: Resource2$CloseFailException: Resource ID = 1
+ * at Resource2.close(Resource2.java:20)
+ * at Foo4.main(Foo4.java:5)
+ * Caused by: java.lang.Exception: Rats, you caught me
+ * at Resource2$CloseFailException.
+ */
+// public void printStackTrace() {
+// printStackTrace(System.err);
+// }
+//
+// /**
+// * Prints this throwable and its backtrace to the specified print stream.
+// *
+// * @param s {@code PrintStream} to use for output
+// */
+// public void printStackTrace(PrintStream s) {
+// printStackTrace(new WrappedPrintStream(s));
+// }
+//
+// private void printStackTrace(PrintStreamOrWriter s) {
+// // Guard against malicious overrides of Throwable.equals by
+// // using a Set with identity equality semantics.
+//// SetVirtualMachineError
with no detail message.
+ */
+ public VirtualMachineError() {
+ super();
+ }
+
+ /**
+ * Constructs a VirtualMachineError
with the specified
+ * detail message.
+ *
+ * @param s the detail message.
+ */
+ public VirtualMachineError(String s) {
+ super(s);
+ }
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/Annotation.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/Annotation.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.annotation;
+
+/**
+ * The common interface extended by all annotation types. Note that an
+ * interface that manually extends this one does not define
+ * an annotation type. Also note that this interface does not itself
+ * define an annotation type.
+ *
+ * More information about annotation types can be found in section 9.6 of
+ * The Java™ Language Specification.
+ *
+ * @author Josh Bloch
+ * @since 1.5
+ */
+public interface Annotation {
+ /**
+ * Returns true if the specified object represents an annotation
+ * that is logically equivalent to this one. In other words,
+ * returns true if the specified object is an instance of the same
+ * annotation type as this instance, all of whose members are equal
+ * to the corresponding member of this annotation, as defined below:
+ *
+ *
+ *
+ * @return true if the specified object represents an annotation
+ * that is logically equivalent to this one, otherwise false
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hash code of this annotation, as defined below:
+ *
+ *
+ *
+ *
+ * @return the hash code of this annotation
+ */
+ int hashCode();
+
+ /**
+ * Returns a string representation of this annotation. The details
+ * of the representation are implementation-dependent, but the following
+ * may be regarded as typical:
+ *
+ * @com.acme.util.Name(first=Alfred, middle=E., last=Neuman)
+ *
+ *
+ * @return a string representation of this annotation
+ */
+ String toString();
+
+ /**
+ * Returns the annotation type of this annotation.
+ */
+ Class extends Annotation> annotationType();
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/Documented.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/Documented.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.annotation;
+
+/**
+ * Indicates that annotations with a type are to be documented by javadoc
+ * and similar tools by default. This type should be used to annotate the
+ * declarations of types whose annotations affect the use of annotated
+ * elements by their clients. If a type declaration is annotated with
+ * Documented, its annotations become part of the public API
+ * of the annotated elements.
+ *
+ * @author Joshua Bloch
+ * @since 1.5
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/ElementType.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/ElementType.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.annotation;
+
+/**
+ * A program element type. The constants of this enumerated type
+ * provide a simple classification of the declared elements in a
+ * Java program.
+ *
+ *
+ * @Target(ElementType.ANNOTATION_TYPE)
+ * public @interface MetaAnnotationType {
+ * ...
+ * }
+ *
+ * This meta-annotation indicates that the declared type is intended solely
+ * for use as a member type in complex annotation type declarations. It
+ * cannot be used to annotate anything directly:
+ *
+ * @Target({})
+ * public @interface MemberType {
+ * ...
+ * }
+ *
+ * It is a compile-time error for a single ElementType constant to
+ * appear more than once in a Target annotation. For example, the
+ * following meta-annotation is illegal:
+ *
+ * @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
+ * public @interface Bogus {
+ * ...
+ * }
+ *
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/lang/annotation/UnsupportedOperationException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/lang/annotation/UnsupportedOperationException.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Thrown to indicate that the requested operation is not supported.cause
is
+ * not automatically incorporated in this exception's detail
+ * message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link Throwable#getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link Throwable#getCause()} method). (A null value
+ * is permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.5
+ */
+ public UnsupportedOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables (for example, {@link
+ * java.security.PrivilegedActionException}).
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link Throwable#getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.5
+ */
+ public UnsupportedOperationException(Throwable cause) {
+ super(cause);
+ }
+
+ static final long serialVersionUID = -1242599979055084673L;
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/java/java/util/Comparator.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/java/java/util/Comparator.java Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util;
+
+/**
+ * A comparison function, which imposes a total ordering on some
+ * collection of objects. Comparators can be passed to a sort method (such
+ * as {@link Collections#sort(List,Comparator) Collections.sort} or {@link
+ * Arrays#sort(Object[],Comparator) Arrays.sort}) to allow precise control
+ * over the sort order. Comparators can also be used to control the order of
+ * certain data structures (such as {@link SortedSet sorted sets} or {@link
+ * SortedMap sorted maps}), or to provide an ordering for collections of
+ * objects that don't have a {@link Comparable natural ordering}.
+ * {(x, y) such that c.compare(x, y) <= 0}.
+ *
The quotient for this total order is:
+ * {(x, y) such that c.compare(x, y) == 0}.
+ *
+ *
+ * It follows immediately from the contract for compare that the
+ * quotient is an equivalence relation on S, and that the
+ * imposed ordering is a total order on S. When we say that
+ * the ordering imposed by c on S is consistent with
+ * equals, we mean that the quotient for the ordering is the equivalence
+ * relation defined by the objects' {@link Object#equals(Object)
+ * equals(Object)} method(s):
+ * {(x, y) such that x.equals(y)}.
+ *
+ * comp1.equals(comp2)
implies that sgn(comp1.compare(o1,
+ * o2))==sgn(comp2.compare(o1, o2)) for every object reference
+ * o1 and o2.true
only if the specified object is also
+ * a comparator and it imposes the same ordering as this
+ * comparator.
+ * @see Object#equals(Object)
+ * @see Object#hashCode()
+ */
+ boolean equals(Object obj);
+}
diff -r 4fca8ddf46de -r ff3f0de0b8a2 emul/src/main/resources/org/apidesign/vm4brwsr/emul/java_lang_String.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/src/main/resources/org/apidesign/vm4brwsr/emul/java_lang_String.js Thu Oct 11 06:16:00 2012 -0700
@@ -0,0 +1,2658 @@
+/* */
+
+
+function java_lang_String_consVAC(arg0,arg1) {
+ arg0.r = arg1.join("");
+}
+
+function java_lang_String_consVACII(self, charArr, off, cnt) {
+ self.r = charArr.slice(off, off + cnt).join("");
+}
+
+function java_lang_String_charAtCI(arg0,arg1) {
+ return arg0.toString().charAt(arg1);
+}
+function java_lang_String_lengthI(arg0) {
+ return arg0.toString().length;
+}
+function java_lang_String_isEmptyZ(arg0) {
+ return arg0.toString().length === 0;
+}
+
+/*
+function java_lang_String_codePointAtII(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: if (stack.pop() < 0) { gt = 12; continue; } // 155 0 11
+ case 4: stack.push(arg1); // 27
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().count); // 180 1 97
+ case 9: if (stack.pop() > stack.pop()) { gt = 21; continue; } // 161 0 12
+ case 12: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 15: stack.push(stack[stack.length - 1]); // 89
+ case 16: stack.push(arg1); // 27
+ case 17: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 20: // 191
+ case 21: stack.push(arg0); // 42
+ case 22: stack.push(stack.pop().value); // 180 1 100
+ case 25: stack.push(arg0); // 42
+ case 26: stack.push(stack.pop().offset); // 180 1 99
+ case 29: stack.push(arg1); // 27
+ case 30: stack.push(stack.pop() + stack.pop()); // 96
+ case 31: stack.push(arg0); // 42
+ case 32: stack.push(stack.pop().offset); // 180 1 99
+ case 35: stack.push(arg0); // 42
+ case 36: stack.push(stack.pop().count); // 180 1 97
+ case 39: stack.push(stack.pop() + stack.pop()); // 96
+ case 40: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Character_codePointAtImplAIACAIAI(v0, v1, v2)); } // 184 1 113
+ case 43: return stack.pop(); // 172
+ }
+}
+function java_lang_String_codePointBeforeII(arg0,arg1) {
+ var arg2;
+ var arg3;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: stack.push(1); // 4
+ case 2: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 3: arg2 = stack.pop(); // 61
+ case 4: stack.push(arg2); // 28
+ case 5: if (stack.pop() < 0) { gt = 16; continue; } // 155 0 11
+ case 8: stack.push(arg2); // 28
+ case 9: stack.push(arg0); // 42
+ case 10: stack.push(stack.pop().count); // 180 1 97
+ case 13: if (stack.pop() > stack.pop()) { gt = 25; continue; } // 161 0 12
+ case 16: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 19: stack.push(stack[stack.length - 1]); // 89
+ case 20: stack.push(arg1); // 27
+ case 21: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 24: // 191
+ case 25: stack.push(arg0); // 42
+ case 26: stack.push(stack.pop().value); // 180 1 100
+ case 29: stack.push(arg0); // 42
+ case 30: stack.push(stack.pop().offset); // 180 1 99
+ case 33: stack.push(arg1); // 27
+ case 34: stack.push(stack.pop() + stack.pop()); // 96
+ case 35: stack.push(arg0); // 42
+ case 36: stack.push(stack.pop().offset); // 180 1 99
+ case 39: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Character_codePointBeforeImplAIACAIAI(v0, v1, v2)); } // 184 1 114
+ case 42: return stack.pop(); // 172
+ }
+}
+function java_lang_String_codePointCountIII(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: if (stack.pop() < 0) { gt = 17; continue; } // 155 0 16
+ case 4: stack.push(arg2); // 28
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().count); // 180 1 97
+ case 9: if (stack.pop() < stack.pop()) { gt = 17; continue; } // 163 0 8
+ case 12: stack.push(arg1); // 27
+ case 13: stack.push(arg2); // 28
+ case 14: if (stack.pop() >= stack.pop()) { gt = 25; continue; } // 164 0 11
+ case 17: stack.push(new java_lang_IndexOutOfBoundsException); // 187 0 194
+ case 20: stack.push(stack[stack.length - 1]); // 89
+ case 21: { java_lang_IndexOutOfBoundsException_consV(stack.pop()); } // 183 1 124
+ case 24: // 191
+ case 25: stack.push(arg0); // 42
+ case 26: stack.push(stack.pop().value); // 180 1 100
+ case 29: stack.push(arg0); // 42
+ case 30: stack.push(stack.pop().offset); // 180 1 99
+ case 33: stack.push(arg1); // 27
+ case 34: stack.push(stack.pop() + stack.pop()); // 96
+ case 35: stack.push(arg2); // 28
+ case 36: stack.push(arg1); // 27
+ case 37: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 38: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Character_codePointCountImplAIACAIAI(v0, v1, v2)); } // 184 1 115
+ case 41: return stack.pop(); // 172
+ }
+}
+function java_lang_String_offsetByCodePointsIII(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(5);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: if (stack.pop() < 0) { gt = 12; continue; } // 155 0 11
+ case 4: stack.push(arg1); // 27
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().count); // 180 1 97
+ case 9: if (stack.pop() >= stack.pop()) { gt = 20; continue; } // 164 0 11
+ case 12: stack.push(new java_lang_IndexOutOfBoundsException); // 187 0 194
+ case 15: stack.push(stack[stack.length - 1]); // 89
+ case 16: { java_lang_IndexOutOfBoundsException_consV(stack.pop()); } // 183 1 124
+ case 19: // 191
+ case 20: stack.push(arg0); // 42
+ case 21: stack.push(stack.pop().value); // 180 1 100
+ case 24: stack.push(arg0); // 42
+ case 25: stack.push(stack.pop().offset); // 180 1 99
+ case 28: stack.push(arg0); // 42
+ case 29: stack.push(stack.pop().count); // 180 1 97
+ case 32: stack.push(arg0); // 42
+ case 33: stack.push(stack.pop().offset); // 180 1 99
+ case 36: stack.push(arg1); // 27
+ case 37: stack.push(stack.pop() + stack.pop()); // 96
+ case 38: stack.push(arg2); // 28
+ case 39: { var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Character_offsetByCodePointsImplAIACAIAIAIAI(v0, v1, v2, v3, v4)); } // 184 1 116
+ case 42: stack.push(arg0); // 42
+ case 43: stack.push(stack.pop().offset); // 180 1 99
+ case 46: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 47: return stack.pop(); // 172
+ }
+}
+*/
+
+// public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
+function java_lang_String_getCharsVIIACAI(arg0,arg1,arg2,arg3,arg4) {
+ var s = arg0.toString();
+ while (arg1 < arg2) {
+ arg3[arg4++] = s[arg1++];
+ }
+}
+
+/*
+function java_lang_String_getBytesVIIABI(arg0,arg1,arg2,arg3,arg4) {
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: if (stack.pop() >= 0) { gt = 13; continue; } // 156 0 12
+ case 4: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 7: stack.push(stack[stack.length - 1]); // 89
+ case 8: stack.push(arg1); // 27
+ case 9: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 12: // 191
+ case 13: stack.push(arg2); // 28
+ case 14: stack.push(arg0); // 42
+ case 15: stack.push(stack.pop().count); // 180 1 97
+ case 18: if (stack.pop() >= stack.pop()) { gt = 30; continue; } // 164 0 12
+ case 21: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 24: stack.push(stack[stack.length - 1]); // 89
+ case 25: stack.push(arg2); // 28
+ case 26: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 29: // 191
+ case 30: stack.push(arg1); // 27
+ case 31: stack.push(arg2); // 28
+ case 32: if (stack.pop() >= stack.pop()) { gt = 46; continue; } // 164 0 14
+ case 35: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 38: stack.push(stack[stack.length - 1]); // 89
+ case 39: stack.push(arg2); // 28
+ case 40: stack.push(arg1); // 27
+ case 41: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 42: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 45: // 191
+ case 46: stack.push(arg4); // 21 4
+ case 48: arg5 = stack.pop() // 54 5
+ case 50: stack.push(arg0); // 42
+ case 51: stack.push(stack.pop().offset); // 180 1 99
+ case 54: stack.push(arg2); // 28
+ case 55: stack.push(stack.pop() + stack.pop()); // 96
+ case 56: arg6 = stack.pop() // 54 6
+ case 58: stack.push(arg0); // 42
+ case 59: stack.push(stack.pop().offset); // 180 1 99
+ case 62: stack.push(arg1); // 27
+ case 63: stack.push(stack.pop() + stack.pop()); // 96
+ case 64: arg7 = stack.pop() // 54 7
+ case 66: stack.push(arg0); // 42
+ case 67: stack.push(stack.pop().value); // 180 1 100
+ case 70: arg8 = stack.pop() // 58 8
+ case 72: stack.push(arg7); // 21 7
+ case 74: stack.push(arg6); // 21 6
+ case 76: if (stack.pop() <= stack.pop()) { gt = 98; continue; } // 162 0 22
+ case 79: stack.push(arg3); // 45
+ case 80: stack.push(arg5); // 21 5
+ case 82: arg5++; // 132 5 1
+ case 85: stack.push(arg8); // 25 8
+ case 87: stack.push(arg7); // 21 7
+ case 89: arg7++; // 132 7 1
+ case 92: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 93: // number conversion // 145
+ case 94: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 84
+ case 95: gt = 72; continue; // 167 255 233
+ case 98: return; // 177
+ }
+}
+function java_lang_String_getBytesABLjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: if (stack.pop()) { gt = 12; continue; } // 199 0 11
+ case 4: stack.push(new java_lang_NullPointerException); // 187 0 198
+ case 7: stack.push(stack[stack.length - 1]); // 89
+ case 8: { java_lang_NullPointerException_consV(stack.pop()); } // 183 1 128
+ case 11: // 191
+ case 12: stack.push(arg1); // 43
+ case 13: stack.push(arg0); // 42
+ case 14: stack.push(stack.pop().value); // 180 1 100
+ case 17: stack.push(arg0); // 42
+ case 18: stack.push(stack.pop().offset); // 180 1 99
+ case 21: stack.push(arg0); // 42
+ case 22: stack.push(stack.pop().count); // 180 1 97
+ case 25: { var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_StringCoding_encodeABLjava_lang_StringACAIAI(v0, v1, v2, v3)); } // 184 1 166
+ case 28: return stack.pop(); // 176
+ }
+}
+function java_lang_String_getBytesABLjava_nio_charset_Charset(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: if (stack.pop()) { gt = 12; continue; } // 199 0 11
+ case 4: stack.push(new java_lang_NullPointerException); // 187 0 198
+ case 7: stack.push(stack[stack.length - 1]); // 89
+ case 8: { java_lang_NullPointerException_consV(stack.pop()); } // 183 1 128
+ case 11: // 191
+ case 12: stack.push(arg1); // 43
+ case 13: stack.push(arg0); // 42
+ case 14: stack.push(stack.pop().value); // 180 1 100
+ case 17: stack.push(arg0); // 42
+ case 18: stack.push(stack.pop().offset); // 180 1 99
+ case 21: stack.push(arg0); // 42
+ case 22: stack.push(stack.pop().count); // 180 1 97
+ case 25: { var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_StringCoding_encodeABLjava_nio_charset_CharsetACAIAI(v0, v1, v2, v3)); } // 184 1 168
+ case 28: return stack.pop(); // 176
+ }
+}
+function java_lang_String_getBytesAB(arg0) {
+ var arg1;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().value); // 180 1 100
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(stack.pop().offset); // 180 1 99
+ case 8: stack.push(arg0); // 42
+ case 9: stack.push(stack.pop().count); // 180 1 97
+ case 12: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_StringCoding_encodeABACAIAI(v0, v1, v2)); } // 184 1 164
+ case 15: return stack.pop(); // 176
+ }
+}
+function java_lang_String_equalsZLjava_lang_Object(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: // 166
+ case 3: // 0
+ case 4: stack.push(2); // 5
+ case 5: stack.push(1); // 4
+ case 6: return stack.pop(); // 172
+ case 7: stack.push(arg1); // 43
+ case 8: stack.push(stack.pop().$instOf_java_lang_String ? 1 : 0); // 193 0 200
+ case 11: if (stack.pop() == 0) { gt = 86; continue; } // 153 0 75
+ case 14: stack.push(arg1); // 43
+ case 15: if(stack[stack.length - 1].$instOf_java_lang_String != 1) throw {}; // 192 0 200
+ case 18: arg2 = stack.pop(); // 77
+ case 19: stack.push(arg0); // 42
+ case 20: stack.push(stack.pop().count); // 180 1 97
+ case 23: arg3 = stack.pop(); // 62
+ case 24: stack.push(arg3); // 29
+ case 25: stack.push(arg2); // 44
+ case 26: stack.push(stack.pop().count); // 180 1 97
+ case 29: if (stack.pop() != stack.pop()) { gt = 86; continue; } // 160 0 57
+ case 32: stack.push(arg0); // 42
+ case 33: stack.push(stack.pop().value); // 180 1 100
+ case 36: arg4 = stack.pop() // 58 4
+ case 38: stack.push(arg2); // 44
+ case 39: stack.push(stack.pop().value); // 180 1 100
+ case 42: arg5 = stack.pop() // 58 5
+ case 44: stack.push(arg0); // 42
+ case 45: stack.push(stack.pop().offset); // 180 1 99
+ case 48: arg6 = stack.pop() // 54 6
+ case 50: stack.push(arg2); // 44
+ case 51: stack.push(stack.pop().offset); // 180 1 99
+ case 54: arg7 = stack.pop() // 54 7
+ case 56: stack.push(arg3); // 29
+ case 57: arg3 += 255; // 132 3 255
+ case 60: if (stack.pop() == 0) { gt = 84; continue; } // 153 0 24
+ case 63: stack.push(arg4); // 25 4
+ case 65: stack.push(arg6); // 21 6
+ case 67: arg6++; // 132 6 1
+ case 70: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 71: stack.push(arg5); // 25 5
+ case 73: stack.push(arg7); // 21 7
+ case 75: arg7++; // 132 7 1
+ case 78: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 79: if (stack.pop() == stack.pop()) { gt = 56; continue; } // 159 255 233
+ case 82: stack.push(0); // 3
+ case 83: return stack.pop(); // 172
+ case 84: stack.push(1); // 4
+ case 85: return stack.pop(); // 172
+ case 86: stack.push(0); // 3
+ case 87: return stack.pop(); // 172
+ }
+}
+function java_lang_String_contentEqualsZLjava_lang_StringBuffer(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: stack.push(stack[stack.length - 1]); // 89
+ case 2: arg2 = stack.pop(); // 77
+ case 3: // 194
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(arg1); // 43
+ case 6: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.contentEqualsZLjava_lang_CharSequence(self, v0)); } // 182 1 146
+ case 9: stack.push(arg2); // 44
+ case 10: // 195
+ case 11: return stack.pop(); // 172
+ case 12: arg3 = stack.pop(); // 78
+ case 13: stack.push(arg2); // 44
+ case 14: // 195
+ case 15: stack.push(arg3); // 45
+ case 16: // 191
+ }
+}
+function java_lang_String_contentEqualsZLjava_lang_CharSequence(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().count); // 180 1 97
+ case 4: stack.push(arg1); // 43
+ case 5: { var self = stack.pop(); stack.push(self.lengthI(self)); } // 185 1 188
+ case 8: // 1
+ case 9: // 0
+ case 10: if (stack.pop() == stack.pop()) { gt = 15; continue; } // 159 0 5
+ case 13: stack.push(0); // 3
+ case 14: return stack.pop(); // 172
+ case 15: stack.push(arg1); // 43
+ case 16: stack.push(stack.pop().$instOf_java_lang_AbstractStringBuilder ? 1 : 0); // 193 0 186
+ case 19: if (stack.pop() == 0) { gt = 77; continue; } // 153 0 58
+ case 22: stack.push(arg0); // 42
+ case 23: stack.push(stack.pop().value); // 180 1 100
+ case 26: arg2 = stack.pop(); // 77
+ case 27: stack.push(arg1); // 43
+ case 28: if(stack[stack.length - 1].$instOf_java_lang_AbstractStringBuilder != 1) throw {}; // 192 0 186
+ case 31: { var self = stack.pop(); stack.push(self.getValueAC(self)); } // 182 1 103
+ case 34: arg3 = stack.pop(); // 78
+ case 35: stack.push(arg0); // 42
+ case 36: stack.push(stack.pop().offset); // 180 1 99
+ case 39: arg4 = stack.pop() // 54 4
+ case 41: stack.push(0); // 3
+ case 42: arg5 = stack.pop() // 54 5
+ case 44: stack.push(arg0); // 42
+ case 45: stack.push(stack.pop().count); // 180 1 97
+ case 48: arg6 = stack.pop() // 54 6
+ case 50: stack.push(arg6); // 21 6
+ case 52: arg6 += 255; // 132 6 255
+ case 55: if (stack.pop() == 0) { gt = 77; continue; } // 153 0 22
+ case 58: stack.push(arg2); // 44
+ case 59: stack.push(arg4); // 21 4
+ case 61: arg4++; // 132 4 1
+ case 64: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 65: stack.push(arg3); // 45
+ case 66: stack.push(arg5); // 21 5
+ case 68: arg5++; // 132 5 1
+ case 71: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 72: if (stack.pop() == stack.pop()) { gt = 50; continue; } // 159 255 234
+ case 75: stack.push(0); // 3
+ case 76: return stack.pop(); // 172
+ case 77: stack.push(arg1); // 43
+ case 78: stack.push(arg0); // 42
+ case 79: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.equalsZLjava_lang_Object(self, v0)); } // 182 1 131
+ case 82: if (stack.pop() == 0) { gt = 87; continue; } // 153 0 5
+ case 85: stack.push(1); // 4
+ case 86: return stack.pop(); // 172
+ case 87: stack.push(arg0); // 42
+ case 88: stack.push(stack.pop().value); // 180 1 100
+ case 91: arg2 = stack.pop(); // 77
+ case 92: stack.push(arg0); // 42
+ case 93: stack.push(stack.pop().offset); // 180 1 99
+ case 96: arg3 = stack.pop(); // 62
+ case 97: stack.push(0); // 3
+ case 98: arg4 = stack.pop() // 54 4
+ case 100: stack.push(arg0); // 42
+ case 101: stack.push(stack.pop().count); // 180 1 97
+ case 104: arg5 = stack.pop() // 54 5
+ case 106: stack.push(arg5); // 21 5
+ case 108: arg5 += 255; // 132 5 255
+ case 111: if (stack.pop() == 0) { gt = 136; continue; } // 153 0 25
+ case 114: stack.push(arg2); // 44
+ case 115: stack.push(arg3); // 29
+ case 116: arg3++; // 132 3 1
+ case 119: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 120: stack.push(arg1); // 43
+ case 121: stack.push(arg4); // 21 4
+ case 123: arg4++; // 132 4 1
+ case 126: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.charAtCI(self, v0)); } // 185 1 189
+ case 129: // 2
+ case 130: // 0
+ case 131: if (stack.pop() == stack.pop()) { gt = 106; continue; } // 159 255 231
+ case 134: stack.push(0); // 3
+ case 135: return stack.pop(); // 172
+ case 136: stack.push(1); // 4
+ case 137: return stack.pop(); // 172
+ }
+}
+function java_lang_String_equalsIgnoreCaseZLjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(6);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: // 166
+ case 3: // 0
+ case 4: stack.push(4); // 7
+ case 5: stack.push(1); // 4
+ case 6: gt = 44; continue; // 167 0 38
+ case 9: stack.push(arg1); // 43
+ case 10: if (!stack.pop()) { gt = 43; continue; } // 198 0 33
+ case 13: stack.push(arg1); // 43
+ case 14: stack.push(stack.pop().count); // 180 1 97
+ case 17: stack.push(arg0); // 42
+ case 18: stack.push(stack.pop().count); // 180 1 97
+ case 21: if (stack.pop() != stack.pop()) { gt = 43; continue; } // 160 0 22
+ case 24: stack.push(arg0); // 42
+ case 25: stack.push(1); // 4
+ case 26: stack.push(0); // 3
+ case 27: stack.push(arg1); // 43
+ case 28: stack.push(0); // 3
+ case 29: stack.push(arg0); // 42
+ case 30: stack.push(stack.pop().count); // 180 1 97
+ case 33: { var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.regionMatchesZZILjava_lang_StringII(self, v0, v1, v2, v3, v4)); } // 182 1 153
+ case 36: if (stack.pop() == 0) { gt = 43; continue; } // 153 0 7
+ case 39: stack.push(1); // 4
+ case 40: gt = 44; continue; // 167 0 4
+ case 43: stack.push(0); // 3
+ case 44: return stack.pop(); // 172
+ }
+}
+function java_lang_String_compareToILjava_lang_String(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+ var arg10;
+ var arg11;
+ var arg12;
+ var arg13;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().count); // 180 1 97
+ case 4: arg2 = stack.pop(); // 61
+ case 5: stack.push(arg1); // 43
+ case 6: stack.push(stack.pop().count); // 180 1 97
+ case 9: arg3 = stack.pop(); // 62
+ case 10: stack.push(arg2); // 28
+ case 11: stack.push(arg3); // 29
+ case 12: { var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Math_minIII(v0, v1)); } // 184 1 127
+ case 15: arg4 = stack.pop() // 54 4
+ case 17: stack.push(arg0); // 42
+ case 18: stack.push(stack.pop().value); // 180 1 100
+ case 21: arg5 = stack.pop() // 58 5
+ case 23: stack.push(arg1); // 43
+ case 24: stack.push(stack.pop().value); // 180 1 100
+ case 27: arg6 = stack.pop() // 58 6
+ case 29: stack.push(arg0); // 42
+ case 30: stack.push(stack.pop().offset); // 180 1 99
+ case 33: arg7 = stack.pop() // 54 7
+ case 35: stack.push(arg1); // 43
+ case 36: stack.push(stack.pop().offset); // 180 1 99
+ case 39: arg8 = stack.pop() // 54 8
+ case 41: stack.push(arg7); // 21 7
+ case 43: stack.push(arg8); // 21 8
+ case 45: if (stack.pop() != stack.pop()) { gt = 102; continue; } // 160 0 57
+ case 48: stack.push(arg7); // 21 7
+ case 50: arg9 = stack.pop() // 54 9
+ case 52: stack.push(arg4); // 21 4
+ case 54: stack.push(arg7); // 21 7
+ case 56: stack.push(stack.pop() + stack.pop()); // 96
+ case 57: arg10 = stack.pop() // 54 10
+ case 59: stack.push(arg9); // 21 9
+ case 61: stack.push(arg10); // 21 10
+ case 63: if (stack.pop() <= stack.pop()) { gt = 99; continue; } // 162 0 36
+ case 66: stack.push(arg5); // 25 5
+ case 68: stack.push(arg9); // 21 9
+ case 70: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 71: arg11 = stack.pop() // 54 11
+ case 73: stack.push(arg6); // 25 6
+ case 75: stack.push(arg9); // 21 9
+ case 77: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 78: arg12 = stack.pop() // 54 12
+ case 80: stack.push(arg11); // 21 11
+ case 82: stack.push(arg12); // 21 12
+ case 84: if (stack.pop() == stack.pop()) { gt = 93; continue; } // 159 0 9
+ case 87: stack.push(arg11); // 21 11
+ case 89: stack.push(arg12); // 21 12
+ case 91: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 92: return stack.pop(); // 172
+ case 93: arg9++; // 132 9 1
+ case 96: gt = 59; continue; // 167 255 219
+ case 99: gt = 146; continue; // 167 0 47
+ case 102: stack.push(arg4); // 21 4
+ case 104: arg4 += 255; // 132 4 255
+ case 107: if (stack.pop() == 0) { gt = 146; continue; } // 153 0 39
+ case 110: stack.push(arg5); // 25 5
+ case 112: stack.push(arg7); // 21 7
+ case 114: arg7++; // 132 7 1
+ case 117: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 118: arg9 = stack.pop() // 54 9
+ case 120: stack.push(arg6); // 25 6
+ case 122: stack.push(arg8); // 21 8
+ case 124: arg8++; // 132 8 1
+ case 127: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 128: arg10 = stack.pop() // 54 10
+ case 130: stack.push(arg9); // 21 9
+ case 132: stack.push(arg10); // 21 10
+ case 134: if (stack.pop() == stack.pop()) { gt = 143; continue; } // 159 0 9
+ case 137: stack.push(arg9); // 21 9
+ case 139: stack.push(arg10); // 21 10
+ case 141: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 142: return stack.pop(); // 172
+ case 143: gt = 102; continue; // 167 255 215
+ case 146: stack.push(arg2); // 28
+ case 147: stack.push(arg3); // 29
+ case 148: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 149: return stack.pop(); // 172
+ }
+}
+function java_lang_String_compareToIgnoreCaseILjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(java_lang_String_CASE_INSENSITIVE_ORDER); // 178 1 102
+ case 3: stack.push(arg0); // 42
+ case 4: stack.push(arg1); // 43
+ case 5: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.compareILjava_lang_ObjectLjava_lang_Object(self, v0, v1)); } // 185 1 190
+ case 8: stack.push(0); // 3
+ case 9: // 0
+ case 10: return stack.pop(); // 172
+ }
+}
+function java_lang_String_regionMatchesZILjava_lang_StringII(arg0,arg1,arg2,arg3,arg4) {
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+;
+ var stack = new Array(6);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().value); // 180 1 100
+ case 4: arg5 = stack.pop() // 58 5
+ case 6: stack.push(arg0); // 42
+ case 7: stack.push(stack.pop().offset); // 180 1 99
+ case 10: stack.push(arg1); // 27
+ case 11: stack.push(stack.pop() + stack.pop()); // 96
+ case 12: arg6 = stack.pop() // 54 6
+ case 14: stack.push(arg2); // 44
+ case 15: stack.push(stack.pop().value); // 180 1 100
+ case 18: arg7 = stack.pop() // 58 7
+ case 20: stack.push(arg2); // 44
+ case 21: stack.push(stack.pop().offset); // 180 1 99
+ case 24: stack.push(arg3); // 29
+ case 25: stack.push(stack.pop() + stack.pop()); // 96
+ case 26: arg8 = stack.pop() // 54 8
+ case 28: stack.push(arg3); // 29
+ case 29: if (stack.pop() < 0) { gt = 66; continue; } // 155 0 37
+ case 32: stack.push(arg1); // 27
+ case 33: if (stack.pop() < 0) { gt = 66; continue; } // 155 0 33
+ case 36: stack.push(arg1); // 27
+ case 37: // number conversion // 133
+ case 38: stack.push(arg0); // 42
+ case 39: stack.push(stack.pop().count); // 180 1 97
+ case 42: // number conversion // 133
+ case 43: stack.push(arg4); // 21 4
+ case 45: // number conversion // 133
+ case 46: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 101
+ case 47: { var delta = stack.pop() - stack.pop(); stack.push(delta < 0 ?-1 : (delta == 0 ? 0 : 1)); } // 148
+ case 48: if (stack.pop() > 0) { gt = 66; continue; } // 157 0 18
+ case 51: stack.push(arg3); // 29
+ case 52: // number conversion // 133
+ case 53: stack.push(arg2); // 44
+ case 54: stack.push(stack.pop().count); // 180 1 97
+ case 57: // number conversion // 133
+ case 58: stack.push(arg4); // 21 4
+ case 60: // number conversion // 133
+ case 61: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 101
+ case 62: { var delta = stack.pop() - stack.pop(); stack.push(delta < 0 ?-1 : (delta == 0 ? 0 : 1)); } // 148
+ case 63: if (stack.pop() <= 0) { gt = 68; continue; } // 158 0 5
+ case 66: stack.push(0); // 3
+ case 67: return stack.pop(); // 172
+ case 68: stack.push(arg4); // 21 4
+ case 70: arg4 += 255; // 132 4 255
+ case 73: if (stack.pop() <= 0) { gt = 97; continue; } // 158 0 24
+ case 76: stack.push(arg5); // 25 5
+ case 78: stack.push(arg6); // 21 6
+ case 80: arg6++; // 132 6 1
+ case 83: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 84: stack.push(arg7); // 25 7
+ case 86: stack.push(arg8); // 21 8
+ case 88: arg8++; // 132 8 1
+ case 91: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 92: if (stack.pop() == stack.pop()) { gt = 68; continue; } // 159 255 232
+ case 95: stack.push(0); // 3
+ case 96: return stack.pop(); // 172
+ case 97: stack.push(1); // 4
+ case 98: return stack.pop(); // 172
+ }
+}
+function java_lang_String_regionMatchesZZILjava_lang_StringII(arg0,arg1,arg2,arg3,arg4,arg5) {
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+ var arg10;
+ var arg11;
+ var arg12;
+ var arg13;
+ var arg14;
+;
+ var stack = new Array(6);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().value); // 180 1 100
+ case 4: arg6 = stack.pop() // 58 6
+ case 6: stack.push(arg0); // 42
+ case 7: stack.push(stack.pop().offset); // 180 1 99
+ case 10: stack.push(arg2); // 28
+ case 11: stack.push(stack.pop() + stack.pop()); // 96
+ case 12: arg7 = stack.pop() // 54 7
+ case 14: stack.push(arg3); // 45
+ case 15: stack.push(stack.pop().value); // 180 1 100
+ case 18: arg8 = stack.pop() // 58 8
+ case 20: stack.push(arg3); // 45
+ case 21: stack.push(stack.pop().offset); // 180 1 99
+ case 24: stack.push(arg4); // 21 4
+ case 26: stack.push(stack.pop() + stack.pop()); // 96
+ case 27: arg9 = stack.pop() // 54 9
+ case 29: stack.push(arg4); // 21 4
+ case 31: if (stack.pop() < 0) { gt = 69; continue; } // 155 0 38
+ case 34: stack.push(arg2); // 28
+ case 35: if (stack.pop() < 0) { gt = 69; continue; } // 155 0 34
+ case 38: stack.push(arg2); // 28
+ case 39: // number conversion // 133
+ case 40: stack.push(arg0); // 42
+ case 41: stack.push(stack.pop().count); // 180 1 97
+ case 44: // number conversion // 133
+ case 45: stack.push(arg5); // 21 5
+ case 47: // number conversion // 133
+ case 48: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 101
+ case 49: { var delta = stack.pop() - stack.pop(); stack.push(delta < 0 ?-1 : (delta == 0 ? 0 : 1)); } // 148
+ case 50: if (stack.pop() > 0) { gt = 69; continue; } // 157 0 19
+ case 53: stack.push(arg4); // 21 4
+ case 55: // number conversion // 133
+ case 56: stack.push(arg3); // 45
+ case 57: stack.push(stack.pop().count); // 180 1 97
+ case 60: // number conversion // 133
+ case 61: stack.push(arg5); // 21 5
+ case 63: // number conversion // 133
+ case 64: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 101
+ case 65: { var delta = stack.pop() - stack.pop(); stack.push(delta < 0 ?-1 : (delta == 0 ? 0 : 1)); } // 148
+ case 66: if (stack.pop() <= 0) { gt = 71; continue; } // 158 0 5
+ case 69: stack.push(0); // 3
+ case 70: return stack.pop(); // 172
+ case 71: stack.push(arg5); // 21 5
+ case 73: arg5 += 255; // 132 5 255
+ case 76: if (stack.pop() <= 0) { gt = 155; continue; } // 158 0 79
+ case 79: stack.push(arg6); // 25 6
+ case 81: stack.push(arg7); // 21 7
+ case 83: arg7++; // 132 7 1
+ case 86: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 87: arg10 = stack.pop() // 54 10
+ case 89: stack.push(arg8); // 25 8
+ case 91: stack.push(arg9); // 21 9
+ case 93: arg9++; // 132 9 1
+ case 96: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 97: arg11 = stack.pop() // 54 11
+ case 99: stack.push(arg10); // 21 10
+ case 101: stack.push(arg11); // 21 11
+ case 103: if (stack.pop() != stack.pop()) { gt = 109; continue; } // 160 0 6
+ case 106: gt = 71; continue; // 167 255 221
+ case 109: stack.push(arg1); // 27
+ case 110: if (stack.pop() == 0) { gt = 153; continue; } // 153 0 43
+ case 113: stack.push(arg10); // 21 10
+ case 115: { var v0 = stack.pop(); stack.push(java_lang_Character_toUpperCaseCC(v0)); } // 184 1 105
+ case 118: arg12 = stack.pop() // 54 12
+ case 120: stack.push(arg11); // 21 11
+ case 122: { var v0 = stack.pop(); stack.push(java_lang_Character_toUpperCaseCC(v0)); } // 184 1 105
+ case 125: arg13 = stack.pop() // 54 13
+ case 127: stack.push(arg12); // 21 12
+ case 129: stack.push(arg13); // 21 13
+ case 131: if (stack.pop() != stack.pop()) { gt = 137; continue; } // 160 0 6
+ case 134: gt = 71; continue; // 167 255 193
+ case 137: stack.push(arg12); // 21 12
+ case 139: { var v0 = stack.pop(); stack.push(java_lang_Character_toLowerCaseCC(v0)); } // 184 1 104
+ case 142: stack.push(arg13); // 21 13
+ case 144: { var v0 = stack.pop(); stack.push(java_lang_Character_toLowerCaseCC(v0)); } // 184 1 104
+ case 147: if (stack.pop() != stack.pop()) { gt = 153; continue; } // 160 0 6
+ case 150: gt = 71; continue; // 167 255 177
+ case 153: stack.push(0); // 3
+ case 154: return stack.pop(); // 172
+ case 155: stack.push(1); // 4
+ case 156: return stack.pop(); // 172
+ }
+}
+function java_lang_String_startsWithZLjava_lang_StringI(arg0,arg1,arg2) {
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().value); // 180 1 100
+ case 4: arg3 = stack.pop(); // 78
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().offset); // 180 1 99
+ case 9: stack.push(arg2); // 28
+ case 10: stack.push(stack.pop() + stack.pop()); // 96
+ case 11: arg4 = stack.pop() // 54 4
+ case 13: stack.push(arg1); // 43
+ case 14: stack.push(stack.pop().value); // 180 1 100
+ case 17: arg5 = stack.pop() // 58 5
+ case 19: stack.push(arg1); // 43
+ case 20: stack.push(stack.pop().offset); // 180 1 99
+ case 23: arg6 = stack.pop() // 54 6
+ case 25: stack.push(arg1); // 43
+ case 26: stack.push(stack.pop().count); // 180 1 97
+ case 29: arg7 = stack.pop() // 54 7
+ case 31: stack.push(arg2); // 28
+ case 32: if (stack.pop() < 0) { gt = 46; continue; } // 155 0 14
+ case 35: stack.push(arg2); // 28
+ case 36: stack.push(arg0); // 42
+ case 37: stack.push(stack.pop().count); // 180 1 97
+ case 40: stack.push(arg7); // 21 7
+ case 42: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 43: if (stack.pop() >= stack.pop()) { gt = 48; continue; } // 164 0 5
+ case 46: stack.push(0); // 3
+ case 47: return stack.pop(); // 172
+ case 48: arg7 += 255; // 132 7 255
+ case 51: stack.push(arg7); // 21 7
+ case 53: if (stack.pop() < 0) { gt = 76; continue; } // 155 0 23
+ case 56: stack.push(arg3); // 45
+ case 57: stack.push(arg4); // 21 4
+ case 59: arg4++; // 132 4 1
+ case 62: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 63: stack.push(arg5); // 25 5
+ case 65: stack.push(arg6); // 21 6
+ case 67: arg6++; // 132 6 1
+ case 70: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 71: if (stack.pop() == stack.pop()) { gt = 48; continue; } // 159 255 233
+ case 74: stack.push(0); // 3
+ case 75: return stack.pop(); // 172
+ case 76: stack.push(1); // 4
+ case 77: return stack.pop(); // 172
+ }
+}
+function java_lang_String_startsWithZLjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: stack.push(0); // 3
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.startsWithZLjava_lang_StringI(self, v0, v1)); } // 182 1 152
+ case 6: return stack.pop(); // 172
+ }
+}
+function java_lang_String_endsWithZLjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: stack.push(arg0); // 42
+ case 3: stack.push(stack.pop().count); // 180 1 97
+ case 6: stack.push(arg1); // 43
+ case 7: stack.push(stack.pop().count); // 180 1 97
+ case 10: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 11: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.startsWithZLjava_lang_StringI(self, v0, v1)); } // 182 1 152
+ case 14: return stack.pop(); // 172
+ }
+}
+function java_lang_String_hashCodeI(arg0) {
+ var arg1;
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().hash); // 180 1 98
+ case 4: arg1 = stack.pop(); // 60
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().count); // 180 1 97
+ case 9: arg2 = stack.pop(); // 61
+ case 10: stack.push(arg1); // 27
+ case 11: if (stack.pop() != 0) { gt = 62; continue; } // 154 0 51
+ case 14: stack.push(arg2); // 28
+ case 15: if (stack.pop() <= 0) { gt = 62; continue; } // 158 0 47
+ case 18: stack.push(arg0); // 42
+ case 19: stack.push(stack.pop().offset); // 180 1 99
+ case 22: arg3 = stack.pop(); // 62
+ case 23: stack.push(arg0); // 42
+ case 24: stack.push(stack.pop().value); // 180 1 100
+ case 27: arg4 = stack.pop() // 58 4
+ case 29: stack.push(0); // 3
+ case 30: arg5 = stack.pop() // 54 5
+ case 32: stack.push(arg5); // 21 5
+ case 34: stack.push(arg2); // 28
+ case 35: if (stack.pop() <= stack.pop()) { gt = 57; continue; } // 162 0 22
+ case 38: stack.push(31); // 16 31
+ case 40: stack.push(arg1); // 27
+ case 41: stack.push(stack.pop() * stack.pop()); // 104
+ case 42: stack.push(arg4); // 25 4
+ case 44: stack.push(arg3); // 29
+ case 45: arg3++; // 132 3 1
+ case 48: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 49: stack.push(stack.pop() + stack.pop()); // 96
+ case 50: arg1 = stack.pop(); // 60
+ case 51: arg5++; // 132 5 1
+ case 54: gt = 32; continue; // 167 255 234
+ case 57: stack.push(arg0); // 42
+ case 58: stack.push(arg1); // 27
+ case 59: { var v = stack.pop(); stack.pop().hash = v; } // 181 1 98
+ case 62: stack.push(arg1); // 27
+ case 63: return stack.pop(); // 172
+ }
+}
+function java_lang_String_indexOfII(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 27
+ case 2: stack.push(0); // 3
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.indexOfIII(self, v0, v1)); } // 182 1 135
+ case 6: return stack.pop(); // 172
+ }
+}
+function java_lang_String_indexOfIII(arg0,arg1,arg2) {
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().offset); // 180 1 99
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(stack.pop().count); // 180 1 97
+ case 8: stack.push(stack.pop() + stack.pop()); // 96
+ case 9: arg3 = stack.pop(); // 62
+ case 10: stack.push(arg0); // 42
+ case 11: stack.push(stack.pop().value); // 180 1 100
+ case 14: arg4 = stack.pop() // 58 4
+ case 16: stack.push(arg2); // 28
+ case 17: if (stack.pop() >= 0) { gt = 25; continue; } // 156 0 8
+ case 20: stack.push(0); // 3
+ case 21: arg2 = stack.pop(); // 61
+ case 22: gt = 35; continue; // 167 0 13
+ case 25: stack.push(arg2); // 28
+ case 26: stack.push(arg0); // 42
+ case 27: stack.push(stack.pop().count); // 180 1 97
+ case 30: if (stack.pop() > stack.pop()) { gt = 35; continue; } // 161 0 5
+ case 33: // 2
+ case 34: return stack.pop(); // 172
+ case 35: stack.push(arg0); // 42
+ case 36: stack.push(stack.pop().offset); // 180 1 99
+ case 39: stack.push(arg2); // 28
+ case 40: stack.push(stack.pop() + stack.pop()); // 96
+ case 41: arg5 = stack.pop() // 54 5
+ case 43: stack.push(arg1); // 27
+ case 44: stack.push(65536); // 18 3
+ case 46: if (stack.pop() <= stack.pop()) { gt = 80; continue; } // 162 0 34
+ case 49: stack.push(arg5); // 21 5
+ case 51: stack.push(arg3); // 29
+ case 52: if (stack.pop() <= stack.pop()) { gt = 78; continue; } // 162 0 26
+ case 55: stack.push(arg4); // 25 4
+ case 57: stack.push(arg5); // 21 5
+ case 59: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 60: stack.push(arg1); // 27
+ case 61: if (stack.pop() != stack.pop()) { gt = 72; continue; } // 160 0 11
+ case 64: stack.push(arg5); // 21 5
+ case 66: stack.push(arg0); // 42
+ case 67: stack.push(stack.pop().offset); // 180 1 99
+ case 70: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 71: return stack.pop(); // 172
+ case 72: arg5++; // 132 5 1
+ case 75: gt = 49; continue; // 167 255 230
+ case 78: // 2
+ case 79: return stack.pop(); // 172
+ case 80: stack.push(arg1); // 27
+ case 81: stack.push(1114111); // 18 4
+ case 83: if (stack.pop() < stack.pop()) { gt = 149; continue; } // 163 0 66
+ case 86: stack.push(arg1); // 27
+ case 87: { var v0 = stack.pop(); stack.push(java_lang_Character_toCharsACI(v0)); } // 184 1 109
+ case 90: arg6 = stack.pop() // 58 6
+ case 92: stack.push(arg5); // 21 5
+ case 94: stack.push(arg3); // 29
+ case 95: if (stack.pop() <= stack.pop()) { gt = 149; continue; } // 162 0 54
+ case 98: stack.push(arg4); // 25 4
+ case 100: stack.push(arg5); // 21 5
+ case 102: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 103: stack.push(arg6); // 25 6
+ case 105: stack.push(0); // 3
+ case 106: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 107: if (stack.pop() != stack.pop()) { gt = 143; continue; } // 160 0 36
+ case 110: stack.push(arg5); // 21 5
+ case 112: stack.push(1); // 4
+ case 113: stack.push(stack.pop() + stack.pop()); // 96
+ case 114: stack.push(arg3); // 29
+ case 115: if (stack.pop() != stack.pop()) { gt = 121; continue; } // 160 0 6
+ case 118: gt = 149; continue; // 167 0 31
+ case 121: stack.push(arg4); // 25 4
+ case 123: stack.push(arg5); // 21 5
+ case 125: stack.push(1); // 4
+ case 126: stack.push(stack.pop() + stack.pop()); // 96
+ case 127: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 128: stack.push(arg6); // 25 6
+ case 130: stack.push(1); // 4
+ case 131: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 132: if (stack.pop() != stack.pop()) { gt = 143; continue; } // 160 0 11
+ case 135: stack.push(arg5); // 21 5
+ case 137: stack.push(arg0); // 42
+ case 138: stack.push(stack.pop().offset); // 180 1 99
+ case 141: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 142: return stack.pop(); // 172
+ case 143: arg5++; // 132 5 1
+ case 146: gt = 92; continue; // 167 255 202
+ case 149: // 2
+ case 150: return stack.pop(); // 172
+ }
+}
+function java_lang_String_lastIndexOfII(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(4);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 27
+ case 2: stack.push(arg0); // 42
+ case 3: stack.push(stack.pop().count); // 180 1 97
+ case 6: stack.push(1); // 4
+ case 7: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 8: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.lastIndexOfIII(self, v0, v1)); } // 182 1 136
+ case 11: return stack.pop(); // 172
+ }
+}
+function java_lang_String_lastIndexOfIII(arg0,arg1,arg2) {
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().offset); // 180 1 99
+ case 4: arg3 = stack.pop(); // 62
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().value); // 180 1 100
+ case 9: arg4 = stack.pop() // 58 4
+ case 11: stack.push(arg0); // 42
+ case 12: stack.push(stack.pop().offset); // 180 1 99
+ case 15: stack.push(arg2); // 28
+ case 16: stack.push(arg0); // 42
+ case 17: stack.push(stack.pop().count); // 180 1 97
+ case 20: if (stack.pop() > stack.pop()) { gt = 32; continue; } // 161 0 12
+ case 23: stack.push(arg0); // 42
+ case 24: stack.push(stack.pop().count); // 180 1 97
+ case 27: stack.push(1); // 4
+ case 28: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 29: gt = 33; continue; // 167 0 4
+ case 32: stack.push(arg2); // 28
+ case 33: stack.push(stack.pop() + stack.pop()); // 96
+ case 34: arg5 = stack.pop() // 54 5
+ case 36: stack.push(arg1); // 27
+ case 37: stack.push(65536); // 18 3
+ case 39: if (stack.pop() <= stack.pop()) { gt = 73; continue; } // 162 0 34
+ case 42: stack.push(arg5); // 21 5
+ case 44: stack.push(arg3); // 29
+ case 45: if (stack.pop() > stack.pop()) { gt = 71; continue; } // 161 0 26
+ case 48: stack.push(arg4); // 25 4
+ case 50: stack.push(arg5); // 21 5
+ case 52: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 53: stack.push(arg1); // 27
+ case 54: if (stack.pop() != stack.pop()) { gt = 65; continue; } // 160 0 11
+ case 57: stack.push(arg5); // 21 5
+ case 59: stack.push(arg0); // 42
+ case 60: stack.push(stack.pop().offset); // 180 1 99
+ case 63: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 64: return stack.pop(); // 172
+ case 65: arg5 += 255; // 132 5 255
+ case 68: gt = 42; continue; // 167 255 230
+ case 71: // 2
+ case 72: return stack.pop(); // 172
+ case 73: stack.push(arg0); // 42
+ case 74: stack.push(stack.pop().offset); // 180 1 99
+ case 77: stack.push(arg0); // 42
+ case 78: stack.push(stack.pop().count); // 180 1 97
+ case 81: stack.push(stack.pop() + stack.pop()); // 96
+ case 82: arg6 = stack.pop() // 54 6
+ case 84: stack.push(arg1); // 27
+ case 85: stack.push(1114111); // 18 4
+ case 87: if (stack.pop() < stack.pop()) { gt = 154; continue; } // 163 0 67
+ case 90: stack.push(arg1); // 27
+ case 91: { var v0 = stack.pop(); stack.push(java_lang_Character_toCharsACI(v0)); } // 184 1 109
+ case 94: arg7 = stack.pop() // 58 7
+ case 96: stack.push(arg5); // 21 5
+ case 98: stack.push(arg3); // 29
+ case 99: if (stack.pop() > stack.pop()) { gt = 154; continue; } // 161 0 55
+ case 102: stack.push(arg4); // 25 4
+ case 104: stack.push(arg5); // 21 5
+ case 106: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 107: stack.push(arg7); // 25 7
+ case 109: stack.push(0); // 3
+ case 110: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 111: if (stack.pop() != stack.pop()) { gt = 148; continue; } // 160 0 37
+ case 114: stack.push(arg5); // 21 5
+ case 116: stack.push(1); // 4
+ case 117: stack.push(stack.pop() + stack.pop()); // 96
+ case 118: stack.push(arg6); // 21 6
+ case 120: if (stack.pop() != stack.pop()) { gt = 126; continue; } // 160 0 6
+ case 123: gt = 154; continue; // 167 0 31
+ case 126: stack.push(arg4); // 25 4
+ case 128: stack.push(arg5); // 21 5
+ case 130: stack.push(1); // 4
+ case 131: stack.push(stack.pop() + stack.pop()); // 96
+ case 132: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 133: stack.push(arg7); // 25 7
+ case 135: stack.push(1); // 4
+ case 136: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 137: if (stack.pop() != stack.pop()) { gt = 148; continue; } // 160 0 11
+ case 140: stack.push(arg5); // 21 5
+ case 142: stack.push(arg0); // 42
+ case 143: stack.push(stack.pop().offset); // 180 1 99
+ case 146: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 147: return stack.pop(); // 172
+ case 148: arg5 += 255; // 132 5 255
+ case 151: gt = 96; continue; // 167 255 201
+ case 154: // 2
+ case 155: return stack.pop(); // 172
+ }
+}
+function java_lang_String_indexOfILjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: stack.push(0); // 3
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.indexOfILjava_lang_StringI(self, v0, v1)); } // 182 1 150
+ case 6: return stack.pop(); // 172
+ }
+}
+function java_lang_String_indexOfILjava_lang_StringI(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(7);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().value); // 180 1 100
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(stack.pop().offset); // 180 1 99
+ case 8: stack.push(arg0); // 42
+ case 9: stack.push(stack.pop().count); // 180 1 97
+ case 12: stack.push(arg1); // 43
+ case 13: stack.push(stack.pop().value); // 180 1 100
+ case 16: stack.push(arg1); // 43
+ case 17: stack.push(stack.pop().offset); // 180 1 99
+ case 20: stack.push(arg1); // 43
+ case 21: stack.push(stack.pop().count); // 180 1 97
+ case 24: stack.push(arg2); // 28
+ case 25: { var v6 = stack.pop(); var v5 = stack.pop(); var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_String_indexOfAIACAIAIACAIAIAI(v0, v1, v2, v3, v4, v5, v6)); } // 184 1 144
+ case 28: return stack.pop(); // 172
+ }
+}
+function java_lang_String_indexOfIACIIACIII(arg0,arg1,arg2,arg3,arg4,arg5,arg6) {
+ var arg7;
+ var arg8;
+ var arg9;
+ var arg10;
+ var arg11;
+ var arg12;
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg6); // 21 6
+ case 2: stack.push(arg2); // 28
+ case 3: if (stack.pop() > stack.pop()) { gt = 17; continue; } // 161 0 14
+ case 6: stack.push(arg5); // 21 5
+ case 8: if (stack.pop() != 0) { gt = 15; continue; } // 154 0 7
+ case 11: stack.push(arg2); // 28
+ case 12: gt = 16; continue; // 167 0 4
+ case 15: // 2
+ case 16: return stack.pop(); // 172
+ case 17: stack.push(arg6); // 21 6
+ case 19: if (stack.pop() >= 0) { gt = 25; continue; } // 156 0 6
+ case 22: stack.push(0); // 3
+ case 23: arg6 = stack.pop() // 54 6
+ case 25: stack.push(arg5); // 21 5
+ case 27: if (stack.pop() != 0) { gt = 33; continue; } // 154 0 6
+ case 30: stack.push(arg6); // 21 6
+ case 32: return stack.pop(); // 172
+ case 33: stack.push(arg3); // 45
+ case 34: stack.push(arg4); // 21 4
+ case 36: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 37: arg7 = stack.pop() // 54 7
+ case 39: stack.push(arg1); // 27
+ case 40: stack.push(arg2); // 28
+ case 41: stack.push(arg5); // 21 5
+ case 43: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 44: stack.push(stack.pop() + stack.pop()); // 96
+ case 45: arg8 = stack.pop() // 54 8
+ case 47: stack.push(arg1); // 27
+ case 48: stack.push(arg6); // 21 6
+ case 50: stack.push(stack.pop() + stack.pop()); // 96
+ case 51: arg9 = stack.pop() // 54 9
+ case 53: stack.push(arg9); // 21 9
+ case 55: stack.push(arg8); // 21 8
+ case 57: if (stack.pop() < stack.pop()) { gt = 164; continue; } // 163 0 107
+ case 60: stack.push(arg0); // 42
+ case 61: stack.push(arg9); // 21 9
+ case 63: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 64: stack.push(arg7); // 21 7
+ case 66: if (stack.pop() == stack.pop()) { gt = 91; continue; } // 159 0 25
+ case 69: arg9++; // 132 9 1
+ case 72: stack.push(arg9); // 21 9
+ case 74: stack.push(arg8); // 21 8
+ case 76: if (stack.pop() < stack.pop()) { gt = 91; continue; } // 163 0 15
+ case 79: stack.push(arg0); // 42
+ case 80: stack.push(arg9); // 21 9
+ case 82: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 83: stack.push(arg7); // 21 7
+ case 85: if (stack.pop() == stack.pop()) { gt = 91; continue; } // 159 0 6
+ case 88: gt = 69; continue; // 167 255 237
+ case 91: stack.push(arg9); // 21 9
+ case 93: stack.push(arg8); // 21 8
+ case 95: if (stack.pop() < stack.pop()) { gt = 158; continue; } // 163 0 63
+ case 98: stack.push(arg9); // 21 9
+ case 100: stack.push(1); // 4
+ case 101: stack.push(stack.pop() + stack.pop()); // 96
+ case 102: arg10 = stack.pop() // 54 10
+ case 104: stack.push(arg10); // 21 10
+ case 106: stack.push(arg5); // 21 5
+ case 108: stack.push(stack.pop() + stack.pop()); // 96
+ case 109: stack.push(1); // 4
+ case 110: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 111: arg11 = stack.pop() // 54 11
+ case 113: stack.push(arg4); // 21 4
+ case 115: stack.push(1); // 4
+ case 116: stack.push(stack.pop() + stack.pop()); // 96
+ case 117: arg12 = stack.pop() // 54 12
+ case 119: stack.push(arg10); // 21 10
+ case 121: stack.push(arg11); // 21 11
+ case 123: if (stack.pop() <= stack.pop()) { gt = 146; continue; } // 162 0 23
+ case 126: stack.push(arg0); // 42
+ case 127: stack.push(arg10); // 21 10
+ case 129: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 130: stack.push(arg3); // 45
+ case 131: stack.push(arg12); // 21 12
+ case 133: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 134: if (stack.pop() != stack.pop()) { gt = 146; continue; } // 160 0 12
+ case 137: arg10++; // 132 10 1
+ case 140: arg12++; // 132 12 1
+ case 143: gt = 119; continue; // 167 255 232
+ case 146: stack.push(arg10); // 21 10
+ case 148: stack.push(arg11); // 21 11
+ case 150: if (stack.pop() != stack.pop()) { gt = 158; continue; } // 160 0 8
+ case 153: stack.push(arg9); // 21 9
+ case 155: stack.push(arg1); // 27
+ case 156: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 157: return stack.pop(); // 172
+ case 158: arg9++; // 132 9 1
+ case 161: gt = 53; continue; // 167 255 148
+ case 164: // 2
+ case 165: return stack.pop(); // 172
+ }
+}
+function java_lang_String_lastIndexOfILjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: stack.push(arg0); // 42
+ case 3: stack.push(stack.pop().count); // 180 1 97
+ case 6: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.lastIndexOfILjava_lang_StringI(self, v0, v1)); } // 182 1 151
+ case 9: return stack.pop(); // 172
+ }
+}
+function java_lang_String_lastIndexOfILjava_lang_StringI(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(7);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().value); // 180 1 100
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(stack.pop().offset); // 180 1 99
+ case 8: stack.push(arg0); // 42
+ case 9: stack.push(stack.pop().count); // 180 1 97
+ case 12: stack.push(arg1); // 43
+ case 13: stack.push(stack.pop().value); // 180 1 100
+ case 16: stack.push(arg1); // 43
+ case 17: stack.push(stack.pop().offset); // 180 1 99
+ case 20: stack.push(arg1); // 43
+ case 21: stack.push(stack.pop().count); // 180 1 97
+ case 24: stack.push(arg2); // 28
+ case 25: { var v6 = stack.pop(); var v5 = stack.pop(); var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_String_lastIndexOfAIACAIAIACAIAIAI(v0, v1, v2, v3, v4, v5, v6)); } // 184 1 145
+ case 28: return stack.pop(); // 172
+ }
+}
+function java_lang_String_lastIndexOfIACIIACIII(arg0,arg1,arg2,arg3,arg4,arg5,arg6) {
+ var arg7;
+ var arg8;
+ var arg9;
+ var arg10;
+ var arg11;
+ var arg12;
+ var arg13;
+ var arg14;
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg2); // 28
+ case 1: stack.push(arg5); // 21 5
+ case 3: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 4: arg7 = stack.pop() // 54 7
+ case 6: stack.push(arg6); // 21 6
+ case 8: if (stack.pop() >= 0) { gt = 13; continue; } // 156 0 5
+ case 11: // 2
+ case 12: return stack.pop(); // 172
+ case 13: stack.push(arg6); // 21 6
+ case 15: stack.push(arg7); // 21 7
+ case 17: if (stack.pop() >= stack.pop()) { gt = 24; continue; } // 164 0 7
+ case 20: stack.push(arg7); // 21 7
+ case 22: arg6 = stack.pop() // 54 6
+ case 24: stack.push(arg5); // 21 5
+ case 26: if (stack.pop() != 0) { gt = 32; continue; } // 154 0 6
+ case 29: stack.push(arg6); // 21 6
+ case 31: return stack.pop(); // 172
+ case 32: stack.push(arg4); // 21 4
+ case 34: stack.push(arg5); // 21 5
+ case 36: stack.push(stack.pop() + stack.pop()); // 96
+ case 37: stack.push(1); // 4
+ case 38: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 39: arg8 = stack.pop() // 54 8
+ case 41: stack.push(arg3); // 45
+ case 42: stack.push(arg8); // 21 8
+ case 44: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 45: arg9 = stack.pop() // 54 9
+ case 47: stack.push(arg1); // 27
+ case 48: stack.push(arg5); // 21 5
+ case 50: stack.push(stack.pop() + stack.pop()); // 96
+ case 51: stack.push(1); // 4
+ case 52: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 53: arg10 = stack.pop() // 54 10
+ case 55: stack.push(arg10); // 21 10
+ case 57: stack.push(arg6); // 21 6
+ case 59: stack.push(stack.pop() + stack.pop()); // 96
+ case 60: arg11 = stack.pop() // 54 11
+ case 62: stack.push(arg11); // 21 11
+ case 64: stack.push(arg10); // 21 10
+ case 66: if (stack.pop() > stack.pop()) { gt = 84; continue; } // 161 0 18
+ case 69: stack.push(arg0); // 42
+ case 70: stack.push(arg11); // 21 11
+ case 72: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 73: stack.push(arg9); // 21 9
+ case 75: if (stack.pop() == stack.pop()) { gt = 84; continue; } // 159 0 9
+ case 78: arg11 += 255; // 132 11 255
+ case 81: gt = 62; continue; // 167 255 237
+ case 84: stack.push(arg11); // 21 11
+ case 86: stack.push(arg10); // 21 10
+ case 88: if (stack.pop() <= stack.pop()) { gt = 93; continue; } // 162 0 5
+ case 91: // 2
+ case 92: return stack.pop(); // 172
+ case 93: stack.push(arg11); // 21 11
+ case 95: stack.push(1); // 4
+ case 96: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 97: arg12 = stack.pop() // 54 12
+ case 99: stack.push(arg12); // 21 12
+ case 101: stack.push(arg5); // 21 5
+ case 103: stack.push(1); // 4
+ case 104: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 105: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 106: arg13 = stack.pop() // 54 13
+ case 108: stack.push(arg8); // 21 8
+ case 110: stack.push(1); // 4
+ case 111: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 112: arg14 = stack.pop() // 54 14
+ case 114: stack.push(arg12); // 21 12
+ case 116: stack.push(arg13); // 21 13
+ case 118: if (stack.pop() >= stack.pop()) { gt = 144; continue; } // 164 0 26
+ case 121: stack.push(arg0); // 42
+ case 122: stack.push(arg12); // 21 12
+ case 124: arg12 += 255; // 132 12 255
+ case 127: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 128: stack.push(arg3); // 45
+ case 129: stack.push(arg14); // 21 14
+ case 131: arg14 += 255; // 132 14 255
+ case 134: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 135: if (stack.pop() == stack.pop()) { gt = 114; continue; } // 159 255 235
+ case 138: arg11 += 255; // 132 11 255
+ case 141: gt = 62; continue; // 167 255 177
+ case 144: stack.push(arg13); // 21 13
+ case 146: stack.push(arg1); // 27
+ case 147: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 148: stack.push(1); // 4
+ case 149: stack.push(stack.pop() + stack.pop()); // 96
+ case 150: return stack.pop(); // 172
+ }
+}
+function java_lang_String_substringLjava_lang_StringI(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 27
+ case 2: stack.push(arg0); // 42
+ case 3: stack.push(stack.pop().count); // 180 1 97
+ case 6: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.substringLjava_lang_StringII(self, v0, v1)); } // 182 1 147
+ case 9: return stack.pop(); // 176
+ }
+}
+function java_lang_String_substringLjava_lang_StringII(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(5);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: if (stack.pop() >= 0) { gt = 13; continue; } // 156 0 12
+ case 4: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 7: stack.push(stack[stack.length - 1]); // 89
+ case 8: stack.push(arg1); // 27
+ case 9: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 12: // 191
+ case 13: stack.push(arg2); // 28
+ case 14: stack.push(arg0); // 42
+ case 15: stack.push(stack.pop().count); // 180 1 97
+ case 18: if (stack.pop() >= stack.pop()) { gt = 30; continue; } // 164 0 12
+ case 21: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 24: stack.push(stack[stack.length - 1]); // 89
+ case 25: stack.push(arg2); // 28
+ case 26: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 29: // 191
+ case 30: stack.push(arg1); // 27
+ case 31: stack.push(arg2); // 28
+ case 32: if (stack.pop() >= stack.pop()) { gt = 46; continue; } // 164 0 14
+ case 35: stack.push(new java_lang_StringIndexOutOfBoundsException); // 187 0 206
+ case 38: stack.push(stack[stack.length - 1]); // 89
+ case 39: stack.push(arg2); // 28
+ case 40: stack.push(arg1); // 27
+ case 41: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 42: { var v0 = stack.pop(); java_lang_StringIndexOutOfBoundsException_consVI(stack.pop(), v0); } // 183 1 169
+ case 45: // 191
+ case 46: stack.push(arg1); // 27
+ case 47: if (stack.pop() != 0) { gt = 62; continue; } // 154 0 15
+ case 50: stack.push(arg2); // 28
+ case 51: stack.push(arg0); // 42
+ case 52: stack.push(stack.pop().count); // 180 1 97
+ case 55: if (stack.pop() != stack.pop()) { gt = 62; continue; } // 160 0 7
+ case 58: stack.push(arg0); // 42
+ case 59: gt = 82; continue; // 167 0 23
+ case 62: stack.push(new java_lang_String); // 187 0 200
+ case 65: stack.push(stack[stack.length - 1]); // 89
+ case 66: stack.push(arg0); // 42
+ case 67: stack.push(stack.pop().offset); // 180 1 99
+ case 70: stack.push(arg1); // 27
+ case 71: stack.push(stack.pop() + stack.pop()); // 96
+ case 72: stack.push(arg2); // 28
+ case 73: stack.push(arg1); // 27
+ case 74: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 75: stack.push(arg0); // 42
+ case 76: stack.push(stack.pop().value); // 180 1 100
+ case 79: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVIIAC(stack.pop(), v0, v1, v2); } // 183 1 137
+ case 82: return stack.pop(); // 176
+ }
+}
+function java_lang_String_subSequenceLjava_lang_CharSequenceII(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 27
+ case 2: stack.push(arg2); // 28
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.substringLjava_lang_StringII(self, v0, v1)); } // 182 1 147
+ case 6: return stack.pop(); // 176
+ }
+}
+function java_lang_String_concatLjava_lang_StringLjava_lang_String(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+;
+ var stack = new Array(5);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: { var self = stack.pop(); stack.push(self.lengthI(self)); } // 182 1 133
+ case 4: arg2 = stack.pop(); // 61
+ case 5: stack.push(arg2); // 28
+ case 6: if (stack.pop() != 0) { gt = 11; continue; } // 154 0 5
+ case 9: stack.push(arg0); // 42
+ case 10: return stack.pop(); // 176
+ case 11: stack.push(arg0); // 42
+ case 12: stack.push(stack.pop().count); // 180 1 97
+ case 15: stack.push(arg2); // 28
+ case 16: stack.push(stack.pop() + stack.pop()); // 96
+ case 17: stack.push(new Array(stack.pop())); // 188 5
+ case 19: arg3 = stack.pop(); // 78
+ case 20: stack.push(arg0); // 42
+ case 21: stack.push(0); // 3
+ case 22: stack.push(arg0); // 42
+ case 23: stack.push(stack.pop().count); // 180 1 97
+ case 26: stack.push(arg3); // 45
+ case 27: stack.push(0); // 3
+ case 28: { var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); self.getCharsVIIACAI(self, v0, v1, v2, v3); } // 182 1 138
+ case 31: stack.push(arg1); // 43
+ case 32: stack.push(0); // 3
+ case 33: stack.push(arg2); // 28
+ case 34: stack.push(arg3); // 45
+ case 35: stack.push(arg0); // 42
+ case 36: stack.push(stack.pop().count); // 180 1 97
+ case 39: { var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); self.getCharsVIIACAI(self, v0, v1, v2, v3); } // 182 1 138
+ case 42: stack.push(new java_lang_String); // 187 0 200
+ case 45: stack.push(stack[stack.length - 1]); // 89
+ case 46: stack.push(0); // 3
+ case 47: stack.push(arg0); // 42
+ case 48: stack.push(stack.pop().count); // 180 1 97
+ case 51: stack.push(arg2); // 28
+ case 52: stack.push(stack.pop() + stack.pop()); // 96
+ case 53: stack.push(arg3); // 45
+ case 54: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVIIAC(stack.pop(), v0, v1, v2); } // 183 1 137
+ case 57: return stack.pop(); // 176
+ }
+}
+function java_lang_String_replaceLjava_lang_StringCC(arg0,arg1,arg2) {
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+;
+ var stack = new Array(5);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 27
+ case 1: stack.push(arg2); // 28
+ case 2: if (stack.pop() == stack.pop()) { gt = 140; continue; } // 159 0 138
+ case 5: stack.push(arg0); // 42
+ case 6: stack.push(stack.pop().count); // 180 1 97
+ case 9: arg3 = stack.pop(); // 62
+ case 10: // 2
+ case 11: arg4 = stack.pop() // 54 4
+ case 13: stack.push(arg0); // 42
+ case 14: stack.push(stack.pop().value); // 180 1 100
+ case 17: arg5 = stack.pop() // 58 5
+ case 19: stack.push(arg0); // 42
+ case 20: stack.push(stack.pop().offset); // 180 1 99
+ case 23: arg6 = stack.pop() // 54 6
+ case 25: arg4++; // 132 4 1
+ case 28: stack.push(arg4); // 21 4
+ case 30: stack.push(arg3); // 29
+ case 31: if (stack.pop() <= stack.pop()) { gt = 49; continue; } // 162 0 18
+ case 34: stack.push(arg5); // 25 5
+ case 36: stack.push(arg6); // 21 6
+ case 38: stack.push(arg4); // 21 4
+ case 40: stack.push(stack.pop() + stack.pop()); // 96
+ case 41: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 42: stack.push(arg1); // 27
+ case 43: if (stack.pop() != stack.pop()) { gt = 25; continue; } // 160 255 238
+ case 46: gt = 49; continue; // 167 0 3
+ case 49: stack.push(arg4); // 21 4
+ case 51: stack.push(arg3); // 29
+ case 52: if (stack.pop() <= stack.pop()) { gt = 140; continue; } // 162 0 88
+ case 55: stack.push(arg3); // 29
+ case 56: stack.push(new Array(stack.pop())); // 188 5
+ case 58: arg7 = stack.pop() // 58 7
+ case 60: stack.push(0); // 3
+ case 61: arg8 = stack.pop() // 54 8
+ case 63: stack.push(arg8); // 21 8
+ case 65: stack.push(arg4); // 21 4
+ case 67: if (stack.pop() <= stack.pop()) { gt = 89; continue; } // 162 0 22
+ case 70: stack.push(arg7); // 25 7
+ case 72: stack.push(arg8); // 21 8
+ case 74: stack.push(arg5); // 25 5
+ case 76: stack.push(arg6); // 21 6
+ case 78: stack.push(arg8); // 21 8
+ case 80: stack.push(stack.pop() + stack.pop()); // 96
+ case 81: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 82: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 83: arg8++; // 132 8 1
+ case 86: gt = 63; continue; // 167 255 233
+ case 89: stack.push(arg4); // 21 4
+ case 91: stack.push(arg3); // 29
+ case 92: if (stack.pop() <= stack.pop()) { gt = 128; continue; } // 162 0 36
+ case 95: stack.push(arg5); // 25 5
+ case 97: stack.push(arg6); // 21 6
+ case 99: stack.push(arg4); // 21 4
+ case 101: stack.push(stack.pop() + stack.pop()); // 96
+ case 102: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 103: arg8 = stack.pop() // 54 8
+ case 105: stack.push(arg7); // 25 7
+ case 107: stack.push(arg4); // 21 4
+ case 109: stack.push(arg8); // 21 8
+ case 111: stack.push(arg1); // 27
+ case 112: if (stack.pop() != stack.pop()) { gt = 119; continue; } // 160 0 7
+ case 115: stack.push(arg2); // 28
+ case 116: gt = 121; continue; // 167 0 5
+ case 119: stack.push(arg8); // 21 8
+ case 121: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 122: arg4++; // 132 4 1
+ case 125: gt = 89; continue; // 167 255 220
+ case 128: stack.push(new java_lang_String); // 187 0 200
+ case 131: stack.push(stack[stack.length - 1]); // 89
+ case 132: stack.push(0); // 3
+ case 133: stack.push(arg3); // 29
+ case 134: stack.push(arg7); // 25 7
+ case 136: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVIIAC(stack.pop(), v0, v1, v2); } // 183 1 137
+ case 139: return stack.pop(); // 176
+ case 140: stack.push(arg0); // 42
+ case 141: return stack.pop(); // 176
+ }
+}
+function java_lang_String_matchesZLjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: stack.push(arg0); // 42
+ case 2: { var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_util_regex_Pattern_matchesZLjava_lang_StringLjava_lang_CharSequence(v0, v1)); } // 184 1 183
+ case 5: return stack.pop(); // 172
+ }
+}
+function java_lang_String_containsZLjava_lang_CharSequence(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: { var self = stack.pop(); stack.push(self.toStringLjava_lang_String(self)); } // 182 1 132
+ case 5: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.indexOfILjava_lang_String(self, v0)); } // 182 1 149
+ case 8: // 2
+ case 9: if (stack.pop() >= stack.pop()) { gt = 16; continue; } // 164 0 7
+ case 12: stack.push(1); // 4
+ case 13: gt = 17; continue; // 167 0 4
+ case 16: stack.push(0); // 3
+ case 17: return stack.pop(); // 172
+ }
+}
+function java_lang_String_replaceFirstLjava_lang_StringLjava_lang_StringLjava_lang_String(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: { var v0 = stack.pop(); stack.push(java_util_regex_Pattern_compileLjava_util_regex_PatternLjava_lang_String(v0)); } // 184 1 186
+ case 4: stack.push(arg0); // 42
+ case 5: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.matcherLjava_util_regex_MatcherLjava_lang_CharSequence(self, v0)); } // 182 1 185
+ case 8: stack.push(arg2); // 44
+ case 9: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.replaceFirstLjava_lang_StringLjava_lang_String(self, v0)); } // 182 1 182
+ case 12: return stack.pop(); // 176
+ }
+}
+function java_lang_String_replaceAllLjava_lang_StringLjava_lang_StringLjava_lang_String(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: { var v0 = stack.pop(); stack.push(java_util_regex_Pattern_compileLjava_util_regex_PatternLjava_lang_String(v0)); } // 184 1 186
+ case 4: stack.push(arg0); // 42
+ case 5: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.matcherLjava_util_regex_MatcherLjava_lang_CharSequence(self, v0)); } // 182 1 185
+ case 8: stack.push(arg2); // 44
+ case 9: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.replaceAllLjava_lang_StringLjava_lang_String(self, v0)); } // 182 1 181
+ case 12: return stack.pop(); // 176
+ }
+}
+function java_lang_String_replaceLjava_lang_StringLjava_lang_CharSequenceLjava_lang_CharSequence(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: { var self = stack.pop(); stack.push(self.toStringLjava_lang_String(self)); } // 182 1 132
+ case 4: stack.push(16); // 16 16
+ case 6: { var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_util_regex_Pattern_compileLjava_util_regex_PatternLjava_lang_StringI(v0, v1)); } // 184 1 187
+ case 9: stack.push(arg0); // 42
+ case 10: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.matcherLjava_util_regex_MatcherLjava_lang_CharSequence(self, v0)); } // 182 1 185
+ case 13: stack.push(arg2); // 44
+ case 14: { var self = stack.pop(); stack.push(self.toStringLjava_lang_String(self)); } // 182 1 132
+ case 17: { var v0 = stack.pop(); stack.push(java_util_regex_Matcher_quoteReplacementLjava_lang_StringLjava_lang_String(v0)); } // 184 1 180
+ case 20: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.replaceAllLjava_lang_StringLjava_lang_String(self, v0)); } // 182 1 181
+ case 23: return stack.pop(); // 176
+ }
+}
+function java_lang_String_splitALjava_lang_StringLjava_lang_StringI(arg0,arg1,arg2) {
+ var arg3;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: { var v0 = stack.pop(); stack.push(java_util_regex_Pattern_compileLjava_util_regex_PatternLjava_lang_String(v0)); } // 184 1 186
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(arg2); // 28
+ case 6: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.splitALjava_lang_StringLjava_lang_CharSequenceI(self, v0, v1)); } // 182 1 184
+ case 9: return stack.pop(); // 176
+ }
+}
+function java_lang_String_splitALjava_lang_StringLjava_lang_String(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: stack.push(0); // 3
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.splitALjava_lang_StringLjava_lang_StringI(self, v0, v1)); } // 182 1 157
+ case 6: return stack.pop(); // 176
+ }
+}
+function java_lang_String_toLowerCaseLjava_lang_StringLjava_util_Locale(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+ var arg10;
+ var arg11;
+ var arg12;
+ var arg13;
+ var arg14;
+;
+ var stack = new Array(6);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: if (stack.pop()) { gt = 12; continue; } // 199 0 11
+ case 4: stack.push(new java_lang_NullPointerException); // 187 0 198
+ case 7: stack.push(stack[stack.length - 1]); // 89
+ case 8: { java_lang_NullPointerException_consV(stack.pop()); } // 183 1 128
+ case 11: // 191
+ case 12: stack.push(0); // 3
+ case 13: arg2 = stack.pop(); // 61
+ case 14: stack.push(arg2); // 28
+ case 15: stack.push(arg0); // 42
+ case 16: stack.push(stack.pop().count); // 180 1 97
+ case 19: if (stack.pop() <= stack.pop()) { gt = 94; continue; } // 162 0 75
+ case 22: stack.push(arg0); // 42
+ case 23: stack.push(stack.pop().value); // 180 1 100
+ case 26: stack.push(arg0); // 42
+ case 27: stack.push(stack.pop().offset); // 180 1 99
+ case 30: stack.push(arg2); // 28
+ case 31: stack.push(stack.pop() + stack.pop()); // 96
+ case 32: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 33: arg3 = stack.pop(); // 62
+ case 34: stack.push(arg3); // 29
+ case 35: stack.push(55296); // 18 1
+ case 37: if (stack.pop() > stack.pop()) { gt = 77; continue; } // 161 0 40
+ case 40: stack.push(arg3); // 29
+ case 41: stack.push(56319); // 18 2
+ case 43: if (stack.pop() < stack.pop()) { gt = 77; continue; } // 163 0 34
+ case 46: stack.push(arg0); // 42
+ case 47: stack.push(arg2); // 28
+ case 48: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.codePointAtII(self, v0)); } // 182 1 134
+ case 51: arg4 = stack.pop() // 54 4
+ case 53: stack.push(arg4); // 21 4
+ case 55: stack.push(arg4); // 21 4
+ case 57: { var v0 = stack.pop(); stack.push(java_lang_Character_toLowerCaseII(v0)); } // 184 1 107
+ case 60: if (stack.pop() == stack.pop()) { gt = 66; continue; } // 159 0 6
+ case 63: gt = 96; continue; // 167 0 33
+ case 66: stack.push(arg2); // 28
+ case 67: stack.push(arg4); // 21 4
+ case 69: { var v0 = stack.pop(); stack.push(java_lang_Character_charCountII(v0)); } // 184 1 106
+ case 72: stack.push(stack.pop() + stack.pop()); // 96
+ case 73: arg2 = stack.pop(); // 61
+ case 74: gt = 91; continue; // 167 0 17
+ case 77: stack.push(arg3); // 29
+ case 78: stack.push(arg3); // 29
+ case 79: { var v0 = stack.pop(); stack.push(java_lang_Character_toLowerCaseCC(v0)); } // 184 1 104
+ case 82: if (stack.pop() == stack.pop()) { gt = 88; continue; } // 159 0 6
+ case 85: gt = 96; continue; // 167 0 11
+ case 88: arg2++; // 132 2 1
+ case 91: gt = 14; continue; // 167 255 179
+ case 94: stack.push(arg0); // 42
+ case 95: return stack.pop(); // 176
+ case 96: stack.push(arg0); // 42
+ case 97: stack.push(stack.pop().count); // 180 1 97
+ case 100: stack.push(new Array(stack.pop())); // 188 5
+ case 102: arg3 = stack.pop(); // 78
+ case 103: stack.push(0); // 3
+ case 104: arg4 = stack.pop() // 54 4
+ case 106: stack.push(arg0); // 42
+ case 107: stack.push(stack.pop().value); // 180 1 100
+ case 110: stack.push(arg0); // 42
+ case 111: stack.push(stack.pop().offset); // 180 1 99
+ case 114: stack.push(arg3); // 45
+ case 115: stack.push(0); // 3
+ case 116: stack.push(arg2); // 28
+ case 117: { var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_System_arraycopyVLjava_lang_ObjectILjava_lang_ObjectII(v0, v1, v2, v3, v4); } // 184 1 171
+ case 120: stack.push(arg1); // 43
+ case 121: { var self = stack.pop(); stack.push(self.getLanguageLjava_lang_String(self)); } // 182 1 178
+ case 124: arg5 = stack.pop() // 58 5
+ case 126: stack.push(arg5); // 25 5
+ case 128: stack.push("tr"); // 18 11
+ case 130: // 165
+ case 131: // 0
+ case 132: stack.push(6405); // 17 25 5
+ case 135: stack.push("az"); // 18 5
+ case 137: // 165
+ case 138: // 0
+ case 139: stack.push(1); // 10
+ case 140: stack.push(arg5); // 25 5
+ case 142: stack.push("lt"); // 18 9
+ case 144: // 166
+ case 145: // 0
+ case 146: stack.push(4); // 7
+ case 147: stack.push(1); // 4
+ case 148: gt = 152; continue; // 167 0 4
+ case 151: stack.push(0); // 3
+ case 152: arg6 = stack.pop() // 54 6
+ case 154: stack.push(arg2); // 28
+ case 155: arg11 = stack.pop() // 54 11
+ case 157: stack.push(arg11); // 21 11
+ case 159: stack.push(arg0); // 42
+ case 160: stack.push(stack.pop().count); // 180 1 97
+ case 163: if (stack.pop() <= stack.pop()) { gt = 419; continue; } // 162 1 0
+ case 166: stack.push(arg0); // 42
+ case 167: stack.push(stack.pop().value); // 180 1 100
+ case 170: stack.push(arg0); // 42
+ case 171: stack.push(stack.pop().offset); // 180 1 99
+ case 174: stack.push(arg11); // 21 11
+ case 176: stack.push(stack.pop() + stack.pop()); // 96
+ case 177: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 178: arg9 = stack.pop() // 54 9
+ case 180: stack.push(arg9); // 21 9
+ case 182: // number conversion // 146
+ case 183: stack.push(55296); // 18 1
+ case 185: if (stack.pop() > stack.pop()) { gt = 214; continue; } // 161 0 29
+ case 188: stack.push(arg9); // 21 9
+ case 190: // number conversion // 146
+ case 191: stack.push(56319); // 18 2
+ case 193: if (stack.pop() < stack.pop()) { gt = 214; continue; } // 163 0 21
+ case 196: stack.push(arg0); // 42
+ case 197: stack.push(arg11); // 21 11
+ case 199: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.codePointAtII(self, v0)); } // 182 1 134
+ case 202: arg9 = stack.pop() // 54 9
+ case 204: stack.push(arg9); // 21 9
+ case 206: { var v0 = stack.pop(); stack.push(java_lang_Character_charCountII(v0)); } // 184 1 106
+ case 209: arg10 = stack.pop() // 54 10
+ case 211: gt = 217; continue; // 167 0 6
+ case 214: stack.push(1); // 4
+ case 215: arg10 = stack.pop() // 54 10
+ case 217: stack.push(arg6); // 21 6
+ case 219: if (stack.pop() != 0) { gt = 230; continue; } // 154 0 11
+ case 222: stack.push(arg9); // 21 9
+ case 224: stack.push(931); // 17 3 163
+ case 227: if (stack.pop() != stack.pop()) { gt = 242; continue; } // 160 0 15
+ case 230: stack.push(arg0); // 42
+ case 231: stack.push(arg11); // 21 11
+ case 233: stack.push(arg1); // 43
+ case 234: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_ConditionalSpecialCasing_toLowerCaseExILjava_lang_StringILjava_util_Locale(v0, v1, v2)); } // 184 1 117
+ case 237: arg8 = stack.pop() // 54 8
+ case 239: gt = 249; continue; // 167 0 10
+ case 242: stack.push(arg9); // 21 9
+ case 244: { var v0 = stack.pop(); stack.push(java_lang_Character_toLowerCaseII(v0)); } // 184 1 107
+ case 247: arg8 = stack.pop() // 54 8
+ case 249: stack.push(arg8); // 21 8
+ case 251: // 2
+ case 252: if (stack.pop() == stack.pop()) { gt = 262; continue; } // 159 0 10
+ case 255: stack.push(arg8); // 21 8
+ case 257: stack.push(65536); // 18 3
+ case 259: if (stack.pop() > stack.pop()) { gt = 399; continue; } // 161 0 140
+ case 262: stack.push(arg8); // 21 8
+ case 264: // 2
+ case 265: if (stack.pop() != stack.pop()) { gt = 280; continue; } // 160 0 15
+ case 268: stack.push(arg0); // 42
+ case 269: stack.push(arg11); // 21 11
+ case 271: stack.push(arg1); // 43
+ case 272: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_ConditionalSpecialCasing_toLowerCaseCharArrayACLjava_lang_StringILjava_util_Locale(v0, v1, v2)); } // 184 1 119
+ case 275: arg7 = stack.pop() // 58 7
+ case 277: gt = 315; continue; // 167 0 38
+ case 280: stack.push(arg10); // 21 10
+ case 282: stack.push(2); // 5
+ case 283: if (stack.pop() != stack.pop()) { gt = 308; continue; } // 160 0 25
+ case 286: stack.push(arg4); // 21 4
+ case 288: stack.push(arg8); // 21 8
+ case 290: stack.push(arg3); // 45
+ case 291: stack.push(arg11); // 21 11
+ case 293: stack.push(arg4); // 21 4
+ case 295: stack.push(stack.pop() + stack.pop()); // 96
+ case 296: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Character_toCharsAIIACAI(v0, v1, v2)); } // 184 1 111
+ case 299: stack.push(arg10); // 21 10
+ case 301: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 302: stack.push(stack.pop() + stack.pop()); // 96
+ case 303: arg4 = stack.pop() // 54 4
+ case 305: gt = 409; continue; // 167 0 104
+ case 308: stack.push(arg8); // 21 8
+ case 310: { var v0 = stack.pop(); stack.push(java_lang_Character_toCharsACI(v0)); } // 184 1 109
+ case 313: arg7 = stack.pop() // 58 7
+ case 315: stack.push(arg7); // 25 7
+ case 317: stack.push(stack.pop().length); // 190
+ case 318: arg12 = stack.pop() // 54 12
+ case 320: stack.push(arg12); // 21 12
+ case 322: stack.push(arg10); // 21 10
+ case 324: if (stack.pop() >= stack.pop()) { gt = 355; continue; } // 164 0 31
+ case 327: stack.push(arg3); // 45
+ case 328: stack.push(stack.pop().length); // 190
+ case 329: stack.push(arg12); // 21 12
+ case 331: stack.push(stack.pop() + stack.pop()); // 96
+ case 332: stack.push(arg10); // 21 10
+ case 334: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 335: stack.push(new Array(stack.pop())); // 188 5
+ case 337: arg13 = stack.pop() // 58 13
+ case 339: stack.push(arg3); // 45
+ case 340: stack.push(0); // 3
+ case 341: stack.push(arg13); // 25 13
+ case 343: stack.push(0); // 3
+ case 344: stack.push(arg11); // 21 11
+ case 346: stack.push(arg4); // 21 4
+ case 348: stack.push(stack.pop() + stack.pop()); // 96
+ case 349: { var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_System_arraycopyVLjava_lang_ObjectILjava_lang_ObjectII(v0, v1, v2, v3, v4); } // 184 1 171
+ case 352: stack.push(arg13); // 25 13
+ case 354: arg3 = stack.pop(); // 78
+ case 355: stack.push(0); // 3
+ case 356: arg13 = stack.pop() // 54 13
+ case 358: stack.push(arg13); // 21 13
+ case 360: stack.push(arg12); // 21 12
+ case 362: if (stack.pop() <= stack.pop()) { gt = 386; continue; } // 162 0 24
+ case 365: stack.push(arg3); // 45
+ case 366: stack.push(arg11); // 21 11
+ case 368: stack.push(arg4); // 21 4
+ case 370: stack.push(stack.pop() + stack.pop()); // 96
+ case 371: stack.push(arg13); // 21 13
+ case 373: stack.push(stack.pop() + stack.pop()); // 96
+ case 374: stack.push(arg7); // 25 7
+ case 376: stack.push(arg13); // 21 13
+ case 378: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 379: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 380: arg13++; // 132 13 1
+ case 383: gt = 358; continue; // 167 255 231
+ case 386: stack.push(arg4); // 21 4
+ case 388: stack.push(arg12); // 21 12
+ case 390: stack.push(arg10); // 21 10
+ case 392: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 393: stack.push(stack.pop() + stack.pop()); // 96
+ case 394: arg4 = stack.pop() // 54 4
+ case 396: gt = 409; continue; // 167 0 13
+ case 399: stack.push(arg3); // 45
+ case 400: stack.push(arg11); // 21 11
+ case 402: stack.push(arg4); // 21 4
+ case 404: stack.push(stack.pop() + stack.pop()); // 96
+ case 405: stack.push(arg8); // 21 8
+ case 407: // number conversion // 146
+ case 408: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 409: stack.push(arg11); // 21 11
+ case 411: stack.push(arg10); // 21 10
+ case 413: stack.push(stack.pop() + stack.pop()); // 96
+ case 414: arg11 = stack.pop() // 54 11
+ case 416: gt = 157; continue; // 167 254 253
+ case 419: stack.push(new java_lang_String); // 187 0 200
+ case 422: stack.push(stack[stack.length - 1]); // 89
+ case 423: stack.push(0); // 3
+ case 424: stack.push(arg0); // 42
+ case 425: stack.push(stack.pop().count); // 180 1 97
+ case 428: stack.push(arg4); // 21 4
+ case 430: stack.push(stack.pop() + stack.pop()); // 96
+ case 431: stack.push(arg3); // 45
+ case 432: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVIIAC(stack.pop(), v0, v1, v2); } // 183 1 137
+ case 435: return stack.pop(); // 176
+ }
+}
+function java_lang_String_toLowerCaseLjava_lang_String(arg0) {
+ var arg1;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: { stack.push(java_util_Locale_getDefaultLjava_util_Locale()); } // 184 1 179
+ case 4: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.toLowerCaseLjava_lang_StringLjava_util_Locale(self, v0)); } // 182 1 158
+ case 7: return stack.pop(); // 176
+ }
+}
+function java_lang_String_toUpperCaseLjava_lang_StringLjava_util_Locale(arg0,arg1) {
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+ var arg6;
+ var arg7;
+ var arg8;
+ var arg9;
+ var arg10;
+ var arg11;
+ var arg12;
+ var arg13;
+ var arg14;
+;
+ var stack = new Array(6);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg1); // 43
+ case 1: if (stack.pop()) { gt = 12; continue; } // 199 0 11
+ case 4: stack.push(new java_lang_NullPointerException); // 187 0 198
+ case 7: stack.push(stack[stack.length - 1]); // 89
+ case 8: { java_lang_NullPointerException_consV(stack.pop()); } // 183 1 128
+ case 11: // 191
+ case 12: stack.push(0); // 3
+ case 13: arg2 = stack.pop(); // 61
+ case 14: stack.push(arg2); // 28
+ case 15: stack.push(arg0); // 42
+ case 16: stack.push(stack.pop().count); // 180 1 97
+ case 19: if (stack.pop() <= stack.pop()) { gt = 93; continue; } // 162 0 74
+ case 22: stack.push(arg0); // 42
+ case 23: stack.push(stack.pop().value); // 180 1 100
+ case 26: stack.push(arg0); // 42
+ case 27: stack.push(stack.pop().offset); // 180 1 99
+ case 30: stack.push(arg2); // 28
+ case 31: stack.push(stack.pop() + stack.pop()); // 96
+ case 32: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 33: arg3 = stack.pop(); // 62
+ case 34: stack.push(arg3); // 29
+ case 35: stack.push(55296); // 18 1
+ case 37: if (stack.pop() > stack.pop()) { gt = 61; continue; } // 161 0 24
+ case 40: stack.push(arg3); // 29
+ case 41: stack.push(56319); // 18 2
+ case 43: if (stack.pop() < stack.pop()) { gt = 61; continue; } // 163 0 18
+ case 46: stack.push(arg0); // 42
+ case 47: stack.push(arg2); // 28
+ case 48: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.codePointAtII(self, v0)); } // 182 1 134
+ case 51: arg3 = stack.pop(); // 62
+ case 52: stack.push(arg3); // 29
+ case 53: { var v0 = stack.pop(); stack.push(java_lang_Character_charCountII(v0)); } // 184 1 106
+ case 56: arg4 = stack.pop() // 54 4
+ case 58: gt = 64; continue; // 167 0 6
+ case 61: stack.push(1); // 4
+ case 62: arg4 = stack.pop() // 54 4
+ case 64: stack.push(arg3); // 29
+ case 65: { var v0 = stack.pop(); stack.push(java_lang_Character_toUpperCaseExII(v0)); } // 184 1 108
+ case 68: arg5 = stack.pop() // 54 5
+ case 70: stack.push(arg5); // 21 5
+ case 72: // 2
+ case 73: if (stack.pop() == stack.pop()) { gt = 95; continue; } // 159 0 22
+ case 76: stack.push(arg3); // 29
+ case 77: stack.push(arg5); // 21 5
+ case 79: if (stack.pop() == stack.pop()) { gt = 85; continue; } // 159 0 6
+ case 82: gt = 95; continue; // 167 0 13
+ case 85: stack.push(arg2); // 28
+ case 86: stack.push(arg4); // 21 4
+ case 88: stack.push(stack.pop() + stack.pop()); // 96
+ case 89: arg2 = stack.pop(); // 61
+ case 90: gt = 14; continue; // 167 255 180
+ case 93: stack.push(arg0); // 42
+ case 94: return stack.pop(); // 176
+ case 95: stack.push(arg0); // 42
+ case 96: stack.push(stack.pop().count); // 180 1 97
+ case 99: stack.push(new Array(stack.pop())); // 188 5
+ case 101: arg3 = stack.pop(); // 78
+ case 102: stack.push(0); // 3
+ case 103: arg4 = stack.pop() // 54 4
+ case 105: stack.push(arg0); // 42
+ case 106: stack.push(stack.pop().value); // 180 1 100
+ case 109: stack.push(arg0); // 42
+ case 110: stack.push(stack.pop().offset); // 180 1 99
+ case 113: stack.push(arg3); // 45
+ case 114: stack.push(0); // 3
+ case 115: stack.push(arg2); // 28
+ case 116: { var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_System_arraycopyVLjava_lang_ObjectILjava_lang_ObjectII(v0, v1, v2, v3, v4); } // 184 1 171
+ case 119: stack.push(arg1); // 43
+ case 120: { var self = stack.pop(); stack.push(self.getLanguageLjava_lang_String(self)); } // 182 1 178
+ case 123: arg5 = stack.pop() // 58 5
+ case 125: stack.push(arg5); // 25 5
+ case 127: stack.push("tr"); // 18 11
+ case 129: // 165
+ case 130: // 0
+ case 131: stack.push(6405); // 17 25 5
+ case 134: stack.push("az"); // 18 5
+ case 136: // 165
+ case 137: // 0
+ case 138: stack.push(1); // 10
+ case 139: stack.push(arg5); // 25 5
+ case 141: stack.push("lt"); // 18 9
+ case 143: // 166
+ case 144: // 0
+ case 145: stack.push(4); // 7
+ case 146: stack.push(1); // 4
+ case 147: gt = 151; continue; // 167 0 4
+ case 150: stack.push(0); // 3
+ case 151: arg6 = stack.pop() // 54 6
+ case 153: stack.push(arg2); // 28
+ case 154: arg11 = stack.pop() // 54 11
+ case 156: stack.push(arg11); // 21 11
+ case 158: stack.push(arg0); // 42
+ case 159: stack.push(stack.pop().count); // 180 1 97
+ case 162: if (stack.pop() <= stack.pop()) { gt = 425; continue; } // 162 1 7
+ case 165: stack.push(arg0); // 42
+ case 166: stack.push(stack.pop().value); // 180 1 100
+ case 169: stack.push(arg0); // 42
+ case 170: stack.push(stack.pop().offset); // 180 1 99
+ case 173: stack.push(arg11); // 21 11
+ case 175: stack.push(stack.pop() + stack.pop()); // 96
+ case 176: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 177: arg9 = stack.pop() // 54 9
+ case 179: stack.push(arg9); // 21 9
+ case 181: // number conversion // 146
+ case 182: stack.push(55296); // 18 1
+ case 184: if (stack.pop() > stack.pop()) { gt = 213; continue; } // 161 0 29
+ case 187: stack.push(arg9); // 21 9
+ case 189: // number conversion // 146
+ case 190: stack.push(56319); // 18 2
+ case 192: if (stack.pop() < stack.pop()) { gt = 213; continue; } // 163 0 21
+ case 195: stack.push(arg0); // 42
+ case 196: stack.push(arg11); // 21 11
+ case 198: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.codePointAtII(self, v0)); } // 182 1 134
+ case 201: arg9 = stack.pop() // 54 9
+ case 203: stack.push(arg9); // 21 9
+ case 205: { var v0 = stack.pop(); stack.push(java_lang_Character_charCountII(v0)); } // 184 1 106
+ case 208: arg10 = stack.pop() // 54 10
+ case 210: gt = 216; continue; // 167 0 6
+ case 213: stack.push(1); // 4
+ case 214: arg10 = stack.pop() // 54 10
+ case 216: stack.push(arg6); // 21 6
+ case 218: if (stack.pop() == 0) { gt = 233; continue; } // 153 0 15
+ case 221: stack.push(arg0); // 42
+ case 222: stack.push(arg11); // 21 11
+ case 224: stack.push(arg1); // 43
+ case 225: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_ConditionalSpecialCasing_toUpperCaseExILjava_lang_StringILjava_util_Locale(v0, v1, v2)); } // 184 1 118
+ case 228: arg8 = stack.pop() // 54 8
+ case 230: gt = 240; continue; // 167 0 10
+ case 233: stack.push(arg9); // 21 9
+ case 235: { var v0 = stack.pop(); stack.push(java_lang_Character_toUpperCaseExII(v0)); } // 184 1 108
+ case 238: arg8 = stack.pop() // 54 8
+ case 240: stack.push(arg8); // 21 8
+ case 242: // 2
+ case 243: if (stack.pop() == stack.pop()) { gt = 253; continue; } // 159 0 10
+ case 246: stack.push(arg8); // 21 8
+ case 248: stack.push(65536); // 18 3
+ case 250: if (stack.pop() > stack.pop()) { gt = 405; continue; } // 161 0 155
+ case 253: stack.push(arg8); // 21 8
+ case 255: // 2
+ case 256: if (stack.pop() != stack.pop()) { gt = 286; continue; } // 160 0 30
+ case 259: stack.push(arg6); // 21 6
+ case 261: if (stack.pop() == 0) { gt = 276; continue; } // 153 0 15
+ case 264: stack.push(arg0); // 42
+ case 265: stack.push(arg11); // 21 11
+ case 267: stack.push(arg1); // 43
+ case 268: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_ConditionalSpecialCasing_toUpperCaseCharArrayACLjava_lang_StringILjava_util_Locale(v0, v1, v2)); } // 184 1 120
+ case 271: arg7 = stack.pop() // 58 7
+ case 273: gt = 321; continue; // 167 0 48
+ case 276: stack.push(arg9); // 21 9
+ case 278: { var v0 = stack.pop(); stack.push(java_lang_Character_toUpperCaseCharArrayACI(v0)); } // 184 1 110
+ case 281: arg7 = stack.pop() // 58 7
+ case 283: gt = 321; continue; // 167 0 38
+ case 286: stack.push(arg10); // 21 10
+ case 288: stack.push(2); // 5
+ case 289: if (stack.pop() != stack.pop()) { gt = 314; continue; } // 160 0 25
+ case 292: stack.push(arg4); // 21 4
+ case 294: stack.push(arg8); // 21 8
+ case 296: stack.push(arg3); // 45
+ case 297: stack.push(arg11); // 21 11
+ case 299: stack.push(arg4); // 21 4
+ case 301: stack.push(stack.pop() + stack.pop()); // 96
+ case 302: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Character_toCharsAIIACAI(v0, v1, v2)); } // 184 1 111
+ case 305: stack.push(arg10); // 21 10
+ case 307: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 308: stack.push(stack.pop() + stack.pop()); // 96
+ case 309: arg4 = stack.pop() // 54 4
+ case 311: gt = 415; continue; // 167 0 104
+ case 314: stack.push(arg8); // 21 8
+ case 316: { var v0 = stack.pop(); stack.push(java_lang_Character_toCharsACI(v0)); } // 184 1 109
+ case 319: arg7 = stack.pop() // 58 7
+ case 321: stack.push(arg7); // 25 7
+ case 323: stack.push(stack.pop().length); // 190
+ case 324: arg12 = stack.pop() // 54 12
+ case 326: stack.push(arg12); // 21 12
+ case 328: stack.push(arg10); // 21 10
+ case 330: if (stack.pop() >= stack.pop()) { gt = 361; continue; } // 164 0 31
+ case 333: stack.push(arg3); // 45
+ case 334: stack.push(stack.pop().length); // 190
+ case 335: stack.push(arg12); // 21 12
+ case 337: stack.push(stack.pop() + stack.pop()); // 96
+ case 338: stack.push(arg10); // 21 10
+ case 340: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 341: stack.push(new Array(stack.pop())); // 188 5
+ case 343: arg13 = stack.pop() // 58 13
+ case 345: stack.push(arg3); // 45
+ case 346: stack.push(0); // 3
+ case 347: stack.push(arg13); // 25 13
+ case 349: stack.push(0); // 3
+ case 350: stack.push(arg11); // 21 11
+ case 352: stack.push(arg4); // 21 4
+ case 354: stack.push(stack.pop() + stack.pop()); // 96
+ case 355: { var v4 = stack.pop(); var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_System_arraycopyVLjava_lang_ObjectILjava_lang_ObjectII(v0, v1, v2, v3, v4); } // 184 1 171
+ case 358: stack.push(arg13); // 25 13
+ case 360: arg3 = stack.pop(); // 78
+ case 361: stack.push(0); // 3
+ case 362: arg13 = stack.pop() // 54 13
+ case 364: stack.push(arg13); // 21 13
+ case 366: stack.push(arg12); // 21 12
+ case 368: if (stack.pop() <= stack.pop()) { gt = 392; continue; } // 162 0 24
+ case 371: stack.push(arg3); // 45
+ case 372: stack.push(arg11); // 21 11
+ case 374: stack.push(arg4); // 21 4
+ case 376: stack.push(stack.pop() + stack.pop()); // 96
+ case 377: stack.push(arg13); // 21 13
+ case 379: stack.push(stack.pop() + stack.pop()); // 96
+ case 380: stack.push(arg7); // 25 7
+ case 382: stack.push(arg13); // 21 13
+ case 384: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 385: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 386: arg13++; // 132 13 1
+ case 389: gt = 364; continue; // 167 255 231
+ case 392: stack.push(arg4); // 21 4
+ case 394: stack.push(arg12); // 21 12
+ case 396: stack.push(arg10); // 21 10
+ case 398: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 399: stack.push(stack.pop() + stack.pop()); // 96
+ case 400: arg4 = stack.pop() // 54 4
+ case 402: gt = 415; continue; // 167 0 13
+ case 405: stack.push(arg3); // 45
+ case 406: stack.push(arg11); // 21 11
+ case 408: stack.push(arg4); // 21 4
+ case 410: stack.push(stack.pop() + stack.pop()); // 96
+ case 411: stack.push(arg8); // 21 8
+ case 413: // number conversion // 146
+ case 414: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 415: stack.push(arg11); // 21 11
+ case 417: stack.push(arg10); // 21 10
+ case 419: stack.push(stack.pop() + stack.pop()); // 96
+ case 420: arg11 = stack.pop() // 54 11
+ case 422: gt = 156; continue; // 167 254 246
+ case 425: stack.push(new java_lang_String); // 187 0 200
+ case 428: stack.push(stack[stack.length - 1]); // 89
+ case 429: stack.push(0); // 3
+ case 430: stack.push(arg0); // 42
+ case 431: stack.push(stack.pop().count); // 180 1 97
+ case 434: stack.push(arg4); // 21 4
+ case 436: stack.push(stack.pop() + stack.pop()); // 96
+ case 437: stack.push(arg3); // 45
+ case 438: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVIIAC(stack.pop(), v0, v1, v2); } // 183 1 137
+ case 441: return stack.pop(); // 176
+ }
+}
+function java_lang_String_toUpperCaseLjava_lang_String(arg0) {
+ var arg1;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: { stack.push(java_util_Locale_getDefaultLjava_util_Locale()); } // 184 1 179
+ case 4: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.toUpperCaseLjava_lang_StringLjava_util_Locale(self, v0)); } // 182 1 159
+ case 7: return stack.pop(); // 176
+ }
+}
+function java_lang_String_trimLjava_lang_String(arg0) {
+ var arg1;
+ var arg2;
+ var arg3;
+ var arg4;
+ var arg5;
+;
+ var stack = new Array(3);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().count); // 180 1 97
+ case 4: arg1 = stack.pop(); // 60
+ case 5: stack.push(0); // 3
+ case 6: arg2 = stack.pop(); // 61
+ case 7: stack.push(arg0); // 42
+ case 8: stack.push(stack.pop().offset); // 180 1 99
+ case 11: arg3 = stack.pop(); // 62
+ case 12: stack.push(arg0); // 42
+ case 13: stack.push(stack.pop().value); // 180 1 100
+ case 16: arg4 = stack.pop() // 58 4
+ case 18: stack.push(arg2); // 28
+ case 19: stack.push(arg1); // 27
+ case 20: if (stack.pop() <= stack.pop()) { gt = 40; continue; } // 162 0 20
+ case 23: stack.push(arg4); // 25 4
+ case 25: stack.push(arg3); // 29
+ case 26: stack.push(arg2); // 28
+ case 27: stack.push(stack.pop() + stack.pop()); // 96
+ case 28: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 29: stack.push(32); // 16 32
+ case 31: if (stack.pop() < stack.pop()) { gt = 40; continue; } // 163 0 9
+ case 34: arg2++; // 132 2 1
+ case 37: gt = 18; continue; // 167 255 237
+ case 40: stack.push(arg2); // 28
+ case 41: stack.push(arg1); // 27
+ case 42: if (stack.pop() <= stack.pop()) { gt = 64; continue; } // 162 0 22
+ case 45: stack.push(arg4); // 25 4
+ case 47: stack.push(arg3); // 29
+ case 48: stack.push(arg1); // 27
+ case 49: stack.push(stack.pop() + stack.pop()); // 96
+ case 50: stack.push(1); // 4
+ case 51: { var tmp = stack.pop(); stack.push(stack.pop() - tmp); } // 100
+ case 52: { var indx = stack.pop(); stack.push(stack.pop()[indx]); } // 52
+ case 53: stack.push(32); // 16 32
+ case 55: if (stack.pop() < stack.pop()) { gt = 64; continue; } // 163 0 9
+ case 58: arg1 += 255; // 132 1 255
+ case 61: gt = 40; continue; // 167 255 235
+ case 64: stack.push(arg2); // 28
+ case 65: if (stack.pop() > 0) { gt = 76; continue; } // 157 0 11
+ case 68: stack.push(arg1); // 27
+ case 69: stack.push(arg0); // 42
+ case 70: stack.push(stack.pop().count); // 180 1 97
+ case 73: if (stack.pop() <= stack.pop()) { gt = 85; continue; } // 162 0 12
+ case 76: stack.push(arg0); // 42
+ case 77: stack.push(arg2); // 28
+ case 78: stack.push(arg1); // 27
+ case 79: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.substringLjava_lang_StringII(self, v0, v1)); } // 182 1 147
+ case 82: gt = 86; continue; // 167 0 4
+ case 85: stack.push(arg0); // 42
+ case 86: return stack.pop(); // 176
+ }
+}
+*/
+function java_lang_String_toStringLjava_lang_String(arg0) {
+ return arg0.toString();
+}
+/*
+function java_lang_String_toCharArrayAC(arg0) {
+ var arg1;
+ var arg2;
+;
+ var stack = new Array(5);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(stack.pop().count); // 180 1 97
+ case 4: stack.push(new Array(stack.pop())); // 188 5
+ case 6: arg1 = stack.pop(); // 76
+ case 7: stack.push(arg0); // 42
+ case 8: stack.push(0); // 3
+ case 9: stack.push(arg0); // 42
+ case 10: stack.push(stack.pop().count); // 180 1 97
+ case 13: stack.push(arg1); // 43
+ case 14: stack.push(0); // 3
+ case 15: { var v3 = stack.pop(); var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); self.getCharsVIIACAI(self, v0, v1, v2, v3); } // 182 1 138
+ case 18: stack.push(arg1); // 43
+ case 19: return stack.pop(); // 176
+ }
+}
+function java_lang_String_formatLjava_lang_StringLjava_lang_StringLjava_lang_Object(arg0,arg1) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(new java_util_Formatter); // 187 0 211
+ case 3: stack.push(stack[stack.length - 1]); // 89
+ case 4: { java_util_Formatter_consV(stack.pop()); } // 183 1 174
+ case 7: stack.push(arg0); // 42
+ case 8: stack.push(arg1); // 43
+ case 9: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.formatALjava_util_FormatterLjava_lang_StringALjava_lang_Object(self, v0, v1)); } // 182 1 177
+ case 12: { var self = stack.pop(); stack.push(self.toStringLjava_lang_String(self)); } // 182 1 175
+ case 15: return stack.pop(); // 176
+ }
+}
+function java_lang_String_formatLjava_lang_StringLjava_util_LocaleLjava_lang_StringLjava_lang_Object(arg0,arg1,arg2) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(new java_util_Formatter); // 187 0 211
+ case 3: stack.push(stack[stack.length - 1]); // 89
+ case 4: stack.push(arg0); // 42
+ case 5: { var v0 = stack.pop(); java_util_Formatter_consVLjava_util_Locale(stack.pop(), v0); } // 183 1 176
+ case 8: stack.push(arg1); // 43
+ case 9: stack.push(arg2); // 44
+ case 10: { var v1 = stack.pop(); var v0 = stack.pop(); var self = stack.pop(); stack.push(self.formatALjava_util_FormatterLjava_lang_StringALjava_lang_Object(self, v0, v1)); } // 182 1 177
+ case 13: { var self = stack.pop(); stack.push(self.toStringLjava_lang_String(self)); } // 182 1 175
+ case 16: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringLjava_lang_Object(arg0) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: if (stack.pop()) { gt = 9; continue; } // 199 0 8
+ case 4: stack.push("null"); // 18 10
+ case 6: gt = 13; continue; // 167 0 7
+ case 9: stack.push(arg0); // 42
+ case 10: { var self = stack.pop(); stack.push(self.toStringLjava_lang_String(self)); } // 182 1 132
+ case 13: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringAC(arg0) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(new java_lang_String); // 187 0 200
+ case 3: stack.push(stack[stack.length - 1]); // 89
+ case 4: stack.push(arg0); // 42
+ case 5: { var v0 = stack.pop(); java_lang_String_consVAC(stack.pop(), v0); } // 183 1 142
+ case 8: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringACII(arg0,arg1,arg2) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(new java_lang_String); // 187 0 200
+ case 3: stack.push(stack[stack.length - 1]); // 89
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(arg1); // 27
+ case 6: stack.push(arg2); // 28
+ case 7: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVACAIAI(stack.pop(), v0, v1, v2); } // 183 1 143
+ case 10: return stack.pop(); // 176
+ }
+}
+function java_lang_String_copyValueOfLjava_lang_StringACII(arg0,arg1,arg2) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(new java_lang_String); // 187 0 200
+ case 3: stack.push(stack[stack.length - 1]); // 89
+ case 4: stack.push(arg0); // 42
+ case 5: stack.push(arg1); // 27
+ case 6: stack.push(arg2); // 28
+ case 7: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVACAIAI(stack.pop(), v0, v1, v2); } // 183 1 143
+ case 10: return stack.pop(); // 176
+ }
+}
+function java_lang_String_copyValueOfLjava_lang_StringAC(arg0) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(0); // 3
+ case 2: stack.push(arg0); // 42
+ case 3: stack.push(stack.pop().length); // 190
+ case 4: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_String_copyValueOfALjava_lang_StringACAIAI(v0, v1, v2)); } // 184 1 155
+ case 7: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringZ(arg0) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 26
+ case 1: if (stack.pop() == 0) { gt = 9; continue; } // 153 0 8
+ case 4: stack.push("true"); // 18 12
+ case 6: gt = 11; continue; // 167 0 5
+ case 9: stack.push("false"); // 18 8
+ case 11: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringC(arg0) {
+ var arg1;
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(1); // 4
+ case 1: stack.push(new Array(stack.pop())); // 188 5
+ case 3: stack.push(stack[stack.length - 1]); // 89
+ case 4: stack.push(0); // 3
+ case 5: stack.push(arg0); // 26
+ case 6: { var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; } // 85
+ case 7: arg1 = stack.pop(); // 76
+ case 8: stack.push(new java_lang_String); // 187 0 200
+ case 11: stack.push(stack[stack.length - 1]); // 89
+ case 12: stack.push(0); // 3
+ case 13: stack.push(1); // 4
+ case 14: stack.push(arg1); // 43
+ case 15: { var v2 = stack.pop(); var v1 = stack.pop(); var v0 = stack.pop(); java_lang_String_consVIIAC(stack.pop(), v0, v1, v2); } // 183 1 137
+ case 18: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringI(arg0) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 26
+ case 1: stack.push(10); // 16 10
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Integer_toStringLjava_lang_StringII(v0, v1)); } // 184 1 125
+ case 6: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringJ(arg0) {
+ var arg1;
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 30
+ case 1: stack.push(10); // 16 10
+ case 3: { var v1 = stack.pop(); var v0 = stack.pop(); stack.push(java_lang_Long_toStringLjava_lang_StringJI(v0, v1)); } // 184 1 126
+ case 6: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringF(arg0) {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 34
+ case 1: { var v0 = stack.pop(); stack.push(java_lang_Float_toStringLjava_lang_StringF(v0)); } // 184 1 122
+ case 4: return stack.pop(); // 176
+ }
+}
+function java_lang_String_valueOfLjava_lang_StringD(arg0) {
+ var arg1;
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 38
+ case 1: { var v0 = stack.pop(); stack.push(java_lang_Double_toStringLjava_lang_StringD(v0)); } // 184 1 121
+ case 4: return stack.pop(); // 176
+ }
+}
+function java_lang_String_internLjava_lang_String(arg0) {
+ // no code found for null
+}
+function java_lang_String_compareToILjava_lang_Object(arg0,arg1) {
+ var arg2;
+;
+ var stack = new Array(2);
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(arg0); // 42
+ case 1: stack.push(arg1); // 43
+ case 2: if(stack[stack.length - 1].$instOf_java_lang_String != 1) throw {}; // 192 0 200
+ case 5: { var v0 = stack.pop(); var self = stack.pop(); stack.push(self.compareToILjava_lang_String(self, v0)); } // 182 1 148
+ case 8: return stack.pop(); // 172
+ }
+}
+function java_lang_String_classV() {
+ var stack = new Array();
+ var gt = 0;
+ for(;;) switch(gt) {
+ case 0: stack.push(0); // 3
+ case 1: stack.push(new Array(stack.pop())); // 189 0 183
+ case 4: java_lang_String_serialPersistentFields = stack.pop(); // 179 1 101
+ case 7: stack.push(new java_lang_String$CaseInsensitiveComparator); // 187 0 202
+ case 10: stack.push(stack[stack.length - 1]); // 89
+ case 11: // 1
+ case 12: { var v0 = stack.pop(); java_lang_String$CaseInsensitiveComparator_consVLjava_lang_String$1(stack.pop(), v0); } // 183 1 160
+ case 15: java_lang_String_CASE_INSENSITIVE_ORDER = stack.pop(); // 179 1 102
+ case 18: return; // 177
+ }
+}
+*/
+var java_lang_String_serialVersionUID = 0;
+var java_lang_String_serialPersistentFields = 0;
+var java_lang_String_CASE_INSENSITIVE_ORDER = 0;
+function java_lang_String() {
+ /** the real value of this 'string' we delegate to */
+ this.r = '';
+
+ var self = this;
+ /*
+ this.value = 0;
+ this.offset = 0;
+ this.count = 0;
+ this.hash = 0;
+ */
+ this.toString = function() { return self.r; };
+}
+java_lang_String.prototype = new String;
+//java_lang_String_classV();
+
+/* new method for JavaScript String */
+String.prototype.charAtCI = java_lang_String_charAtCI;
+String.prototype.lengthI = java_lang_String_lengthI;
+String.prototype.isEmptyZ = java_lang_String_isEmptyZ;
+String.prototype.getCharsVIIACI = java_lang_String_getCharsVIIACAI;
+String.prototype.toStringLjava_lang_String = java_lang_String_toStringLjava_lang_String;
+String.prototype.$instOf_java_lang_String = true;
+String.prototype.$instOf_java_io_Serializable = true;
+String.prototype.$instOf_java_lang_Comparable = true;
+String.prototype.$instOf_java_lang_CharSequence = true;
+
+/*
+ this.lengthI = java_lang_String_lengthI;
+ this.isEmptyZ = java_lang_String_isEmptyZ;
+ this.charAtCI = java_lang_String_charAtCI;
+ this.codePointAtII = java_lang_String_codePointAtII;
+ this.codePointBeforeII = java_lang_String_codePointBeforeII;
+ this.codePointCountIII = java_lang_String_codePointCountIII;
+ this.offsetByCodePointsIII = java_lang_String_offsetByCodePointsIII;
+ this.getCharsVACI = java_lang_String_getCharsVACI;
+ this.getCharsVIIACI = java_lang_String_getCharsVIIACI;
+ this.getBytesVIIABI = java_lang_String_getBytesVIIABI;
+ this.getBytesABLjava_lang_String = java_lang_String_getBytesABLjava_lang_String;
+ this.getBytesABLjava_nio_charset_Charset = java_lang_String_getBytesABLjava_nio_charset_Charset;
+ this.getBytesAB = java_lang_String_getBytesAB;
+ this.equalsZLjava_lang_Object = java_lang_String_equalsZLjava_lang_Object;
+ this.contentEqualsZLjava_lang_StringBuffer = java_lang_String_contentEqualsZLjava_lang_StringBuffer;
+ this.contentEqualsZLjava_lang_CharSequence = java_lang_String_contentEqualsZLjava_lang_CharSequence;
+ this.equalsIgnoreCaseZLjava_lang_String = java_lang_String_equalsIgnoreCaseZLjava_lang_String;
+ this.compareToILjava_lang_String = java_lang_String_compareToILjava_lang_String;
+ this.compareToIgnoreCaseILjava_lang_String = java_lang_String_compareToIgnoreCaseILjava_lang_String;
+ this.regionMatchesZILjava_lang_StringII = java_lang_String_regionMatchesZILjava_lang_StringII;
+ this.regionMatchesZZILjava_lang_StringII = java_lang_String_regionMatchesZZILjava_lang_StringII;
+ this.startsWithZLjava_lang_StringI = java_lang_String_startsWithZLjava_lang_StringI;
+ this.startsWithZLjava_lang_String = java_lang_String_startsWithZLjava_lang_String;
+ this.endsWithZLjava_lang_String = java_lang_String_endsWithZLjava_lang_String;
+ this.hashCodeI = java_lang_String_hashCodeI;
+ this.indexOfII = java_lang_String_indexOfII;
+ this.indexOfIII = java_lang_String_indexOfIII;
+ this.lastIndexOfII = java_lang_String_lastIndexOfII;
+ this.lastIndexOfIII = java_lang_String_lastIndexOfIII;
+ this.indexOfILjava_lang_String = java_lang_String_indexOfILjava_lang_String;
+ this.indexOfILjava_lang_StringI = java_lang_String_indexOfILjava_lang_StringI;
+ this.lastIndexOfILjava_lang_String = java_lang_String_lastIndexOfILjava_lang_String;
+ this.lastIndexOfILjava_lang_StringI = java_lang_String_lastIndexOfILjava_lang_StringI;
+ this.substringLjava_lang_StringI = java_lang_String_substringLjava_lang_StringI;
+ this.substringLjava_lang_StringII = java_lang_String_substringLjava_lang_StringII;
+ this.subSequenceLjava_lang_CharSequenceII = java_lang_String_subSequenceLjava_lang_CharSequenceII;
+ this.concatLjava_lang_StringLjava_lang_String = java_lang_String_concatLjava_lang_StringLjava_lang_String;
+ this.replaceLjava_lang_StringCC = java_lang_String_replaceLjava_lang_StringCC;
+ this.matchesZLjava_lang_String = java_lang_String_matchesZLjava_lang_String;
+ this.containsZLjava_lang_CharSequence = java_lang_String_containsZLjava_lang_CharSequence;
+ this.replaceFirstLjava_lang_StringLjava_lang_StringLjava_lang_String = java_lang_String_replaceFirstLjava_lang_StringLjava_lang_StringLjava_lang_String;
+ this.replaceAllLjava_lang_StringLjava_lang_StringLjava_lang_String = java_lang_String_replaceAllLjava_lang_StringLjava_lang_StringLjava_lang_String;
+ this.replaceLjava_lang_StringLjava_lang_CharSequenceLjava_lang_CharSequence = java_lang_String_replaceLjava_lang_StringLjava_lang_CharSequenceLjava_lang_CharSequence;
+ this.splitALjava_lang_StringLjava_lang_StringI = java_lang_String_splitALjava_lang_StringLjava_lang_StringI;
+ this.splitALjava_lang_StringLjava_lang_String = java_lang_String_splitALjava_lang_StringLjava_lang_String;
+ this.toLowerCaseLjava_lang_StringLjava_util_Locale = java_lang_String_toLowerCaseLjava_lang_StringLjava_util_Locale;
+ this.toLowerCaseLjava_lang_String = java_lang_String_toLowerCaseLjava_lang_String;
+ this.toUpperCaseLjava_lang_StringLjava_util_Locale = java_lang_String_toUpperCaseLjava_lang_StringLjava_util_Locale;
+ this.toUpperCaseLjava_lang_String = java_lang_String_toUpperCaseLjava_lang_String;
+ this.trimLjava_lang_String = java_lang_String_trimLjava_lang_String;
+ this.toStringLjava_lang_String = java_lang_String_toStringLjava_lang_String;
+ this.toCharArrayAC = java_lang_String_toCharArrayAC;
+ this.internLjava_lang_String = java_lang_String_internLjava_lang_String;
+ this.compareToILjava_lang_Object = java_lang_String_compareToILjava_lang_Object;
+ */
+
+
+
diff -r 4fca8ddf46de -r ff3f0de0b8a2 htmlpage/pom.xml
--- a/htmlpage/pom.xml Fri Sep 28 14:58:21 2012 +0200
+++ b/htmlpage/pom.xml Thu Oct 11 06:16:00 2012 -0700
@@ -31,6 +31,25 @@
@Page
annotation to
+ * generate a Java representation of elements with IDs in that page.
+ * Depending on the type of the elements, they will have different
+ * methods (e.g. PG_TITLE
has setText
, etc.).
+ * Use @OnClick
annotation to associate behavior
+ * with existing elements. Use the generated elements
+ * (PG_TITLE
, PG_TEXT
) to modify the page.
+ * java/lang/String
. Can be null
* if one is not interested in knowing references
+ * @param scripts write only collection with names of resources to read
+ * @return the initialization code for this class, if any. Otherwise null
+ *
* @throws IOException if something goes wrong during read or write or translating
*/
- public static void compile(
+ public static String compile(
InputStream classFile, Appendable out,
- Collection super String> references
+ Collection super String> references,
+ Collection super String> scripts
) throws IOException {
ClassFile jc = new ClassFile(classFile, true);
+ final ClassName extraAnn = ClassName.getClassName(ExtraJavaScript.class.getName().replace('.', '/'));
+ Annotation a = jc.getAnnotation(extraAnn);
+ if (a != null) {
+ final ElementValue annVal = a.getComponent("resource").getValue();
+ String res = ((PrimitiveElementValue)annVal).getValue().getValue().toString();
+ scripts.add(res);
+ final AnnotationComponent process = a.getComponent("processByteCode");
+ if (process != null && "const=0".equals(process.getValue().toString())) {
+ return null;
+ }
+ }
+
ByteCodeToJavaScript compiler = new ByteCodeToJavaScript(
jc, out, references
);
@@ -95,26 +118,39 @@
out.append("\n this." + v.getName() + " = 0;");
}
}
- out.append("\n}");
+ out.append("\n}\n\nfunction ").append(className).append("_proto() {");
+ out.append("\n if (").append(className).
+ append(".prototype.$instOf_").append(className).append(") {");
+ out.append("\n return ").append(className).append(".prototype;");
+ out.append("\n }");
ClassName sc = jc.getSuperClass();
if (sc != null) {
- out.append("\n").append(className)
+ out.append("\n ").append(sc.getInternalName().replace('/', '_')).append("_proto();");
+ out.append("\n ").append(className)
.append(".prototype = new ").append(sc.getInternalName().replace('/', '_')).append(';');
}
for (Method m : jc.getMethods()) {
if (!m.isStatic() && !m.isPrivate() && !m.getName().contains("