ICU-5390 eclipse/jdk13 compatibility support

X-SVN-Rev: 20334
This commit is contained in:
Yoshito Umaoka 2006-09-15 18:09:25 +00:00
parent 5725b0e4cd
commit 4598074686
24 changed files with 314 additions and 162 deletions

View File

@ -88,9 +88,10 @@
<property name="jarSrc.file" value="icu4jsrc.jar"/>
<property name="zipCoreSrc.file" value="icu4jcsrc.zip"/>
<property name="zipTestSrc.file" value="icu4jtsrc.zip"/>
<property name="jdk.wrapper.jar.file" value="icu4jwrapper.jar"/>
<property name="eclipse.dir" value="${src.dir}/com/ibm/icu/dev/eclipse"/>
<property name="eclipse.wrapper.dir" value="eclipseWrapper"/>
<property name="eclipse.dist.dir" value="eclipseDist"/>
<property name="eclipse.projects.dir" value="eclipseProjects"/>
<property name="wrapper.build.dir" value="classes.wrapper"/>
<property name="jarDocs.file" value="icu4jdocs.jar"/>
<property name="icu4j.manifest" value="${src.dir}/com/ibm/icu/manifest.stub"/>
<property name="icu4j.module.manifest" value="${src.dir}/com/ibm/icu/manifest.module.stub"/>
@ -129,8 +130,7 @@
<property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${eclipse.wrapper.dir}"/>
<mkdir dir="${eclipse.dist.dir}"/>
<mkdir dir="${wrapper.build.dir}"/>
<echo message="java home: ${java.home}"/>
<echo message="java version: ${java.version}"/>
@ -696,6 +696,14 @@
<delete dir="${doc.dir}"/>
<delete file="${jar.file}"/>
<delete dir="${richedit.dir}"/>
<delete file="${testjar.file}"/>
<delete file="${jarSrc.file}"/>
<delete dir="${eclipse.projects.dir}"/>
<delete dir="${wrapper.build.dir}"/>
<delete file="${zipCoreSrc.file}"/>
<delete file="${zipTestSrc.file}"/>
<delete file="${jdk.wrapper.jar.file}"/>
</target>
<!--
@ -1220,23 +1228,9 @@
</target>
<!-- for building eclipse distribution -->
<target name="zipCoreSrc" depends="init" description="build zip of core sources for debugging">
<!-- for eclipse -->
<zip destfile="${zipCoreSrc.file}"
compress="true"
basedir="${src.dir}"
includes="../license.html,../Copyright_Assignment.rtf,com/ibm/icu/impl/**/*,com/ibm/icu/lang/**/*,com/ibm/icu/math/**/*,com/ibm/icu/text/**/*,com/ibm/icu/util/**/*"/>
</target>
<target name="zipTestSrc" depends="init" description="build zip of test sources for debugging">
<!-- for eclipse -->
<zip destfile="${zipTestSrc.file}"
compress="true"
basedir="${src.dir}"
includes="com/ibm/icu/dev/test/**/*"
excludes="com/ibm/icu/dev/test/cldr/**/*, com/ibm/icu/dev/test/perf/**/*"/>
</target>
<target name="eclipseProjects"
depends="eclipseCoreProject,eclipseTestProject,eclipseWrapperProject"
description="create all eclipse icu projects"/>
<target name="undoEclipseMangle" depends="buildmangle" description="preprocess files back to default)">
<java classname="com.ibm.icu.dev.tool.docs.CodeMangler" classpath="${build.dir}" logError="true">
@ -1253,17 +1247,8 @@
</java>
</target>
<target name="eclipseTestMangle" depends="buildmangle">
<java classname="com.ibm.icu.dev.tool.docs.CodeMangler" classpath="${build.dir}" logError="true">
<arg value="-dFOUNDATION"/>
<arg value="-t"/>
<arg value="@eclipseTestArgs.txt"/>
</java>
</target>
<target name="eclipseCore" depends="init,coreData,icudata,eclipseCoreMangle">
<javac includes="com/ibm/icu/util/**/*.java,com/ibm/icu/text/**/*.java,com/ibm/icu/math/**/*.java,com/ibm/icu/impl/**/*.java,com/ibm/icu/lang/*.java"
excludes="**/CVS/**/*,**/GlobalizationPreferences*"
compiler="javac1.3"
srcdir="${src.dir}"
destdir="${build.dir}"
@ -1282,55 +1267,50 @@
manifest="${icu4j.manifest}"/>
</target>
<target name="eclipseCorePkg" depends="eclipseCore" description="build eclipse core package">
<!-- should do a clean build before start -->
<copy file="${jar.file}" toDir="${eclipse.dir}/com.ibm.icu"/>
<antcall target="zipCoreSrc"/>
<move file="${zipCoreSrc.file}" toDir="${eclipse.dir}/com.ibm.icu"/>
<zip destfile="eclipseICU4J_core.zip"
basedir="${eclipse.dir}"
includes="com.ibm.icu,com.ibm.icu/**/*"
excludes="com.ibm.icu/CVS/**/*"/>
</target>
<target name="eclipseTestPkg" depends="eclipseCore,eclipseTestMangle" description="build tests trimmed for eclipse API">
<antcall target="tests"/>
<jar jarfile="${testjar.file}" compress="true" manifest="${icu4j.tests.manifest}">
<fileset dir="${build.dir}" includes="com/ibm/icu/dev/test/**/*" excludes="/com/ibm/icu/dev/test/**/GlobalizationPreferences*"/>
<fileset dir="${build.dir}" includes="com/ibm/icu/dev/data/**/*"/>
</jar>
<copy file="${testjar.file}" toDir="${eclipse.dir}/com.ibm.icu.tests"/>
<antcall target="zipTestSrc"/>
<move file="${zipTestSrc.file}" toDir="${eclipse.dir}/com.ibm.icu.tests"/>
<zip destfile="eclipseICU4J_tests.zip"
basedir="${eclipse.dir}"
includes="com.ibm.icu.tests,com.ibm.icu.tests/**/*"/>
</target>
<target name="eclipseDistro" depends="init, eclipseCore">
<target name="eclipseCoreProject" depends="eclipseCore" description="gather eclipse icu core project files">
<delete failonerror="no">
<fileset dir="${eclipse.dist.dir}"/>
<fileset dir="${eclipse.projects.dir}/com.ibm.icu"/>
<fileset dir="${eclipse.projects.dir}/com.ibm.icu-feature"/>
</delete>
<copy todir="${eclipse.dist.dir}/src/com/ibm/icu">
<!-- collect source files -->
<copy toDir="${eclipse.projects.dir}/com.ibm.icu/src/com/ibm/icu">
<fileset dir="src/com/ibm/icu"
includes="impl/**/*,lang/**/*,math/**/*,text/**/*,util/**/*"
excludes="**/CVS/**/*,**/*.jar,**/Transliterator_Han_Latin*.txt"/>
</copy>
<copy todir="${eclipse.dist.dir}/src/com/ibm/icu/impl/data">
<!-- collect icu data files -->
<copy todir="${eclipse.projects.dir}/com.ibm.icu/src/com/ibm/icu/impl/data">
<fileset dir="${build.dir}/com/ibm/icu/impl/data"
includes="**/*.brk,**/*.icu,**/*.res,**/*.spp,**/*.txt"
excludes="**/Transliterator_Han_Latin*.txt"/>
</copy>
<!-- collect eclipse project files -->
<copy todir="${eclipse.projects.dir}">
<fileset dir="${eclipse.dir}"
includes="com.ibm.icu/**/*,com.ibm.icu-feature/**/*"
excludes="**/CVS/**/*"/>
</copy>
<!-- copy ICU license file -->
<copy file="license.html"
todir="${eclipse.projects.dir}/com.ibm.icu/about_files"/>
<!-- ucd terms -->
<copy file="src/com/ibm/icu/dev/data/unicode/ucdterms.txt"
todir="${eclipse.projects.dir}/com.ibm.icu/about_files"/>
<!-- copy ICU about file -->
<copy file="${eclipse.dir}/misc/about_icu.html"
tofile="${eclipse.projects.dir}/com.ibm.icu/about.html"/>
<!-- common eclipse about file -->
<copy file="${eclipse.dir}/misc/about.html"
todir="${eclipse.projects.dir}/com.ibm.icu-feature/sourceTemplatePlugin"/>
</target>
<!-- ensure eclipse wrapper code builds with foundation1.0/java1.3 -->
<target name="eclipseWrapper" depends="init">
<javac includes="com/ibm/icu/util/**/*.java,com/ibm/icu/text/**/*.java"
excludes="**/CVS/**/*,**/GlobalizationPreferences*"
compiler="javac1.3"
srcdir="${src.dir}/com/ibm/icu/dev/eclipse/com.ibm.icu.base/src"
destdir="${eclipse.wrapper.dir}"
destdir="${wrapper.build.dir}"
classpathref="build.classpath"
bootclasspath="ee.foundation.jar"
source="1.3"
@ -1338,6 +1318,95 @@
debug="on"
deprecation="off"
encoding="ascii"/>
<jar jarfile="${jdk.wrapper.jar.file}"
compress="true"
basedir="${wrapper.build.dir}"/>
</target>
<target name="eclipseWrapperTest" depends="init">
<!-- TODO: build the wrapper test code this ant target -->
</target>
<target name="eclipseWrapperProject" depends="eclipseWrapper,eclipseWrapperTest" description="gather eclipse icu core project files">
<delete failonerror="no">
<fileset dir="${eclipse.projects.dir}/com.ibm.icu.base"/>
<fileset dir="${eclipse.projects.dir}/com.ibm.icu.base-feature"/>
<fileset dir="${eclipse.projects.dir}/com.ibm.icu.base.tests"/>
</delete>
<!-- collect eclipse project files -->
<copy todir="${eclipse.projects.dir}">
<fileset dir="${eclipse.dir}"
includes="com.ibm.icu.base/**/*,com.ibm.icu.base-feature/**/*,com.ibm.icu.base.tests/**/*"
excludes="**/CVS/**/*"/>
</copy>
<!-- copy ICU license file -->
<copy file="license.html"
todir="${eclipse.projects.dir}/com.ibm.icu.base/about_files"/>
<!-- copy ICU about file -->
<copy file="${eclipse.dir}/misc/about_icu.html"
tofile="${eclipse.projects.dir}/com.ibm.icu.base/about.html"/>
<!-- common eclipse about file -->
<copy file="${eclipse.dir}/misc/about.html"
todir="${eclipse.projects.dir}/com.ibm.icu.base-feature/sourceTemplatePlugin"/>
</target>
<target name="eclipseTestMangle" depends="buildmangle">
<java classname="com.ibm.icu.dev.tool.docs.CodeMangler" classpath="${build.dir}" logError="true">
<arg value="-dFOUNDATION"/>
<arg value="-t"/>
<arg value="@eclipseTestArgs.txt"/>
</java>
</target>
<target name="eclipseTests" depends="eclipseCore,testdata,eclipseTestMangle" description="build tests trimmed for eclipse API">
<!-- TODO: we should actually use ee.foundation.jar for eclipse env -->
<javac includes="com/ibm/icu/dev/test/**/*.java"
excludes="**/CVS/**/*,com/ibm/icu/dev/test/charset/**/*.*,com/ibm/icu/dev/test/perf/**/*.*"
srcdir="${src.dir}"
destdir="${build.dir}"
source="1.3"
target="1.3"
classpathref="build.classpath"
debug="on"
deprecation="off"/>
<antcall target="indices"/>
<jar jarfile="${testjar.file}" compress="true" manifest="${icu4j.tests.manifest}">
<fileset dir="${build.dir}" includes="com/ibm/icu/dev/test/**/*"/>
<fileset dir="${build.dir}" includes="com/ibm/icu/dev/data/**/*"/>
</jar>
</target>
<target name="eclipseTestProject" depends="eclipseTests,zipTestSrc" description="gather eclipse icu test project files">
<delete failonerror="no">
<fileset dir="${eclipse.projects.dir}/com.ibm.icu.tests"/>
</delete>
<!-- copy eclipse test source and project files -->
<copy toDir="${eclipse.projects.dir}/com.ibm.icu.tests">
<fileset dir="${eclipse.dir}/com.ibm.icu.tests"
includes="**/*"
excludes="**/CVS/**/"/>
</copy>
<!-- copy icu test jar -->
<copy toDir="${eclipse.projects.dir}/com.ibm.icu.tests" file="${testjar.file}"/>
<!-- copy icu test source zip -->
<copy toDir="${eclipse.projects.dir}/com.ibm.icu.tests" file="${zipTestSrc.file}"/>
</target>
<target name="zipCoreSrc" depends="init" description="build zip of core sources for debugging">
<!-- for eclipse -->
<zip destfile="${zipCoreSrc.file}"
compress="true"
basedir="${src.dir}"
includes="../license.html,../Copyright_Assignment.rtf,com/ibm/icu/impl/**/*,com/ibm/icu/lang/**/*,com/ibm/icu/math/**/*,com/ibm/icu/text/**/*,com/ibm/icu/util/**/*"/>
</target>
<target name="zipTestSrc" depends="init" description="build zip of test sources for debugging">
<!-- for eclipse -->
<zip destfile="${zipTestSrc.file}"
compress="true"
basedir="${src.dir}"
includes="com/ibm/icu/dev/test/**/*"
excludes="com/ibm/icu/dev/test/cldr/**/*, com/ibm/icu/dev/test/perf/**/*"/>
</target>
<target name="gatherICU4JWrapperAPI" depends="tools" if="version.1.4">
@ -1383,16 +1452,6 @@
</java>
</target>
<target name="eclipseWrapperPkg" depends="init" description="build eclipse wrapper">
<zip destfile="eclipseICU4J_intf.zip"
basedir="${eclipse.dir}"
includes="com.ibm.icu.base/**/*"/>
</target>
<target name="eclipsePkgs"
depends="eclipseCorePkg,eclipseTestPkg,eclipseWrapperPkg"
description="build all eclipse packages"/>
<target name="runCheck" depends="init,tests">
<java classname="com.ibm.icu.dev.test.TestAll" fork="yes" failonerror="true">
<arg value="-n"/>
@ -1404,12 +1463,24 @@
</classpath>
</java>
</target>
<target name="eclipseRunCheck" depends="init,eclipseTests">
<java classname="com.ibm.icu.dev.test.TestAll" fork="yes" failonerror="true">
<arg value="-n"/>
<classpath>
<pathelement path="${java.class.path}/"/>
<pathelement location="icu4j.jar"/>
<pathelement location="clover.jar"/>
<pathelement path="${build.dir}"/>
</classpath>
</java>
</target>
<target name="eclipseCompat" depends="init, eclipseCore"/>
<target name="eclipseCompatTests" depends="init, eclipseTestMangle, tests" />
<target name="eclipseCompatCheck" depends="init, eclipseCompat, eclipseCompatTests, jar, deleteCore, runCheck"/>
<target name="eclipseCompatTests" depends="init, eclipseTestMangle, eclipseTests" />
<target name="eclipseCompatCheck" depends="init, eclipseCompat, eclipseCompatTests, jar, deleteCore, eclipseRunCheck"/>
<target name="jdk13Compat" depends="init, eclipseCoreMangle, core" description="builds ICU4J core with JDK 1.3"/>
<target name="jdk13CompatTests" depends="init, jdk13Compat, eclipseTestMangle, tests" description="builds ICU4J tests with JDK 1.3"/>
<target name="jdk13CompatCheck" depends="init, jdk13CompatTests, jar, deleteCore, runCheck" description="runs the tests with JDK 1.3"/>
<target name="jdk13CompatTests" depends="init, jdk13Compat, eclipseTestMangle, eclipseTests" description="builds ICU4J tests with JDK 1.3"/>
<target name="jdk13CompatCheck" depends="init, jdk13CompatTests, jar, deleteCore, eclipseRunCheck" description="runs the tests with JDK 1.3"/>
</project>

View File

@ -5,13 +5,18 @@ src/com/ibm/icu/impl/ICUResourceBundle.java
src/com/ibm/icu/impl/ICUResourceBundleImpl.java
src/com/ibm/icu/impl/ICUResourceBundleReader.java
src/com/ibm/icu/impl/LRUMap.java
src/com/ibm/icu/impl/PatternTokenizer.java
src/com/ibm/icu/impl/Utility.java
src/com/ibm/icu/lang/UCharacter.java
src/com/ibm/icu/math/BigDecimal.java
src/com/ibm/icu/text/DateTimePatternGenerator.java
src/com/ibm/icu/text/DecimalFormat.java
src/com/ibm/icu/text/DigitList.java
src/com/ibm/icu/text/NumberFormat.java
src/com/ibm/icu/text/RuleBasedCollator.java
src/com/ibm/icu/text/RuleBasedBreakIterator.java
src/com/ibm/icu/text/RuleBasedNumberFormat.java
src/com/ibm/icu/text/UnicodeSet.java
src/com/ibm/icu/text/UTF16.java
src/com/ibm/icu/util/ByteArrayWrapper.java
src/com/ibm/icu/util/GlobalizationPreferences.java

View File

@ -6,7 +6,9 @@ src/com/ibm/icu/dev/test/charsetdet/TestCharsetDetector.java
src/com/ibm/icu/dev/test/collator/RandomCollator.java
src/com/ibm/icu/dev/test/collator/TestAll.java
src/com/ibm/icu/dev/test/format/BigNumberFormatTest.java
src/com/ibm/icu/dev/test/format/DateTimeGeneratorTest.java
src/com/ibm/icu/dev/test/format/GlobalizationPreferencesTest.java
src/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java
src/com/ibm/icu/dev/test/format/NumberFormatRegressionTest.java
src/com/ibm/icu/dev/test/format/NumberFormatTest.java
src/com/ibm/icu/dev/test/format/NumberRegression.java
@ -29,6 +31,8 @@ src/com/ibm/icu/dev/test/util/TestUtilities.java
src/com/ibm/icu/dev/test/util/Tokenizer.java
src/com/ibm/icu/dev/test/util/BNF.java
src/com/ibm/icu/dev/test/util/TestBNF.java
src/com/ibm/icu/dev/test/serializable/FormatTests.java
src/com/ibm/icu/dev/test/serializable/SerializableTest.java
src/com/ibm/icu/dev/test/TestAll.java
src/com/ibm/icu/dev/test/TestFmwk.java
src/com/ibm/icu/dev/test/TestUtil.java

View File

@ -2,7 +2,7 @@
<feature
id="com.ibm.icu"
label="com.ibm.icu"
version="3.4.5">
version="3.6">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
@ -20,13 +20,13 @@
id="com.ibm.icu"
download-size="0"
install-size="0"
version="3.4.5"
version="3.6"
unpack="false"/>
<plugin
id="com.ibm.icu.source"
download-size="0"
install-size="0"
version="3.4.5"/>
version="3.6"/>
</feature>

View File

@ -2,7 +2,7 @@
<feature
id="com.ibm.icu.base"
label="com.ibm.icu.base"
version="3.4.5"
version="3.6"
provider-name="IBM">
<description url="http://www.example.com/description">
@ -21,13 +21,13 @@
id="com.ibm.icu.base"
download-size="0"
install-size="0"
version="3.4.5"
version="3.6"
unpack="false"/>
<plugin
id="com.ibm.icu.base.source"
download-size="0"
install-size="0"
version="3.4.5"/>
version="3.6"/>
</feature>

View File

@ -7,7 +7,7 @@ Bundle-Vendor: IBM
Bundle-Copyright: Licensed Materials - Property of IBM
(C) Copyright IBM Corp. 2006. All Rights Reserved.
IBM is a registered trademark of IBM Corp.
Fragment-Host: com.ibm.icu.base;bundle-version="[3.4.3,3.5.0)"
Fragment-Host: com.ibm.icu.base;bundle-version="[3.4.3,3.7.0)"
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.3,
CDC-1.0/Foundation-1.0

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.ibm.icu.base
Bundle-Version: 3.4.5
Bundle-Version: 3.6
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Copyright: Licensed Materials - Property of IBM

View File

@ -4,7 +4,7 @@ Bundle-Name: ICU Test Fragment
Bundle-SymbolicName: com.ibm.icu.tests
Bundle-Version: 1.0.0
Bundle-Vendor: IBM
Fragment-Host: com.ibm.icu;bundle-version="[3.4.2,3.5.0)"
Fragment-Host: com.ibm.icu;bundle-version="[3.4.2,3.7.0)"
Bundle-Localization: plugin
Bundle-Copyright: Licensed Materials - Property of IBM
(C) Copyright IBM Corp. 2000-2006. All Rights Reserved.

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.ibm.icu; singleton:=true
Bundle-Version: 3.4.5
Bundle-Version: 3.6
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Copyright: Licensed Materials - Property of IBM

View File

@ -8,7 +8,7 @@
<body lang="EN-US">
<h2>About This Content</h2>
<p>September 1, 2006</p>
<p>October 1, 2006</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
@ -31,7 +31,7 @@ and such source code may be obtained at <a href="http://www.eclipse.org/">http:/
for informational purposes only, and you should look to the Redistributor's license for
terms and conditions of use.</p>
<p><strong>ICU4J 3.4.5</strong> <br/><br/>
<p><strong>ICU4J 3.6</strong> <br/><br/>
The plug-in includes software (&quot;ICU4J&quot;) developed by International Business Machines
Corporation and others.
<br/><br/>

View File

@ -1,3 +1,6 @@
//##header
//#header
//#ifndef FOUNDATION
/*
*******************************************************************************
* Copyright (C) 2006, Google, International Business Machines Corporation and *
@ -208,4 +211,6 @@ public class DateTimeGeneratorTest extends TestFmwk {
new String[] {"HHmm", "23.58"},
new String[] {"mmss", "58.59"},
};
}
}
//#endif
//eof

View File

@ -175,6 +175,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
errln("FAIL: setLocales(List) must be blocked after frozen");
}
//#ifndef FOUNDATION
// setLocales(String)
logln("Call setLocales(String) after frozen");
bSet = true;
@ -186,6 +187,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
if (bSet) {
errln("FAIL: setLocales(String) must be blocked after frozen");
}
//#endif
// setLocale(ULocale)
logln("Call setLocale(ULocale) after frozen");
@ -327,6 +329,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
}
}
//#ifndef FOUNDATION
// setLocales(String)
for (int i = 0; i < ACCEPT_LANGUAGES.length; i++) {
String acceptLanguage = ACCEPT_LANGUAGES[i];
@ -377,6 +380,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
if (!gp.getLocale(0).toString().equals("ko_KR")) {
errln("FAIL: Previous valid locale list had gone");
}
//#endif
}
public void TestResourceBundle() {
@ -412,7 +416,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
gp.setLocales(locales);
try {
rb = gp.getResourceBundle(baseName, ClassLoader.getSystemClassLoader());
rb = gp.getResourceBundle(baseName, Thread.currentThread().getContextClassLoader());
String str = rb.getString("from_en_US");
if (!str.equals("This data comes from en_US")) {
errln("FAIL: from_en_US is not from en_US bundle");

View File

@ -1,3 +1,4 @@
//##header
/*
*******************************************************************************
* Copyright (C) 2001-2006, International Business Machines Corporation and *
@ -35,17 +36,17 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
// This test checks various generic API methods in DecimalFormat to achieve 100% API coverage.
public void TestAPI() {
logln("DecimalFormat API test---");
logln("");
Locale.setDefault(Locale.ENGLISH);
// ======= Test constructors
logln("Testing DecimalFormat constructors");
DecimalFormat def = new DecimalFormat();
final String pattern = new String("#,##0.# FF");
DecimalFormat pat = null;
try {
@ -53,30 +54,30 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
} catch (IllegalArgumentException e) {
errln("ERROR: Could not create DecimalFormat (pattern)");
}
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.FRENCH);
DecimalFormat cust1 = new DecimalFormat(pattern, symbols);
// ======= Test clone(), assignment, and equality
logln("Testing clone() and equality operators");
Format clone = (Format) def.clone();
if (!def.equals(clone)) {
errln("ERROR: Clone() failed");
}
// ======= Test various format() methods
logln("Testing various format() methods");
// final double d = -10456.0037; // this appears as -10456.003700000001 on NT
// final double d = -1.04560037e-4; // this appears as -1.0456003700000002E-4 on NT
final double d = -10456.00370000000000; // this works!
final long l = 100000000;
logln("" + Double.toString(d) + " is the double value");
StringBuffer res1 = new StringBuffer();
StringBuffer res2 = new StringBuffer();
StringBuffer res3 = new StringBuffer();
@ -85,23 +86,23 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
FieldPosition pos2 = new FieldPosition(0);
FieldPosition pos3 = new FieldPosition(0);
FieldPosition pos4 = new FieldPosition(0);
res1 = def.format(d, res1, pos1);
logln("" + Double.toString(d) + " formatted to " + res1);
res2 = pat.format(l, res2, pos2);
logln("" + l + " formatted to " + res2);
res3 = cust1.format(d, res3, pos3);
logln("" + Double.toString(d) + " formatted to " + res3);
res4 = cust1.format(l, res4, pos4);
logln("" + l + " formatted to " + res4);
// ======= Test parse()
logln("Testing parse()");
String text = new String("-10,456.0037");
ParsePosition pos = new ParsePosition(0);
String patt = new String("#,##0.#");
@ -112,17 +113,17 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
"ERROR: Roundtrip failed (via parse(" + Double.toString(d2) + " != " + Double.toString(d) + ")) for " + text);
}
logln(text + " parsed into " + (long) d2);
// ======= Test getters and setters
logln("Testing getters and setters");
final DecimalFormatSymbols syms = pat.getDecimalFormatSymbols();
def.setDecimalFormatSymbols(syms);
if (!pat.getDecimalFormatSymbols().equals(def.getDecimalFormatSymbols())) {
errln("ERROR: set DecimalFormatSymbols() failed");
}
String posPrefix;
pat.setPositivePrefix("+");
posPrefix = pat.getPositivePrefix();
@ -130,7 +131,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (posPrefix != "+") {
errln("ERROR: setPositivePrefix() failed");
}
String negPrefix;
pat.setNegativePrefix("-");
negPrefix = pat.getNegativePrefix();
@ -138,7 +139,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (negPrefix != "-") {
errln("ERROR: setNegativePrefix() failed");
}
String posSuffix;
pat.setPositiveSuffix("_");
posSuffix = pat.getPositiveSuffix();
@ -146,7 +147,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (posSuffix != "_") {
errln("ERROR: setPositiveSuffix() failed");
}
String negSuffix;
pat.setNegativeSuffix("~");
negSuffix = pat.getNegativeSuffix();
@ -154,7 +155,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (negSuffix != "~") {
errln("ERROR: setNegativeSuffix() failed");
}
long multiplier = 0;
pat.setMultiplier(8);
multiplier = pat.getMultiplier();
@ -162,7 +163,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (multiplier != 8) {
errln("ERROR: setMultiplier() failed");
}
int groupingSize = 0;
pat.setGroupingSize(2);
groupingSize = pat.getGroupingSize();
@ -170,7 +171,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (groupingSize != 2) {
errln("ERROR: setGroupingSize() failed");
}
pat.setDecimalSeparatorAlwaysShown(true);
boolean tf = pat.isDecimalSeparatorAlwaysShown();
logln(
@ -178,19 +179,19 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (tf != true) {
errln("ERROR: setDecimalSeparatorAlwaysShown() failed");
}
String funkyPat;
funkyPat = pat.toPattern();
logln("Pattern is " + funkyPat);
String locPat;
locPat = pat.toLocalizedPattern();
logln("Localized pattern is " + locPat);
// ======= Test applyPattern()
logln("Testing applyPattern()");
String p1 = new String("#,##0.0#;(#,##0.0#)");
logln("Applying pattern " + p1);
pat.applyPattern(p1);
@ -200,7 +201,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (!s2.equals(p1)) {
errln("ERROR: toPattern() result did not match pattern applied");
}
String p2 = new String("#,##0.0# FF;(#,##0.0# FF)");
logln("Applying pattern " + p2);
pat.applyLocalizedPattern(p2);
@ -210,14 +211,14 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
if (!s3.equals(p2)) {
errln("ERROR: toLocalizedPattern() result did not match pattern applied");
}
// ======= Test getStaticClassID()
// logln("Testing instanceof()");
// try {
// NumberFormat test = new DecimalFormat();
// if (! (test instanceof DecimalFormat)) {
// errln("ERROR: instanceof failed");
// }
@ -255,7 +256,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
errln(
"SetRoundingMode or GetRoundingMode failed for mode=" + mode);
}
//for +2.55 with RoundingIncrement=1.0
pat.setRoundingIncrement(1.0);
resultStr = pat.format(Roundingnumber);
@ -264,7 +265,7 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
verify(message, resultStr, result[i++]);
message = "";
resultStr = "";
//for -2.55 with RoundingIncrement=1.0
resultStr = pat.format(Roundingnumber1);
message = "round(" + (double) Roundingnumber1
@ -274,7 +275,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
resultStr = "";
}
}
//#ifndef FOUNDATION
public void testFormatToCharacterIterator() {
Number number = new Double(350.76);
@ -500,9 +502,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
&& attribute == fc.attribute && value.equals(fc.value));
}
}
//#endif
/*Helper functions */
public void verify(String message, String got, double expected) {
logln(message + got + " Expected : " + (long)expected);
@ -512,4 +513,5 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
errln("ERROR: Round() failed: " + message + got + " Expected : " + expectedStr);
}
}
}
}
//eof

View File

@ -1,3 +1,4 @@
//##header
/*
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
@ -1364,7 +1365,8 @@ public class FormatTests
cdfs_a.getLeapMonth(1).equals(cdfs_b.getLeapMonth(1));
}
}
//#ifndef FOUNDATION
public static class NumberFormatFieldHandler implements SerializableTest.Handler
{
public Object[] getTestObjects()
@ -1387,9 +1389,11 @@ public class FormatTests
return field_a.toString().equals(field_b.toString());
}
}
//#endif
public static void main(String[] args)
{
// nothing needed...
}
}
//eof

View File

@ -1,3 +1,4 @@
//##header
/*
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
@ -450,8 +451,10 @@ public class SerializableTest extends TestFmwk.TestGroup
map.put("com.ibm.icu.text.StringPrepParseException", new ExceptionTests.StringPrepParseExceptionHandler());
map.put("com.ibm.icu.util.UResourceTypeMismatchException", new ExceptionTests.UResourceTypeMismatchExceptionHandler());
map.put("com.ibm.icu.impl.InvalidFormatException", new ExceptionTests.InvalidFormatExceptionHandler());
//#ifndef FOUNDATION
map.put("com.ibm.icu.text.NumberFormat$Field", new FormatTests.NumberFormatFieldHandler());
//#endif
}
public SerializableTest()
@ -473,3 +476,4 @@ public class SerializableTest extends TestFmwk.TestGroup
test.run(args);
}
}
//eof

View File

@ -45,7 +45,10 @@ public final class ICUResourceBundleTest extends TestFmwk {
}
public void TestGetResources(){
try{
Enumeration en = testLoader.getResources("META-INF");
// It does not work well in eclipse plug-in test because of class loader configuration??
// For now, specify resource path explicitly in this test case
//Enumeration en = testLoader.getResources("META-INF");
Enumeration en = testLoader.getResources("com.ibm.icu.dev.data");
for(;en.hasMoreElements();) {
URL url = (URL)en.nextElement();
if (url == null) {

View File

@ -329,7 +329,8 @@ public final class CollectionUtilities {
}
return result.toString();
}
//#ifndef FOUNDATION
/**
* Does one string contain another, starting at a specific offset?
* @param text
@ -362,7 +363,7 @@ public final class CollectionUtilities {
if (newOffset < 0) return offset;
}
}
/**
* Returns the ending offset found by matching characters with testSet, until a position is found that does match
* @param string
@ -378,6 +379,7 @@ public final class CollectionUtilities {
// we don't have to worry about surrogates for this.
}
}
//#endif
public static String prettyPrint(UnicodeSet uset, boolean compressRanges, UnicodeSet toQuote, Transliterator quoter,
Comparator ordering, Comparator spaceComparator) {

View File

@ -1,3 +1,5 @@
//##header
//#ifndef FOUNDATION
/*
*******************************************************************************
* Copyright (C) 2006, Google, International Business Machines Corporation and *
@ -367,4 +369,6 @@ public class PatternTokenizer {
}
}
}
//#endif
//eof

View File

@ -1,3 +1,5 @@
//##header
//#ifndef FOUNDATION
/*
*******************************************************************************
* Copyright (C) 2006, Google, International Business Machines Corporation and *
@ -5,8 +7,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DateTimePatternGenerator.java,v $
* $Date: 2006/09/09 03:03:00 $
* $Revision: 1.8 $
* $Date: 2006/09/15 18:09:24 $
* $Revision: 1.9 $
*
*******************************************************************************
*/
@ -1571,3 +1573,5 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
}
}
}
//#endif
//eof

View File

@ -716,11 +716,12 @@ public class DecimalFormat extends NumberFormat {
result.append(symbols.getNaN());
// [Spark/CDL] Add attribute for NaN here.
// result.append(symbols.getNaN());
//#ifndef FOUNDATION
if (parseAttr) {
addAttribute(Field.INTEGER, result.length()
- symbols.getNaN().length(), result.length());
}
//#endif
if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) {
fieldPosition.setEndIndex(result.length());
}
@ -764,11 +765,12 @@ public class DecimalFormat extends NumberFormat {
// [Spark/CDL] Add attribute for infinity here.
result.append(symbols.getInfinity());
//#ifndef FOUNDATION
if (parseAttr) {
addAttribute(Field.INTEGER, result.length()
- symbols.getInfinity().length(), result.length());
}
//#endif
if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) {
fieldPosition.setEndIndex(result.length());
}
@ -1202,14 +1204,16 @@ public class DecimalFormat extends NumberFormat {
if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) {
fieldPosition.setEndIndex(result.length());
}
//#ifndef FOUNDATION
// [Spark/CDL] Add attribute for integer part
if (parseAttr) {
intEnd = result.length();
addAttribute(Field.INTEGER, intBegin, result.length());
}
// [Spark/CDL] Add attribute for decimal separator
//#endif
result.append(decimal);
//#ifndef FOUNDATION
// [Spark/CDL] Add attribute for decimal separator
if (parseAttr) {
// Length of decimal separator is 1.
int decimalSeparatorBegin = result.length() - 1;
@ -1217,7 +1221,7 @@ public class DecimalFormat extends NumberFormat {
decimalSeparatorBegin, result.length());
fracBegin = result.length();
}
//#endif
// Record field information for caller.
if (fieldPosition.getField() == NumberFormat.FRACTION_FIELD) {
fieldPosition.setBeginIndex(result.length());
@ -1244,7 +1248,7 @@ public class DecimalFormat extends NumberFormat {
}
fieldPosition.setEndIndex(result.length());
}
//#ifndef FOUNDATION
// [Spark/CDL] Calcuate the end index of integer part and fractional
// part if they are not properly processed yet.
if (parseAttr) {
@ -1255,20 +1259,21 @@ public class DecimalFormat extends NumberFormat {
addAttribute(Field.FRACTION, fracBegin, result.length());
}
}
//#endif
// The exponent is output using the pattern-specified minimum
// exponent digits. There is no maximum limit to the exponent
// digits, since truncating the exponent would result in an
// unacceptable inaccuracy.
result.append(symbols.getExponentSeparator());
//#ifndef FOUNDATION
// [Spark/CDL] For exponent symbol, add an attribute.
if (parseAttr) {
addAttribute(Field.EXPONENT_SYMBOL, result.length()
- symbols.getExponentSeparator().length(), result
.length());
}
//#endif
// For zero values, we force the exponent to zero. We
// must do this here, and not earlier, because the value
// is used to determine integer digit count above.
@ -1278,6 +1283,7 @@ public class DecimalFormat extends NumberFormat {
if (negativeExponent) {
exponent = -exponent;
result.append(symbols.getMinusSign());
//#ifndef FOUNDATION
// [Spark/CDL] If exponent has sign, then add an exponent sign
// attribute.
if (parseAttr) {
@ -1285,15 +1291,18 @@ public class DecimalFormat extends NumberFormat {
addAttribute(Field.EXPONENT_SIGN, result.length() - 1,
result.length());
}
//#endif
} else if (exponentSignAlwaysShown) {
// [Spark/CDL] Add an plus sign attribute.
result.append(symbols.getPlusSign());
//#ifndef FOUNDATION
// [Spark/CDL] Add an plus sign attribute.
if (parseAttr) {
// Length of exponent sign is 1.
int expSignBegin = result.length() - 1;
addAttribute(Field.EXPONENT_SIGN, expSignBegin, result
.length());
}
//#endif
}
int expBegin = result.length();
digitList.set(exponent);
@ -1309,10 +1318,12 @@ public class DecimalFormat extends NumberFormat {
result.append((i < digitList.count) ?
(char)(digitList.digits[i] + zeroDelta) : zero);
}
//#ifndef FOUNDATION
// [Spark/CDL] Add attribute for exponent part.
if (parseAttr) {
addAttribute(Field.EXPONENT, expBegin, result.length());
}
//#endif
}
else
{
@ -1374,12 +1385,14 @@ public class DecimalFormat extends NumberFormat {
// Output grouping separator if necessary.
if (isGroupingPosition(i)) {
result.append(grouping);
//#ifndef FOUNDATION
// [Spark/CDL] Add grouping separator attribute here.
if (parseAttr) {
// Length of grouping separator is 1.
addAttribute(Field.GROUPING_SEPARATOR,
result.length() - 1, result.length());
}
//#endif
}
}
@ -1398,21 +1411,23 @@ public class DecimalFormat extends NumberFormat {
// _any_ digits, and we won't be able to parse this string.
if (!fractionPresent && result.length() == sizeBeforeIntegerPart)
result.append(zero);
//#ifndef FOUNDATION
// [Spark/CDL] Add attribute for integer part.
if (parseAttr) {
addAttribute(Field.INTEGER, intBegin, result.length());
}
//#endif
// Output the decimal separator if we always do so.
if (decimalSeparatorAlwaysShown || fractionPresent)
{
result.append(decimal);
//#ifndef FOUNDATION
// [Spark/CDL] Add attribute for decimal separator
if (parseAttr) {
addAttribute(Field.DECIMAL_SEPARATOR, result.length() - 1,
result.length());
}
//#endif
}
// Record field information for caller.
@ -1473,10 +1488,12 @@ public class DecimalFormat extends NumberFormat {
if (fieldPosition.getField() == NumberFormat.FRACTION_FIELD) {
fieldPosition.setEndIndex(result.length());
}
//#ifndef FOUNDATION
// [Spark/CDL] Add attribute information if necessary.
if (parseAttr && (decimalSeparatorAlwaysShown || fractionPresent)) {
addAttribute(Field.FRACTION, fracBegin, result.length());
}
//#endif
}
int suffixLen = appendAffix(result, isNegative, false, parseAttr);
@ -3259,6 +3276,7 @@ public class DecimalFormat extends NumberFormat {
} else {
affix = isNegative ? negativeSuffix : positiveSuffix;
}
//#ifndef FOUNDATION
// [Spark/CDL] Invoke formatAffix2Attribute to add attributes for affix
if (parseAttr) {
int offset = affix.indexOf(symbols.getCurrencySymbol());
@ -3271,10 +3289,12 @@ public class DecimalFormat extends NumberFormat {
formatAffix2Attribute(affix, buf.length() + offset, buf.length()
+ affix.length());
}
//#endif
buf.append(affix);
return affix.length();
}
//#ifndef FOUNDATION
/*
* [Spark/CDL] This is a newly added method, used to add attributes for
* prefix and suffix.
@ -3294,7 +3314,9 @@ public class DecimalFormat extends NumberFormat {
addAttribute(Field.PERMILLE, begin, end);
}
}
//#endif
//#ifndef FOUNDATION
/*
* [Spark/CDL] Use this method to add attribute.
*/
@ -3304,6 +3326,8 @@ public class DecimalFormat extends NumberFormat {
pos.setEndIndex(end);
attributes.add(pos);
}
//#endif
//#ifndef FOUNDATION
/**
* Format the object to an attributed string, and return the corresponding iterator

View File

@ -1537,7 +1537,8 @@ public abstract class NumberFormat extends UFormat {
// new in ICU4J 3.6
private boolean parseStrict;
//#ifndef FOUNDATION
/**
* [Spark/CDL] The instances of this inner class are used as attribute keys and values
* in AttributedCharacterIterator that
@ -1647,4 +1648,5 @@ public abstract class NumberFormat extends UFormat {
throw new InvalidObjectException("An invalid object.");
}
}
//#endif
}

View File

@ -1,3 +1,4 @@
//##header
/*
*******************************************************************************
* Copyright (C) 2005-2006 International Business Machines Corporation and *
@ -74,7 +75,11 @@ public class RuleBasedBreakIterator extends BreakIterator {
} catch (IOException e) {
// An IO exception can only arrive here if there is a bug in the RBBI Rule compiler,
// causing bogus compiled rules to be produced, but with no compile error raised.
//#ifdef FOUNDATION
//## RuntimeException rte = new RuntimeException("RuleBasedBreakIterator rule compilation internal error:");
//#else
RuntimeException rte = new RuntimeException("RuleBasedBreakIterator rule compilation internal error:", e);
//#endif
throw rte;
}
}
@ -1369,3 +1374,4 @@ public int getRuleStatusVec(int[] fillInArray) {
}
}
//eof

View File

@ -1,3 +1,4 @@
//##header
/**
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
@ -228,7 +229,8 @@ public final class UTF16
}
return single; // return unmatched surrogate
}
//#ifndef FOUNDATION
/**
* Extract a single UTF-32 value from a string.
* Used when iterating forwards or backwards (with
@ -256,7 +258,7 @@ public final class UTF16
}
return _charAt(source, offset16, single);
}
private static int _charAt(CharSequence source, int offset16, char single)
{
if (single > UTF16.TRAIL_SURROGATE_MAX_VALUE) {
@ -293,6 +295,7 @@ public final class UTF16
}
return single; // return unmatched surrogate
}
//#endif
/**
* Extract a single UTF-32 value from a string.
@ -2849,3 +2852,4 @@ public final class UTF16
return result.toString();
}
}
//eof

View File

@ -1,3 +1,4 @@
//##header
/*
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
@ -920,6 +921,7 @@ public class UnicodeSet extends UnicodeFilter implements Freezable {
return maxLen;
}
//#ifndef FOUNDATION
/**
* Tests whether the text matches at the offset. If so, returns the end of the longest substring that it matches. If not, returns -1. For now, an internal routine.
* @internal
@ -956,6 +958,7 @@ public class UnicodeSet extends UnicodeFilter implements Freezable {
}
return offset+len;
}
//#endif
/**
* Implementation of UnicodeMatcher API. Union the set of all
@ -3616,3 +3619,4 @@ public class UnicodeSet extends UnicodeFilter implements Freezable {
}
}
}
//eof