--- a/jdk/make/java/java/Makefile Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/java/java/Makefile Fri Dec 04 10:23:07 2009 -0800
@@ -390,7 +390,7 @@
LOCALES_GEN_SH = localelist.sh
$(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
- $(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java $(LOCALES_GEN_SH)
+ $(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java.template $(LOCALES_GEN_SH)
@$(prep-target)
NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
$< $@
--- a/jdk/make/java/java/genlocales.gmk Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/java/java/genlocales.gmk Fri Dec 04 10:23:07 2009 -0800
@@ -68,7 +68,7 @@
FILES_java := $(FILES_java_orig)
FILES_compiled_properties := $(FILES_compiled_properties_orig)
-LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java
+LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/LocaleDataMetaInfo.java
LOCALEGEN_SH=localegen.sh
RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData"
--- a/jdk/make/java/java/localegen.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/java/java/localegen.sh Fri Dec 04 10:23:07 2009 -0800
@@ -27,7 +27,7 @@
#
# This script is to generate the supported locale list string and replace the
-# LocaleDataMetaInfo-XLocales.java in <ws>/src/share/classes/sun/util
+# LocaleDataMetaInfo-XLocales.java.template in <ws>/src/share/classes/sun/util
#
# SORT, NAWK & SED is passed in as environment variables.
#
--- a/jdk/make/java/nio/Makefile Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/java/nio/Makefile Fri Dec 04 10:23:07 2009 -0800
@@ -834,7 +834,7 @@
GENCSSRC = $(BUILDDIR)/tools/CharsetMapping
CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar
-$(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java $(GENCSSRC)/sbcs
+$(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java.template $(GENCSSRC)/sbcs
@$(prep-target)
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSSRC) $(SCS_GEN) sbcs
--- a/jdk/make/netbeans/README Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/netbeans/README Fri Dec 04 10:23:07 2009 -0800
@@ -411,7 +411,7 @@
java/util/regex/,\
java/util/spi/,\
java/util/zip/,\
- **/*-XLocales.java
+ **/*-XLocales.java.template
jtreg.tests=\
java/util/**/*Collection/ \
java/util/**/*Map/ \
--- a/jdk/make/sun/nio/Makefile Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/sun/nio/Makefile Fri Dec 04 10:23:07 2009 -0800
@@ -82,7 +82,9 @@
$(FILES_MAP) $(FILES_DAT) sjis0213
-$(FILES_genout_extcs): $(GENCSDATASRC)/SingleByte-X.java $(GENCSDATASRC)/DoubleByte-X.java \
+$(FILES_genout_extcs): \
+ $(GENCSDATASRC)/SingleByte-X.java.template \
+ $(GENCSDATASRC)/DoubleByte-X.java.template \
$(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs
@$(prep-target)
$(RM) -r $(GENCSEXT)
--- a/jdk/make/tools/CharsetMapping/DoubleByte-X.java Wed Dec 02 12:17:42 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package $PACKAGE$;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.util.Arrays;
-import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.ext.DoubleByte;
-
-public class $NAME_CLZ$ extends Charset
- $IMPLEMENTS$
-{
- public $NAME_CLZ$() {
- super("$NAME_CS$", $NAME_ALIASES$);
- }
-
- $HISTORICALNAME$
-
- public boolean contains(Charset cs) {
- $CONTAINS$
- }
-
- public CharsetDecoder newDecoder() {
- initb2c();
- return new DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$);
- }
-
- public CharsetEncoder newEncoder() {
- initc2b();
- return new DoubleByte.Encoder$ENCTYPE$(this, c2b, c2bIndex);
- }
-
- $B2C$
- static char[][] b2c = new char[b2cStr.length][];
- static char[] b2cSB;
- private static volatile boolean b2cInitialized = false;
-
- static void initb2c() {
- if (b2cInitialized)
- return;
- synchronized (b2c) {
- if (b2cInitialized)
- return;
- for (int i = 0; i < b2cStr.length; i++) {
- if (b2cStr[i] == null)
- b2c[i] = DoubleByte.B2C_UNMAPPABLE;
- else
- b2c[i] = b2cStr[i].toCharArray();
- }
- b2cSB = b2cSBStr.toCharArray();
- b2cInitialized = true;
- }
- }
-
- static char[] c2b = new char[$C2BLENGTH$];
- static char[] c2bIndex = new char[0x100];
- private static volatile boolean c2bInitialized = false;
-
- static void initc2b() {
- if (c2bInitialized)
- return;
- synchronized (c2b) {
- if (c2bInitialized)
- return;
- $NONROUNDTRIP_B2C$
- $NONROUNDTRIP_C2B$
- DoubleByte.Encoder.initC2B(b2cStr, b2cSBStr, b2cNR, c2bNR,
- $B2MIN$, $B2MAX$,
- c2b, c2bIndex);
- c2bInitialized = true;
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/CharsetMapping/DoubleByte-X.java.template Fri Dec 04 10:23:07 2009 -0800
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.util.Arrays;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.ext.DoubleByte;
+
+public class $NAME_CLZ$ extends Charset
+ $IMPLEMENTS$
+{
+ public $NAME_CLZ$() {
+ super("$NAME_CS$", $NAME_ALIASES$);
+ }
+
+ $HISTORICALNAME$
+
+ public boolean contains(Charset cs) {
+ $CONTAINS$
+ }
+
+ public CharsetDecoder newDecoder() {
+ initb2c();
+ return new DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$);
+ }
+
+ public CharsetEncoder newEncoder() {
+ initc2b();
+ return new DoubleByte.Encoder$ENCTYPE$(this, c2b, c2bIndex);
+ }
+
+ $B2C$
+ static char[][] b2c = new char[b2cStr.length][];
+ static char[] b2cSB;
+ private static volatile boolean b2cInitialized = false;
+
+ static void initb2c() {
+ if (b2cInitialized)
+ return;
+ synchronized (b2c) {
+ if (b2cInitialized)
+ return;
+ for (int i = 0; i < b2cStr.length; i++) {
+ if (b2cStr[i] == null)
+ b2c[i] = DoubleByte.B2C_UNMAPPABLE;
+ else
+ b2c[i] = b2cStr[i].toCharArray();
+ }
+ b2cSB = b2cSBStr.toCharArray();
+ b2cInitialized = true;
+ }
+ }
+
+ static char[] c2b = new char[$C2BLENGTH$];
+ static char[] c2bIndex = new char[0x100];
+ private static volatile boolean c2bInitialized = false;
+
+ static void initc2b() {
+ if (c2bInitialized)
+ return;
+ synchronized (c2b) {
+ if (c2bInitialized)
+ return;
+ $NONROUNDTRIP_B2C$
+ $NONROUNDTRIP_C2B$
+ DoubleByte.Encoder.initC2B(b2cStr, b2cSBStr, b2cNR, c2bNR,
+ $B2MIN$, $B2MAX$,
+ c2b, c2bIndex);
+ c2bInitialized = true;
+ }
+ }
+}
--- a/jdk/make/tools/CharsetMapping/SingleByte-X.java Wed Dec 02 12:17:42 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package $PACKAGE$;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.StandardCharsets;
-import sun.nio.cs.SingleByte;
-import sun.nio.cs.HistoricallyNamedCharset;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
-{
- public $NAME_CLZ$() {
- super("$NAME_CS$", $NAME_ALIASES$);
- }
-
- public String historicalName() {
- return "$NAME_HIS$";
- }
-
- public boolean contains(Charset cs) {
- $CONTAINS$;
- }
-
- public CharsetDecoder newDecoder() {
- return new SingleByte.Decoder(this, b2c);
- }
-
- public CharsetEncoder newEncoder() {
- return new SingleByte.Encoder(this, c2b, c2bIndex);
- }
-
- public String getDecoderSingleByteMappings() {
- return b2cTable;
- }
-
- public char[] getEncoderIndex2() {
- return c2b;
- }
-
- public char[] getEncoderIndex1() {
- return c2bIndex;
- }
-
- private final static String b2cTable = $B2CTABLE$
-
- private final static char[] b2c = b2cTable.toCharArray();
- private final static char[] c2b = new char[$C2BLENGTH$];
- private final static char[] c2bIndex = new char[0x100];
-
- static {
- char[] b2cMap = b2c;
- char[] c2bNR = null;
- $NONROUNDTRIP_B2C$
- $NONROUNDTRIP_C2B$
- SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/CharsetMapping/SingleByte-X.java.template Fri Dec 04 10:23:07 2009 -0800
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.StandardCharsets;
+import sun.nio.cs.SingleByte;
+import sun.nio.cs.HistoricallyNamedCharset;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
+{
+ public $NAME_CLZ$() {
+ super("$NAME_CS$", $NAME_ALIASES$);
+ }
+
+ public String historicalName() {
+ return "$NAME_HIS$";
+ }
+
+ public boolean contains(Charset cs) {
+ $CONTAINS$;
+ }
+
+ public CharsetDecoder newDecoder() {
+ return new SingleByte.Decoder(this, b2c);
+ }
+
+ public CharsetEncoder newEncoder() {
+ return new SingleByte.Encoder(this, c2b, c2bIndex);
+ }
+
+ public String getDecoderSingleByteMappings() {
+ return b2cTable;
+ }
+
+ public char[] getEncoderIndex2() {
+ return c2b;
+ }
+
+ public char[] getEncoderIndex1() {
+ return c2bIndex;
+ }
+
+ private final static String b2cTable = $B2CTABLE$
+
+ private final static char[] b2c = b2cTable.toCharArray();
+ private final static char[] c2b = new char[$C2BLENGTH$];
+ private final static char[] c2bIndex = new char[0x100];
+
+ static {
+ char[] b2cMap = b2c;
+ char[] c2bNR = null;
+ $NONROUNDTRIP_B2C$
+ $NONROUNDTRIP_C2B$
+ SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
+ }
+}
--- a/jdk/make/tools/src/build/tools/charsetmapping/GenerateDBCS.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/tools/src/build/tools/charsetmapping/GenerateDBCS.java Fri Dec 04 10:23:07 2009 -0800
@@ -63,7 +63,7 @@
int b2Min = toInteger(fields[8]);
int b2Max = toInteger(fields[9]);
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
- genClass(args[0], args[1], "DoubleByte-X.java",
+ genClass(args[0], args[1], "DoubleByte-X.java.template",
clzName, csName, hisName, pkgName,
isASCII, type,
b1Min, b1Max, b2Min, b2Max);
--- a/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java Fri Dec 04 10:23:07 2009 -0800
@@ -55,7 +55,7 @@
String pkgName = fields[4];
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
- genClass(args[0], args[1], "SingleByte-X.java",
+ genClass(args[0], args[1], "SingleByte-X.java.template",
clzName, csName, hisName, pkgName, isASCII);
}
}
--- a/jdk/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java Wed Dec 02 12:17:42 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc. 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-#warn This file is preprocessed before being compiled
-
-package sun.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-
-/**
- * This is a convenient class for loading some of internal resources faster
- * if they are built with Resources.gmk defined in J2SE workspace. Also,
- * they have to be in class file format.
- *
- * "LOCALE_LIST" will be replaced at built time by a list of locales we
- * defined in Defs.gmk. We want to exclude these locales from search to
- * gain better performance. For example, since we know if the resource
- * is built with Resources.gmk, they are not going to provide basename_en.class
- * & basename_en_US.class resources, in that case, continuing searching them
- * is expensive. By excluding them from the candidate locale list, these
- * resources won't be searched.
- *
- * @since 1.6.
- */
-public class CoreResourceBundleControl extends ResourceBundle.Control {
- /* the candidate locale list to search */
- private final Collection<Locale> excludedJDKLocales;
- /* singlton instance of the resource bundle control. */
- private static CoreResourceBundleControl resourceBundleControlInstance =
- new CoreResourceBundleControl();
-
- protected CoreResourceBundleControl() {
- excludedJDKLocales = Arrays.asList(#LOCALE_LIST#);
- }
-
- /**
- * This method is to provide a customized ResourceBundle.Control to speed
- * up the search of resources in JDK.
- *
- * @return the instance of resource bundle control.
- */
- public static CoreResourceBundleControl getRBControlInstance() {
- return resourceBundleControlInstance;
- }
-
- /**
- * This method is to provide a customized ResourceBundle.Control to speed
- * up the search of resources in JDK, with the bundle's package name check.
- *
- * @param bundleName bundle name to check
- * @return the instance of resource bundle control if the bundle is JDK's,
- * otherwise returns null.
- */
- public static CoreResourceBundleControl getRBControlInstance(String bundleName) {
- if (bundleName.startsWith("com.sun.") ||
- bundleName.startsWith("java.") ||
- bundleName.startsWith("javax.") ||
- bundleName.startsWith("sun.")) {
- return resourceBundleControlInstance;
- } else {
- return null;
- }
- }
-
- /**
- * @returns a list of candidate locales to search from.
- * @exception NullPointerException if baseName or locale is null.
- */
- @Override
- public List<Locale> getCandidateLocales(String baseName, Locale locale) {
- List<Locale> candidates = super.getCandidateLocales(baseName, locale);
- candidates.removeAll(excludedJDKLocales);
- return candidates;
- }
-
- /**
- * @ returns TTL_DONT_CACHE so that ResourceBundle instance won't be cached.
- * User of this CoreResourceBundleControl should probably maintain a hard reference
- * to the ResourceBundle object themselves.
- */
- @Override
- public long getTimeToLive(String baseName, Locale locale) {
- return ResourceBundle.Control.TTL_DONT_CACHE;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template Fri Dec 04 10:23:07 2009 -0800
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+package sun.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.ResourceBundle.Control;
+
+/**
+ * This is a convenient class for loading some of internal resources faster
+ * if they are built with Resources.gmk defined in J2SE workspace. Also,
+ * they have to be in class file format.
+ *
+ * "LOCALE_LIST" will be replaced at built time by a list of locales we
+ * defined in Defs.gmk. We want to exclude these locales from search to
+ * gain better performance. For example, since we know if the resource
+ * is built with Resources.gmk, they are not going to provide basename_en.class
+ * & basename_en_US.class resources, in that case, continuing searching them
+ * is expensive. By excluding them from the candidate locale list, these
+ * resources won't be searched.
+ *
+ * @since 1.6.
+ */
+public class CoreResourceBundleControl extends ResourceBundle.Control {
+ /* the candidate locale list to search */
+ private final Collection<Locale> excludedJDKLocales;
+ /* singlton instance of the resource bundle control. */
+ private static CoreResourceBundleControl resourceBundleControlInstance =
+ new CoreResourceBundleControl();
+
+ protected CoreResourceBundleControl() {
+ excludedJDKLocales = Arrays.asList(#LOCALE_LIST#);
+ }
+
+ /**
+ * This method is to provide a customized ResourceBundle.Control to speed
+ * up the search of resources in JDK.
+ *
+ * @return the instance of resource bundle control.
+ */
+ public static CoreResourceBundleControl getRBControlInstance() {
+ return resourceBundleControlInstance;
+ }
+
+ /**
+ * This method is to provide a customized ResourceBundle.Control to speed
+ * up the search of resources in JDK, with the bundle's package name check.
+ *
+ * @param bundleName bundle name to check
+ * @return the instance of resource bundle control if the bundle is JDK's,
+ * otherwise returns null.
+ */
+ public static CoreResourceBundleControl getRBControlInstance(String bundleName) {
+ if (bundleName.startsWith("com.sun.") ||
+ bundleName.startsWith("java.") ||
+ bundleName.startsWith("javax.") ||
+ bundleName.startsWith("sun.")) {
+ return resourceBundleControlInstance;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @returns a list of candidate locales to search from.
+ * @exception NullPointerException if baseName or locale is null.
+ */
+ @Override
+ public List<Locale> getCandidateLocales(String baseName, Locale locale) {
+ List<Locale> candidates = super.getCandidateLocales(baseName, locale);
+ candidates.removeAll(excludedJDKLocales);
+ return candidates;
+ }
+
+ /**
+ * @ returns TTL_DONT_CACHE so that ResourceBundle instance won't be cached.
+ * User of this CoreResourceBundleControl should probably maintain a hard reference
+ * to the ResourceBundle object themselves.
+ */
+ @Override
+ public long getTimeToLive(String baseName, Locale locale) {
+ return ResourceBundle.Control.TTL_DONT_CACHE;
+ }
+}
--- a/jdk/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java Wed Dec 02 12:17:42 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc. 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-#warn This file is preprocessed before being compiled
-
-/*
- * This class contains a map which records the locale list string for
- * each resource in sun.util.resources & sun.text.resources.
- * It is used to avoid loading non-existent localized resources so that
- * jar files won't be opened unnecessary to look up them.
- *
- * @since 1.6
- */
-package sun.util;
-
-import java.util.HashMap;
-
-
-public class LocaleDataMetaInfo {
-
- private static final HashMap<String, String> resourceNameToLocales =
- new HashMap<String, String>(6);
-
-
- static {
- /* During JDK build time, #XXX_YYY# will be replaced by a string contain all the locales
- supported by the resource.
-
- Don't remove the space character between " and #. That is put there purposely so that
- look up locale string such as "en" could be based on if it contains " en ".
- */
- resourceNameToLocales.put("sun.text.resources.FormatData",
- " #FormatData_EuroLocales# | #FormatData_NonEuroLocales# ");
-
- resourceNameToLocales.put("sun.text.resources.CollationData",
- " #CollationData_EuroLocales# | #CollationData_NonEuroLocales# ");
-
- resourceNameToLocales.put("sun.util.resources.TimeZoneNames",
- " #TimeZoneNames_EuroLocales# | #TimeZoneNames_NonEuroLocales# ");
-
- resourceNameToLocales.put("sun.util.resources.LocaleNames",
- " #LocaleNames_EuroLocales# | #LocaleNames_NonEuroLocales# ");
-
- resourceNameToLocales.put("sun.util.resources.CurrencyNames",
- " #CurrencyNames_EuroLocales# | #CurrencyNames_NonEuroLocales# ");
-
- resourceNameToLocales.put("sun.util.resources.CalendarData",
- " #CalendarData_EuroLocales# | #CalendarData_NonEuroLocales# ");
- }
-
- /*
- * @param resourceName the resource name
- * @return the supported locale string for the passed in resource.
- */
- public static String getSupportedLocaleString(String resourceName) {
-
- return resourceNameToLocales.get(resourceName);
- }
-
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template Fri Dec 04 10:23:07 2009 -0800
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+/*
+ * This class contains a map which records the locale list string for
+ * each resource in sun.util.resources & sun.text.resources.
+ * It is used to avoid loading non-existent localized resources so that
+ * jar files won't be opened unnecessary to look up them.
+ *
+ * @since 1.6
+ */
+package sun.util;
+
+import java.util.HashMap;
+
+
+public class LocaleDataMetaInfo {
+
+ private static final HashMap<String, String> resourceNameToLocales =
+ new HashMap<String, String>(6);
+
+
+ static {
+ /* During JDK build time, #XXX_YYY# will be replaced by a string contain all the locales
+ supported by the resource.
+
+ Don't remove the space character between " and #. That is put there purposely so that
+ look up locale string such as "en" could be based on if it contains " en ".
+ */
+ resourceNameToLocales.put("sun.text.resources.FormatData",
+ " #FormatData_EuroLocales# | #FormatData_NonEuroLocales# ");
+
+ resourceNameToLocales.put("sun.text.resources.CollationData",
+ " #CollationData_EuroLocales# | #CollationData_NonEuroLocales# ");
+
+ resourceNameToLocales.put("sun.util.resources.TimeZoneNames",
+ " #TimeZoneNames_EuroLocales# | #TimeZoneNames_NonEuroLocales# ");
+
+ resourceNameToLocales.put("sun.util.resources.LocaleNames",
+ " #LocaleNames_EuroLocales# | #LocaleNames_NonEuroLocales# ");
+
+ resourceNameToLocales.put("sun.util.resources.CurrencyNames",
+ " #CurrencyNames_EuroLocales# | #CurrencyNames_NonEuroLocales# ");
+
+ resourceNameToLocales.put("sun.util.resources.CalendarData",
+ " #CalendarData_EuroLocales# | #CalendarData_NonEuroLocales# ");
+ }
+
+ /*
+ * @param resourceName the resource name
+ * @return the supported locale string for the passed in resource.
+ */
+ public static String getSupportedLocaleString(String resourceName) {
+
+ return resourceNameToLocales.get(resourceName);
+ }
+
+}
--- a/jdk/test/Makefile Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/Makefile Fri Dec 04 10:23:07 2009 -0800
@@ -282,11 +282,23 @@
RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
+EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt
+
+TESTEXIT = \
+ if [ ! -s $(EXITCODE) ] ; then \
+ $(ECHO) "ERROR: EXITCODE file not filled in."; \
+ $(ECHO) "1" > $(EXITCODE); \
+ fi ; \
+ testExitCode=`$(CAT) $(EXITCODE)`; \
+ $(ECHO) "EXIT CODE: $${testExitCode}"; \
+ exit ${testExitCode}
+
BUNDLE_UP_AND_EXIT = \
( \
- exitCode=$$? && \
+ jtregExitCode=$$? && \
_summary="$(SUMMARY_TXT)"; \
- $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST); \
+ $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
+ $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
if [ -r "$${_summary}" ] ; then \
$(ECHO) "Summary: $${_summary}" > $(STATS_TXT); \
$(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
@@ -297,10 +309,13 @@
$(EGREP) ' Error\.' $(RUNLIST); \
$(EGREP) -v ' Passed\.' $(RUNLIST) ) \
| $(SORT) | $(UNIQ) > $(FAILLIST); \
- if [ $${exitCode} != 0 -o -s $(FAILLIST) ] ; then \
+ if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
$(EXPAND) $(FAILLIST) \
| $(CUT) -d' ' -f1 \
| $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
+ if [ $${jtregExitCode} = 0 ] ; then \
+ jtregExitCode=1; \
+ fi; \
fi; \
runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
@@ -312,8 +327,8 @@
$(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
fi; \
$(CAT) $(STATS_TXT); \
- $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) && \
- exit $${exitCode} \
+ $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \
+ $(TESTEXIT) \
)
################################################################
@@ -598,7 +613,7 @@
$(JTREG_TEST_OPTIONS) \
$(TESTDIRS) \
) ; $(BUNDLE_UP_AND_EXIT) \
- ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt
+ ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
PHONY_LIST += jtreg_tests
--- a/jdk/test/ProblemList.txt Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/ProblemList.txt Fri Dec 04 10:23:07 2009 -0800
@@ -1099,6 +1099,14 @@
sun/tools/jps/jps-Vvml_2.sh generic-all
sun/tools/jps/jps-m_2.sh generic-all
+# Fails on OpenSolaris "Could not synchronize with target"
+sun/tools/jps/jps-Defaults.sh generic-all
+sun/tools/jps/jps-V_2.sh generic-all
+sun/tools/jps/jps-Vm_2.sh generic-all
+sun/tools/jps/jps-Vvm.sh generic-all
+sun/tools/jps/jps-Vvml.sh generic-all
+sun/tools/jps/jps-m.sh generic-all
+
# Server name error, port 2098 problem?
sun/tools/jstatd/jstatdServerName.sh generic-all
--- a/jdk/test/com/sun/jdi/BadHandshakeTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -110,9 +110,10 @@
String exe = System.getProperty("java.home")
+ File.separator + "bin" + File.separator;
String arch = System.getProperty("os.arch");
- if (arch.equals("sparcv9")) {
+ String osname = System.getProperty("os.name");
+ if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
- } else if (arch.equals("amd64")) {
+ } else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
--- a/jdk/test/com/sun/jdi/DoubleAgentTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/com/sun/jdi/DoubleAgentTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -92,9 +92,10 @@
String exe = System.getProperty("java.home")
+ File.separator + "bin" + File.separator;
String arch = System.getProperty("os.arch");
- if (arch.equals("sparcv9")) {
+ String osname = System.getProperty("os.name");
+ if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
- } else if (arch.equals("amd64")) {
+ } else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
--- a/jdk/test/com/sun/jdi/ExclusiveBind.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/com/sun/jdi/ExclusiveBind.java Fri Dec 04 10:23:07 2009 -0800
@@ -99,9 +99,10 @@
String exe = System.getProperty("java.home") + File.separator + "bin" +
File.separator;
String arch = System.getProperty("os.arch");
- if (arch.equals("sparcv9")) {
+ String osname = System.getProperty("os.name");
+ if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
- } else if (arch.equals("amd64")) {
+ } else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
--- a/jdk/test/com/sun/jdi/RunToExit.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/com/sun/jdi/RunToExit.java Fri Dec 04 10:23:07 2009 -0800
@@ -115,9 +115,10 @@
String exe = System.getProperty("java.home")
+ File.separator + "bin" + File.separator;
String arch = System.getProperty("os.arch");
- if (arch.equals("sparcv9")) {
+ String osname = System.getProperty("os.name");
+ if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
- } else if (arch.equals("amd64")) {
+ } else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
--- a/jdk/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java Fri Dec 04 10:23:07 2009 -0800
@@ -145,9 +145,10 @@
String exe = System.getProperty("java.home") + File.separator + "bin" +
File.separator;
String arch = System.getProperty("os.arch");
- if (arch.equals("sparcv9")) {
+ String osname = System.getProperty("os.name");
+ if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
- } else if (arch.equals("amd64")) {
+ } else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
--- a/jdk/test/demo/jvmti/hprof/CpuOldTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/CpuOldTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5012882 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g HelloWorld.java ../DemoRun.java
+ * @compile -g HelloWorld.java ../DemoRun.java
* @build CpuOldTest
* @run main CpuOldTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/CpuSamplesTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/CpuSamplesTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5012882
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g:lines HelloWorld.java ../DemoRun.java
+ * @compile -g:lines HelloWorld.java ../DemoRun.java
* @build CpuSamplesTest
* @run main CpuSamplesTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5097131 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g HelloWorld.java DefineClass.java ../DemoRun.java
+ * @compile -g HelloWorld.java DefineClass.java ../DemoRun.java
* @build CpuTimesDefineClassTest
* @run main CpuTimesDefineClassTest DefineClass
*
--- a/jdk/test/demo/jvmti/hprof/CpuTimesTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/CpuTimesTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5012882 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g HelloWorld.java ../DemoRun.java
+ * @compile -g HelloWorld.java ../DemoRun.java
* @build CpuTimesTest
* @run main CpuTimesTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/HeapAllTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/HeapAllTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5012882 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g HelloWorld.java ../DemoRun.java
+ * @compile -g HelloWorld.java ../DemoRun.java
* @build HeapAllTest
* @run main HeapAllTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/HeapBinaryFormatTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/HeapBinaryFormatTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 4965057 6313381
* @summary Test jvmti hprof format=b
*
- * @compile -source 1.5 -g:source HelloWorld.java ../DemoRun.java
+ * @compile -g:source HelloWorld.java ../DemoRun.java
* @build HeapBinaryFormatTest
* @run main HeapBinaryFormatTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/HeapDumpTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/HeapDumpTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5012882 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g:source HelloWorld.java ../DemoRun.java
+ * @compile -g:source HelloWorld.java ../DemoRun.java
* @build HeapDumpTest
* @run main HeapDumpTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/HeapSitesTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/HeapSitesTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5012882 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g:vars HelloWorld.java ../DemoRun.java
+ * @compile -g:vars HelloWorld.java ../DemoRun.java
* @build HeapSitesTest
* @run main HeapSitesTest HelloWorld
*/
--- a/jdk/test/demo/jvmti/hprof/OptionsTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/demo/jvmti/hprof/OptionsTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 5083441 6299047
* @summary Test jvmti hprof
*
- * @compile -source 1.5 -g:lines HelloWorld.java ../DemoRun.java
+ * @compile -g:lines HelloWorld.java ../DemoRun.java
* @build OptionsTest
* @run main OptionsTest HelloWorld
*/
--- a/jdk/test/java/io/Serializable/enum/array/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/array/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 4838379
* @summary Verify that serialization of enum constant arrays functions
* properly.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/badResolve/Write.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/badResolve/Write.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,10 +26,10 @@
* @summary Verify that enum classes present in a serialization stream cannot
* be resolved by the receiver to non-enum classes, and vice-versa.
*
- * @compile -source 1.5 Write.java
+ * @compile Write.java
* @run main Write
* @clean Write
- * @compile -source 1.5 Read.java
+ * @compile Read.java
* @run main Read
* @clean Read
*/
--- a/jdk/test/java/io/Serializable/enum/basic/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/basic/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 4838379
* @summary Verify that basic serialization of non-specialized enum constants
* functions properly.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/classObject/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/classObject/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 4838379
* @summary Verify that serialization of Class objects for enum types works
* properly.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/constantSubclasses/Write.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/constantSubclasses/Write.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,10 +26,10 @@
* @summary Verify that serialization of enum constants that are instances of
* constant-specific subclasses functions properly.
*
- * @compile -source 1.5 Write.java
+ * @compile Write.java
* @run main Write
* @clean Write
- * @compile -source 1.5 Read.java
+ * @compile Read.java
* @run main Read
* @clean Read
*/
--- a/jdk/test/java/io/Serializable/enum/ignoreSerializationFields/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/ignoreSerializationFields/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 4838379
* @summary Verify that serialVersionUID and serialPersistentFields
* declarations made by enum types and constants are ignored.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/ignoreSerializationMethods/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/ignoreSerializationMethods/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 4838379
* @summary Verify that custom serialization methods defined by enum types are
* not invoked during serialization or deserialization.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/mismatchedTypecode/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/mismatchedTypecode/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @summary Verify that TC_OBJECT followed by a class descriptor for an enum
* class results in an InvalidClassException, as does TC_ENUM followed
* by a class descriptor for a non-enum class.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/missingConstant/Write.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/missingConstant/Write.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,10 +26,10 @@
* @summary Verify that deserialization of an enum constant that does not exist
* on the receiving side results in an InvalidObjectException.
*
- * @compile -source 1.5 Write.java
+ * @compile Write.java
* @run main Write
* @clean Write
- * @compile -source 1.5 Read.java
+ * @compile Read.java
* @run main Read
* @clean Read
*/
--- a/jdk/test/java/io/Serializable/enum/unshared/Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/io/Serializable/enum/unshared/Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 4838379
* @summary Verify that unshared write and read operations work properly with
* enum constants.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
*/
import java.io.*;
--- a/jdk/test/java/lang/Boolean/MakeBooleanComparable.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Boolean/MakeBooleanComparable.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4329937
* @summary Basic test for making Boolean implement Comparable
* @author Josh Bloch
- *
- * @compile -source 1.5 MakeBooleanComparable.java
- * @run main MakeBooleanComparable
*/
import java.util.*;
--- a/jdk/test/java/lang/Class/Cast.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Class/Cast.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @test
* @bug 4881275
* @summary (reflect) Class.cast() - typesafe cast desired
- *
- * @compile -source 1.5 Cast.java
- * @run main Cast
*/
public class Cast {
--- a/jdk/test/java/lang/Class/IsEnum.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Class/IsEnum.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4891872 4989735 4990789 5020490
* @summary Check isEnum() method
* @author Joseph D. Darcy
- * @compile -source 1.5 IsEnum.java
- * @run main IsEnum
*/
import java.lang.annotation.*;
--- a/jdk/test/java/lang/Class/asSubclass/BasicUnit.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Class/asSubclass/BasicUnit.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,7 +27,7 @@
* @summary please add a typesafe cast for Class<?> types
* @author gafter
*
- * @compile -Xlint:unchecked -Werror -source 1.5 BasicUnit.java
+ * @compile -Xlint:unchecked -Werror BasicUnit.java
* @run main BasicUnit
*/
--- a/jdk/test/java/lang/ClassLoader/Assert.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/ClassLoader/Assert.sh Fri Dec 04 10:23:07 2009 -0800
@@ -47,7 +47,7 @@
cp -R ${TESTSRC}/package1 .
cp -R ${TESTSRC}/package2 .
-${TESTJAVA}/bin/javac -source 1.4 Assert.java
+${TESTJAVA}/bin/javac Assert.java
${TESTJAVA}/bin/java Assert
--- a/jdk/test/java/lang/Integer/BitTwiddle.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Integer/BitTwiddle.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4495754
* @summary Basic test for int bit twiddling
* @author Josh Bloch
- *
- * @compile -source 1.5 BitTwiddle.java
- * @run main BitTwiddle
*/
import java.util.Random;
--- a/jdk/test/java/lang/Long/BitTwiddle.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Long/BitTwiddle.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4495754
* @summary Basic test for long bit twiddling
* @author Josh Bloch
- *
- * @compile -source 1.5 BitTwiddle.java
- * @run main BitTwiddle
*/
import java.util.Random;
--- a/jdk/test/java/lang/Math/Atan2Tests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Math/Atan2Tests.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,8 +25,6 @@
* @test
* @bug 4984407
* @summary Tests for {Math, StrictMath}.atan2
- * @compile -source 1.5 Atan2Tests.java
- * @run main Atan2Tests
* @author Joseph D. Darcy
*/
--- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4860891 4826732 4780454 4939441 4826652
* @summary Tests for IEEE 754[R] recommended functions and similar methods
* @author Joseph D. Darcy
- * @compile -source 1.5 IeeeRecommendedTests.java
- * @run main IeeeRecommendedTests
*/
import sun.misc.FpUtils;
--- a/jdk/test/java/lang/Math/PowTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Math/PowTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,8 +25,6 @@
* @test
* @bug 4984407 5033578
* @summary Tests for {Math, StrictMath}.pow
- * @compile -source 1.5 PowTests.java
- * @run main PowTests
* @author Joseph D. Darcy
*/
--- a/jdk/test/java/lang/Math/TanTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Math/TanTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,8 +25,6 @@
* @test
* @bug 5033578
* @summary Tests for {Math, StrictMath}.tan
- * @compile -source 1.5 TanTests.java
- * @run main TanTests
* @author Joseph D. Darcy
*/
--- a/jdk/test/java/lang/Runtime/exec/WinCommand.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Runtime/exec/WinCommand.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,9 +25,6 @@
* @bug 5006520
* @summary Check many different ways to run Windows programs
* @author Martin Buchholz
- *
- * @compile -source 1.5 WinCommand.java
- * @run main WinCommand
*/
import java.io.*;
--- a/jdk/test/java/lang/Thread/GenerifyStackTraces.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Thread/GenerifyStackTraces.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4919105
* @summary Generified basic unit test of Thread.getAllStackTraces()
* @author Mandy Chung
- *
- * @compile -source 1.5 GenerifyStackTraces.java
- * @run main GenerifyStackTraces
*/
import java.util.*;
--- a/jdk/test/java/lang/Thread/UncaughtExceptions.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/Thread/UncaughtExceptions.sh Fri Dec 04 10:23:07 2009 -0800
@@ -121,7 +121,7 @@
}
EOJAVA
- Sys "$javac" "-source" "1.5" "Seppuku.java"
+ Sys "$javac" "Seppuku.java"
CheckCommandResults "$expectedRC" "$expectedOut" "$expectedErr" \
"$java" "Seppuku"
Cleanup
--- a/jdk/test/java/lang/annotation/UnitTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/annotation/UnitTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4906359 4963461 4965058 4965039 4986770
* @summary Unit test for annotation reading
* @author Josh Bloch
- * @compile -source 1.5 UnitTest.java
- * @run main UnitTest
*/
import static java.lang.annotation.RetentionPolicy.RUNTIME;
--- a/jdk/test/java/lang/annotation/package-info.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/annotation/package-info.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,7 +27,7 @@
* @summary Package annotations
* @author gafter
*
- * @compile -source 1.5 package-info.java PackageMain.java
+ * @compile package-info.java PackageMain.java
* @run main PackageMain
*/
--- a/jdk/test/java/lang/management/CompositeData/MemoryNotifInfoCompositeData.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/CompositeData/MemoryNotifInfoCompositeData.java Fri Dec 04 10:23:07 2009 -0800
@@ -29,7 +29,7 @@
* the input CompositeData is invalid.
* @author Mandy Chung
*
- * @compile -source 1.5 OpenTypeConverter.java
+ * @compile OpenTypeConverter.java
* @build MemoryNotifInfoCompositeData
* @run main MemoryNotifInfoCompositeData
*/
--- a/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java Fri Dec 04 10:23:07 2009 -0800
@@ -29,7 +29,7 @@
* the input CompositeData is invalid.
* @author Mandy Chung
*
- * @compile -source 1.5 OpenTypeConverter.java
+ * @compile OpenTypeConverter.java
* @build ThreadInfoCompositeData
* @run main ThreadInfoCompositeData
*/
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 5024531
* @summary Basic Test for ManagementFactory.newPlatformMXBean().
* @author Mandy Chung
- *
- * @compile -source 1.5 MXBeanProxyTest.java
- * @run main MXBeanProxyTest
*/
import javax.management.*;
import java.lang.management.ClassLoadingMXBean;
--- a/jdk/test/java/lang/management/ManagementFactory/PlatformMBeanServerTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/PlatformMBeanServerTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4947536
* @summary Basic unit test of ManagementFactory.getPlatformMBeanServer()
* @author Mandy Chung
- *
- * @compile -source 1.5 PlatformMBeanServerTest.java
- * @run main PlatformMBeanServerTest
*/
import java.lang.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyExceptions.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyExceptions.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,9 +27,6 @@
* @summary Test type mapping of the platform MXBean proxy
* returned from Management.newPlatformMXBeanProxy().
* @author Mandy Chung
- *
- * @compile -source 1.5 ProxyExceptions.java
- * @run main ProxyExceptions
*/
import java.lang.management.*;
import javax.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java Fri Dec 04 10:23:07 2009 -0800
@@ -28,7 +28,7 @@
* returned from Management.newPlatformMXBeanProxy().
* @author Mandy Chung
*
- * @compile -source 1.5 ProxyTypeMapping.java
+ * @compile ProxyTypeMapping.java
* @run main/othervm -verbose:gc ProxyTypeMapping
*/
import java.lang.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java Fri Dec 04 10:23:07 2009 -0800
@@ -28,7 +28,7 @@
* MBeanServer.
* @author Mandy Chung
*
- * @compile -source 1.5 ValidateOpenTypes.java
+ * @compile ValidateOpenTypes.java
* @run main/othervm -verbose:gc ValidateOpenTypes
*/
import java.lang.management.*;
--- a/jdk/test/java/lang/management/RuntimeMXBean/GetSystemProperties.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/RuntimeMXBean/GetSystemProperties.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4990512
* @summary Basic Test for RuntimeMXBean.getSystemProperties().
* @author Mandy Chung
- *
- * @compile -source 1.5 GetSystemProperties.java
- * @run main GetSystemProperties
*/
import java.lang.management.ManagementFactory;
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh Fri Dec 04 10:23:07 2009 -0800
@@ -27,7 +27,7 @@
# @summary
# @author Mandy Chung
#
-# @run compile -source 1.5 InputArgument.java
+# @run compile InputArgument.java
# @run shell TestInputArgument.sh
#
--- a/jdk/test/java/lang/reflect/Constructor/GenericStringTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Constructor/GenericStringTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 5033583 6316717 6470106
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
- * @compile -source 1.5 GenericStringTest.java
- * @run main GenericStringTest
*/
import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Field/GenericStringTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Field/GenericStringTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 5033583
* @summary Check toGenericString() method
* @author Joseph D. Darcy
- * @compile -source 1.5 GenericStringTest.java
- * @run main GenericStringTest
*/
import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Generics/StringsAndBounds.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Generics/StringsAndBounds.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 5015676 4987888 4997464
* @summary Testing upper bounds and availability of toString methods
* @author Joseph D. Darcy
- * @compile -source 1.5 StringsAndBounds.java
- * @run main StringsAndBounds
*/
import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Generics/TestC1.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Generics/TestC1.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 4891872
* @summary Some tests for the generic core reflection api.
* @author Gilad Bracha
-* @compile -source 1.5 TestC1.java
+* @compile TestC1.java
* @run main/othervm -ea TestC1
*/
--- a/jdk/test/java/lang/reflect/Generics/TestC2.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Generics/TestC2.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 4891872
* @summary Some tests for the generic core reflection api.
* @author Gilad Bracha
-* @compile -source 1.5 TestC2.java
+* @compile TestC2.java
* @run main/othervm -ea TestC2
*/
--- a/jdk/test/java/lang/reflect/Generics/TestN1.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Generics/TestN1.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @bug 4891872
* @summary Some tests for the generic core reflection api.
* @author Gilad Bracha
-* @compile -source 1.5 TestN1.java
+* @compile TestN1.java
* @run main/othervm -ea TestN1
*/
--- a/jdk/test/java/lang/reflect/Generics/exceptionCauseTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Generics/exceptionCauseTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4981727
* @summary
* @author Joseph D. Darcy
- * @compile -source 1.5 exceptionCauseTest.java
- * @run main exceptionCauseTest
*/
import java.io.PrintStream;
--- a/jdk/test/java/lang/reflect/Generics/getAnnotationTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Generics/getAnnotationTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4979440
* @summary Test for signature parsing corner case
* @author Joseph D. Darcy
- * @compile -source 1.5 getAnnotationTest.java
- * @run main getAnnotationTest
*/
import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Method/Equals.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Method/Equals.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,7 +27,7 @@
* @summary Generic framework to test Method.equals.
*
* @clean A
- * @compile -source 1.5 Equals.java
+ * @compile Equals.java
* @run main Equals
*/
--- a/jdk/test/java/lang/reflect/Method/GenericStringTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/lang/reflect/Method/GenericStringTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 5033583 6316717 6470106
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
- * @compile -source 1.5 GenericStringTest.java
- * @run main GenericStringTest
*/
import java.lang.reflect.*;
--- a/jdk/test/java/math/BigDecimal/DivideTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/math/BigDecimal/DivideTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4851776 4907265 6177836 6876282
* @summary Some tests for the divide methods.
* @author Joseph D. Darcy
- * @compile -source 1.5 DivideTests.java
- * @run main DivideTests
*/
import java.math.*;
--- a/jdk/test/java/math/BigDecimal/IntegralDivisionTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/math/BigDecimal/IntegralDivisionTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -25,8 +25,6 @@
* @bug 4904082 4917089 6337226
* @summary Tests that integral division and related methods return the proper result and scale.
* @author Joseph D. Darcy
- * @compile -source 1.5 IntegralDivisionTests.java
- * @run main IntegralDivisionTests
*/
import java.math.*;
public class IntegralDivisionTests {
--- a/jdk/test/java/math/BigDecimal/PowTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/math/BigDecimal/PowTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4916097
* @summary Some exponent over/undeflow tests for the pow method
* @author Joseph D. Darcy
- * @compile -source 1.5 PowTests.java
- * @run main PowTests
*/
import java.math.*;
--- a/jdk/test/java/math/BigDecimal/ToPlainStringTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/math/BigDecimal/ToPlainStringTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4984872
* @summary Basic tests of toPlainString method
* @author Joseph D. Darcy
- * @compile -source 1.5 ToPlainStringTests.java
- * @run main ToPlainStringTests
*/
import java.math.*;
--- a/jdk/test/java/math/BigDecimal/ZeroScalingTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/math/BigDecimal/ZeroScalingTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4902952 4905407 4916149
* @summary Tests that the scale of zero is propagated properly and has the proper effect.
* @author Joseph D. Darcy
- * @compile -source 1.5 ZeroScalingTests.java
- * @run main ZeroScalingTests
*/
import java.math.*;
--- a/jdk/test/java/math/RoundingMode/RoundingModeTests.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/math/RoundingMode/RoundingModeTests.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,8 +26,6 @@
* @bug 4851776 4891522 4905335
* @summary Basic tests for the RoundingMode class.
* @author Joseph D. Darcy
- * @compile -source 1.5 RoundingModeTests.java
- * @run main RoundingModeTests
*/
import java.math.RoundingMode;
--- a/jdk/test/java/net/ProxySelector/ProxyTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/net/ProxySelector/ProxyTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,7 +27,7 @@
* @summary HTTP client: Improve proxy server configuration and selection
* @library ../../../sun/net/www/httptest/
* @build ClosedChannelList HttpServer HttpTransaction HttpCallback
- * @compile -source 1.5 ProxyTest.java
+ * @compile ProxyTest.java
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest
*/
--- a/jdk/test/java/net/URL/PerConnectionProxy.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/net/URL/PerConnectionProxy.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,7 +26,7 @@
* @summary Needs per connection proxy support for URLs
* @library ../../../sun/net/www/httptest/
* @build ClosedChannelList HttpServer HttpTransaction HttpCallback
- * @compile -source 1.5 PerConnectionProxy.java
+ * @compile PerConnectionProxy.java
* @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 PerConnectionProxy
*/
--- a/jdk/test/java/security/cert/PKIXBuilderParameters/InvalidParameters.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/security/cert/PKIXBuilderParameters/InvalidParameters.java Fri Dec 04 10:23:07 2009 -0800
@@ -24,7 +24,7 @@
/**
* @test
* @test 4422738
- * @compile -source 1.4 -target 1.4 InvalidParameters.java
+ * @compile -source 1.4 InvalidParameters.java
* @run main InvalidParameters
* @summary Make sure PKIXBuilderParameters(Set) detects invalid
* parameters and throws correct exceptions
--- a/jdk/test/java/security/cert/PKIXParameters/InvalidParameters.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/security/cert/PKIXParameters/InvalidParameters.java Fri Dec 04 10:23:07 2009 -0800
@@ -24,7 +24,7 @@
/**
* @test
* @test 4422738
- * @compile -source 1.4 -target 1.4 InvalidParameters.java
+ * @compile -source 1.4 InvalidParameters.java
* @run main InvalidParameters
* @summary Make sure PKIXParameters(Set) and setTrustAnchors() detects invalid
* parameters and throws correct exceptions
--- a/jdk/test/java/util/AbstractList/CheckForComodification.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/AbstractList/CheckForComodification.java Fri Dec 04 10:23:07 2009 -0800
@@ -28,8 +28,6 @@
* @author Josh Bloch
*
* @ignore Bug fix temporarily removed as it uncovered other bugs (4992226)
- * @compile -source 1.5 CheckForComodification.java
- * @run main CheckForComodification
*/
import java.util.*;
--- a/jdk/test/java/util/Collections/AddAll.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/Collections/AddAll.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4822887
* @summary Basic test for Collections.addAll
* @author Josh Bloch
- *
- * @compile -source 1.5 AddAll.java
- * @run main AddAll
*/
import java.util.*;
--- a/jdk/test/java/util/Collections/Disjoint.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/Collections/Disjoint.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4339792
* @summary Basic test for Collections.disjoint
* @author Josh Bloch
- *
- * @compile -source 1.5 Disjoint.java
- * @run main Disjoint
*/
import java.util.*;
--- a/jdk/test/java/util/Collections/Frequency.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/Collections/Frequency.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4193200
* @summary Basic test for Collections.frequency
* @author Josh Bloch
- *
- * @compile -source 1.5 Frequency.java
- * @run main Frequency
*/
import java.util.*;
--- a/jdk/test/java/util/EnumMap/EnumMapBash.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/EnumMap/EnumMapBash.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,9 +27,6 @@
* @summary Unit test for EnumMap
* @author Josh Bloch
* @author Yo Yo Ma
- *
- * @compile -source 1.5 EnumMapBash.java
- * @run main EnumMapBash
*/
import java.util.*;
--- a/jdk/test/java/util/EnumSet/AllOf.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/EnumSet/AllOf.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4946090
* @summary AllOf static factory is broken in Regular and Jumbo enum set
* @author Josh Bloch
- *
- * @compile -source 1.5 AllOf.java
- * @run main AllOf
*/
import java.util.*;
--- a/jdk/test/java/util/EnumSet/ComplementOf.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/EnumSet/ComplementOf.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4946096
* @summary ComplementOf static factory is broken in Regular and Jumbo enum set
* @author Josh Bloch
- *
- * @compile -source 1.5 ComplementOf.java
- * @run main ComplementOf
*/
import java.util.*;
--- a/jdk/test/java/util/EnumSet/EnumSetBash.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/EnumSet/EnumSetBash.java Fri Dec 04 10:23:07 2009 -0800
@@ -28,9 +28,6 @@
* @author Josh Bloch
* @author Neal Gafter
* @author Yo Ma Ma
- *
- * @compile -source 1.5 EnumSetBash.java
- * @run main EnumSetBash
*/
import java.util.*;
--- a/jdk/test/java/util/EnumSet/JumboRange.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/EnumSet/JumboRange.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4958003
* @summary Range static factory fails to compute size in Jumbo enum set
* @author Josh Bloch
- *
- * @compile -source 1.5 JumboRange.java
- * @run main JumboRange
*/
import java.util.*;
--- a/jdk/test/java/util/EnumSet/Range.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/EnumSet/Range.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4952736
* @summary Range static factory is broken in Regular and Jumbo enum set
* @author Josh Bloch
- *
- * @compile -source 1.5 Range.java
- * @run main Range
*/
import java.util.*;
--- a/jdk/test/java/util/Formattable/StockName.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/Formattable/StockName.java Fri Dec 04 10:23:07 2009 -0800
@@ -21,11 +21,9 @@
* have any questions.
*/
-/**
+/*
* @test
* @bug 4965770 4992540 5030716
- * @compile -source 1.5 StockName.java
- * @run main StockName
*/
import java.nio.CharBuffer;
--- a/jdk/test/java/util/Formatter/Basic-X.java Wed Dec 02 12:17:42 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1712 +0,0 @@
-/*
- * Copyright 2003-2007 Sun Microsystems, Inc. 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.
- *
- * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/* Type-specific source code for unit test
- *
- * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
- * We check in the generated source files so that the test tree can be used
- * independently of the rest of the source tree.
- */
-
-#warn This file is preprocessed before being compiled
-
-import java.io.*;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.DateFormatSymbols;
-import java.util.*;
-#if[double]
-import sun.misc.FpUtils;
-import sun.misc.DoubleConsts;
-#end[double]
-
-import static java.util.Calendar.*;
-#if[datetime]
-import static java.util.SimpleTimeZone.*;
-import java.util.regex.Pattern;
-#end[datetime]
-
-public class Basic$Type$ extends Basic {
-
- private static void test(String fs, String exp, Object ... args) {
- Formatter f = new Formatter(new StringBuilder(), Locale.US);
- f.format(fs, args);
- ck(fs, exp, f.toString());
- }
-
- private static void test(Locale l, String fs, String exp, Object ... args)
- {
- Formatter f = new Formatter(new StringBuilder(), l);
- f.format(fs, args);
- ck(fs, exp, f.toString());
- }
-
- private static void test(String fs, Object ... args) {
- Formatter f = new Formatter(new StringBuilder(), Locale.US);
- f.format(fs, args);
- ck(fs, "fail", f.toString());
- }
-
- private static void test(String fs) {
- Formatter f = new Formatter(new StringBuilder(), Locale.US);
- f.format(fs, "fail");
- ck(fs, "fail", f.toString());
- }
-
- private static void testSysOut(String fs, String exp, Object ... args) {
- FileOutputStream fos = null;
- FileInputStream fis = null;
- try {
- PrintStream saveOut = System.out;
- fos = new FileOutputStream("testSysOut");
- System.setOut(new PrintStream(fos));
- System.out.format(Locale.US, fs, args);
- fos.close();
-
- fis = new FileInputStream("testSysOut");
- byte [] ba = new byte[exp.length()];
- int len = fis.read(ba);
- String got = new String(ba);
- if (len != ba.length)
- fail(fs, exp, got);
- ck(fs, exp, got);
-
- System.setOut(saveOut);
- } catch (FileNotFoundException ex) {
- fail(fs, ex.getClass());
- } catch (IOException ex) {
- fail(fs, ex.getClass());
- } finally {
- try {
- if (fos != null)
- fos.close();
- if (fis != null)
- fis.close();
- } catch (IOException ex) {
- fail(fs, ex.getClass());
- }
- }
- }
-
- private static void tryCatch(String fs, Class<?> ex) {
- boolean caught = false;
- try {
- test(fs);
- } catch (Throwable x) {
- if (ex.isAssignableFrom(x.getClass()))
- caught = true;
- }
- if (!caught)
- fail(fs, ex);
- else
- pass();
- }
-
- private static void tryCatch(String fs, Class<?> ex, Object ... args) {
- boolean caught = false;
- try {
- test(fs, args);
- } catch (Throwable x) {
- if (ex.isAssignableFrom(x.getClass()))
- caught = true;
- }
- if (!caught)
- fail(fs, ex);
- else
- pass();
- }
-
-#if[datetime]
- private static void testDateTime(String fs, String exp, Calendar c) {
- testDateTime(fs, exp, c, true);
- }
-
- private static void testDateTime(String fs, String exp, Calendar c, boolean upper) {
- //---------------------------------------------------------------------
- // Date/Time conversions applicable to Calendar, Date, and long.
- //---------------------------------------------------------------------
-
- // Calendar
- test(fs, exp, c);
- test((Locale)null, fs, exp, c);
- test(Locale.US, fs, exp, c);
-
- // Date/long do not have timezone information so they will always use
- // the default timezone.
- String nexp = (fs.equals("%tZ") || fs.equals("%TZ")
- || fs.equals("%tc") || fs.equals("%Tc")
- ? exp.replace("PST", "GMT-08:00")
- : exp);
-
- // Date (implemented via conversion to Calendar)
- Date d = c.getTime();
- test(fs, nexp, d);
- test((Locale)null, fs, nexp, d);
- test(Locale.US, fs, nexp, d);
-
- // long (implemented via conversion to Calendar)
- long l = c.getTimeInMillis();
- test(fs, nexp, l);
- test((Locale)null, fs, nexp, l);
- test(Locale.US, fs, nexp, l);
-
- if (upper)
- // repeat all tests for upper case variant (%T)
- testDateTime(Pattern.compile("t").matcher(fs).replaceFirst("T"),
- exp.toUpperCase(), c, false);
- }
-
- private static void testHours() {
- for (int i = 0; i < 24; i++) {
- // GregorianCalendar(int year, int month, int dayOfMonth,
- // int hourOfDay, int minute, int second);
- Calendar c = new GregorianCalendar(1995, MAY, 23, i, 48, 34);
-
- //-----------------------------------------------------------------
- // DateTime.HOUR_OF_DAY - 'k' (0 - 23) -- like H
- //-----------------------------------------------------------------
- String exp = Integer.toString(i);
- testDateTime("%tk", exp, c);
-
- //-----------------------------------------------------------------
- // DateTime.HOUR - 'l' (1 - 12) -- like I
- //-----------------------------------------------------------------
- int v = i % 12;
- v = (v == 0 ? 12 : v);
- String exp2 = Integer.toString(v);
- testDateTime("%tl", exp2, c);
-
- //-----------------------------------------------------------------
- // DateTime.HOUR_OF_DAY_0 - 'H' (00 - 23) [zero padded]
- //-----------------------------------------------------------------
- if (exp.length() < 2) exp = "0" + exp;
- testDateTime("%tH", exp, c);
-
- //-----------------------------------------------------------------
- // DateTime.HOUR_0 - 'I' (01 - 12)
- //-----------------------------------------------------------------
- if (exp2.length() < 2) exp2 = "0" + exp2;
- testDateTime("%tI", exp2, c);
-
- //-----------------------------------------------------------------
- // DateTime.AM_PM - (am or pm)
- //-----------------------------------------------------------------
- testDateTime("%tp", (i <12 ? "am" : "pm"), c);
- }
- }
-#end[datetime]
-
-#if[dec]
-#if[prim]
- private static $type$ negate($type$ v) {
- return ($type$) -v;
- }
-#end[prim]
-#end[dec]
-#if[Byte]
- private static $type$ negate($type$ v) {
- return new $type$((byte) -v.byteValue());
- }
-#end[Byte]
-#if[Short]
- private static $type$ negate($type$ v) {
- return new $type$((short) -v.shortValue());
- }
-#end[Short]
-#if[Integer]
- private static $type$ negate($type$ v) {
- return new $type$(-v.intValue());
- }
-#end[Integer]
-#if[Long]
- private static $type$ negate($type$ v) {
- return new $type$(-v.longValue());
- }
-#end[Long]
-
-#if[BigDecimal]
- private static $type$ create(double v) {
- return new $type$(v);
- }
-
- private static $type$ negate($type$ v) {
- return v.negate();
- }
-
- private static $type$ mult($type$ v, double mul) {
- return v.multiply(new $type$(mul));
- }
-
- private static $type$ recip($type$ v) {
- return BigDecimal.ONE.divide(v);
- }
-#end[BigDecimal]
-#if[float]
- private static $type$ create(double v) {
- return ($type$) v;
- }
-
- private static $type$ negate(double v) {
- return ($type$) -v;
- }
-
- private static $type$ mult($type$ v, double mul) {
- return v * ($type$) mul;
- }
-
- private static $type$ recip($type$ v) {
- return 1.0f / v;
- }
-#end[float]
-#if[Float]
- private static $type$ create(double v) {
- return new $type$(v);
- }
-
- private static $type$ negate($type$ v) {
- return new $type$(-v.floatValue());
- }
-
- private static $type$ mult($type$ v, double mul) {
- return new $type$(v.floatValue() * (float) mul);
- }
-
- private static $type$ recip($type$ v) {
- return new $type$(1.0f / v.floatValue());
- }
-#end[Float]
-#if[double]
- private static $type$ create(double v) {
- return ($type$) v;
- }
-
-
- private static $type$ negate(double v) {
- return -v;
- }
-
- private static $type$ mult($type$ v, double mul) {
- return v * mul;
- }
-
- private static $type$ recip($type$ v) {
- return 1.0 / v;
- }
-#end[double]
-#if[Double]
- private static $type$ create(double v) {
- return new $type$(v);
- }
-
- private static $type$ negate($type$ v) {
- return new $type$(-v.doubleValue());
- }
-
- private static $type$ mult($type$ v, double mul) {
- return new $type$(v.doubleValue() * mul);
- }
-
- private static $type$ recip($type$ v) {
- return new $type$(1.0 / v.doubleValue());
- }
-#end[Double]
-
- public static void test() {
- TimeZone.setDefault(TimeZone.getTimeZone("GMT-0800"));
-
- // Any characters not explicitly defined as conversions, date/time
- // conversion suffixes, or flags are illegal and are reserved for
- // future extensions. Use of such a character in a format string will
- // cause an UnknownFormatConversionException or
- // UnknownFormatFlagsException to be thrown.
- tryCatch("%q", UnknownFormatConversionException.class);
- tryCatch("%t&", UnknownFormatConversionException.class);
- tryCatch("%&d", UnknownFormatConversionException.class);
- tryCatch("%^b", UnknownFormatConversionException.class);
-
- //---------------------------------------------------------------------
- // Formatter.java class javadoc examples
- //---------------------------------------------------------------------
- test(Locale.FRANCE, "e = %+10.4f", "e = +2,7183", Math.E);
- test("%4$2s %3$2s %2$2s %1$2s", " d c b a", "a", "b", "c", "d");
- test("Amount gained or lost since last statement: $ %,(.2f",
- "Amount gained or lost since last statement: $ (6,217.58)",
- (new BigDecimal("-6217.58")));
- Calendar c = new GregorianCalendar(1969, JULY, 20, 16, 17, 0);
- testSysOut("Local time: %tT", "Local time: 16:17:00", c);
-
- test("Unable to open file '%1$s': %2$s",
- "Unable to open file 'food': No such file or directory",
- "food", "No such file or directory");
- Calendar duke = new GregorianCalendar(1995, MAY, 23, 19, 48, 34);
- duke.set(Calendar.MILLISECOND, 584);
- test("Duke's Birthday: %1$tB %1$te, %1$tY",
- "Duke's Birthday: May 23, 1995",
- duke);
- test("Duke's Birthday: %1$tB %1$te, %1$tY",
- "Duke's Birthday: May 23, 1995",
- duke.getTime());
- test("Duke's Birthday: %1$tB %1$te, %1$tY",
- "Duke's Birthday: May 23, 1995",
- duke.getTimeInMillis());
-
- test("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
- "d c b a d c b a", "a", "b", "c", "d");
- test("%s %s %<s %<s", "a b b b", "a", "b", "c", "d");
- test("%s %s %s %s", "a b c d", "a", "b", "c", "d");
- test("%2$s %s %<s %s", "b a a b", "a", "b", "c", "d");
-
- //---------------------------------------------------------------------
- // %b
- //
- // General conversion applicable to any argument.
- //---------------------------------------------------------------------
- test("%b", "true", true);
- test("%b", "false", false);
- test("%B", "TRUE", true);
- test("%B", "FALSE", false);
- test("%b", "true", Boolean.TRUE);
- test("%b", "false", Boolean.FALSE);
- test("%B", "TRUE", Boolean.TRUE);
- test("%B", "FALSE", Boolean.FALSE);
- test("%14b", " true", true);
- test("%-14b", "true ", true);
- test("%5.1b", " f", false);
- test("%-5.1b", "f ", false);
-
- test("%b", "true", "foo");
- test("%b", "false", (Object)null);
-
- // Boolean.java hardcodes the Strings for "true" and "false", so no
- // localization is possible.
- test(Locale.FRANCE, "%b", "true", true);
- test(Locale.FRANCE, "%b", "false", false);
-
- // If you pass in a single array to a varargs method, the compiler
- // uses it as the array of arguments rather than treating it as a
- // single array-type argument.
- test("%b", "false", (Object[])new String[2]);
- test("%b", "true", new String[2], new String[2]);
-
- int [] ia = { 1, 2, 3 };
- test("%b", "true", ia);
-
- //---------------------------------------------------------------------
- // %b - errors
- //---------------------------------------------------------------------
- tryCatch("%#b", FormatFlagsConversionMismatchException.class);
- tryCatch("%-b", MissingFormatWidthException.class);
- // correct or side-effect of implementation?
- tryCatch("%.b", UnknownFormatConversionException.class);
- tryCatch("%,b", FormatFlagsConversionMismatchException.class);
-
- //---------------------------------------------------------------------
- // %c
- //
- // General conversion applicable to any argument.
- //---------------------------------------------------------------------
- test("%c", "i", 'i');
- test("%C", "I", 'i');
- test("%4c", " i", 'i');
- test("%-4c", "i ", 'i');
- test("%4C", " I", 'i');
- test("%-4C", "I ", 'i');
- test("%c", "i", new Character('i'));
- test("%c", "H", (byte) 72);
- test("%c", "i", (short) 105);
- test("%c", "!", (int) 33);
- test("%c", "\u007F", Byte.MAX_VALUE);
- test("%c", new String(Character.toChars(Short.MAX_VALUE)),
- Short.MAX_VALUE);
- test("%c", "null", (Object) null);
-
- //---------------------------------------------------------------------
- // %c - errors
- //---------------------------------------------------------------------
- tryCatch("%c", IllegalFormatConversionException.class,
- Boolean.TRUE);
- tryCatch("%c", IllegalFormatConversionException.class,
- (float) 0.1);
- tryCatch("%c", IllegalFormatConversionException.class,
- new Object());
- tryCatch("%c", IllegalFormatCodePointException.class,
- Byte.MIN_VALUE);
- tryCatch("%c", IllegalFormatCodePointException.class,
- Short.MIN_VALUE);
- tryCatch("%c", IllegalFormatCodePointException.class,
- Integer.MIN_VALUE);
- tryCatch("%c", IllegalFormatCodePointException.class,
- Integer.MAX_VALUE);
-
- tryCatch("%#c", FormatFlagsConversionMismatchException.class);
- tryCatch("%,c", FormatFlagsConversionMismatchException.class);
- tryCatch("%(c", FormatFlagsConversionMismatchException.class);
- tryCatch("%$c", UnknownFormatConversionException.class);
- tryCatch("%.2c", IllegalFormatPrecisionException.class);
-
- //---------------------------------------------------------------------
- // %s
- //
- // General conversion applicable to any argument.
- //---------------------------------------------------------------------
- test("%s", "Hello, Duke", "Hello, Duke");
- test("%S", "HELLO, DUKE", "Hello, Duke");
- test("%20S", " HELLO, DUKE", "Hello, Duke");
- test("%20s", " Hello, Duke", "Hello, Duke");
- test("%-20s", "Hello, Duke ", "Hello, Duke");
- test("%-20.5s", "Hello ", "Hello, Duke");
- test("%s", "null", (Object)null);
-
- StringBuffer sb = new StringBuffer("foo bar");
- test("%s", sb.toString(), sb);
- test("%S", sb.toString().toUpperCase(), sb);
-
- //---------------------------------------------------------------------
- // %s - errors
- //---------------------------------------------------------------------
- tryCatch("%-s", MissingFormatWidthException.class);
- tryCatch("%--s", DuplicateFormatFlagsException.class);
- tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0);
- tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
- tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
- tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
-
- //---------------------------------------------------------------------
- // %h
- //
- // General conversion applicable to any argument.
- //---------------------------------------------------------------------
- test("%h", Integer.toHexString("Hello, Duke".hashCode()),
- "Hello, Duke");
- test("%10h", " ddf63471", "Hello, Duke");
- test("%-10h", "ddf63471 ", "Hello, Duke");
- test("%-10H", "DDF63471 ", "Hello, Duke");
- test("%10h", " 402e0000", 15.0);
- test("%10H", " 402E0000", 15.0);
-
- //---------------------------------------------------------------------
- // %h - errors
- //---------------------------------------------------------------------
- tryCatch("%#h", FormatFlagsConversionMismatchException.class);
-
- //---------------------------------------------------------------------
- // flag/conversion errors
- //---------------------------------------------------------------------
- tryCatch("%F", UnknownFormatConversionException.class);
-
- tryCatch("%#g", FormatFlagsConversionMismatchException.class);
-
-#if[dec]
-
-#if[prim]
- $type$ minByte = Byte.MIN_VALUE; // -128
-#else[prim]
- $type$ minByte = new $type$(Byte.MIN_VALUE);
-#end[prim]
-
- //---------------------------------------------------------------------
- // %d
- //
- // Numeric conversion applicable to byte, short, int, long, and
- // BigInteger.
- //---------------------------------------------------------------------
- test("%d", "null", (Object)null);
-
-#if[byte]
-#if[prim]
- //---------------------------------------------------------------------
- // %d - byte
- //---------------------------------------------------------------------
- $type$ seventeen = ($type$) 17;
- test("%d", "17", seventeen);
- test("%,d", "17", seventeen);
- test("%,d", "-17", negate(seventeen));
- test("%(d", "17", seventeen);
- test("%(d", "(17)", negate(seventeen));
- test("% d", " 17", seventeen);
- test("% d", "-17", negate(seventeen));
- test("%+d", "+17", seventeen);
- test("%+d", "-17", negate(seventeen));
- test("%010d", "0000000017", seventeen);
- test("%010d", "-000000017", negate(seventeen));
- test("%(10d", " (17)", negate(seventeen));
- test("%-10d", "17 ", seventeen);
- test("%-10d", "-17 ", negate(seventeen));
-#end[prim]
-#else[byte]
-#if[short]
- //---------------------------------------------------------------------
- // %d - short
- //---------------------------------------------------------------------
- $type$ oneToFive = ($type$) 12345;
- test("%d", "12345", oneToFive);
- test("%,d", "12,345", oneToFive);
- test("%,d", "-12,345", negate(oneToFive));
- test("%(d", "12345", oneToFive);
- test("%(d", "(12345)", negate(oneToFive));
- test("% d", " 12345", oneToFive);
- test("% d", "-12345", negate(oneToFive));
- test("%+d", "+12345", oneToFive);
- test("%+d", "-12345", negate(oneToFive));
- test("%010d", "0000012345", oneToFive);
- test("%010d", "-000012345", negate(oneToFive));
- test("%(10d", " (12345)", negate(oneToFive));
- test("%-10d", "12345 ", oneToFive);
- test("%-10d", "-12345 ", negate(oneToFive));
-
-#else[short]
-#if[prim]
- //---------------------------------------------------------------------
- // %d - int and long
- //---------------------------------------------------------------------
- $type$ oneToSeven = ($type$) 1234567;
- test("%d", "1234567", oneToSeven);
- test("%,d", "1,234,567", oneToSeven);
- test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", oneToSeven);
- test("%,d", "-1,234,567", negate(oneToSeven));
- test("%(d", "1234567", oneToSeven);
- test("%(d", "(1234567)", negate(oneToSeven));
- test("% d", " 1234567", oneToSeven);
- test("% d", "-1234567", negate(oneToSeven));
- test("%+d", "+1234567", oneToSeven);
- test("%+d", "-1234567", negate(oneToSeven));
- test("%010d", "0001234567", oneToSeven);
- test("%010d", "-001234567", negate(oneToSeven));
- test("%(10d", " (1234567)", negate(oneToSeven));
- test("%-10d", "1234567 ", oneToSeven);
- test("%-10d", "-1234567 ", negate(oneToSeven));
-#end[prim]
-#end[short]
-#end[byte]
- //---------------------------------------------------------------------
- // %d - errors
- //---------------------------------------------------------------------
- tryCatch("%#d", FormatFlagsConversionMismatchException.class);
- tryCatch("%D", UnknownFormatConversionException.class);
- tryCatch("%0d", MissingFormatWidthException.class);
- tryCatch("%-d", MissingFormatWidthException.class);
- tryCatch("%7.3d", IllegalFormatPrecisionException.class);
-
- //---------------------------------------------------------------------
- // %o
- //
- // Numeric conversion applicable to byte, short, int, long, and
- // BigInteger.
- //---------------------------------------------------------------------
- test("%o", "null", (Object)null);
-
-#if[byte]
- //---------------------------------------------------------------------
- // %o - byte
- //---------------------------------------------------------------------
- test("%010o", "0000000200", minByte);
- test("%-10o", "200 ", minByte);
- test("%#10o", " 0200", minByte);
-#end[byte]
-#if[short]
- //---------------------------------------------------------------------
- // %o - short
- //---------------------------------------------------------------------
-
- test("%010o", "0000177600", minByte);
- test("%-10o", "177600 ", minByte);
- test("%#10o", " 0177600", minByte);
-#end[short]
-#if[int]
- //---------------------------------------------------------------------
- // %o - int
- //---------------------------------------------------------------------
- test("%014o", "00037777777600", minByte);
- test("%-14o", "37777777600 ", minByte);
- test("%#14o", " 037777777600", minByte);
-
- $type$ oneToSevenOct = ($type$) 1234567;
- test("%o", "4553207", oneToSevenOct);
- test("%010o", "0004553207", oneToSevenOct);
- test("%-10o", "4553207 ", oneToSevenOct);
- test("%#10o", " 04553207", oneToSevenOct);
-#end[int]
-#if[long]
- //---------------------------------------------------------------------
- // %o - long
- //---------------------------------------------------------------------
- test("%024o", "001777777777777777777600", minByte);
- test("%-24o", "1777777777777777777600 ", minByte);
- test("%#24o", " 01777777777777777777600", minByte);
-
- $type$ oneToSevenOct = ($type$) 1234567;
- test("%o", "4553207", oneToSevenOct);
- test("%010o", "0004553207", oneToSevenOct);
- test("%-10o", "4553207 ", oneToSevenOct);
- test("%#10o", " 04553207", oneToSevenOct);
-#end[long]
-
- //---------------------------------------------------------------------
- // %o - errors
- //---------------------------------------------------------------------
- tryCatch("%(o", FormatFlagsConversionMismatchException.class,
- minByte);
- tryCatch("%+o", FormatFlagsConversionMismatchException.class,
- minByte);
- tryCatch("% o", FormatFlagsConversionMismatchException.class,
- minByte);
- tryCatch("%0o", MissingFormatWidthException.class);
- tryCatch("%-o", MissingFormatWidthException.class);
- tryCatch("%,o", FormatFlagsConversionMismatchException.class);
- tryCatch("%O", UnknownFormatConversionException.class);
-
- //---------------------------------------------------------------------
- // %x
- //
- // Numeric conversion applicable to byte, short, int, long, and
- // BigInteger.
- //---------------------------------------------------------------------
- test("%x", "null", (Object)null);
-
-#if[byte]
- //---------------------------------------------------------------------
- // %x - byte
- //---------------------------------------------------------------------
- test("%010x", "0000000080", minByte);
- test("%-10x", "80 ", minByte);
- test("%#10x", " 0x80", minByte);
- test("%0#10x","0x00000080", minByte);
- test("%#10X", " 0X80", minByte);
- test("%X", "80", minByte);
-#end[byte]
-#if[short]
- //---------------------------------------------------------------------
- // %x - short
- //---------------------------------------------------------------------
- test("%010x", "000000ff80", minByte);
- test("%-10x", "ff80 ", minByte);
- test("%#10x", " 0xff80", minByte);
- test("%0#10x","0x0000ff80", minByte);
- test("%#10X", " 0XFF80", minByte);
- test("%X", "FF80", minByte);
-#end[short]
-#if[int]
- //---------------------------------------------------------------------
- // %x - int
- //---------------------------------------------------------------------
- $type$ oneToSevenHex = ($type$)1234567;
- test("%x", "null", (Object)null);
- test("%x", "12d687", oneToSevenHex);
- test("%010x", "000012d687", oneToSevenHex);
- test("%-10x", "12d687 ", oneToSevenHex);
- test("%#10x", " 0x12d687", oneToSevenHex);
- test("%#10X", " 0X12D687",oneToSevenHex);
- test("%X", "12D687", oneToSevenHex);
-
- test("%010x", "00ffffff80", minByte);
- test("%-10x", "ffffff80 ", minByte);
- test("%#10x", "0xffffff80", minByte);
- test("%0#12x","0x00ffffff80", minByte);
- test("%#12X", " 0XFFFFFF80", minByte);
- test("%X", "FFFFFF80", minByte);
-#end[int]
-#if[long]
- //---------------------------------------------------------------------
- // %x - long
- //---------------------------------------------------------------------
- $type$ oneToSevenHex = ($type$)1234567;
- test("%x", "null", (Object)null);
- test("%x", "12d687", oneToSevenHex);
- test("%010x", "000012d687", oneToSevenHex);
- test("%-10x", "12d687 ", oneToSevenHex);
- test("%#10x", " 0x12d687", oneToSevenHex);
- test("%#10X", " 0X12D687",oneToSevenHex);
- test("%X", "12D687", oneToSevenHex);
-
- test("%018x", "00ffffffffffffff80", minByte);
- test("%-18x", "ffffffffffffff80 ", minByte);
- test("%#20x", " 0xffffffffffffff80", minByte);
- test("%0#20x", "0x00ffffffffffffff80", minByte);
- test("%#20X", " 0XFFFFFFFFFFFFFF80", minByte);
- test("%X", "FFFFFFFFFFFFFF80", minByte);
-#end[long]
- //---------------------------------------------------------------------
- // %x - errors
- //---------------------------------------------------------------------
- tryCatch("%,x", FormatFlagsConversionMismatchException.class);
- tryCatch("%0x", MissingFormatWidthException.class);
- tryCatch("%-x", MissingFormatWidthException.class);
-
-#end[dec]
-
-#if[BigInteger]
- //---------------------------------------------------------------------
- // BigInteger - errors
- //---------------------------------------------------------------------
- tryCatch("%f", IllegalFormatConversionException.class,
- new BigInteger("1"));
-
- //---------------------------------------------------------------------
- // %d - BigInteger
- //---------------------------------------------------------------------
- test("%d", "null", (Object)null);
- test("%d", "1234567", new BigInteger("1234567", 10));
- test("%,d", "1,234,567", new BigInteger("1234567", 10));
- test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", new BigInteger("1234567", 10));
- test("%,d", "-1,234,567", new BigInteger("-1234567", 10));
- test("%(d", "1234567", new BigInteger("1234567", 10));
- test("%(d", "(1234567)", new BigInteger("-1234567", 10));
- test("% d", " 1234567", new BigInteger("1234567", 10));
- test("% d", "-1234567", new BigInteger("-1234567", 10));
- test("%+d", "+1234567", new BigInteger("1234567", 10));
- test("%+d", "-1234567", new BigInteger("-1234567", 10));
- test("%010d", "0001234567", new BigInteger("1234567", 10));
- test("%010d", "-001234567", new BigInteger("-1234567", 10));
- test("%(10d", " (1234567)", new BigInteger("-1234567", 10));
- test("%+d", "+1234567", new BigInteger("1234567", 10));
- test("%+d", "-1234567", new BigInteger("-1234567", 10));
- test("%-10d", "1234567 ", new BigInteger("1234567", 10));
- test("%-10d", "-1234567 ", new BigInteger("-1234567", 10));
-
- //---------------------------------------------------------------------
- // %o - BigInteger
- //---------------------------------------------------------------------
- test("%o", "null", (Object)null);
- test("%o", "1234567", new BigInteger("1234567", 8));
- test("%(o", "1234567", new BigInteger("1234567", 8));
- test("%(o", "(1234567)", new BigInteger("-1234567", 8));
- test("% o", " 1234567", new BigInteger("1234567", 8));
- test("% o", "-1234567", new BigInteger("-1234567", 8));
- test("%+o", "+1234567", new BigInteger("1234567", 8));
- test("%+o", "-1234567", new BigInteger("-1234567", 8));
- test("%010o", "0001234567", new BigInteger("1234567", 8));
- test("%010o", "-001234567", new BigInteger("-1234567", 8));
- test("%(10o", " (1234567)", new BigInteger("-1234567", 8));
- test("%+o", "+1234567", new BigInteger("1234567", 8));
- test("%+o", "-1234567", new BigInteger("-1234567", 8));
- test("%-10o", "1234567 ", new BigInteger("1234567", 8));
- test("%-10o", "-1234567 ", new BigInteger("-1234567", 8));
- test("%#10o", " 01234567", new BigInteger("1234567", 8));
- test("%#10o", " -01234567", new BigInteger("-1234567", 8));
-
- //---------------------------------------------------------------------
- // %x - BigInteger
- //---------------------------------------------------------------------
- test("%x", "null", (Object)null);
- test("%x", "1234567", new BigInteger("1234567", 16));
- test("%(x", "1234567", new BigInteger("1234567", 16));
- test("%(x", "(1234567)", new BigInteger("-1234567", 16));
- test("% x", " 1234567", new BigInteger("1234567", 16));
- test("% x", "-1234567", new BigInteger("-1234567", 16));
- test("%+x", "+1234567", new BigInteger("1234567", 16));
- test("%+x", "-1234567", new BigInteger("-1234567", 16));
- test("%010x", "0001234567", new BigInteger("1234567", 16));
- test("%010x", "-001234567", new BigInteger("-1234567", 16));
- test("%(10x", " (1234567)", new BigInteger("-1234567", 16));
- test("%+x", "+1234567", new BigInteger("1234567", 16));
- test("%+x", "-1234567", new BigInteger("-1234567", 16));
- test("%-10x", "1234567 ", new BigInteger("1234567", 16));
- test("%-10x", "-1234567 ", new BigInteger("-1234567", 16));
- test("%#10x", " 0x1234567", new BigInteger("1234567", 16));
- test("%#10x", "-0x1234567", new BigInteger("-1234567", 16));
- test("%#10X", " 0X1234567", new BigInteger("1234567", 16));
- test("%#10X", "-0X1234567", new BigInteger("-1234567", 16));
- test("%X", "1234567A", new BigInteger("1234567a", 16));
- test("%X", "-1234567A", new BigInteger("-1234567a", 16));
-#end[BigInteger]
-
-#if[fp]
-#if[BigDecimal]
- //---------------------------------------------------------------------
- // %s - BigDecimal
- //---------------------------------------------------------------------
- $type$ one = BigDecimal.ONE;
- $type$ ten = BigDecimal.TEN;
- $type$ pi = new $type$(Math.PI);
- $type$ piToThe300 = pi.pow(300);
-
- test("%s", "3.141592653589793115997963468544185161590576171875", pi);
-#end[BigDecimal]
-#if[float]
- //---------------------------------------------------------------------
- // %s - float
- //---------------------------------------------------------------------
- $type$ one = 1.0f;
- $type$ ten = 10.0f;
- $type$ pi = (float) Math.PI;
-
- test("%s", "3.1415927", pi);
-#end[float]
-#if[Float]
- //---------------------------------------------------------------------
- // %s - Float
- //---------------------------------------------------------------------
- $type$ one = new $type$(1.0f);
- $type$ ten = new $type$(10.0f);
- $type$ pi = new $type$(Math.PI);
-
- test("%s", "3.1415927", pi);
-#end[Float]
-#if[double]
- //---------------------------------------------------------------------
- // %s - double
- //---------------------------------------------------------------------
- $type$ one = 1.0;
- $type$ ten = 10.0;
- $type$ pi = Math.PI;
-
- test("%s", "3.141592653589793", pi);
-#end[double]
-#if[Double]
- //---------------------------------------------------------------------
- // %s - Double
- //---------------------------------------------------------------------
- $type$ one = new $type$(1.0);
- $type$ ten = new $type$(10.0);
- $type$ pi = new $type$(Math.PI);
-
- test("%s", "3.141592653589793", pi);
-#end[Double]
-
- //---------------------------------------------------------------------
- // flag/conversion errors
- //---------------------------------------------------------------------
- tryCatch("%d", IllegalFormatConversionException.class, one);
- tryCatch("%,.4e", FormatFlagsConversionMismatchException.class, one);
-
- //---------------------------------------------------------------------
- // %e
- //
- // Floating-point conversions applicable to float, double, and
- // BigDecimal.
- //---------------------------------------------------------------------
- test("%e", "null", (Object)null);
-
- //---------------------------------------------------------------------
- // %e - float and double
- //---------------------------------------------------------------------
- // double PI = 3.141 592 653 589 793 238 46;
- test("%e", "3.141593e+00", pi);
- test("%.0e", "1e+01", ten);
- test("%#.0e", "1.e+01", ten);
- test("%E", "3.141593E+00", pi);
- test("%10.3e", " 3.142e+00", pi);
- test("%10.3e", "-3.142e+00", negate(pi));
- test("%010.3e", "03.142e+00", pi);
- test("%010.3e", "-3.142e+00", negate(pi));
- test("%-12.3e", "3.142e+00 ", pi);
- test("%-12.3e", "-3.142e+00 ", negate(pi));
- test("%.3e", "3.142e+00", pi);
- test("%.3e", "-3.142e+00", negate(pi));
- test("%.3e", "3.142e+06", mult(pi, 1000000.0));
- test("%.3e", "-3.142e+06", mult(pi, -1000000.0));
-
- test(Locale.FRANCE, "%e", "3,141593e+00", pi);
-
- // double PI^300
- // = 13962455701329742638131355433930076081862072808 ... e+149
-#if[BigDecimal]
- //---------------------------------------------------------------------
- // %e - BigDecimal
- //---------------------------------------------------------------------
- test("%.3e", "1.396e+149", piToThe300);
- test("%.3e", "-1.396e+149", piToThe300.negate());
- test("%.3e", "1.000e-100", recip(ten.pow(100)));
- test("%.3e", "-1.000e-100", negate(recip(ten.pow(100))));
-
- test("%3.0e", "1e-06", new BigDecimal("0.000001"));
- test("%3.0e", "1e-05", new BigDecimal("0.00001"));
- test("%3.0e", "1e-04", new BigDecimal("0.0001"));
- test("%3.0e", "1e-03", new BigDecimal("0.001"));
- test("%3.0e", "1e-02", new BigDecimal("0.01"));
- test("%3.0e", "1e-01", new BigDecimal("0.1"));
- test("%3.0e", "9e-01", new BigDecimal("0.9"));
- test("%3.1e", "9.0e-01", new BigDecimal("0.9"));
- test("%3.0e", "1e+00", new BigDecimal("1.00"));
- test("%3.0e", "1e+01", new BigDecimal("10.00"));
- test("%3.0e", "1e+02", new BigDecimal("99.19"));
- test("%3.1e", "9.9e+01", new BigDecimal("99.19"));
- test("%3.0e", "1e+02", new BigDecimal("99.99"));
- test("%3.0e", "1e+02", new BigDecimal("100.00"));
- test("%#3.0e", "1.e+03", new BigDecimal("1000.00"));
- test("%3.0e", "1e+04", new BigDecimal("10000.00"));
- test("%3.0e", "1e+05", new BigDecimal("100000.00"));
- test("%3.0e", "1e+06", new BigDecimal("1000000.00"));
- test("%3.0e", "1e+07", new BigDecimal("10000000.00"));
- test("%3.0e", "1e+08", new BigDecimal("100000000.00"));
-#end[BigDecimal]
-
- test("%10.3e", " 1.000e+00", one);
- test("%+.3e", "+3.142e+00", pi);
- test("%+.3e", "-3.142e+00", negate(pi));
- test("% .3e", " 3.142e+00", pi);
- test("% .3e", "-3.142e+00", negate(pi));
- test("%#.0e", "3.e+00", create(3.0));
- test("%#.0e", "-3.e+00", create(-3.0));
- test("%.0e", "3e+00", create(3.0));
- test("%.0e", "-3e+00", create(-3.0));
-
- test("%(.4e", "3.1416e+06", mult(pi, 1000000.0));
- test("%(.4e", "(3.1416e+06)", mult(pi, -1000000.0));
-
- //---------------------------------------------------------------------
- // %e - boundary problems
- //---------------------------------------------------------------------
- test("%3.0e", "1e-06", 0.000001);
- test("%3.0e", "1e-05", 0.00001);
- test("%3.0e", "1e-04", 0.0001);
- test("%3.0e", "1e-03", 0.001);
- test("%3.0e", "1e-02", 0.01);
- test("%3.0e", "1e-01", 0.1);
- test("%3.0e", "9e-01", 0.9);
- test("%3.1e", "9.0e-01", 0.9);
- test("%3.0e", "1e+00", 1.00);
- test("%3.0e", "1e+01", 10.00);
- test("%3.0e", "1e+02", 99.19);
- test("%3.1e", "9.9e+01", 99.19);
- test("%3.0e", "1e+02", 99.99);
- test("%3.0e", "1e+02", 100.00);
- test("%#3.0e", "1.e+03", 1000.00);
- test("%3.0e", "1e+04", 10000.00);
- test("%3.0e", "1e+05", 100000.00);
- test("%3.0e", "1e+06", 1000000.00);
- test("%3.0e", "1e+07", 10000000.00);
- test("%3.0e", "1e+08", 100000000.00);
-
- //---------------------------------------------------------------------
- // %f
- //
- // Floating-point conversions applicable to float, double, and
- // BigDecimal.
- //---------------------------------------------------------------------
- test("%f", "null", (Object)null);
- test("%f", "3.141593", pi);
- test(Locale.FRANCE, "%f", "3,141593", pi);
- test("%10.3f", " 3.142", pi);
- test("%10.3f", " -3.142", negate(pi));
- test("%010.3f", "000003.142", pi);
- test("%010.3f", "-00003.142", negate(pi));
- test("%-10.3f", "3.142 ", pi);
- test("%-10.3f", "-3.142 ", negate(pi));
- test("%.3f", "3.142", pi);
- test("%.3f", "-3.142", negate(pi));
- test("%+.3f", "+3.142", pi);
- test("%+.3f", "-3.142", negate(pi));
- test("% .3f", " 3.142", pi);
- test("% .3f", "-3.142", negate(pi));
- test("%#.0f", "3.", create(3.0));
- test("%#.0f", "-3.", create(-3.0));
- test("%.0f", "3", create(3.0));
- test("%.0f", "-3", create(-3.0));
- test("%.3f", "10.000", ten);
- test("%.3f", "1.000", one);
- test("%10.3f", " 1.000", one);
-
- //---------------------------------------------------------------------
- // %f - boundary problems
- //---------------------------------------------------------------------
- test("%3.0f", " 0", 0.000001);
- test("%3.0f", " 0", 0.00001);
- test("%3.0f", " 0", 0.0001);
- test("%3.0f", " 0", 0.001);
- test("%3.0f", " 0", 0.01);
- test("%3.0f", " 0", 0.1);
- test("%3.0f", " 1", 0.9);
- test("%3.1f", "0.9", 0.9);
- test("%3.0f", " 1", 1.00);
- test("%3.0f", " 10", 10.00);
- test("%3.0f", " 99", 99.19);
- test("%3.1f", "99.2", 99.19);
- test("%3.0f", "100", 99.99);
- test("%3.0f", "100", 100.00);
- test("%#3.0f", "1000.", 1000.00);
- test("%3.0f", "10000", 10000.00);
- test("%3.0f", "100000", 100000.00);
- test("%3.0f", "1000000", 1000000.00);
- test("%3.0f", "10000000", 10000000.00);
- test("%3.0f", "100000000", 100000000.00);
-#if[BigDecimal]
- //---------------------------------------------------------------------
- // %f - BigDecimal
- //---------------------------------------------------------------------
- test("%4.0f", " 99", new BigDecimal("99.19"));
- test("%4.1f", "99.2", new BigDecimal("99.19"));
-
- BigDecimal val = new BigDecimal("99.95");
- test("%4.0f", " 100", val);
- test("%#4.0f", "100.", val);
- test("%4.1f", "100.0", val);
- test("%4.2f", "99.95", val);
- test("%4.3f", "99.950", val);
-
- val = new BigDecimal(".99");
- test("%4.1f", " 1.0", val);
- test("%4.2f", "0.99", val);
- test("%4.3f", "0.990", val);
-
- // #6476425
- val = new BigDecimal("0.00001");
- test("%.0f", "0", val);
- test("%.1f", "0.0", val);
- test("%.2f", "0.00", val);
- test("%.3f", "0.000", val);
- test("%.4f", "0.0000", val);
- test("%.5f", "0.00001", val);
-
- val = new BigDecimal("1.00001");
- test("%.0f", "1", val);
- test("%.1f", "1.0", val);
- test("%.2f", "1.00", val);
- test("%.3f", "1.000", val);
- test("%.4f", "1.0000", val);
- test("%.5f", "1.00001", val);
-
- val = new BigDecimal("1.23456");
- test("%.0f", "1", val);
- test("%.1f", "1.2", val);
- test("%.2f", "1.23", val);
- test("%.3f", "1.235", val);
- test("%.4f", "1.2346", val);
- test("%.5f", "1.23456", val);
- test("%.6f", "1.234560", val);
-
- val = new BigDecimal("9.99999");
- test("%.0f", "10", val);
- test("%.1f", "10.0", val);
- test("%.2f", "10.00", val);
- test("%.3f", "10.000", val);
- test("%.4f", "10.0000", val);
- test("%.5f", "9.99999", val);
- test("%.6f", "9.999990", val);
-
-
- val = new BigDecimal("1.99999");
- test("%.0f", "2", val);
- test("%.1f", "2.0", val);
- test("%.2f", "2.00", val);
- test("%.3f", "2.000", val);
- test("%.4f", "2.0000", val);
- test("%.5f", "1.99999", val);
- test("%.6f", "1.999990", val);
-
-#end[BigDecimal]
-
-#if[float]
- //---------------------------------------------------------------------
- // %f - float
- //---------------------------------------------------------------------
- // Float can not accurately store 1e6 * PI.
- test("%.3f", "3141.593", mult(pi, 1000.0));
- test("%.3f", "-3141.593", mult(pi, -1000.0));
-
- test("%,.2f", "3,141.59", mult(pi, 1000.0));
- test(Locale.FRANCE, "%,.2f", "3\u00a0141,59", mult(pi, 1000.0));
- test("%,.2f", "-3,141.59", mult(pi, -1000.0));
- test("%(.2f", "3141.59", mult(pi, 1000.0));
- test("%(.2f", "(3141.59)", mult(pi, -1000.0));
- test("%(,.2f", "3,141.59", mult(pi, 1000.0));
- test("%(,.2f", "(3,141.59)", mult(pi, -1000.0));
-
-#else[float]
-#if[!Float]
- //---------------------------------------------------------------------
- // %f - float, double, Double, BigDecimal
- //---------------------------------------------------------------------
- test("%.3f", "3141592.654", mult(pi, 1000000.0));
- test("%.3f", "-3141592.654", mult(pi, -1000000.0));
- test("%,.4f", "3,141,592.6536", mult(pi, 1000000.0));
- test(Locale.FRANCE, "%,.4f", "3\u00a0141\u00a0592,6536", mult(pi, 1000000.0));
- test("%,.4f", "-3,141,592.6536", mult(pi, -1000000.0));
- test("%(.4f", "3141592.6536", mult(pi, 1000000.0));
- test("%(.4f", "(3141592.6536)", mult(pi, -1000000.0));
- test("%(,.4f", "3,141,592.6536", mult(pi, 1000000.0));
- test("%(,.4f", "(3,141,592.6536)", mult(pi, -1000000.0));
-#end[!Float]
-#end[float]
-
-
- //---------------------------------------------------------------------
- // %g
- //
- // Floating-point conversions applicable to float, double, and
- // BigDecimal.
- //---------------------------------------------------------------------
- test("%g", "null", (Object)null);
- test("%g", "3.14159", pi);
- test(Locale.FRANCE, "%g", "3,14159", pi);
- test("%.0g", "1e+01", ten);
- test("%G", "3.14159", pi);
- test("%10.3g", " 3.14", pi);
- test("%10.3g", " -3.14", negate(pi));
- test("%010.3g", "0000003.14", pi);
- test("%010.3g", "-000003.14", negate(pi));
- test("%-12.3g", "3.14 ", pi);
- test("%-12.3g", "-3.14 ", negate(pi));
- test("%.3g", "3.14", pi);
- test("%.3g", "-3.14", negate(pi));
- test("%.3g", "3.14e+08", mult(pi, 100000000.0));
- test("%.3g", "-3.14e+08", mult(pi, -100000000.0));
-
- test("%.3g", "1.00e-05", recip(create(100000.0)));
- test("%.3g", "-1.00e-05", recip(create(-100000.0)));
- test("%.0g", "-1e-05", recip(create(-100000.0)));
- test("%.0g", "1e+05", create(100000.0));
- test("%.3G", "1.00E-05", recip(create(100000.0)));
- test("%.3G", "-1.00E-05", recip(create(-100000.0)));
-
- test("%3.0g", "1e-06", 0.000001);
- test("%3.0g", "1e-05", 0.00001);
- test("%3.0g", "1e-05", 0.0000099);
- test("%3.1g", "1e-05", 0.0000099);
- test("%3.2g", "9.9e-06", 0.0000099);
- test("%3.0g", "0.0001", 0.0001);
- test("%3.0g", "9e-05", 0.00009);
- test("%3.0g", "0.0001", 0.000099);
- test("%3.1g", "0.0001", 0.000099);
- test("%3.2g", "9.9e-05", 0.000099);
- test("%3.0g", "0.001", 0.001);
- test("%3.0g", "0.001", 0.00099);
- test("%3.1g", "0.001", 0.00099);
- test("%3.2g", "0.00099", 0.00099);
- test("%3.3g", "0.00100", 0.001);
- test("%3.4g", "0.001000", 0.001);
- test("%3.0g", "0.01", 0.01);
- test("%3.0g", "0.1", 0.1);
- test("%3.0g", "0.9", 0.9);
- test("%3.1g", "0.9", 0.9);
- test("%3.0g", " 1", 1.00);
- test("%3.2g", " 10", 10.00);
- test("%3.0g", "1e+01", 10.00);
- test("%3.0g", "1e+02", 99.19);
- test("%3.1g", "1e+02", 99.19);
- test("%3.2g", " 99", 99.19);
- test("%3.0g", "1e+02", 99.9);
- test("%3.1g", "1e+02", 99.9);
- test("%3.2g", "1.0e+02", 99.9);
- test("%3.0g", "1e+02", 99.99);
- test("%3.0g", "1e+02", 100.00);
- test("%3.0g", "1e+03", 999.9);
- test("%3.1g", "1e+03", 999.9);
- test("%3.2g", "1.0e+03", 999.9);
- test("%3.3g", "1.00e+03", 999.9);
- test("%3.4g", "999.9", 999.9);
- test("%3.4g", "1000", 999.99);
- test("%3.0g", "1e+03", 1000.00);
- test("%3.0g", "1e+04", 10000.00);
- test("%3.0g", "1e+05", 100000.00);
- test("%3.0g", "1e+06", 1000000.00);
- test("%3.0g", "1e+07", 10000000.00);
- test("%3.9g", "100000000", 100000000.00);
- test("%3.10g", "100000000.0", 100000000.00);
-
- tryCatch("%#3.0g", FormatFlagsConversionMismatchException.class, 1000.00);
-
- // double PI^300
- // = 13962455701329742638131355433930076081862072808 ... e+149
-#if[BigDecimal]
- //---------------------------------------------------------------------
- // %g - BigDecimal
- //---------------------------------------------------------------------
- test("%.3g", "1.40e+149", piToThe300);
- test("%.3g", "-1.40e+149", piToThe300.negate());
- test(Locale.FRANCE, "%.3g", "-1,40e+149", piToThe300.negate());
- test("%.3g", "1.00e-100", recip(ten.pow(100)));
- test("%.3g", "-1.00e-100", negate(recip(ten.pow(100))));
-
- test("%3.0g", "1e-06", new BigDecimal("0.000001"));
- test("%3.0g", "1e-05", new BigDecimal("0.00001"));
- test("%3.0g", "0.0001", new BigDecimal("0.0001"));
- test("%3.0g", "0.001", new BigDecimal("0.001"));
- test("%3.3g", "0.00100", new BigDecimal("0.001"));
- test("%3.4g", "0.001000", new BigDecimal("0.001"));
- test("%3.0g", "0.01", new BigDecimal("0.01"));
- test("%3.0g", "0.1", new BigDecimal("0.1"));
- test("%3.0g", "0.9", new BigDecimal("0.9"));
- test("%3.1g", "0.9", new BigDecimal("0.9"));
- test("%3.0g", " 1", new BigDecimal("1.00"));
- test("%3.2g", " 10", new BigDecimal("10.00"));
- test("%3.0g", "1e+01", new BigDecimal("10.00"));
- test("%3.0g", "1e+02", new BigDecimal("99.19"));
- test("%3.1g", "1e+02", new BigDecimal("99.19"));
- test("%3.2g", " 99", new BigDecimal("99.19"));
- test("%3.0g", "1e+02", new BigDecimal("99.99"));
- test("%3.0g", "1e+02", new BigDecimal("100.00"));
- test("%3.0g", "1e+03", new BigDecimal("1000.00"));
- test("%3.0g", "1e+04", new BigDecimal("10000.00"));
- test("%3.0g", "1e+05", new BigDecimal("100000.00"));
- test("%3.0g", "1e+06", new BigDecimal("1000000.00"));
- test("%3.0g", "1e+07", new BigDecimal("10000000.00"));
- test("%3.9g", "100000000", new BigDecimal("100000000.00"));
- test("%3.10g", "100000000.0", new BigDecimal("100000000.00"));
-#end[BigDecimal]
-
- test("%.3g", "10.0", ten);
- test("%.3g", "1.00", one);
- test("%10.3g", " 1.00", one);
- test("%+10.3g", " +3.14", pi);
- test("%+10.3g", " -3.14", negate(pi));
- test("% .3g", " 3.14", pi);
- test("% .3g", "-3.14", negate(pi));
- test("%.0g", "3", create(3.0));
- test("%.0g", "-3", create(-3.0));
-
- test("%(.4g", "3.142e+08", mult(pi, 100000000.0));
- test("%(.4g", "(3.142e+08)", mult(pi, -100000000.0));
-
-#if[float]
- // Float can not accurately store 1e6 * PI.
- test("%,.6g", "3,141.59", mult(pi, 1000.0));
- test("%(,.6g", "(3,141.59)", mult(pi, -1000.0));
-#else[float]
-#if[!Float]
- test("%,.11g", "3,141,592.6536", mult(pi, 1000000.0));
- test("%(,.11g", "(3,141,592.6536)", mult(pi, -1000000.0));
-#end[!Float]
-#end[float]
-
-#if[double]
- //---------------------------------------------------------------------
- // %a
- //
- // Floating-point conversions applicable to float, double, and
- // BigDecimal.
- //---------------------------------------------------------------------
- test("%a", "null", (Object)null);
- test("%.11a", "0x0.00000000000p0", 0.0);
- test(Locale.FRANCE, "%.11a", "0x0.00000000000p0", 0.0); // no localization
- test("%.1a", "0x0.0p0", 0.0);
- test("%.11a", "-0x0.00000000000p0", -0.0);
- test("%.1a", "-0x0.0p0", -0.0);
- test("%.11a", "0x1.00000000000p0", 1.0);
- test("%.1a", "0x1.0p0", 1.0);
- test("%.11a", "-0x1.00000000000p0", -1.0);
- test("%.1a", "-0x1.0p0", -1.0);
- test("%.11a", "0x1.80000000000p1", 3.0);
- test("%.1a", "0x1.8p1", 3.0);
- test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
- test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
- test("%.11a", "0x1.00000000000p-1022",
- FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
- test("%.1a", "0x1.0p-1022",
- FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
- test("%.11a", "0x1.ffffffffffep-1023",
- Double.parseDouble("0x0.fffffffffffp-1022"));
- test("%.1a", "0x1.0p-1022",
- Double.parseDouble("0x0.fffffffffffp-1022"));
- test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE);
- test("%.13a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
- test("%.11a", "0x1.00000000000p-1074", Double.MIN_VALUE);
- test("%.1a", "0x1.0p-1074", Double.MIN_VALUE);
-
- test("%.11a", "0x1.08000000000p-1069",
- Double.MIN_VALUE + Double.MIN_VALUE*32);
- test("%.1a", "0x1.0p-1069",
- Double.MIN_VALUE + Double.MIN_VALUE*32);
- test("%.30a", "0x1.fffffffffffff00000000000000000p1023", Double.MAX_VALUE);
- test("%.13a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
- test("%.11a", "0x1.00000000000p1024", Double.MAX_VALUE);
- test("%.1a", "0x1.0p1024", Double.MAX_VALUE);
- test("%.11a", "0x1.18000000000p0", Double.parseDouble("0x1.18p0"));
- test("%.1a", "0x1.2p0", Double.parseDouble("0x1.18p0"));
-
- test("%.11a", "0x1.18000000000p0",
- Double.parseDouble("0x1.180000000001p0"));
- test("%.1a", "0x1.2p0",
- Double.parseDouble("0x1.180000000001p0"));
- test("%.11a", "0x1.28000000000p0", Double.parseDouble("0x1.28p0"));
- test("%.1a", "0x1.2p0", Double.parseDouble("0x1.28p0"));
-
- test("%.11a", "0x1.28000000000p0",
- Double.parseDouble("0x1.280000000001p0"));
- test("%.1a", "0x1.3p0", Double.parseDouble("0x1.280000000001p0"));
-#end[double]
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - Boundaries
- //---------------------------------------------------------------------
-#if[float]
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - NaN
- //---------------------------------------------------------------------
- test("%f", "NaN", Float.NaN);
- // s
- test("%+f", "NaN", Float.NaN);
-// test("%F", "NAN", Float.NaN);
- test("%e", "NaN", Float.NaN);
- test("%+e", "NaN", Float.NaN);
- test("%E", "NAN", Float.NaN);
- test("%g", "NaN", Float.NaN);
- test("%+g", "NaN", Float.NaN);
- test("%G", "NAN", Float.NaN);
- test("%a", "NaN", Float.NaN);
- test("%+a", "NaN", Float.NaN);
- test("%A", "NAN", Float.NaN);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - +0.0
- //---------------------------------------------------------------------
- test("%f", "0.000000", +0.0);
- test("%+f", "+0.000000", +0.0);
- test("% f", " 0.000000", +0.0);
-// test("%F", "0.000000", +0.0);
- test("%e", "0.000000e+00", 0e0);
- test("%e", "0.000000e+00", +0.0);
- test("%+e", "+0.000000e+00", +0.0);
- test("% e", " 0.000000e+00", +0.0);
- test("%E", "0.000000E+00", 0e0);
- test("%E", "0.000000E+00", +0.0);
- test("%+E", "+0.000000E+00", +0.0);
- test("% E", " 0.000000E+00", +0.0);
- test("%g", "0.00000", +0.0);
- test("%+g", "+0.00000", +0.0);
- test("% g", " 0.00000", +0.0);
- test("%G", "0.00000", +0.0);
- test("% G", " 0.00000", +0.0);
- test("%a", "0x0.0p0", +0.0);
- test("%+a", "+0x0.0p0", +0.0);
- test("% a", " 0x0.0p0", +0.0);
- test("%A", "0X0.0P0", +0.0);
- test("% A", " 0X0.0P0", +0.0);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - -0.0
- //---------------------------------------------------------------------
- test("%f", "-0.000000", -0.0);
- test("%+f", "-0.000000", -0.0);
-// test("%F", "-0.000000", -0.0);
- test("%e", "-0.000000e+00", -0.0);
- test("%+e", "-0.000000e+00", -0.0);
- test("%E", "-0.000000E+00", -0.0);
- test("%+E", "-0.000000E+00", -0.0);
- test("%g", "-0.00000", -0.0);
- test("%+g", "-0.00000", -0.0);
- test("%G", "-0.00000", -0.0);
- test("%a", "-0x0.0p0", -0.0);
- test("%+a", "-0x0.0p0", -0.0);
- test("%+A", "-0X0.0P0", -0.0);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - +Infinity
- //---------------------------------------------------------------------
- test("%f", "Infinity", Float.POSITIVE_INFINITY);
- test("%+f", "+Infinity", Float.POSITIVE_INFINITY);
- test("% f", " Infinity", Float.POSITIVE_INFINITY);
-// test("%F", "INFINITY", Float.POSITIVE_INFINITY);
- test("%e", "Infinity", Float.POSITIVE_INFINITY);
- test("%+e", "+Infinity", Float.POSITIVE_INFINITY);
- test("% e", " Infinity", Float.POSITIVE_INFINITY);
- test("%E", "INFINITY", Float.POSITIVE_INFINITY);
- test("%+E", "+INFINITY", Float.POSITIVE_INFINITY);
- test("% E", " INFINITY", Float.POSITIVE_INFINITY);
- test("%g", "Infinity", Float.POSITIVE_INFINITY);
- test("%+g", "+Infinity", Float.POSITIVE_INFINITY);
- test("%G", "INFINITY", Float.POSITIVE_INFINITY);
- test("% G", " INFINITY", Float.POSITIVE_INFINITY);
- test("%+G", "+INFINITY", Float.POSITIVE_INFINITY);
- test("%a", "Infinity", Float.POSITIVE_INFINITY);
- test("%+a", "+Infinity", Float.POSITIVE_INFINITY);
- test("% a", " Infinity", Float.POSITIVE_INFINITY);
- test("%A", "INFINITY", Float.POSITIVE_INFINITY);
- test("%+A", "+INFINITY", Float.POSITIVE_INFINITY);
- test("% A", " INFINITY", Float.POSITIVE_INFINITY);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - -Infinity
- //---------------------------------------------------------------------
- test("%f", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%+f", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%(f", "(Infinity)", Float.NEGATIVE_INFINITY);
-// test("%F", "-INFINITY", Float.NEGATIVE_INFINITY);
- test("%e", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%+e", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%E", "-INFINITY", Float.NEGATIVE_INFINITY);
- test("%+E", "-INFINITY", Float.NEGATIVE_INFINITY);
- test("%g", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%+g", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%G", "-INFINITY", Float.NEGATIVE_INFINITY);
- test("%+G", "-INFINITY", Float.NEGATIVE_INFINITY);
- test("%a", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%+a", "-Infinity", Float.NEGATIVE_INFINITY);
- test("%A", "-INFINITY", Float.NEGATIVE_INFINITY);
- test("%+A", "-INFINITY", Float.NEGATIVE_INFINITY);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - Float.MIN_VALUE
- //---------------------------------------------------------------------
- test("%f", "0.000000", Float.MIN_VALUE);
- test("%,f", "0.000000", Float.MIN_VALUE);
- test("%(f", "(0.000000)", -Float.MIN_VALUE);
- test("%30.0f", " 0", Float.MIN_VALUE);
- test("%30.5f", " 0.00000", Float.MIN_VALUE);
- test("%30.13f", " 0.0000000000000", Float.MIN_VALUE);
- test("%30.20f", " 0.00000000000000000000", Float.MIN_VALUE);
- test("%e", "1.401298e-45", Float.MIN_VALUE);
- test("%E", "1.401298E-45", Float.MIN_VALUE);
- test("%(.1e", "1.4e-45", Float.MIN_VALUE);
- test("%(E", "(1.401298E-45)", -Float.MIN_VALUE);
- test("%30.5e", " 1.40130e-45", Float.MIN_VALUE);
- test("%30.13e", " 1.4012984643248e-45", Float.MIN_VALUE);
- test("%30.20e", " 1.40129846432481700000e-45", Float.MIN_VALUE);
- test("%g", "1.40130e-45", Float.MIN_VALUE);
- test("%G", "1.40130E-45", Float.MIN_VALUE);
- test("%(g", "1.40130e-45", Float.MIN_VALUE);
- test("%,g", "1.40130e-45", Float.MIN_VALUE);
- test("%(G", "(1.40130E-45)", -Float.MIN_VALUE);
- test("%30.5g", " 1.4013e-45", Float.MIN_VALUE);
- test("%30.13g", " 1.401298464325e-45", Float.MIN_VALUE);
- test("%30.20g", " 1.4012984643248170000e-45", Float.MIN_VALUE);
- test("%a", "0x1.0p-149", Float.MIN_VALUE);
- test("%A", "0X1.0P-149", Float.MIN_VALUE);
- test("%20a", " 0x1.0p-149", Float.MIN_VALUE);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - Float.MAX_VALUE
- //---------------------------------------------------------------------
- test("%f", "340282346638528860000000000000000000000.000000", Float.MAX_VALUE);
- test("%,f","340,282,346,638,528,860,000,000,000,000,000,000,000.000000",
- Float.MAX_VALUE);
- test("%(f", "(340282346638528860000000000000000000000.000000)", -Float.MAX_VALUE);
- test("%60.5f", " 340282346638528860000000000000000000000.00000",
- Float.MAX_VALUE);
- test("%60.13f", " 340282346638528860000000000000000000000.0000000000000",
- Float.MAX_VALUE);
- test("%61.20f", " 340282346638528860000000000000000000000.00000000000000000000",
- Float.MAX_VALUE);
- test("%e", "3.402823e+38", Float.MAX_VALUE);
- test("%E", "3.402823E+38", Float.MAX_VALUE);
- test("%(e", "3.402823e+38", Float.MAX_VALUE);
- test("%(e", "(3.402823e+38)", -Float.MAX_VALUE);
- test("%30.5e", " 3.40282e+38", Float.MAX_VALUE);
- test("%30.13e", " 3.4028234663853e+38", Float.MAX_VALUE);
- test("%30.20e", " 3.40282346638528860000e+38", Float.MAX_VALUE);
- test("%g", "3.40282e+38", Float.MAX_VALUE);
- test("%G", "3.40282E+38", Float.MAX_VALUE);
- test("%,g", "3.40282e+38", Float.MAX_VALUE);
- test("%(g", "(3.40282e+38)", -Float.MAX_VALUE);
- test("%30.5g", " 3.4028e+38", Float.MAX_VALUE);
- test("%30.13g", " 3.402823466385e+38", Float.MAX_VALUE);
- test("%30.20G", " 3.4028234663852886000E+38", Float.MAX_VALUE);
- test("%a", "0x1.fffffep127", Float.MAX_VALUE);
- test("%A", "0X1.FFFFFEP127", Float.MAX_VALUE);
- test("%20a"," 0x1.fffffep127", Float.MAX_VALUE);
-
-#end[float]
-
-#if[double]
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - Double.MIN_VALUE
- //---------------------------------------------------------------------
- test("%f", "0.000000", Double.MIN_VALUE);
- test("%,f", "0.000000", Double.MIN_VALUE);
- test("%(f", "(0.000000)", -Double.MIN_VALUE);
- test("%30.0f", " 0", Double.MIN_VALUE);
- test("%30.5f", " 0.00000", Double.MIN_VALUE);
- test("%30.13f", " 0.0000000000000", Double.MIN_VALUE);
- test("%30.20f", " 0.00000000000000000000", Double.MIN_VALUE);
- test("%30.350f","0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000",
- Double.MIN_VALUE);
- test("%e", "4.900000e-324", Double.MIN_VALUE);
- test("%E", "4.900000E-324", Double.MIN_VALUE);
- test("%(.1e", "4.9e-324", Double.MIN_VALUE);
- test("%(E", "(4.900000E-324)", -Double.MIN_VALUE);
- test("%30.5e", " 4.90000e-324", Double.MIN_VALUE);
- test("%30.13e", " 4.9000000000000e-324", Double.MIN_VALUE);
- test("%30.20e", " 4.90000000000000000000e-324", Double.MIN_VALUE);
- test("%g", "4.90000e-324", Double.MIN_VALUE);
- test("%G", "4.90000E-324", Double.MIN_VALUE);
- test("%(g", "4.90000e-324", Double.MIN_VALUE);
- test("%,g", "4.90000e-324", Double.MIN_VALUE);
- test("%30.5g", " 4.9000e-324", Double.MIN_VALUE);
- test("%30.13g", " 4.900000000000e-324", Double.MIN_VALUE);
- test("%30.20g", " 4.9000000000000000000e-324", Double.MIN_VALUE);
- test("%a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
- test("%A", "0X0.0000000000001P-1022", Double.MIN_VALUE);
- test("%30a", " 0x0.0000000000001p-1022", Double.MIN_VALUE);
-
- //---------------------------------------------------------------------
- // %f, %e, %g, %a - Double.MAX_VALUE
- //---------------------------------------------------------------------
- test("%f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000",
- Double.MAX_VALUE);
- test("%,f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000",
- Double.MAX_VALUE);
- test("%,(f", "(179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000)",
- -Double.MAX_VALUE);
- test("%,30.5f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000",
- Double.MAX_VALUE);
- test("%30.13f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000",
- Double.MAX_VALUE);
- test("%30.20f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000000",
- Double.MAX_VALUE);
- test("%e", "1.797693e+308", Double.MAX_VALUE);
- test("%E", "1.797693E+308", Double.MAX_VALUE);
- test("%(e", "1.797693e+308", Double.MAX_VALUE);
- test("%(e", "(1.797693e+308)", -Double.MAX_VALUE);
- test("%30.5e", " 1.79769e+308", Double.MAX_VALUE);
- test("%30.13e", " 1.7976931348623e+308", Double.MAX_VALUE);
- test("%30.20e", " 1.79769313486231570000e+308", Double.MAX_VALUE);
- test("%g", "1.79769e+308", Double.MAX_VALUE);
- test("%G", "1.79769E+308", Double.MAX_VALUE);
- test("%,g", "1.79769e+308", Double.MAX_VALUE);
- test("%(g", "(1.79769e+308)", -Double.MAX_VALUE);
- test("%30.5g", " 1.7977e+308", Double.MAX_VALUE);
- test("%30.13g", " 1.797693134862e+308", Double.MAX_VALUE);
- test("%30.20g", " 1.7976931348623157000e+308", Double.MAX_VALUE);
- test("%a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
- test("%A", "0X1.FFFFFFFFFFFFFP1023", Double.MAX_VALUE);
- test("%30a", " 0x1.fffffffffffffp1023", Double.MAX_VALUE);
-#end[double]
-
-#end[fp]
-
- //---------------------------------------------------------------------
- // %t
- //
- // Date/Time conversions applicable to Calendar, Date, and long.
- //---------------------------------------------------------------------
- test("%tA", "null", (Object)null);
- test("%TA", "NULL", (Object)null);
-
- //---------------------------------------------------------------------
- // %t - errors
- //---------------------------------------------------------------------
- tryCatch("%t", UnknownFormatConversionException.class);
- tryCatch("%T", UnknownFormatConversionException.class);
- tryCatch("%tP", UnknownFormatConversionException.class);
- tryCatch("%TP", UnknownFormatConversionException.class);
- tryCatch("%.5tB", IllegalFormatPrecisionException.class);
- tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
- tryCatch("%-tB", MissingFormatWidthException.class);
-
-#if[datetime]
- //---------------------------------------------------------------------
- // %t - create test Calendar
- //---------------------------------------------------------------------
-
- // Get the supported ids for GMT-08:00 (Pacific Standard Time)
- String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
- // Create a Pacific Standard Time time zone
- SimpleTimeZone tz = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
- // public GregorianCalendar(TimeZone zone, Locale aLocale);
- Calendar c0 = new GregorianCalendar(tz, Locale.US);
- // public final void set(int year, int month, int date,
- // int hourOfDay, int minute, int second);
- c0.set(1995, MAY, 23, 19, 48, 34);
- c0.set(Calendar.MILLISECOND, 584);
-
- //---------------------------------------------------------------------
- // %t - Minutes, {nano,milli}*seconds
- //
- // testDateTime() verifies the expected output for all applicable types
- // (Calendar, Date, and long). It also verifies output for "%t" and
- // "%T". Thus it is sufficient to invoke that method once per
- // conversion/expected output.
- //---------------------------------------------------------------------
- testDateTime("%tM", "48", c0);
- testDateTime("%tN", "584000000", c0);
- testDateTime("%tL", "584", c0);
-// testDateTime("%tQ", "801283714584", c0);
-
- testDateTime("%ts", String.valueOf(c0.getTimeInMillis() / 1000), c0);
- testDateTime("%tS", "34", c0);
- testDateTime("%tT", "19:48:34", c0);
-
- //---------------------------------------------------------------------
- // %t - Hours, morning/afternoon markers
- //
- // testHours() iterates through all twenty-four hours to verify
- // numeric return value and morning/afternoon markers.
- //---------------------------------------------------------------------
- testHours();
-
- //---------------------------------------------------------------------
- // %t - Portions of date [ day, month, dates, weeks ]
- //---------------------------------------------------------------------
- testDateTime("%ta", "Tue", c0);
- testDateTime("%tA", "Tuesday", c0);
- testDateTime("%tb", "May", c0);
- testDateTime("%tB", "May", c0);
- testDateTime("%tC", "19", c0);
- testDateTime("%td", "23", c0);
- testDateTime("%te", "23", c0);
- testDateTime("%th", "May", c0);
- testDateTime("%tj", "143", c0);
- testDateTime("%tm", "05", c0);
- testDateTime("%ty", "95", c0);
- testDateTime("%tY", "1995", c0);
-
- //---------------------------------------------------------------------
- // %t - TimeZone
- //---------------------------------------------------------------------
- testDateTime("%tz", "-0800", c0);
- testDateTime("%tZ", "PST", c0);
-
- //---------------------------------------------------------------------
- // %tz should always adjust for DST
- //---------------------------------------------------------------------
- TimeZone dtz = TimeZone.getDefault();
-
- // Artificial TimeZone based on PST with 3:15 DST always in effect
- TimeZone atz = new SimpleTimeZone(-8 * 60 * 60 * 1000, "AlwaysDST",
- JANUARY, 1, 0, 0, STANDARD_TIME,
- // 24hrs - 1m = 60 * 60 * 1000 * 24 - 1
- DECEMBER, 31, 0, 60 * 60 * 1000 * 24 - 1, STANDARD_TIME,
- (int)(60 * 60 * 1000 * 3.25));
- TimeZone.setDefault(atz);
- testDateTime("%tz", "-0445", Calendar.getInstance(atz));
-
- // Restore the TimeZone and verify
- TimeZone.setDefault(dtz);
- if (atz.hasSameRules(TimeZone.getDefault()))
- throw new RuntimeException("Default TimeZone not restored");
-
- //---------------------------------------------------------------------
- // %t - Composites
- //---------------------------------------------------------------------
- testDateTime("%tr", "07:48:34 PM", c0);
- testDateTime("%tR", "19:48", c0);
- testDateTime("%tc", "Tue May 23 19:48:34 PST 1995", c0);
- testDateTime("%tD", "05/23/95", c0);
- testDateTime("%tF", "1995-05-23", c0);
- testDateTime("%-12tF", "1995-05-23 ", c0);
- testDateTime("%12tF", " 1995-05-23", c0);
-#end[datetime]
-
- //---------------------------------------------------------------------
- // %n
- //---------------------------------------------------------------------
- test("%n", System.getProperty("line.separator"), (Object)null);
- test("%n", System.getProperty("line.separator"), "");
-
- tryCatch("%,n", IllegalFormatFlagsException.class);
- tryCatch("%.n", UnknownFormatConversionException.class);
- tryCatch("%5.n", UnknownFormatConversionException.class);
- tryCatch("%5n", IllegalFormatWidthException.class);
- tryCatch("%.7n", IllegalFormatPrecisionException.class);
- tryCatch("%<n", IllegalFormatFlagsException.class);
-
- //---------------------------------------------------------------------
- // %%
- //---------------------------------------------------------------------
- test("%%", "%", (Object)null);
- test("%%", "%", "");
- tryCatch("%%%", UnknownFormatConversionException.class);
- // perhaps an IllegalFormatArgumentIndexException should be defined?
- tryCatch("%<%", IllegalFormatFlagsException.class);
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Formatter/Basic-X.java.template Fri Dec 04 10:23:07 2009 -0800
@@ -0,0 +1,1712 @@
+/*
+ * Copyright 2003-2007 Sun Microsystems, Inc. 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.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* Type-specific source code for unit test
+ *
+ * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
+ * We check in the generated source files so that the test tree can be used
+ * independently of the rest of the source tree.
+ */
+
+#warn This file is preprocessed before being compiled
+
+import java.io.*;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.DateFormatSymbols;
+import java.util.*;
+#if[double]
+import sun.misc.FpUtils;
+import sun.misc.DoubleConsts;
+#end[double]
+
+import static java.util.Calendar.*;
+#if[datetime]
+import static java.util.SimpleTimeZone.*;
+import java.util.regex.Pattern;
+#end[datetime]
+
+public class Basic$Type$ extends Basic {
+
+ private static void test(String fs, String exp, Object ... args) {
+ Formatter f = new Formatter(new StringBuilder(), Locale.US);
+ f.format(fs, args);
+ ck(fs, exp, f.toString());
+ }
+
+ private static void test(Locale l, String fs, String exp, Object ... args)
+ {
+ Formatter f = new Formatter(new StringBuilder(), l);
+ f.format(fs, args);
+ ck(fs, exp, f.toString());
+ }
+
+ private static void test(String fs, Object ... args) {
+ Formatter f = new Formatter(new StringBuilder(), Locale.US);
+ f.format(fs, args);
+ ck(fs, "fail", f.toString());
+ }
+
+ private static void test(String fs) {
+ Formatter f = new Formatter(new StringBuilder(), Locale.US);
+ f.format(fs, "fail");
+ ck(fs, "fail", f.toString());
+ }
+
+ private static void testSysOut(String fs, String exp, Object ... args) {
+ FileOutputStream fos = null;
+ FileInputStream fis = null;
+ try {
+ PrintStream saveOut = System.out;
+ fos = new FileOutputStream("testSysOut");
+ System.setOut(new PrintStream(fos));
+ System.out.format(Locale.US, fs, args);
+ fos.close();
+
+ fis = new FileInputStream("testSysOut");
+ byte [] ba = new byte[exp.length()];
+ int len = fis.read(ba);
+ String got = new String(ba);
+ if (len != ba.length)
+ fail(fs, exp, got);
+ ck(fs, exp, got);
+
+ System.setOut(saveOut);
+ } catch (FileNotFoundException ex) {
+ fail(fs, ex.getClass());
+ } catch (IOException ex) {
+ fail(fs, ex.getClass());
+ } finally {
+ try {
+ if (fos != null)
+ fos.close();
+ if (fis != null)
+ fis.close();
+ } catch (IOException ex) {
+ fail(fs, ex.getClass());
+ }
+ }
+ }
+
+ private static void tryCatch(String fs, Class<?> ex) {
+ boolean caught = false;
+ try {
+ test(fs);
+ } catch (Throwable x) {
+ if (ex.isAssignableFrom(x.getClass()))
+ caught = true;
+ }
+ if (!caught)
+ fail(fs, ex);
+ else
+ pass();
+ }
+
+ private static void tryCatch(String fs, Class<?> ex, Object ... args) {
+ boolean caught = false;
+ try {
+ test(fs, args);
+ } catch (Throwable x) {
+ if (ex.isAssignableFrom(x.getClass()))
+ caught = true;
+ }
+ if (!caught)
+ fail(fs, ex);
+ else
+ pass();
+ }
+
+#if[datetime]
+ private static void testDateTime(String fs, String exp, Calendar c) {
+ testDateTime(fs, exp, c, true);
+ }
+
+ private static void testDateTime(String fs, String exp, Calendar c, boolean upper) {
+ //---------------------------------------------------------------------
+ // Date/Time conversions applicable to Calendar, Date, and long.
+ //---------------------------------------------------------------------
+
+ // Calendar
+ test(fs, exp, c);
+ test((Locale)null, fs, exp, c);
+ test(Locale.US, fs, exp, c);
+
+ // Date/long do not have timezone information so they will always use
+ // the default timezone.
+ String nexp = (fs.equals("%tZ") || fs.equals("%TZ")
+ || fs.equals("%tc") || fs.equals("%Tc")
+ ? exp.replace("PST", "GMT-08:00")
+ : exp);
+
+ // Date (implemented via conversion to Calendar)
+ Date d = c.getTime();
+ test(fs, nexp, d);
+ test((Locale)null, fs, nexp, d);
+ test(Locale.US, fs, nexp, d);
+
+ // long (implemented via conversion to Calendar)
+ long l = c.getTimeInMillis();
+ test(fs, nexp, l);
+ test((Locale)null, fs, nexp, l);
+ test(Locale.US, fs, nexp, l);
+
+ if (upper)
+ // repeat all tests for upper case variant (%T)
+ testDateTime(Pattern.compile("t").matcher(fs).replaceFirst("T"),
+ exp.toUpperCase(), c, false);
+ }
+
+ private static void testHours() {
+ for (int i = 0; i < 24; i++) {
+ // GregorianCalendar(int year, int month, int dayOfMonth,
+ // int hourOfDay, int minute, int second);
+ Calendar c = new GregorianCalendar(1995, MAY, 23, i, 48, 34);
+
+ //-----------------------------------------------------------------
+ // DateTime.HOUR_OF_DAY - 'k' (0 - 23) -- like H
+ //-----------------------------------------------------------------
+ String exp = Integer.toString(i);
+ testDateTime("%tk", exp, c);
+
+ //-----------------------------------------------------------------
+ // DateTime.HOUR - 'l' (1 - 12) -- like I
+ //-----------------------------------------------------------------
+ int v = i % 12;
+ v = (v == 0 ? 12 : v);
+ String exp2 = Integer.toString(v);
+ testDateTime("%tl", exp2, c);
+
+ //-----------------------------------------------------------------
+ // DateTime.HOUR_OF_DAY_0 - 'H' (00 - 23) [zero padded]
+ //-----------------------------------------------------------------
+ if (exp.length() < 2) exp = "0" + exp;
+ testDateTime("%tH", exp, c);
+
+ //-----------------------------------------------------------------
+ // DateTime.HOUR_0 - 'I' (01 - 12)
+ //-----------------------------------------------------------------
+ if (exp2.length() < 2) exp2 = "0" + exp2;
+ testDateTime("%tI", exp2, c);
+
+ //-----------------------------------------------------------------
+ // DateTime.AM_PM - (am or pm)
+ //-----------------------------------------------------------------
+ testDateTime("%tp", (i <12 ? "am" : "pm"), c);
+ }
+ }
+#end[datetime]
+
+#if[dec]
+#if[prim]
+ private static $type$ negate($type$ v) {
+ return ($type$) -v;
+ }
+#end[prim]
+#end[dec]
+#if[Byte]
+ private static $type$ negate($type$ v) {
+ return new $type$((byte) -v.byteValue());
+ }
+#end[Byte]
+#if[Short]
+ private static $type$ negate($type$ v) {
+ return new $type$((short) -v.shortValue());
+ }
+#end[Short]
+#if[Integer]
+ private static $type$ negate($type$ v) {
+ return new $type$(-v.intValue());
+ }
+#end[Integer]
+#if[Long]
+ private static $type$ negate($type$ v) {
+ return new $type$(-v.longValue());
+ }
+#end[Long]
+
+#if[BigDecimal]
+ private static $type$ create(double v) {
+ return new $type$(v);
+ }
+
+ private static $type$ negate($type$ v) {
+ return v.negate();
+ }
+
+ private static $type$ mult($type$ v, double mul) {
+ return v.multiply(new $type$(mul));
+ }
+
+ private static $type$ recip($type$ v) {
+ return BigDecimal.ONE.divide(v);
+ }
+#end[BigDecimal]
+#if[float]
+ private static $type$ create(double v) {
+ return ($type$) v;
+ }
+
+ private static $type$ negate(double v) {
+ return ($type$) -v;
+ }
+
+ private static $type$ mult($type$ v, double mul) {
+ return v * ($type$) mul;
+ }
+
+ private static $type$ recip($type$ v) {
+ return 1.0f / v;
+ }
+#end[float]
+#if[Float]
+ private static $type$ create(double v) {
+ return new $type$(v);
+ }
+
+ private static $type$ negate($type$ v) {
+ return new $type$(-v.floatValue());
+ }
+
+ private static $type$ mult($type$ v, double mul) {
+ return new $type$(v.floatValue() * (float) mul);
+ }
+
+ private static $type$ recip($type$ v) {
+ return new $type$(1.0f / v.floatValue());
+ }
+#end[Float]
+#if[double]
+ private static $type$ create(double v) {
+ return ($type$) v;
+ }
+
+
+ private static $type$ negate(double v) {
+ return -v;
+ }
+
+ private static $type$ mult($type$ v, double mul) {
+ return v * mul;
+ }
+
+ private static $type$ recip($type$ v) {
+ return 1.0 / v;
+ }
+#end[double]
+#if[Double]
+ private static $type$ create(double v) {
+ return new $type$(v);
+ }
+
+ private static $type$ negate($type$ v) {
+ return new $type$(-v.doubleValue());
+ }
+
+ private static $type$ mult($type$ v, double mul) {
+ return new $type$(v.doubleValue() * mul);
+ }
+
+ private static $type$ recip($type$ v) {
+ return new $type$(1.0 / v.doubleValue());
+ }
+#end[Double]
+
+ public static void test() {
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT-0800"));
+
+ // Any characters not explicitly defined as conversions, date/time
+ // conversion suffixes, or flags are illegal and are reserved for
+ // future extensions. Use of such a character in a format string will
+ // cause an UnknownFormatConversionException or
+ // UnknownFormatFlagsException to be thrown.
+ tryCatch("%q", UnknownFormatConversionException.class);
+ tryCatch("%t&", UnknownFormatConversionException.class);
+ tryCatch("%&d", UnknownFormatConversionException.class);
+ tryCatch("%^b", UnknownFormatConversionException.class);
+
+ //---------------------------------------------------------------------
+ // Formatter.java class javadoc examples
+ //---------------------------------------------------------------------
+ test(Locale.FRANCE, "e = %+10.4f", "e = +2,7183", Math.E);
+ test("%4$2s %3$2s %2$2s %1$2s", " d c b a", "a", "b", "c", "d");
+ test("Amount gained or lost since last statement: $ %,(.2f",
+ "Amount gained or lost since last statement: $ (6,217.58)",
+ (new BigDecimal("-6217.58")));
+ Calendar c = new GregorianCalendar(1969, JULY, 20, 16, 17, 0);
+ testSysOut("Local time: %tT", "Local time: 16:17:00", c);
+
+ test("Unable to open file '%1$s': %2$s",
+ "Unable to open file 'food': No such file or directory",
+ "food", "No such file or directory");
+ Calendar duke = new GregorianCalendar(1995, MAY, 23, 19, 48, 34);
+ duke.set(Calendar.MILLISECOND, 584);
+ test("Duke's Birthday: %1$tB %1$te, %1$tY",
+ "Duke's Birthday: May 23, 1995",
+ duke);
+ test("Duke's Birthday: %1$tB %1$te, %1$tY",
+ "Duke's Birthday: May 23, 1995",
+ duke.getTime());
+ test("Duke's Birthday: %1$tB %1$te, %1$tY",
+ "Duke's Birthday: May 23, 1995",
+ duke.getTimeInMillis());
+
+ test("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
+ "d c b a d c b a", "a", "b", "c", "d");
+ test("%s %s %<s %<s", "a b b b", "a", "b", "c", "d");
+ test("%s %s %s %s", "a b c d", "a", "b", "c", "d");
+ test("%2$s %s %<s %s", "b a a b", "a", "b", "c", "d");
+
+ //---------------------------------------------------------------------
+ // %b
+ //
+ // General conversion applicable to any argument.
+ //---------------------------------------------------------------------
+ test("%b", "true", true);
+ test("%b", "false", false);
+ test("%B", "TRUE", true);
+ test("%B", "FALSE", false);
+ test("%b", "true", Boolean.TRUE);
+ test("%b", "false", Boolean.FALSE);
+ test("%B", "TRUE", Boolean.TRUE);
+ test("%B", "FALSE", Boolean.FALSE);
+ test("%14b", " true", true);
+ test("%-14b", "true ", true);
+ test("%5.1b", " f", false);
+ test("%-5.1b", "f ", false);
+
+ test("%b", "true", "foo");
+ test("%b", "false", (Object)null);
+
+ // Boolean.java hardcodes the Strings for "true" and "false", so no
+ // localization is possible.
+ test(Locale.FRANCE, "%b", "true", true);
+ test(Locale.FRANCE, "%b", "false", false);
+
+ // If you pass in a single array to a varargs method, the compiler
+ // uses it as the array of arguments rather than treating it as a
+ // single array-type argument.
+ test("%b", "false", (Object[])new String[2]);
+ test("%b", "true", new String[2], new String[2]);
+
+ int [] ia = { 1, 2, 3 };
+ test("%b", "true", ia);
+
+ //---------------------------------------------------------------------
+ // %b - errors
+ //---------------------------------------------------------------------
+ tryCatch("%#b", FormatFlagsConversionMismatchException.class);
+ tryCatch("%-b", MissingFormatWidthException.class);
+ // correct or side-effect of implementation?
+ tryCatch("%.b", UnknownFormatConversionException.class);
+ tryCatch("%,b", FormatFlagsConversionMismatchException.class);
+
+ //---------------------------------------------------------------------
+ // %c
+ //
+ // General conversion applicable to any argument.
+ //---------------------------------------------------------------------
+ test("%c", "i", 'i');
+ test("%C", "I", 'i');
+ test("%4c", " i", 'i');
+ test("%-4c", "i ", 'i');
+ test("%4C", " I", 'i');
+ test("%-4C", "I ", 'i');
+ test("%c", "i", new Character('i'));
+ test("%c", "H", (byte) 72);
+ test("%c", "i", (short) 105);
+ test("%c", "!", (int) 33);
+ test("%c", "\u007F", Byte.MAX_VALUE);
+ test("%c", new String(Character.toChars(Short.MAX_VALUE)),
+ Short.MAX_VALUE);
+ test("%c", "null", (Object) null);
+
+ //---------------------------------------------------------------------
+ // %c - errors
+ //---------------------------------------------------------------------
+ tryCatch("%c", IllegalFormatConversionException.class,
+ Boolean.TRUE);
+ tryCatch("%c", IllegalFormatConversionException.class,
+ (float) 0.1);
+ tryCatch("%c", IllegalFormatConversionException.class,
+ new Object());
+ tryCatch("%c", IllegalFormatCodePointException.class,
+ Byte.MIN_VALUE);
+ tryCatch("%c", IllegalFormatCodePointException.class,
+ Short.MIN_VALUE);
+ tryCatch("%c", IllegalFormatCodePointException.class,
+ Integer.MIN_VALUE);
+ tryCatch("%c", IllegalFormatCodePointException.class,
+ Integer.MAX_VALUE);
+
+ tryCatch("%#c", FormatFlagsConversionMismatchException.class);
+ tryCatch("%,c", FormatFlagsConversionMismatchException.class);
+ tryCatch("%(c", FormatFlagsConversionMismatchException.class);
+ tryCatch("%$c", UnknownFormatConversionException.class);
+ tryCatch("%.2c", IllegalFormatPrecisionException.class);
+
+ //---------------------------------------------------------------------
+ // %s
+ //
+ // General conversion applicable to any argument.
+ //---------------------------------------------------------------------
+ test("%s", "Hello, Duke", "Hello, Duke");
+ test("%S", "HELLO, DUKE", "Hello, Duke");
+ test("%20S", " HELLO, DUKE", "Hello, Duke");
+ test("%20s", " Hello, Duke", "Hello, Duke");
+ test("%-20s", "Hello, Duke ", "Hello, Duke");
+ test("%-20.5s", "Hello ", "Hello, Duke");
+ test("%s", "null", (Object)null);
+
+ StringBuffer sb = new StringBuffer("foo bar");
+ test("%s", sb.toString(), sb);
+ test("%S", sb.toString().toUpperCase(), sb);
+
+ //---------------------------------------------------------------------
+ // %s - errors
+ //---------------------------------------------------------------------
+ tryCatch("%-s", MissingFormatWidthException.class);
+ tryCatch("%--s", DuplicateFormatFlagsException.class);
+ tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0);
+ tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
+ tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
+ tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+
+ //---------------------------------------------------------------------
+ // %h
+ //
+ // General conversion applicable to any argument.
+ //---------------------------------------------------------------------
+ test("%h", Integer.toHexString("Hello, Duke".hashCode()),
+ "Hello, Duke");
+ test("%10h", " ddf63471", "Hello, Duke");
+ test("%-10h", "ddf63471 ", "Hello, Duke");
+ test("%-10H", "DDF63471 ", "Hello, Duke");
+ test("%10h", " 402e0000", 15.0);
+ test("%10H", " 402E0000", 15.0);
+
+ //---------------------------------------------------------------------
+ // %h - errors
+ //---------------------------------------------------------------------
+ tryCatch("%#h", FormatFlagsConversionMismatchException.class);
+
+ //---------------------------------------------------------------------
+ // flag/conversion errors
+ //---------------------------------------------------------------------
+ tryCatch("%F", UnknownFormatConversionException.class);
+
+ tryCatch("%#g", FormatFlagsConversionMismatchException.class);
+
+#if[dec]
+
+#if[prim]
+ $type$ minByte = Byte.MIN_VALUE; // -128
+#else[prim]
+ $type$ minByte = new $type$(Byte.MIN_VALUE);
+#end[prim]
+
+ //---------------------------------------------------------------------
+ // %d
+ //
+ // Numeric conversion applicable to byte, short, int, long, and
+ // BigInteger.
+ //---------------------------------------------------------------------
+ test("%d", "null", (Object)null);
+
+#if[byte]
+#if[prim]
+ //---------------------------------------------------------------------
+ // %d - byte
+ //---------------------------------------------------------------------
+ $type$ seventeen = ($type$) 17;
+ test("%d", "17", seventeen);
+ test("%,d", "17", seventeen);
+ test("%,d", "-17", negate(seventeen));
+ test("%(d", "17", seventeen);
+ test("%(d", "(17)", negate(seventeen));
+ test("% d", " 17", seventeen);
+ test("% d", "-17", negate(seventeen));
+ test("%+d", "+17", seventeen);
+ test("%+d", "-17", negate(seventeen));
+ test("%010d", "0000000017", seventeen);
+ test("%010d", "-000000017", negate(seventeen));
+ test("%(10d", " (17)", negate(seventeen));
+ test("%-10d", "17 ", seventeen);
+ test("%-10d", "-17 ", negate(seventeen));
+#end[prim]
+#else[byte]
+#if[short]
+ //---------------------------------------------------------------------
+ // %d - short
+ //---------------------------------------------------------------------
+ $type$ oneToFive = ($type$) 12345;
+ test("%d", "12345", oneToFive);
+ test("%,d", "12,345", oneToFive);
+ test("%,d", "-12,345", negate(oneToFive));
+ test("%(d", "12345", oneToFive);
+ test("%(d", "(12345)", negate(oneToFive));
+ test("% d", " 12345", oneToFive);
+ test("% d", "-12345", negate(oneToFive));
+ test("%+d", "+12345", oneToFive);
+ test("%+d", "-12345", negate(oneToFive));
+ test("%010d", "0000012345", oneToFive);
+ test("%010d", "-000012345", negate(oneToFive));
+ test("%(10d", " (12345)", negate(oneToFive));
+ test("%-10d", "12345 ", oneToFive);
+ test("%-10d", "-12345 ", negate(oneToFive));
+
+#else[short]
+#if[prim]
+ //---------------------------------------------------------------------
+ // %d - int and long
+ //---------------------------------------------------------------------
+ $type$ oneToSeven = ($type$) 1234567;
+ test("%d", "1234567", oneToSeven);
+ test("%,d", "1,234,567", oneToSeven);
+ test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", oneToSeven);
+ test("%,d", "-1,234,567", negate(oneToSeven));
+ test("%(d", "1234567", oneToSeven);
+ test("%(d", "(1234567)", negate(oneToSeven));
+ test("% d", " 1234567", oneToSeven);
+ test("% d", "-1234567", negate(oneToSeven));
+ test("%+d", "+1234567", oneToSeven);
+ test("%+d", "-1234567", negate(oneToSeven));
+ test("%010d", "0001234567", oneToSeven);
+ test("%010d", "-001234567", negate(oneToSeven));
+ test("%(10d", " (1234567)", negate(oneToSeven));
+ test("%-10d", "1234567 ", oneToSeven);
+ test("%-10d", "-1234567 ", negate(oneToSeven));
+#end[prim]
+#end[short]
+#end[byte]
+ //---------------------------------------------------------------------
+ // %d - errors
+ //---------------------------------------------------------------------
+ tryCatch("%#d", FormatFlagsConversionMismatchException.class);
+ tryCatch("%D", UnknownFormatConversionException.class);
+ tryCatch("%0d", MissingFormatWidthException.class);
+ tryCatch("%-d", MissingFormatWidthException.class);
+ tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+
+ //---------------------------------------------------------------------
+ // %o
+ //
+ // Numeric conversion applicable to byte, short, int, long, and
+ // BigInteger.
+ //---------------------------------------------------------------------
+ test("%o", "null", (Object)null);
+
+#if[byte]
+ //---------------------------------------------------------------------
+ // %o - byte
+ //---------------------------------------------------------------------
+ test("%010o", "0000000200", minByte);
+ test("%-10o", "200 ", minByte);
+ test("%#10o", " 0200", minByte);
+#end[byte]
+#if[short]
+ //---------------------------------------------------------------------
+ // %o - short
+ //---------------------------------------------------------------------
+
+ test("%010o", "0000177600", minByte);
+ test("%-10o", "177600 ", minByte);
+ test("%#10o", " 0177600", minByte);
+#end[short]
+#if[int]
+ //---------------------------------------------------------------------
+ // %o - int
+ //---------------------------------------------------------------------
+ test("%014o", "00037777777600", minByte);
+ test("%-14o", "37777777600 ", minByte);
+ test("%#14o", " 037777777600", minByte);
+
+ $type$ oneToSevenOct = ($type$) 1234567;
+ test("%o", "4553207", oneToSevenOct);
+ test("%010o", "0004553207", oneToSevenOct);
+ test("%-10o", "4553207 ", oneToSevenOct);
+ test("%#10o", " 04553207", oneToSevenOct);
+#end[int]
+#if[long]
+ //---------------------------------------------------------------------
+ // %o - long
+ //---------------------------------------------------------------------
+ test("%024o", "001777777777777777777600", minByte);
+ test("%-24o", "1777777777777777777600 ", minByte);
+ test("%#24o", " 01777777777777777777600", minByte);
+
+ $type$ oneToSevenOct = ($type$) 1234567;
+ test("%o", "4553207", oneToSevenOct);
+ test("%010o", "0004553207", oneToSevenOct);
+ test("%-10o", "4553207 ", oneToSevenOct);
+ test("%#10o", " 04553207", oneToSevenOct);
+#end[long]
+
+ //---------------------------------------------------------------------
+ // %o - errors
+ //---------------------------------------------------------------------
+ tryCatch("%(o", FormatFlagsConversionMismatchException.class,
+ minByte);
+ tryCatch("%+o", FormatFlagsConversionMismatchException.class,
+ minByte);
+ tryCatch("% o", FormatFlagsConversionMismatchException.class,
+ minByte);
+ tryCatch("%0o", MissingFormatWidthException.class);
+ tryCatch("%-o", MissingFormatWidthException.class);
+ tryCatch("%,o", FormatFlagsConversionMismatchException.class);
+ tryCatch("%O", UnknownFormatConversionException.class);
+
+ //---------------------------------------------------------------------
+ // %x
+ //
+ // Numeric conversion applicable to byte, short, int, long, and
+ // BigInteger.
+ //---------------------------------------------------------------------
+ test("%x", "null", (Object)null);
+
+#if[byte]
+ //---------------------------------------------------------------------
+ // %x - byte
+ //---------------------------------------------------------------------
+ test("%010x", "0000000080", minByte);
+ test("%-10x", "80 ", minByte);
+ test("%#10x", " 0x80", minByte);
+ test("%0#10x","0x00000080", minByte);
+ test("%#10X", " 0X80", minByte);
+ test("%X", "80", minByte);
+#end[byte]
+#if[short]
+ //---------------------------------------------------------------------
+ // %x - short
+ //---------------------------------------------------------------------
+ test("%010x", "000000ff80", minByte);
+ test("%-10x", "ff80 ", minByte);
+ test("%#10x", " 0xff80", minByte);
+ test("%0#10x","0x0000ff80", minByte);
+ test("%#10X", " 0XFF80", minByte);
+ test("%X", "FF80", minByte);
+#end[short]
+#if[int]
+ //---------------------------------------------------------------------
+ // %x - int
+ //---------------------------------------------------------------------
+ $type$ oneToSevenHex = ($type$)1234567;
+ test("%x", "null", (Object)null);
+ test("%x", "12d687", oneToSevenHex);
+ test("%010x", "000012d687", oneToSevenHex);
+ test("%-10x", "12d687 ", oneToSevenHex);
+ test("%#10x", " 0x12d687", oneToSevenHex);
+ test("%#10X", " 0X12D687",oneToSevenHex);
+ test("%X", "12D687", oneToSevenHex);
+
+ test("%010x", "00ffffff80", minByte);
+ test("%-10x", "ffffff80 ", minByte);
+ test("%#10x", "0xffffff80", minByte);
+ test("%0#12x","0x00ffffff80", minByte);
+ test("%#12X", " 0XFFFFFF80", minByte);
+ test("%X", "FFFFFF80", minByte);
+#end[int]
+#if[long]
+ //---------------------------------------------------------------------
+ // %x - long
+ //---------------------------------------------------------------------
+ $type$ oneToSevenHex = ($type$)1234567;
+ test("%x", "null", (Object)null);
+ test("%x", "12d687", oneToSevenHex);
+ test("%010x", "000012d687", oneToSevenHex);
+ test("%-10x", "12d687 ", oneToSevenHex);
+ test("%#10x", " 0x12d687", oneToSevenHex);
+ test("%#10X", " 0X12D687",oneToSevenHex);
+ test("%X", "12D687", oneToSevenHex);
+
+ test("%018x", "00ffffffffffffff80", minByte);
+ test("%-18x", "ffffffffffffff80 ", minByte);
+ test("%#20x", " 0xffffffffffffff80", minByte);
+ test("%0#20x", "0x00ffffffffffffff80", minByte);
+ test("%#20X", " 0XFFFFFFFFFFFFFF80", minByte);
+ test("%X", "FFFFFFFFFFFFFF80", minByte);
+#end[long]
+ //---------------------------------------------------------------------
+ // %x - errors
+ //---------------------------------------------------------------------
+ tryCatch("%,x", FormatFlagsConversionMismatchException.class);
+ tryCatch("%0x", MissingFormatWidthException.class);
+ tryCatch("%-x", MissingFormatWidthException.class);
+
+#end[dec]
+
+#if[BigInteger]
+ //---------------------------------------------------------------------
+ // BigInteger - errors
+ //---------------------------------------------------------------------
+ tryCatch("%f", IllegalFormatConversionException.class,
+ new BigInteger("1"));
+
+ //---------------------------------------------------------------------
+ // %d - BigInteger
+ //---------------------------------------------------------------------
+ test("%d", "null", (Object)null);
+ test("%d", "1234567", new BigInteger("1234567", 10));
+ test("%,d", "1,234,567", new BigInteger("1234567", 10));
+ test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", new BigInteger("1234567", 10));
+ test("%,d", "-1,234,567", new BigInteger("-1234567", 10));
+ test("%(d", "1234567", new BigInteger("1234567", 10));
+ test("%(d", "(1234567)", new BigInteger("-1234567", 10));
+ test("% d", " 1234567", new BigInteger("1234567", 10));
+ test("% d", "-1234567", new BigInteger("-1234567", 10));
+ test("%+d", "+1234567", new BigInteger("1234567", 10));
+ test("%+d", "-1234567", new BigInteger("-1234567", 10));
+ test("%010d", "0001234567", new BigInteger("1234567", 10));
+ test("%010d", "-001234567", new BigInteger("-1234567", 10));
+ test("%(10d", " (1234567)", new BigInteger("-1234567", 10));
+ test("%+d", "+1234567", new BigInteger("1234567", 10));
+ test("%+d", "-1234567", new BigInteger("-1234567", 10));
+ test("%-10d", "1234567 ", new BigInteger("1234567", 10));
+ test("%-10d", "-1234567 ", new BigInteger("-1234567", 10));
+
+ //---------------------------------------------------------------------
+ // %o - BigInteger
+ //---------------------------------------------------------------------
+ test("%o", "null", (Object)null);
+ test("%o", "1234567", new BigInteger("1234567", 8));
+ test("%(o", "1234567", new BigInteger("1234567", 8));
+ test("%(o", "(1234567)", new BigInteger("-1234567", 8));
+ test("% o", " 1234567", new BigInteger("1234567", 8));
+ test("% o", "-1234567", new BigInteger("-1234567", 8));
+ test("%+o", "+1234567", new BigInteger("1234567", 8));
+ test("%+o", "-1234567", new BigInteger("-1234567", 8));
+ test("%010o", "0001234567", new BigInteger("1234567", 8));
+ test("%010o", "-001234567", new BigInteger("-1234567", 8));
+ test("%(10o", " (1234567)", new BigInteger("-1234567", 8));
+ test("%+o", "+1234567", new BigInteger("1234567", 8));
+ test("%+o", "-1234567", new BigInteger("-1234567", 8));
+ test("%-10o", "1234567 ", new BigInteger("1234567", 8));
+ test("%-10o", "-1234567 ", new BigInteger("-1234567", 8));
+ test("%#10o", " 01234567", new BigInteger("1234567", 8));
+ test("%#10o", " -01234567", new BigInteger("-1234567", 8));
+
+ //---------------------------------------------------------------------
+ // %x - BigInteger
+ //---------------------------------------------------------------------
+ test("%x", "null", (Object)null);
+ test("%x", "1234567", new BigInteger("1234567", 16));
+ test("%(x", "1234567", new BigInteger("1234567", 16));
+ test("%(x", "(1234567)", new BigInteger("-1234567", 16));
+ test("% x", " 1234567", new BigInteger("1234567", 16));
+ test("% x", "-1234567", new BigInteger("-1234567", 16));
+ test("%+x", "+1234567", new BigInteger("1234567", 16));
+ test("%+x", "-1234567", new BigInteger("-1234567", 16));
+ test("%010x", "0001234567", new BigInteger("1234567", 16));
+ test("%010x", "-001234567", new BigInteger("-1234567", 16));
+ test("%(10x", " (1234567)", new BigInteger("-1234567", 16));
+ test("%+x", "+1234567", new BigInteger("1234567", 16));
+ test("%+x", "-1234567", new BigInteger("-1234567", 16));
+ test("%-10x", "1234567 ", new BigInteger("1234567", 16));
+ test("%-10x", "-1234567 ", new BigInteger("-1234567", 16));
+ test("%#10x", " 0x1234567", new BigInteger("1234567", 16));
+ test("%#10x", "-0x1234567", new BigInteger("-1234567", 16));
+ test("%#10X", " 0X1234567", new BigInteger("1234567", 16));
+ test("%#10X", "-0X1234567", new BigInteger("-1234567", 16));
+ test("%X", "1234567A", new BigInteger("1234567a", 16));
+ test("%X", "-1234567A", new BigInteger("-1234567a", 16));
+#end[BigInteger]
+
+#if[fp]
+#if[BigDecimal]
+ //---------------------------------------------------------------------
+ // %s - BigDecimal
+ //---------------------------------------------------------------------
+ $type$ one = BigDecimal.ONE;
+ $type$ ten = BigDecimal.TEN;
+ $type$ pi = new $type$(Math.PI);
+ $type$ piToThe300 = pi.pow(300);
+
+ test("%s", "3.141592653589793115997963468544185161590576171875", pi);
+#end[BigDecimal]
+#if[float]
+ //---------------------------------------------------------------------
+ // %s - float
+ //---------------------------------------------------------------------
+ $type$ one = 1.0f;
+ $type$ ten = 10.0f;
+ $type$ pi = (float) Math.PI;
+
+ test("%s", "3.1415927", pi);
+#end[float]
+#if[Float]
+ //---------------------------------------------------------------------
+ // %s - Float
+ //---------------------------------------------------------------------
+ $type$ one = new $type$(1.0f);
+ $type$ ten = new $type$(10.0f);
+ $type$ pi = new $type$(Math.PI);
+
+ test("%s", "3.1415927", pi);
+#end[Float]
+#if[double]
+ //---------------------------------------------------------------------
+ // %s - double
+ //---------------------------------------------------------------------
+ $type$ one = 1.0;
+ $type$ ten = 10.0;
+ $type$ pi = Math.PI;
+
+ test("%s", "3.141592653589793", pi);
+#end[double]
+#if[Double]
+ //---------------------------------------------------------------------
+ // %s - Double
+ //---------------------------------------------------------------------
+ $type$ one = new $type$(1.0);
+ $type$ ten = new $type$(10.0);
+ $type$ pi = new $type$(Math.PI);
+
+ test("%s", "3.141592653589793", pi);
+#end[Double]
+
+ //---------------------------------------------------------------------
+ // flag/conversion errors
+ //---------------------------------------------------------------------
+ tryCatch("%d", IllegalFormatConversionException.class, one);
+ tryCatch("%,.4e", FormatFlagsConversionMismatchException.class, one);
+
+ //---------------------------------------------------------------------
+ // %e
+ //
+ // Floating-point conversions applicable to float, double, and
+ // BigDecimal.
+ //---------------------------------------------------------------------
+ test("%e", "null", (Object)null);
+
+ //---------------------------------------------------------------------
+ // %e - float and double
+ //---------------------------------------------------------------------
+ // double PI = 3.141 592 653 589 793 238 46;
+ test("%e", "3.141593e+00", pi);
+ test("%.0e", "1e+01", ten);
+ test("%#.0e", "1.e+01", ten);
+ test("%E", "3.141593E+00", pi);
+ test("%10.3e", " 3.142e+00", pi);
+ test("%10.3e", "-3.142e+00", negate(pi));
+ test("%010.3e", "03.142e+00", pi);
+ test("%010.3e", "-3.142e+00", negate(pi));
+ test("%-12.3e", "3.142e+00 ", pi);
+ test("%-12.3e", "-3.142e+00 ", negate(pi));
+ test("%.3e", "3.142e+00", pi);
+ test("%.3e", "-3.142e+00", negate(pi));
+ test("%.3e", "3.142e+06", mult(pi, 1000000.0));
+ test("%.3e", "-3.142e+06", mult(pi, -1000000.0));
+
+ test(Locale.FRANCE, "%e", "3,141593e+00", pi);
+
+ // double PI^300
+ // = 13962455701329742638131355433930076081862072808 ... e+149
+#if[BigDecimal]
+ //---------------------------------------------------------------------
+ // %e - BigDecimal
+ //---------------------------------------------------------------------
+ test("%.3e", "1.396e+149", piToThe300);
+ test("%.3e", "-1.396e+149", piToThe300.negate());
+ test("%.3e", "1.000e-100", recip(ten.pow(100)));
+ test("%.3e", "-1.000e-100", negate(recip(ten.pow(100))));
+
+ test("%3.0e", "1e-06", new BigDecimal("0.000001"));
+ test("%3.0e", "1e-05", new BigDecimal("0.00001"));
+ test("%3.0e", "1e-04", new BigDecimal("0.0001"));
+ test("%3.0e", "1e-03", new BigDecimal("0.001"));
+ test("%3.0e", "1e-02", new BigDecimal("0.01"));
+ test("%3.0e", "1e-01", new BigDecimal("0.1"));
+ test("%3.0e", "9e-01", new BigDecimal("0.9"));
+ test("%3.1e", "9.0e-01", new BigDecimal("0.9"));
+ test("%3.0e", "1e+00", new BigDecimal("1.00"));
+ test("%3.0e", "1e+01", new BigDecimal("10.00"));
+ test("%3.0e", "1e+02", new BigDecimal("99.19"));
+ test("%3.1e", "9.9e+01", new BigDecimal("99.19"));
+ test("%3.0e", "1e+02", new BigDecimal("99.99"));
+ test("%3.0e", "1e+02", new BigDecimal("100.00"));
+ test("%#3.0e", "1.e+03", new BigDecimal("1000.00"));
+ test("%3.0e", "1e+04", new BigDecimal("10000.00"));
+ test("%3.0e", "1e+05", new BigDecimal("100000.00"));
+ test("%3.0e", "1e+06", new BigDecimal("1000000.00"));
+ test("%3.0e", "1e+07", new BigDecimal("10000000.00"));
+ test("%3.0e", "1e+08", new BigDecimal("100000000.00"));
+#end[BigDecimal]
+
+ test("%10.3e", " 1.000e+00", one);
+ test("%+.3e", "+3.142e+00", pi);
+ test("%+.3e", "-3.142e+00", negate(pi));
+ test("% .3e", " 3.142e+00", pi);
+ test("% .3e", "-3.142e+00", negate(pi));
+ test("%#.0e", "3.e+00", create(3.0));
+ test("%#.0e", "-3.e+00", create(-3.0));
+ test("%.0e", "3e+00", create(3.0));
+ test("%.0e", "-3e+00", create(-3.0));
+
+ test("%(.4e", "3.1416e+06", mult(pi, 1000000.0));
+ test("%(.4e", "(3.1416e+06)", mult(pi, -1000000.0));
+
+ //---------------------------------------------------------------------
+ // %e - boundary problems
+ //---------------------------------------------------------------------
+ test("%3.0e", "1e-06", 0.000001);
+ test("%3.0e", "1e-05", 0.00001);
+ test("%3.0e", "1e-04", 0.0001);
+ test("%3.0e", "1e-03", 0.001);
+ test("%3.0e", "1e-02", 0.01);
+ test("%3.0e", "1e-01", 0.1);
+ test("%3.0e", "9e-01", 0.9);
+ test("%3.1e", "9.0e-01", 0.9);
+ test("%3.0e", "1e+00", 1.00);
+ test("%3.0e", "1e+01", 10.00);
+ test("%3.0e", "1e+02", 99.19);
+ test("%3.1e", "9.9e+01", 99.19);
+ test("%3.0e", "1e+02", 99.99);
+ test("%3.0e", "1e+02", 100.00);
+ test("%#3.0e", "1.e+03", 1000.00);
+ test("%3.0e", "1e+04", 10000.00);
+ test("%3.0e", "1e+05", 100000.00);
+ test("%3.0e", "1e+06", 1000000.00);
+ test("%3.0e", "1e+07", 10000000.00);
+ test("%3.0e", "1e+08", 100000000.00);
+
+ //---------------------------------------------------------------------
+ // %f
+ //
+ // Floating-point conversions applicable to float, double, and
+ // BigDecimal.
+ //---------------------------------------------------------------------
+ test("%f", "null", (Object)null);
+ test("%f", "3.141593", pi);
+ test(Locale.FRANCE, "%f", "3,141593", pi);
+ test("%10.3f", " 3.142", pi);
+ test("%10.3f", " -3.142", negate(pi));
+ test("%010.3f", "000003.142", pi);
+ test("%010.3f", "-00003.142", negate(pi));
+ test("%-10.3f", "3.142 ", pi);
+ test("%-10.3f", "-3.142 ", negate(pi));
+ test("%.3f", "3.142", pi);
+ test("%.3f", "-3.142", negate(pi));
+ test("%+.3f", "+3.142", pi);
+ test("%+.3f", "-3.142", negate(pi));
+ test("% .3f", " 3.142", pi);
+ test("% .3f", "-3.142", negate(pi));
+ test("%#.0f", "3.", create(3.0));
+ test("%#.0f", "-3.", create(-3.0));
+ test("%.0f", "3", create(3.0));
+ test("%.0f", "-3", create(-3.0));
+ test("%.3f", "10.000", ten);
+ test("%.3f", "1.000", one);
+ test("%10.3f", " 1.000", one);
+
+ //---------------------------------------------------------------------
+ // %f - boundary problems
+ //---------------------------------------------------------------------
+ test("%3.0f", " 0", 0.000001);
+ test("%3.0f", " 0", 0.00001);
+ test("%3.0f", " 0", 0.0001);
+ test("%3.0f", " 0", 0.001);
+ test("%3.0f", " 0", 0.01);
+ test("%3.0f", " 0", 0.1);
+ test("%3.0f", " 1", 0.9);
+ test("%3.1f", "0.9", 0.9);
+ test("%3.0f", " 1", 1.00);
+ test("%3.0f", " 10", 10.00);
+ test("%3.0f", " 99", 99.19);
+ test("%3.1f", "99.2", 99.19);
+ test("%3.0f", "100", 99.99);
+ test("%3.0f", "100", 100.00);
+ test("%#3.0f", "1000.", 1000.00);
+ test("%3.0f", "10000", 10000.00);
+ test("%3.0f", "100000", 100000.00);
+ test("%3.0f", "1000000", 1000000.00);
+ test("%3.0f", "10000000", 10000000.00);
+ test("%3.0f", "100000000", 100000000.00);
+#if[BigDecimal]
+ //---------------------------------------------------------------------
+ // %f - BigDecimal
+ //---------------------------------------------------------------------
+ test("%4.0f", " 99", new BigDecimal("99.19"));
+ test("%4.1f", "99.2", new BigDecimal("99.19"));
+
+ BigDecimal val = new BigDecimal("99.95");
+ test("%4.0f", " 100", val);
+ test("%#4.0f", "100.", val);
+ test("%4.1f", "100.0", val);
+ test("%4.2f", "99.95", val);
+ test("%4.3f", "99.950", val);
+
+ val = new BigDecimal(".99");
+ test("%4.1f", " 1.0", val);
+ test("%4.2f", "0.99", val);
+ test("%4.3f", "0.990", val);
+
+ // #6476425
+ val = new BigDecimal("0.00001");
+ test("%.0f", "0", val);
+ test("%.1f", "0.0", val);
+ test("%.2f", "0.00", val);
+ test("%.3f", "0.000", val);
+ test("%.4f", "0.0000", val);
+ test("%.5f", "0.00001", val);
+
+ val = new BigDecimal("1.00001");
+ test("%.0f", "1", val);
+ test("%.1f", "1.0", val);
+ test("%.2f", "1.00", val);
+ test("%.3f", "1.000", val);
+ test("%.4f", "1.0000", val);
+ test("%.5f", "1.00001", val);
+
+ val = new BigDecimal("1.23456");
+ test("%.0f", "1", val);
+ test("%.1f", "1.2", val);
+ test("%.2f", "1.23", val);
+ test("%.3f", "1.235", val);
+ test("%.4f", "1.2346", val);
+ test("%.5f", "1.23456", val);
+ test("%.6f", "1.234560", val);
+
+ val = new BigDecimal("9.99999");
+ test("%.0f", "10", val);
+ test("%.1f", "10.0", val);
+ test("%.2f", "10.00", val);
+ test("%.3f", "10.000", val);
+ test("%.4f", "10.0000", val);
+ test("%.5f", "9.99999", val);
+ test("%.6f", "9.999990", val);
+
+
+ val = new BigDecimal("1.99999");
+ test("%.0f", "2", val);
+ test("%.1f", "2.0", val);
+ test("%.2f", "2.00", val);
+ test("%.3f", "2.000", val);
+ test("%.4f", "2.0000", val);
+ test("%.5f", "1.99999", val);
+ test("%.6f", "1.999990", val);
+
+#end[BigDecimal]
+
+#if[float]
+ //---------------------------------------------------------------------
+ // %f - float
+ //---------------------------------------------------------------------
+ // Float can not accurately store 1e6 * PI.
+ test("%.3f", "3141.593", mult(pi, 1000.0));
+ test("%.3f", "-3141.593", mult(pi, -1000.0));
+
+ test("%,.2f", "3,141.59", mult(pi, 1000.0));
+ test(Locale.FRANCE, "%,.2f", "3\u00a0141,59", mult(pi, 1000.0));
+ test("%,.2f", "-3,141.59", mult(pi, -1000.0));
+ test("%(.2f", "3141.59", mult(pi, 1000.0));
+ test("%(.2f", "(3141.59)", mult(pi, -1000.0));
+ test("%(,.2f", "3,141.59", mult(pi, 1000.0));
+ test("%(,.2f", "(3,141.59)", mult(pi, -1000.0));
+
+#else[float]
+#if[!Float]
+ //---------------------------------------------------------------------
+ // %f - float, double, Double, BigDecimal
+ //---------------------------------------------------------------------
+ test("%.3f", "3141592.654", mult(pi, 1000000.0));
+ test("%.3f", "-3141592.654", mult(pi, -1000000.0));
+ test("%,.4f", "3,141,592.6536", mult(pi, 1000000.0));
+ test(Locale.FRANCE, "%,.4f", "3\u00a0141\u00a0592,6536", mult(pi, 1000000.0));
+ test("%,.4f", "-3,141,592.6536", mult(pi, -1000000.0));
+ test("%(.4f", "3141592.6536", mult(pi, 1000000.0));
+ test("%(.4f", "(3141592.6536)", mult(pi, -1000000.0));
+ test("%(,.4f", "3,141,592.6536", mult(pi, 1000000.0));
+ test("%(,.4f", "(3,141,592.6536)", mult(pi, -1000000.0));
+#end[!Float]
+#end[float]
+
+
+ //---------------------------------------------------------------------
+ // %g
+ //
+ // Floating-point conversions applicable to float, double, and
+ // BigDecimal.
+ //---------------------------------------------------------------------
+ test("%g", "null", (Object)null);
+ test("%g", "3.14159", pi);
+ test(Locale.FRANCE, "%g", "3,14159", pi);
+ test("%.0g", "1e+01", ten);
+ test("%G", "3.14159", pi);
+ test("%10.3g", " 3.14", pi);
+ test("%10.3g", " -3.14", negate(pi));
+ test("%010.3g", "0000003.14", pi);
+ test("%010.3g", "-000003.14", negate(pi));
+ test("%-12.3g", "3.14 ", pi);
+ test("%-12.3g", "-3.14 ", negate(pi));
+ test("%.3g", "3.14", pi);
+ test("%.3g", "-3.14", negate(pi));
+ test("%.3g", "3.14e+08", mult(pi, 100000000.0));
+ test("%.3g", "-3.14e+08", mult(pi, -100000000.0));
+
+ test("%.3g", "1.00e-05", recip(create(100000.0)));
+ test("%.3g", "-1.00e-05", recip(create(-100000.0)));
+ test("%.0g", "-1e-05", recip(create(-100000.0)));
+ test("%.0g", "1e+05", create(100000.0));
+ test("%.3G", "1.00E-05", recip(create(100000.0)));
+ test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+
+ test("%3.0g", "1e-06", 0.000001);
+ test("%3.0g", "1e-05", 0.00001);
+ test("%3.0g", "1e-05", 0.0000099);
+ test("%3.1g", "1e-05", 0.0000099);
+ test("%3.2g", "9.9e-06", 0.0000099);
+ test("%3.0g", "0.0001", 0.0001);
+ test("%3.0g", "9e-05", 0.00009);
+ test("%3.0g", "0.0001", 0.000099);
+ test("%3.1g", "0.0001", 0.000099);
+ test("%3.2g", "9.9e-05", 0.000099);
+ test("%3.0g", "0.001", 0.001);
+ test("%3.0g", "0.001", 0.00099);
+ test("%3.1g", "0.001", 0.00099);
+ test("%3.2g", "0.00099", 0.00099);
+ test("%3.3g", "0.00100", 0.001);
+ test("%3.4g", "0.001000", 0.001);
+ test("%3.0g", "0.01", 0.01);
+ test("%3.0g", "0.1", 0.1);
+ test("%3.0g", "0.9", 0.9);
+ test("%3.1g", "0.9", 0.9);
+ test("%3.0g", " 1", 1.00);
+ test("%3.2g", " 10", 10.00);
+ test("%3.0g", "1e+01", 10.00);
+ test("%3.0g", "1e+02", 99.19);
+ test("%3.1g", "1e+02", 99.19);
+ test("%3.2g", " 99", 99.19);
+ test("%3.0g", "1e+02", 99.9);
+ test("%3.1g", "1e+02", 99.9);
+ test("%3.2g", "1.0e+02", 99.9);
+ test("%3.0g", "1e+02", 99.99);
+ test("%3.0g", "1e+02", 100.00);
+ test("%3.0g", "1e+03", 999.9);
+ test("%3.1g", "1e+03", 999.9);
+ test("%3.2g", "1.0e+03", 999.9);
+ test("%3.3g", "1.00e+03", 999.9);
+ test("%3.4g", "999.9", 999.9);
+ test("%3.4g", "1000", 999.99);
+ test("%3.0g", "1e+03", 1000.00);
+ test("%3.0g", "1e+04", 10000.00);
+ test("%3.0g", "1e+05", 100000.00);
+ test("%3.0g", "1e+06", 1000000.00);
+ test("%3.0g", "1e+07", 10000000.00);
+ test("%3.9g", "100000000", 100000000.00);
+ test("%3.10g", "100000000.0", 100000000.00);
+
+ tryCatch("%#3.0g", FormatFlagsConversionMismatchException.class, 1000.00);
+
+ // double PI^300
+ // = 13962455701329742638131355433930076081862072808 ... e+149
+#if[BigDecimal]
+ //---------------------------------------------------------------------
+ // %g - BigDecimal
+ //---------------------------------------------------------------------
+ test("%.3g", "1.40e+149", piToThe300);
+ test("%.3g", "-1.40e+149", piToThe300.negate());
+ test(Locale.FRANCE, "%.3g", "-1,40e+149", piToThe300.negate());
+ test("%.3g", "1.00e-100", recip(ten.pow(100)));
+ test("%.3g", "-1.00e-100", negate(recip(ten.pow(100))));
+
+ test("%3.0g", "1e-06", new BigDecimal("0.000001"));
+ test("%3.0g", "1e-05", new BigDecimal("0.00001"));
+ test("%3.0g", "0.0001", new BigDecimal("0.0001"));
+ test("%3.0g", "0.001", new BigDecimal("0.001"));
+ test("%3.3g", "0.00100", new BigDecimal("0.001"));
+ test("%3.4g", "0.001000", new BigDecimal("0.001"));
+ test("%3.0g", "0.01", new BigDecimal("0.01"));
+ test("%3.0g", "0.1", new BigDecimal("0.1"));
+ test("%3.0g", "0.9", new BigDecimal("0.9"));
+ test("%3.1g", "0.9", new BigDecimal("0.9"));
+ test("%3.0g", " 1", new BigDecimal("1.00"));
+ test("%3.2g", " 10", new BigDecimal("10.00"));
+ test("%3.0g", "1e+01", new BigDecimal("10.00"));
+ test("%3.0g", "1e+02", new BigDecimal("99.19"));
+ test("%3.1g", "1e+02", new BigDecimal("99.19"));
+ test("%3.2g", " 99", new BigDecimal("99.19"));
+ test("%3.0g", "1e+02", new BigDecimal("99.99"));
+ test("%3.0g", "1e+02", new BigDecimal("100.00"));
+ test("%3.0g", "1e+03", new BigDecimal("1000.00"));
+ test("%3.0g", "1e+04", new BigDecimal("10000.00"));
+ test("%3.0g", "1e+05", new BigDecimal("100000.00"));
+ test("%3.0g", "1e+06", new BigDecimal("1000000.00"));
+ test("%3.0g", "1e+07", new BigDecimal("10000000.00"));
+ test("%3.9g", "100000000", new BigDecimal("100000000.00"));
+ test("%3.10g", "100000000.0", new BigDecimal("100000000.00"));
+#end[BigDecimal]
+
+ test("%.3g", "10.0", ten);
+ test("%.3g", "1.00", one);
+ test("%10.3g", " 1.00", one);
+ test("%+10.3g", " +3.14", pi);
+ test("%+10.3g", " -3.14", negate(pi));
+ test("% .3g", " 3.14", pi);
+ test("% .3g", "-3.14", negate(pi));
+ test("%.0g", "3", create(3.0));
+ test("%.0g", "-3", create(-3.0));
+
+ test("%(.4g", "3.142e+08", mult(pi, 100000000.0));
+ test("%(.4g", "(3.142e+08)", mult(pi, -100000000.0));
+
+#if[float]
+ // Float can not accurately store 1e6 * PI.
+ test("%,.6g", "3,141.59", mult(pi, 1000.0));
+ test("%(,.6g", "(3,141.59)", mult(pi, -1000.0));
+#else[float]
+#if[!Float]
+ test("%,.11g", "3,141,592.6536", mult(pi, 1000000.0));
+ test("%(,.11g", "(3,141,592.6536)", mult(pi, -1000000.0));
+#end[!Float]
+#end[float]
+
+#if[double]
+ //---------------------------------------------------------------------
+ // %a
+ //
+ // Floating-point conversions applicable to float, double, and
+ // BigDecimal.
+ //---------------------------------------------------------------------
+ test("%a", "null", (Object)null);
+ test("%.11a", "0x0.00000000000p0", 0.0);
+ test(Locale.FRANCE, "%.11a", "0x0.00000000000p0", 0.0); // no localization
+ test("%.1a", "0x0.0p0", 0.0);
+ test("%.11a", "-0x0.00000000000p0", -0.0);
+ test("%.1a", "-0x0.0p0", -0.0);
+ test("%.11a", "0x1.00000000000p0", 1.0);
+ test("%.1a", "0x1.0p0", 1.0);
+ test("%.11a", "-0x1.00000000000p0", -1.0);
+ test("%.1a", "-0x1.0p0", -1.0);
+ test("%.11a", "0x1.80000000000p1", 3.0);
+ test("%.1a", "0x1.8p1", 3.0);
+ test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
+ test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
+ test("%.11a", "0x1.00000000000p-1022",
+ FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+ test("%.1a", "0x1.0p-1022",
+ FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+ test("%.11a", "0x1.ffffffffffep-1023",
+ Double.parseDouble("0x0.fffffffffffp-1022"));
+ test("%.1a", "0x1.0p-1022",
+ Double.parseDouble("0x0.fffffffffffp-1022"));
+ test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE);
+ test("%.13a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
+ test("%.11a", "0x1.00000000000p-1074", Double.MIN_VALUE);
+ test("%.1a", "0x1.0p-1074", Double.MIN_VALUE);
+
+ test("%.11a", "0x1.08000000000p-1069",
+ Double.MIN_VALUE + Double.MIN_VALUE*32);
+ test("%.1a", "0x1.0p-1069",
+ Double.MIN_VALUE + Double.MIN_VALUE*32);
+ test("%.30a", "0x1.fffffffffffff00000000000000000p1023", Double.MAX_VALUE);
+ test("%.13a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
+ test("%.11a", "0x1.00000000000p1024", Double.MAX_VALUE);
+ test("%.1a", "0x1.0p1024", Double.MAX_VALUE);
+ test("%.11a", "0x1.18000000000p0", Double.parseDouble("0x1.18p0"));
+ test("%.1a", "0x1.2p0", Double.parseDouble("0x1.18p0"));
+
+ test("%.11a", "0x1.18000000000p0",
+ Double.parseDouble("0x1.180000000001p0"));
+ test("%.1a", "0x1.2p0",
+ Double.parseDouble("0x1.180000000001p0"));
+ test("%.11a", "0x1.28000000000p0", Double.parseDouble("0x1.28p0"));
+ test("%.1a", "0x1.2p0", Double.parseDouble("0x1.28p0"));
+
+ test("%.11a", "0x1.28000000000p0",
+ Double.parseDouble("0x1.280000000001p0"));
+ test("%.1a", "0x1.3p0", Double.parseDouble("0x1.280000000001p0"));
+#end[double]
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - Boundaries
+ //---------------------------------------------------------------------
+#if[float]
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - NaN
+ //---------------------------------------------------------------------
+ test("%f", "NaN", Float.NaN);
+ // s
+ test("%+f", "NaN", Float.NaN);
+// test("%F", "NAN", Float.NaN);
+ test("%e", "NaN", Float.NaN);
+ test("%+e", "NaN", Float.NaN);
+ test("%E", "NAN", Float.NaN);
+ test("%g", "NaN", Float.NaN);
+ test("%+g", "NaN", Float.NaN);
+ test("%G", "NAN", Float.NaN);
+ test("%a", "NaN", Float.NaN);
+ test("%+a", "NaN", Float.NaN);
+ test("%A", "NAN", Float.NaN);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - +0.0
+ //---------------------------------------------------------------------
+ test("%f", "0.000000", +0.0);
+ test("%+f", "+0.000000", +0.0);
+ test("% f", " 0.000000", +0.0);
+// test("%F", "0.000000", +0.0);
+ test("%e", "0.000000e+00", 0e0);
+ test("%e", "0.000000e+00", +0.0);
+ test("%+e", "+0.000000e+00", +0.0);
+ test("% e", " 0.000000e+00", +0.0);
+ test("%E", "0.000000E+00", 0e0);
+ test("%E", "0.000000E+00", +0.0);
+ test("%+E", "+0.000000E+00", +0.0);
+ test("% E", " 0.000000E+00", +0.0);
+ test("%g", "0.00000", +0.0);
+ test("%+g", "+0.00000", +0.0);
+ test("% g", " 0.00000", +0.0);
+ test("%G", "0.00000", +0.0);
+ test("% G", " 0.00000", +0.0);
+ test("%a", "0x0.0p0", +0.0);
+ test("%+a", "+0x0.0p0", +0.0);
+ test("% a", " 0x0.0p0", +0.0);
+ test("%A", "0X0.0P0", +0.0);
+ test("% A", " 0X0.0P0", +0.0);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - -0.0
+ //---------------------------------------------------------------------
+ test("%f", "-0.000000", -0.0);
+ test("%+f", "-0.000000", -0.0);
+// test("%F", "-0.000000", -0.0);
+ test("%e", "-0.000000e+00", -0.0);
+ test("%+e", "-0.000000e+00", -0.0);
+ test("%E", "-0.000000E+00", -0.0);
+ test("%+E", "-0.000000E+00", -0.0);
+ test("%g", "-0.00000", -0.0);
+ test("%+g", "-0.00000", -0.0);
+ test("%G", "-0.00000", -0.0);
+ test("%a", "-0x0.0p0", -0.0);
+ test("%+a", "-0x0.0p0", -0.0);
+ test("%+A", "-0X0.0P0", -0.0);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - +Infinity
+ //---------------------------------------------------------------------
+ test("%f", "Infinity", Float.POSITIVE_INFINITY);
+ test("%+f", "+Infinity", Float.POSITIVE_INFINITY);
+ test("% f", " Infinity", Float.POSITIVE_INFINITY);
+// test("%F", "INFINITY", Float.POSITIVE_INFINITY);
+ test("%e", "Infinity", Float.POSITIVE_INFINITY);
+ test("%+e", "+Infinity", Float.POSITIVE_INFINITY);
+ test("% e", " Infinity", Float.POSITIVE_INFINITY);
+ test("%E", "INFINITY", Float.POSITIVE_INFINITY);
+ test("%+E", "+INFINITY", Float.POSITIVE_INFINITY);
+ test("% E", " INFINITY", Float.POSITIVE_INFINITY);
+ test("%g", "Infinity", Float.POSITIVE_INFINITY);
+ test("%+g", "+Infinity", Float.POSITIVE_INFINITY);
+ test("%G", "INFINITY", Float.POSITIVE_INFINITY);
+ test("% G", " INFINITY", Float.POSITIVE_INFINITY);
+ test("%+G", "+INFINITY", Float.POSITIVE_INFINITY);
+ test("%a", "Infinity", Float.POSITIVE_INFINITY);
+ test("%+a", "+Infinity", Float.POSITIVE_INFINITY);
+ test("% a", " Infinity", Float.POSITIVE_INFINITY);
+ test("%A", "INFINITY", Float.POSITIVE_INFINITY);
+ test("%+A", "+INFINITY", Float.POSITIVE_INFINITY);
+ test("% A", " INFINITY", Float.POSITIVE_INFINITY);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - -Infinity
+ //---------------------------------------------------------------------
+ test("%f", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%+f", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%(f", "(Infinity)", Float.NEGATIVE_INFINITY);
+// test("%F", "-INFINITY", Float.NEGATIVE_INFINITY);
+ test("%e", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%+e", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%E", "-INFINITY", Float.NEGATIVE_INFINITY);
+ test("%+E", "-INFINITY", Float.NEGATIVE_INFINITY);
+ test("%g", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%+g", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%G", "-INFINITY", Float.NEGATIVE_INFINITY);
+ test("%+G", "-INFINITY", Float.NEGATIVE_INFINITY);
+ test("%a", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%+a", "-Infinity", Float.NEGATIVE_INFINITY);
+ test("%A", "-INFINITY", Float.NEGATIVE_INFINITY);
+ test("%+A", "-INFINITY", Float.NEGATIVE_INFINITY);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - Float.MIN_VALUE
+ //---------------------------------------------------------------------
+ test("%f", "0.000000", Float.MIN_VALUE);
+ test("%,f", "0.000000", Float.MIN_VALUE);
+ test("%(f", "(0.000000)", -Float.MIN_VALUE);
+ test("%30.0f", " 0", Float.MIN_VALUE);
+ test("%30.5f", " 0.00000", Float.MIN_VALUE);
+ test("%30.13f", " 0.0000000000000", Float.MIN_VALUE);
+ test("%30.20f", " 0.00000000000000000000", Float.MIN_VALUE);
+ test("%e", "1.401298e-45", Float.MIN_VALUE);
+ test("%E", "1.401298E-45", Float.MIN_VALUE);
+ test("%(.1e", "1.4e-45", Float.MIN_VALUE);
+ test("%(E", "(1.401298E-45)", -Float.MIN_VALUE);
+ test("%30.5e", " 1.40130e-45", Float.MIN_VALUE);
+ test("%30.13e", " 1.4012984643248e-45", Float.MIN_VALUE);
+ test("%30.20e", " 1.40129846432481700000e-45", Float.MIN_VALUE);
+ test("%g", "1.40130e-45", Float.MIN_VALUE);
+ test("%G", "1.40130E-45", Float.MIN_VALUE);
+ test("%(g", "1.40130e-45", Float.MIN_VALUE);
+ test("%,g", "1.40130e-45", Float.MIN_VALUE);
+ test("%(G", "(1.40130E-45)", -Float.MIN_VALUE);
+ test("%30.5g", " 1.4013e-45", Float.MIN_VALUE);
+ test("%30.13g", " 1.401298464325e-45", Float.MIN_VALUE);
+ test("%30.20g", " 1.4012984643248170000e-45", Float.MIN_VALUE);
+ test("%a", "0x1.0p-149", Float.MIN_VALUE);
+ test("%A", "0X1.0P-149", Float.MIN_VALUE);
+ test("%20a", " 0x1.0p-149", Float.MIN_VALUE);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - Float.MAX_VALUE
+ //---------------------------------------------------------------------
+ test("%f", "340282346638528860000000000000000000000.000000", Float.MAX_VALUE);
+ test("%,f","340,282,346,638,528,860,000,000,000,000,000,000,000.000000",
+ Float.MAX_VALUE);
+ test("%(f", "(340282346638528860000000000000000000000.000000)", -Float.MAX_VALUE);
+ test("%60.5f", " 340282346638528860000000000000000000000.00000",
+ Float.MAX_VALUE);
+ test("%60.13f", " 340282346638528860000000000000000000000.0000000000000",
+ Float.MAX_VALUE);
+ test("%61.20f", " 340282346638528860000000000000000000000.00000000000000000000",
+ Float.MAX_VALUE);
+ test("%e", "3.402823e+38", Float.MAX_VALUE);
+ test("%E", "3.402823E+38", Float.MAX_VALUE);
+ test("%(e", "3.402823e+38", Float.MAX_VALUE);
+ test("%(e", "(3.402823e+38)", -Float.MAX_VALUE);
+ test("%30.5e", " 3.40282e+38", Float.MAX_VALUE);
+ test("%30.13e", " 3.4028234663853e+38", Float.MAX_VALUE);
+ test("%30.20e", " 3.40282346638528860000e+38", Float.MAX_VALUE);
+ test("%g", "3.40282e+38", Float.MAX_VALUE);
+ test("%G", "3.40282E+38", Float.MAX_VALUE);
+ test("%,g", "3.40282e+38", Float.MAX_VALUE);
+ test("%(g", "(3.40282e+38)", -Float.MAX_VALUE);
+ test("%30.5g", " 3.4028e+38", Float.MAX_VALUE);
+ test("%30.13g", " 3.402823466385e+38", Float.MAX_VALUE);
+ test("%30.20G", " 3.4028234663852886000E+38", Float.MAX_VALUE);
+ test("%a", "0x1.fffffep127", Float.MAX_VALUE);
+ test("%A", "0X1.FFFFFEP127", Float.MAX_VALUE);
+ test("%20a"," 0x1.fffffep127", Float.MAX_VALUE);
+
+#end[float]
+
+#if[double]
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - Double.MIN_VALUE
+ //---------------------------------------------------------------------
+ test("%f", "0.000000", Double.MIN_VALUE);
+ test("%,f", "0.000000", Double.MIN_VALUE);
+ test("%(f", "(0.000000)", -Double.MIN_VALUE);
+ test("%30.0f", " 0", Double.MIN_VALUE);
+ test("%30.5f", " 0.00000", Double.MIN_VALUE);
+ test("%30.13f", " 0.0000000000000", Double.MIN_VALUE);
+ test("%30.20f", " 0.00000000000000000000", Double.MIN_VALUE);
+ test("%30.350f","0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000",
+ Double.MIN_VALUE);
+ test("%e", "4.900000e-324", Double.MIN_VALUE);
+ test("%E", "4.900000E-324", Double.MIN_VALUE);
+ test("%(.1e", "4.9e-324", Double.MIN_VALUE);
+ test("%(E", "(4.900000E-324)", -Double.MIN_VALUE);
+ test("%30.5e", " 4.90000e-324", Double.MIN_VALUE);
+ test("%30.13e", " 4.9000000000000e-324", Double.MIN_VALUE);
+ test("%30.20e", " 4.90000000000000000000e-324", Double.MIN_VALUE);
+ test("%g", "4.90000e-324", Double.MIN_VALUE);
+ test("%G", "4.90000E-324", Double.MIN_VALUE);
+ test("%(g", "4.90000e-324", Double.MIN_VALUE);
+ test("%,g", "4.90000e-324", Double.MIN_VALUE);
+ test("%30.5g", " 4.9000e-324", Double.MIN_VALUE);
+ test("%30.13g", " 4.900000000000e-324", Double.MIN_VALUE);
+ test("%30.20g", " 4.9000000000000000000e-324", Double.MIN_VALUE);
+ test("%a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
+ test("%A", "0X0.0000000000001P-1022", Double.MIN_VALUE);
+ test("%30a", " 0x0.0000000000001p-1022", Double.MIN_VALUE);
+
+ //---------------------------------------------------------------------
+ // %f, %e, %g, %a - Double.MAX_VALUE
+ //---------------------------------------------------------------------
+ test("%f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000",
+ Double.MAX_VALUE);
+ test("%,f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000",
+ Double.MAX_VALUE);
+ test("%,(f", "(179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000)",
+ -Double.MAX_VALUE);
+ test("%,30.5f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000",
+ Double.MAX_VALUE);
+ test("%30.13f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000",
+ Double.MAX_VALUE);
+ test("%30.20f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000000",
+ Double.MAX_VALUE);
+ test("%e", "1.797693e+308", Double.MAX_VALUE);
+ test("%E", "1.797693E+308", Double.MAX_VALUE);
+ test("%(e", "1.797693e+308", Double.MAX_VALUE);
+ test("%(e", "(1.797693e+308)", -Double.MAX_VALUE);
+ test("%30.5e", " 1.79769e+308", Double.MAX_VALUE);
+ test("%30.13e", " 1.7976931348623e+308", Double.MAX_VALUE);
+ test("%30.20e", " 1.79769313486231570000e+308", Double.MAX_VALUE);
+ test("%g", "1.79769e+308", Double.MAX_VALUE);
+ test("%G", "1.79769E+308", Double.MAX_VALUE);
+ test("%,g", "1.79769e+308", Double.MAX_VALUE);
+ test("%(g", "(1.79769e+308)", -Double.MAX_VALUE);
+ test("%30.5g", " 1.7977e+308", Double.MAX_VALUE);
+ test("%30.13g", " 1.797693134862e+308", Double.MAX_VALUE);
+ test("%30.20g", " 1.7976931348623157000e+308", Double.MAX_VALUE);
+ test("%a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
+ test("%A", "0X1.FFFFFFFFFFFFFP1023", Double.MAX_VALUE);
+ test("%30a", " 0x1.fffffffffffffp1023", Double.MAX_VALUE);
+#end[double]
+
+#end[fp]
+
+ //---------------------------------------------------------------------
+ // %t
+ //
+ // Date/Time conversions applicable to Calendar, Date, and long.
+ //---------------------------------------------------------------------
+ test("%tA", "null", (Object)null);
+ test("%TA", "NULL", (Object)null);
+
+ //---------------------------------------------------------------------
+ // %t - errors
+ //---------------------------------------------------------------------
+ tryCatch("%t", UnknownFormatConversionException.class);
+ tryCatch("%T", UnknownFormatConversionException.class);
+ tryCatch("%tP", UnknownFormatConversionException.class);
+ tryCatch("%TP", UnknownFormatConversionException.class);
+ tryCatch("%.5tB", IllegalFormatPrecisionException.class);
+ tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
+ tryCatch("%-tB", MissingFormatWidthException.class);
+
+#if[datetime]
+ //---------------------------------------------------------------------
+ // %t - create test Calendar
+ //---------------------------------------------------------------------
+
+ // Get the supported ids for GMT-08:00 (Pacific Standard Time)
+ String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
+ // Create a Pacific Standard Time time zone
+ SimpleTimeZone tz = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
+ // public GregorianCalendar(TimeZone zone, Locale aLocale);
+ Calendar c0 = new GregorianCalendar(tz, Locale.US);
+ // public final void set(int year, int month, int date,
+ // int hourOfDay, int minute, int second);
+ c0.set(1995, MAY, 23, 19, 48, 34);
+ c0.set(Calendar.MILLISECOND, 584);
+
+ //---------------------------------------------------------------------
+ // %t - Minutes, {nano,milli}*seconds
+ //
+ // testDateTime() verifies the expected output for all applicable types
+ // (Calendar, Date, and long). It also verifies output for "%t" and
+ // "%T". Thus it is sufficient to invoke that method once per
+ // conversion/expected output.
+ //---------------------------------------------------------------------
+ testDateTime("%tM", "48", c0);
+ testDateTime("%tN", "584000000", c0);
+ testDateTime("%tL", "584", c0);
+// testDateTime("%tQ", "801283714584", c0);
+
+ testDateTime("%ts", String.valueOf(c0.getTimeInMillis() / 1000), c0);
+ testDateTime("%tS", "34", c0);
+ testDateTime("%tT", "19:48:34", c0);
+
+ //---------------------------------------------------------------------
+ // %t - Hours, morning/afternoon markers
+ //
+ // testHours() iterates through all twenty-four hours to verify
+ // numeric return value and morning/afternoon markers.
+ //---------------------------------------------------------------------
+ testHours();
+
+ //---------------------------------------------------------------------
+ // %t - Portions of date [ day, month, dates, weeks ]
+ //---------------------------------------------------------------------
+ testDateTime("%ta", "Tue", c0);
+ testDateTime("%tA", "Tuesday", c0);
+ testDateTime("%tb", "May", c0);
+ testDateTime("%tB", "May", c0);
+ testDateTime("%tC", "19", c0);
+ testDateTime("%td", "23", c0);
+ testDateTime("%te", "23", c0);
+ testDateTime("%th", "May", c0);
+ testDateTime("%tj", "143", c0);
+ testDateTime("%tm", "05", c0);
+ testDateTime("%ty", "95", c0);
+ testDateTime("%tY", "1995", c0);
+
+ //---------------------------------------------------------------------
+ // %t - TimeZone
+ //---------------------------------------------------------------------
+ testDateTime("%tz", "-0800", c0);
+ testDateTime("%tZ", "PST", c0);
+
+ //---------------------------------------------------------------------
+ // %tz should always adjust for DST
+ //---------------------------------------------------------------------
+ TimeZone dtz = TimeZone.getDefault();
+
+ // Artificial TimeZone based on PST with 3:15 DST always in effect
+ TimeZone atz = new SimpleTimeZone(-8 * 60 * 60 * 1000, "AlwaysDST",
+ JANUARY, 1, 0, 0, STANDARD_TIME,
+ // 24hrs - 1m = 60 * 60 * 1000 * 24 - 1
+ DECEMBER, 31, 0, 60 * 60 * 1000 * 24 - 1, STANDARD_TIME,
+ (int)(60 * 60 * 1000 * 3.25));
+ TimeZone.setDefault(atz);
+ testDateTime("%tz", "-0445", Calendar.getInstance(atz));
+
+ // Restore the TimeZone and verify
+ TimeZone.setDefault(dtz);
+ if (atz.hasSameRules(TimeZone.getDefault()))
+ throw new RuntimeException("Default TimeZone not restored");
+
+ //---------------------------------------------------------------------
+ // %t - Composites
+ //---------------------------------------------------------------------
+ testDateTime("%tr", "07:48:34 PM", c0);
+ testDateTime("%tR", "19:48", c0);
+ testDateTime("%tc", "Tue May 23 19:48:34 PST 1995", c0);
+ testDateTime("%tD", "05/23/95", c0);
+ testDateTime("%tF", "1995-05-23", c0);
+ testDateTime("%-12tF", "1995-05-23 ", c0);
+ testDateTime("%12tF", " 1995-05-23", c0);
+#end[datetime]
+
+ //---------------------------------------------------------------------
+ // %n
+ //---------------------------------------------------------------------
+ test("%n", System.getProperty("line.separator"), (Object)null);
+ test("%n", System.getProperty("line.separator"), "");
+
+ tryCatch("%,n", IllegalFormatFlagsException.class);
+ tryCatch("%.n", UnknownFormatConversionException.class);
+ tryCatch("%5.n", UnknownFormatConversionException.class);
+ tryCatch("%5n", IllegalFormatWidthException.class);
+ tryCatch("%.7n", IllegalFormatPrecisionException.class);
+ tryCatch("%<n", IllegalFormatFlagsException.class);
+
+ //---------------------------------------------------------------------
+ // %%
+ //---------------------------------------------------------------------
+ test("%%", "%", (Object)null);
+ test("%%", "%", "");
+ tryCatch("%%%", UnknownFormatConversionException.class);
+ // perhaps an IllegalFormatArgumentIndexException should be defined?
+ tryCatch("%<%", IllegalFormatFlagsException.class);
+ }
+}
--- a/jdk/test/java/util/Formatter/genBasic.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/Formatter/genBasic.sh Fri Dec 04 10:23:07 2009 -0800
@@ -27,10 +27,10 @@
gen() {
# if [ $3 = "true" ]
-# then $SPP -K$1 -Dtype=$1 -DType=$2 -Kprim<Basic-X.java >Basic$2.java
-# else $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 <Basic-X.java >Basic$2.java
+# then $SPP -K$1 -Dtype=$1 -DType=$2 -Kprim<Basic-X.java.template >Basic$2.java
+# else $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 <Basic-X.java.template >Basic$2.java
# fi
- java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java >Basic$2.java
+ java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java.template >Basic$2.java
}
gen boolean Boolean prim "" "" ""
--- a/jdk/test/java/util/IdentityHashMap/ToString.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/IdentityHashMap/ToString.java Fri Dec 04 10:23:07 2009 -0800
@@ -26,9 +26,6 @@
* @bug 4973432
* @summary Test that toString on entrySet Iterator/Entry behaves reasonably
* @author Josh Bloch
- *
- * @compile -source 1.5 ToString.java
- * @run main ToString
*/
--- a/jdk/test/java/util/Locale/Bug4175998Test.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/Locale/Bug4175998Test.java Fri Dec 04 10:23:07 2009 -0800
@@ -23,7 +23,7 @@
/*
@test
@summary test ISO639-2 language codes
- @compile -encoding ascii -source 1.4 -target 1.4 Bug4175998Test.java
+ @compile -encoding ascii -source 5 Bug4175998Test.java
@run main Bug4175998Test
@bug 4175998
*/
--- a/jdk/test/java/util/UUID/UUIDTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/UUID/UUIDTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -23,8 +23,6 @@
/* @test
* @bug 4173528 5068772
- * @compile -source 1.4 -target 1.4 UUIDTest.java
- * @run main UUIDTest
* @summary Unit tests for java.util.UUID
*/
--- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 CancelledProducerConsumerLoops.java
+ * @compile CancelledProducerConsumerLoops.java
* @run main/timeout=7000 CancelledProducerConsumerLoops
* @summary Checks for responsiveness of blocking queues to cancellation.
* Runs under the assumption that ITERS computations require more than
--- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 MultipleProducersSingleConsumerLoops.java
+ * @compile MultipleProducersSingleConsumerLoops.java
* @run main/timeout=3600 MultipleProducersSingleConsumerLoops
* @summary multiple producers and single consumer using blocking queues
*/
--- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 ProducerConsumerLoops.java
+ * @compile ProducerConsumerLoops.java
* @run main/timeout=3600 ProducerConsumerLoops
* @summary multiple producers and consumers using blocking queues
*/
--- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 SingleProducerMultipleConsumerLoops.java
+ * @compile SingleProducerMultipleConsumerLoops.java
* @run main/timeout=600 SingleProducerMultipleConsumerLoops
* @summary check ordering for blocking queues with 1 producer and multiple consumers
*/
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 MapCheck.java
+ * @compile MapCheck.java
* @run main/timeout=240 MapCheck
* @summary Times and checks basic map operations
*/
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 MapLoops.java
+ * @compile MapLoops.java
* @run main/timeout=1600 MapLoops
* @summary Exercise multithreaded maps, by default ConcurrentHashMap.
* Multithreaded hash table test. Each thread does a random walk
--- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 ExchangeLoops.java
+ * @compile ExchangeLoops.java
* @run main/timeout=720 ExchangeLoops
* @summary checks to make sure a pipeline of exchangers passes data.
*/
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4965960
- * @compile -source 1.5 ExecutorCompletionServiceLoops.java
+ * @compile ExecutorCompletionServiceLoops.java
* @run main/timeout=3600 ExecutorCompletionServiceLoops
* @summary Exercise ExecutorCompletionServiceLoops
*/
--- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 CancelledFutureLoops.java
+ * @compile CancelledFutureLoops.java
* @run main/timeout=2000 CancelledFutureLoops
* @summary Checks for responsiveness of futures to cancellation.
* Runs under the assumption that ITERS computations require more than
--- a/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java Fri Dec 04 10:23:07 2009 -0800
@@ -24,8 +24,6 @@
/*
* @test
* @bug 4992443 4994819
- * @compile -source 1.5 VMSupportsCS8.java
- * @run main VMSupportsCS8
* @summary Checks that the value of VMSupportsCS8 matches system properties.
*/
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 CancelledLockLoops.java
+ * @compile CancelledLockLoops.java
* @run main/timeout=2800 CancelledLockLoops
* @summary tests lockInterruptibly.
* Checks for responsiveness of locks to interrupts. Runs under that
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 LockOncePerThreadLoops.java
+ * @compile LockOncePerThreadLoops.java
* @run main/timeout=15000 LockOncePerThreadLoops
* @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread
*/
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 SimpleReentrantLockLoops.java
+ * @compile SimpleReentrantLockLoops.java
* @run main/timeout=4500 SimpleReentrantLockLoops
* @summary multiple threads using a single lock
*/
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,8 +34,6 @@
/*
* @test
* @bug 4486658 5031862
- * @compile -source 1.5 TimeoutLockLoops.java
- * @run main TimeoutLockLoops
* @summary Checks for responsiveness of locks to timeouts.
* Runs under the assumption that ITERS computations require more than
* TIMEOUT msecs to complete, which seems to be a safe assumption for
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java Fri Dec 04 10:23:07 2009 -0800
@@ -34,7 +34,7 @@
/*
* @test
* @bug 4486658
- * @compile -source 1.5 MapLoops.java
+ * @compile MapLoops.java
* @run main/timeout=4700 MapLoops
* @summary Exercise multithreaded maps, by default ConcurrentHashMap.
* Multithreaded hash table test. Each thread does a random walk
--- a/jdk/test/sun/management/AgentCheckTest.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/sun/management/AgentCheckTest.java Fri Dec 04 10:23:07 2009 -0800
@@ -27,9 +27,6 @@
* @summary Localize log messages from the management agents
*
* @author Tim Bell
- *
- * @run compile -source 1.5 -g AgentCheckTest.java
- * @run main AgentCheckTest
*/
import sun.management.Agent;
--- a/jdk/test/sun/security/krb5/auto/SSL.java Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/sun/security/krb5/auto/SSL.java Fri Dec 04 10:23:07 2009 -0800
@@ -36,33 +36,32 @@
public class SSL {
private static final String KRB5_CIPHER = "TLS_KRB5_WITH_3DES_EDE_CBC_SHA";
- private static final int PORT = 4569;
private static final int LOOP_LIMIT = 1;
private static final char[] PASS = "secret".toCharArray();
private static int loopCount = 0;
-
- private static String SERVER;
+ private static volatile String server;
+ private static volatile int port;
public static void main(String[] args) throws Exception {
KDC kdc = KDC.create(OneKDC.REALM);
// Run this after KDC, so our own DNS service can be started
try {
- SERVER = InetAddress.getLocalHost().getHostName();
+ server = InetAddress.getLocalHost().getHostName().toLowerCase();
} catch (java.net.UnknownHostException e) {
- SERVER = "localhost";
+ server = "localhost";
}
kdc.addPrincipal(OneKDC.USER, OneKDC.PASS);
kdc.addPrincipalRandKey("krbtgt/" + OneKDC.REALM);
- kdc.addPrincipal("host/" + SERVER, PASS);
+ kdc.addPrincipal("host/" + server, PASS);
KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
final Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
- final Context s = Context.fromUserPass("host/" + SERVER, PASS, true);
+ final Context s = Context.fromUserPass("host/" + server, PASS, true);
- c.startAsClient("host/" + SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+ c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
new Thread(new Runnable() {
@@ -87,7 +86,7 @@
public byte[] run(Context s, byte[] input) throws Exception {
SSLSocketFactory sslsf =
(SSLSocketFactory) SSLSocketFactory.getDefault();
- SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(SERVER, PORT);
+ SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(server, port);
// Enable only a KRB5 cipher suite.
String enabledSuites[] = {KRB5_CIPHER};
@@ -124,7 +123,8 @@
SSLServerSocketFactory sslssf =
(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
SSLServerSocket sslServerSocket =
- (SSLServerSocket) sslssf.createServerSocket(PORT);
+ (SSLServerSocket) sslssf.createServerSocket(0); // any port
+ port = sslServerSocket.getLocalPort();
// Enable only a KRB5 cipher suite.
String enabledSuites[] = {KRB5_CIPHER};
--- a/jdk/test/sun/security/util/Oid/S11N.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/sun/security/util/Oid/S11N.sh Fri Dec 04 10:23:07 2009 -0800
@@ -99,7 +99,7 @@
# the test code
-${TESTJAVA}${FS}bin${FS}javac -source 1.3 -target 1.3 -d . ${TESTSRC}${FS}SerialTest.java || exit 10
+${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}SerialTest.java || exit 10
OLDJAVA="
/java/re/j2se/1.6.0/latest/binaries/${PF}
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Wed Dec 02 12:17:42 2009 +0000
+++ b/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Fri Dec 04 10:23:07 2009 -0800
@@ -98,7 +98,7 @@
set -vx
#
#Compile. jconsole.jar is required on the classpath.
-${TESTJAVA}/bin/javac -source 1.5 -d "${TESTCLASSES}" ${CP} -g \
+${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
"${TESTSRC}"/"${TARGETCLASS}".java
#
#Run the test class, again with the classpath we need: