ICU-5862 Updated CodeMangler to accept defined() command and to support OR condition. Also cleaned up the build.xml to support multiple versions of Java build environment. Conditional source codes are now marked as J2SE15 by the CodeMangler tool.

X-SVN-Rev: 22430
This commit is contained in:
Yoshito Umaoka 2007-08-20 22:17:50 +00:00
parent 132489e847
commit 30785c67a8
81 changed files with 1450 additions and 1223 deletions

1
.gitattributes vendored
View file

@ -176,6 +176,7 @@ icu4j/.settings/org.eclipse.jdt.core.prefs -text
icu4j/.settings/org.eclipse.jdt.ui.prefs -text
icu4j/ee.foundation.jar -text
icu4j/license.html -text
icu4j/preprocessor.txt -text
icu4j/src/com/ibm/icu/charset/CharsetISCII.java -text
icu4j/src/com/ibm/icu/charset/CharsetUTF16BE.java -text
icu4j/src/com/ibm/icu/charset/CharsetUTF32BE.java -text

View file

@ -11,4 +11,5 @@ current.year=2007
icu4j.previous.version.number=36
api.report.out=${api.dir}/icu4j_compare_${icu4j.previous.version.number}_${icu4j.version.number}.html
copyright=Copyright (c) 2000-2007, International Business Machines Corporation and others. All Rights Reserved.
corp=IBM Corporation
corp=IBM Corporation
default.target.rt.version=J2SE15

View file

@ -49,33 +49,11 @@
<!-- ### End Clover 1.2 setup ### -->
<target name="anthack1">
<!-- It's a real pain to set properties conditionally.
Ant 1.5 isn't really any better than 1.4, in fact 1.5 enforces that
properties are write-once so you can't even set a default and then
override it, which we used to do for Ant 1.4. -->
<condition property="version.1.4">
<or>
<equals arg1="${ant.java.version}" arg2="1.4" />
<equals arg1="${ant.java.version}" arg2="1.5" />
<equals arg1="${ant.java.version}" arg2="1.6" />
</or>
</condition>
<target name="init"
depends="initBase,initSrc"
description="Initialized ICU4J build environment" />
<condition property="doc.params" value="-breakiterator -use -tagletpath ./classes -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -group 'ICU Core' 'com.ibm.icu.lang*:com.ibm.icu.math*:com.ibm.icu.text*:com.ibm.icu.util*:com.ibm.icu.charset' -group 'ICU Tests' 'com.ibm.icu.dev.test*' -group 'Demos' 'com.ibm.icu.dev.demo*' -group 'ICU Tools' 'com.ibm.icu.dev*'">
<equals arg1="${version.1.4}" arg2="true" />
</condition>
<condition property="richeditdoc.params" value="-breakiterator -use -tagletpath ./classes -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -group 'Rich Text Editing' 'com.ibm.richtext*'">
<equals arg1="${version.1.4}" arg2="true" />
</condition>
</target>
<target name="anthack2" unless="doc.params">
<property name="doc.params" value="" />
</target>
<target name="init">
<target name="initBase" unless="initBase.done">
<tstamp />
<property name="src.dir" value="src" />
<property name="build.dir" value="classes" />
@ -129,6 +107,10 @@
<!-- Capture the computer name in a cross-platform manner -->
<property name="env.COMPUTERNAME" value="${env.HOSTNAME}" />
<!-- JavaDoc params -->
<property name="doc.params" value="-breakiterator -use -tagletpath ./classes -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -group 'ICU Core' 'com.ibm.icu.lang*:com.ibm.icu.math*:com.ibm.icu.text*:com.ibm.icu.util*:com.ibm.icu.charset' -group 'ICU Tests' 'com.ibm.icu.dev.test*' -group 'Demos' 'com.ibm.icu.dev.demo*' -group 'ICU Tools' 'com.ibm.icu.dev*'" />
<property name="richeditdoc.params" value="-breakiterator -use -tagletpath ./classes -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -group 'Rich Text Editing' 'com.ibm.richtext*'" />
<mkdir dir="${build.dir}" />
<mkdir dir="${wrapper.build.dir}" />
@ -139,6 +121,53 @@
<echo message="${env.COMPUTERNAME} with ${os.name} ${os.version} on ${os.arch}" />
<echo message="clover initstring = '${clover.initstring}'" />
<!-- ## Java version dependent build configuration ##-->
<!-- JRE lib version used for building ICU4J -->
<condition property="target.rt.version" value="J2SE13">
<equals arg1="${ant.java.version}" arg2="1.3" />
</condition>
<condition property="target.rt.version" value="J2SE14">
<equals arg1="${ant.java.version}" arg2="1.4" />
</condition>
<condition property="target.rt.version" value="J2SE15">
<equals arg1="${ant.java.version}" arg2="1.5" />
</condition>
<condition property="target.rt.version" value="JAVASE6">
<equals arg1="${ant.java.version}" arg2="1.6" />
</condition>
<echo message="target runtime environment: ${target.rt.version}" />
<condition property="default.java.env">
<equals arg1="${target.rt.version}" arg2="${default.target.rt.version}" />
</condition>
<antcall target="displayBuildEnvWarning" />
<condition property="before.java14">
<or>
<equals arg1="${target.rt.version}" arg2="FOUNDATION10"/>
<equals arg1="${target.rt.version}" arg2="J2SE13"/>
</or>
</condition>
<condition property="before.java15">
<or>
<equals arg1="${target.rt.version}" arg2="FOUNDATION10"/>
<equals arg1="${target.rt.version}" arg2="J2SE13"/>
<equals arg1="${target.rt.version}" arg2="J2SE14"/>
</or>
</condition>
<condition property="jvm.assertion.arg" value="">
<isset property="before.java14" />
</condition>
<condition property="jvm.assertion.arg" value="-ea">
<not>
<isset property="jvm.assertion.arg" />
</not>
</condition>
<uptodate property="icu4j.resources" targetfile="${src.dir}/com/ibm/icu/impl/data">
<!-- note must not have '/' before 'com' in srcfiles includes arg! -->
<srcfiles dir="${build.dir}" includes="${icu4j.data.path}/res_index.res" />
@ -156,15 +185,63 @@
<tstamp>
<format property="date.time" pattern="yyyy-MM-dd 'at' hh:mm:ss z" locale="en,US" />
</tstamp>
<property name="initBase.done" value="true" />
<echo message="Initialized at ${date.time}" />
</target>
<target name="displayBuildEnvWarning" unless="default.java.env">
<echo message="####################### WARINNG #######################" />
<echo message="The JDK version used by the current build environment" />
<echo message="does not match the reference JDK version for this" />
<echo message="ICU4J release. The build outputs may not be identical" />
<echo message="to the official ICU4J binary distribution." />
<echo message="#######################################################" />
</target>
<target name="initSrc"
depends="buildMangle"
description="Run the preprocessor tool to modify Java sources for the Java runtime lib currently used.">
<echo message="Running source code preprocessor for environment: ${target.rt.version}"/>
<!-- Build CodeMangler -->
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}">
<include name="com/ibm/icu/dev/tool/docs/CodeMangler.java" />
</javac>
<!-- Run CodeMangler -->
<antcall target="doMangle">
<param name="target.defs" value="${target.rt.version}" />
<param name="input.file" value="@preprocessor.txt" />
</antcall>
</target>
<target name="normSrc"
depends="buildMangle"
description="Run the preprocessor to normalize Java sources to the ICU source repository target JDK version">
<antcall target="doMangle">
<param name="target.defs" value="${default.target.rt.version}" />
<param name="input.file" value="@preprocessor.txt" />
</antcall>
</target>
<target name="buildMangle" depends="initBase">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}">
<include name="com/ibm/icu/dev/tool/docs/CodeMangler.java" />
</javac>
</target>
<target name="doMangle">
<java classname="com.ibm.icu.dev.tool.docs.CodeMangler" classpath="${build.dir}" logError="true">
<arg value="-d${target.defs}" />
<arg value="${input.file}" />
</java>
</target>
<!-- build everything but dist-related stuff -->
<target name="all" depends="core,tests,tools,richedit,demos,jar,docs" description="build all primary targets" />
<target name="resources" depends="init, icudata, coreData, testdata" description="builds all the resources" />
<target name="icudata" depends="init" if="icu4j.resources">
<target name="icudata" depends="initBase" if="icu4j.resources">
<!-- use this target to force resources to be rebuilt -->
<unjar src="${src.dir}/com/ibm/icu/impl/data/icudata.jar" dest="${build.dir}" />
<touch file="${build.dir}/${icu4j.data.path}/res_index.res" />
@ -173,7 +250,7 @@
</copy>
</target>
<target name="durationdata" depends="init">
<target name="durationdata" depends="initBase">
<copy todir="${build.dir}/com/ibm/icu/impl/duration/impl/data">
<fileset dir="${src.dir}/com/ibm/icu/impl/duration/impl/data" includes="index.txt, pfd*.xml"/>
</copy>
@ -189,12 +266,18 @@
<!-- core does not build richedit or tests -->
<target name="core" depends="init,coreData,icudata,durationdata" description="build core classes and data">
<javac sourcepath="" srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off" encoding="ascii">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/charset/**/*.java" />
<javac sourcepath=""
srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off"
encoding="ascii">
<include name="com/ibm/icu/charset/**/*.java" unless="before.java14" />
<include name="com/ibm/icu/impl/**/*.java" />
<include name="com/ibm/icu/lang/*.java" />
<include name="com/ibm/icu/lang/**/*.java" />
<include name="com/ibm/icu/math/**/*.java" />
<include name="com/ibm/icu/text/**/*.java" />
<include name="com/ibm/icu/util/**/*.java" />
@ -202,76 +285,32 @@
</target>
<target name="tests" depends="core,testdata" description="build tests">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/test/calendar/**/*.java" />
</javac>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/test/collator/**/*.java" />
</javac>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/test/format/**/*.java" />
</javac>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/test/translit/**/*.java" />
</javac>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/test/lang/**/*.java" />
<include name="com/ibm/icu/dev/test/normalizer/**/*.java" />
</javac>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/test/serializable/**/*.java" />
</javac>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off">
<exclude name="com/ibm/icu/dev/test/charset/**/*.java" if="before.java14" />
<exclude name="com/ibm/icu/dev/test/perf/**/*.java" if="before.java14" />
<include name="com/ibm/icu/dev/test/**/*.java" />
</javac>
</target>
<target name="demos" depends="core,testdata" description="build demos">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<target name="demos" depends="core,testdata" unless="before.java14" description="build demos">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off">
<include name="com/ibm/icu/dev/demo/**/*.java" />
</javac>
</target>
<target name="buildmangle" depends="init,anthack1">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}">
<include name="com/ibm/icu/dev/tool/docs/CodeMangler.java" />
</javac>
</target>
<target name="mangle" depends="buildmangle">
<!-- this is a hack for now, need a way to express dependency on the .jpp files
and to provide directories or trees of files to the code mangler tool. -->
<java classname="com.ibm.icu.dev.tool.docs.CodeMangler" classpath="${build.dir}" logError="true">
<arg value="-dVERSION_${ant.java.version}" />
<arg value="${src.dir}/com/ibm/icu/dev/tool/docs/ICUTaglet.java" />
</java>
</target>
<target name="indices" depends="icudata,build_indexgenerator">
<java classname="com.ibm.icu.dev.tool.index.IndexGenerator" classpath="${build.dir}" logError="true">
<arg value="${build.dir}/${icu4j.data.path}" />
@ -287,51 +326,89 @@
</java>
</target>
<target name="one4tools" depends="anthack1,anthack2,mangle" if="version.1.4">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<include name="com/ibm/icu/dev/localeconverter/docs/*.java" />
<include name="com/ibm/icu/dev/tool/docs/*.java" />
</javac>
</target>
<target name="tools" depends="core,one4tools" description="build tools">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<target name="tools"
depends="core"
unless="before.java14"
description="build tools">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off">
<exclude name="com/ibm/icu/dev/tool/cldr/*" />
<exclude name="com/ibm/icu/dev/tool/localeconverter/*" />
<exclude name="com/ibm/icu/dev/tool/docs/*" />
<exclude name="**/CVS/**/*" />
<exclude name="com/ibm/icu/dev/tool/localeconverter/*" if="before.java15" />
<include name="com/ibm/icu/dev/tool/**/*.java" />
</javac>
</target>
<target name="build_indexgenerator">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<target name="build_indexgenerator" depends="init">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off">
<include name="com/ibm/icu/dev/tool/index/IndexGenerator.java" />
</javac>
</target>
<!-- use excludefiles below when we move to ant 1.5 -->
<target name="docs" depends="anthack1,anthack2,tools" description="build user javadoc">
<echo message="doc params: ${doc.params}" />
<target name="docs" depends="init,docs13,docs14plus" description="build user javadoc" />
<target name="docs13" if="before.java14">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="com.ibm.icu.lang,com.ibm.icu.text,com.ibm.icu.util,com.ibm.icu.math,com.ibm.icu.charset,com.ibm.icu.dev" sourcepath="${src.dir}" destdir="${doc.dir}" nodeprecatedlist="true" windowtitle="icu4j" doctitle="icu4j" encoding="iso-8859-1" docencoding="iso-8859-1" bottom="&lt;font size=-1>Copyright (c) ${current.year} IBM Corporation and others.&lt;/font>" additionalparam="${doc.params}" link="http://java.sun.com/j2se/1.5/docs/api" source="1.4" />
<javadoc packagenames="com.ibm.icu.lang,com.ibm.icu.text,com.ibm.icu.util,com.ibm.icu.math"
sourcepath="${src.dir}"
destdir="${doc.dir}"
nodeprecatedlist="true"
windowtitle="icu4j"
doctitle="icu4j"
encoding="iso-8859-1"
docencoding="iso-8859-1"
bottom="&lt;font size=-1>Copyright (c) ${current.year} IBM Corporation and others.&lt;/font>"
link="http://java.sun.com/j2se/1.3/docs/api"
source="1.4" />
</target>
<target name="fulldocs" depends="anthack1,anthack2,tools" description="build all javadoc">
<target name="docs14plus" depends="tools" unless="before.java14">
<echo message="doc params: ${doc.params}" />
<mkdir dir="${doc.dir}" />
<javadoc packagenames="com.ibm.icu.*" sourcepath="${src.dir}" destdir="${doc.dir}" nodeprecatedlist="true" windowtitle="icu4j" doctitle="icu4j" encoding="iso-8859-1" docencoding="iso-8859-1" bottom="&lt;font size=-1>Copyright (c) 2004 IBM Corporation and others.&lt;/font>" additionalparam="${doc.params}" link="http://java.sun.com/j2se/1.4/docs/api" source="1.4" />
<javadoc packagenames="com.ibm.icu.lang,com.ibm.icu.text,com.ibm.icu.util,com.ibm.icu.charset,com.ibm.icu.math,com.ibm.icu.dev"
sourcepath="${src.dir}"
destdir="${doc.dir}"
nodeprecatedlist="true"
windowtitle="icu4j"
doctitle="icu4j"
encoding="iso-8859-1"
docencoding="iso-8859-1"
bottom="&lt;font size=-1>Copyright (c) ${current.year} IBM Corporation and others.&lt;/font>"
additionalparam="${doc.params}"
link="http://java.sun.com/j2se/1.5/docs/api"
source="1.4" />
</target>
<target name="fulldocs" depends="tools" unless="before.java14" description="build all javadoc">
<echo message="doc params: ${doc.params}" />
<mkdir dir="${doc.dir}" />
<javadoc packagenames="com.ibm.icu.*"
sourcepath="${src.dir}"
destdir="${doc.dir}"
nodeprecatedlist="true"
windowtitle="icu4j"
doctitle="icu4j"
encoding="iso-8859-1"
docencoding="iso-8859-1"
bottom="&lt;font size=-1>Copyright (c) ${current.year} IBM Corporation and others.&lt;/font>"
additionalparam="${doc.params}"
link="http://java.sun.com/j2se/1.5/docs/api"
source="1.4" />
</target>
<target name="coreData" depends="init">
<copy todir="${build.dir}/com/ibm/icu/impl/data">
<fileset dir="${src.dir}/com/ibm/icu/impl/data" includes="*.icu,*.spp,*.brk" excludes="**/CVS/**/*,Transliterator_Han_Latin_*.txt" />
<fileset dir="${src.dir}/com/ibm/icu/impl/data" includes="*.icu,*.spp,*.brk" excludes="Transliterator_Han_Latin_*.txt" />
</copy>
</target>
@ -346,10 +423,13 @@
</copy>
<copy file="${src.dir}/com/ibm/icu/dev/data/riwords.txt" todir="${build.dir}/com/ibm/icu/dev/data" />
<copy file="${src.dir}/com/ibm/icu/dev/data/IDNATestInput.txt" todir="${build.dir}/com/ibm/icu/dev/data" />
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off">
<include name="com/ibm/icu/dev/data/*.java" />
<include name="com/ibm/icu/dev/data/resources/*.java" />
</javac>
@ -373,9 +453,13 @@
<!-- builds richedit and richedit tests -->
<target name="richedit" depends="init" description="build richedit classes and tests">
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="build.classpath" source="${icu4j.javac.source}" target="${icu4j.javac.target}" debug="on" deprecation="off">
<exclude name="**/CVS/**/*" />
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.classpath"
source="${icu4j.javac.source}"
target="${icu4j.javac.target}"
debug="on"
deprecation="off">
<include name="com/ibm/richtext/**/*.java" />
</javac>
<copy todir="${build.dir}/com/ibm/richtext/textapps/resources" overwrite="yes" includeEmptyDirs="no">
@ -452,14 +536,30 @@
</jar>
</target>
<target name="jarSrc" depends="init" description="build source 'icu4jsrc.jar' jar file">
<target name="jarSrc" depends="initBase,normSrc" description="build source 'icu4jsrc.jar' jar file">
<!--Create a jar archive of just the source for distribution. The
jar file will be created in the directory above the root ICU4J
directory. The exclude pattern ${src.dir}/com/ibm/icu/dev/data/unicode/UnicodeData-*.txt
and ${src.dir}/com/ibm/icu/dev/data/unicode/SpecialCasing-*.txt
eliminates old archive copies like SpecialCasing-2.txt and
UnicodeData-2.1.8.txt -->
<jar jarfile="${jarSrc.file}" compress="true" basedir="." excludes="${richedit.dir}/**/*,test_*,${src.dir}/com/ibm/icu/dev/data/unicode//UnicodeData-*.txt,${src.dir}/com/ibm/icu/dev/data/unicode/SpecialCasing-*.txt,${src.dir}/com/ibm/icu/dev/data/unicode/CompositionExclusions-*.txt,${obsolete.dir}/**,**/*~,${src.dir}/**/*.class,${build.dir}/**,**/CVS/**/*,${doc.dir}/**,*.jar,*.zip, *.gz">
<jar jarfile="${jarSrc.file}"
compress="true">
<fileset dir=".">
<exclude name="${richedit.dir}/**/*" />
<exclude name="test_*" />
<exclude name="${src.dir}/com/ibm/icu/dev/data/unicode/UnicodeData-*.txt" />
<exclude name="${src.dir}/com/ibm/icu/dev/data/unicode/SpecialCasing-*.txt" />
<exclude name="${src.dir}/com/ibm/icu/dev/data/unicode/CompositionExclusions-*.txt" />
<exclude name="${obsolete.dir}/**" />
<exclude name="**/*~" />
<exclude name="${src.dir}/**/*.class" />
<exclude name="${build.dir}/**" />
<exclude name="${doc.dir}/**" />
<exclude name="*.jar" />
<exclude name="*.zip" />
<exclude name="*.gz" />
</fileset>
<manifest>
<attribute name="Built-By" value="${corp}" />
<section name="common">
@ -550,7 +650,15 @@
<!-- the 'public' docs for richedit -->
<target name="richeditDocs" depends="init" description="build richedit javadoc">
<mkdir dir="${richedit.doc.dir}" />
<javadoc packagenames="com.ibm.richtext.demo,com.ibm.richtext.awtui,com.ibm.richtext.swingui,com.ibm.richtext.textpanel,com.ibm.richtext.styledtext,com.ibm.richtext.textlayout.attributes,com.ibm.richtext.print" sourcepath="${src.dir}" destdir="${richedit.doc.dir}" nodeprecatedlist="true" windowtitle="RichEdit Control" doctitle="RichEdit Control" encoding="iso-8859-1" docencoding="iso-8859-1" bottom="&lt;font size=-1>Copyright (c) 1998-2004 IBM Corporation and others.&lt;/font>" />
<javadoc packagenames="com.ibm.richtext.demo,com.ibm.richtext.awtui,com.ibm.richtext.swingui,com.ibm.richtext.textpanel,com.ibm.richtext.styledtext,com.ibm.richtext.textlayout.attributes,com.ibm.richtext.print"
sourcepath="${src.dir}"
destdir="${richedit.doc.dir}"
nodeprecatedlist="true"
windowtitle="RichEdit Control"
doctitle="RichEdit Control"
encoding="iso-8859-1"
docencoding="iso-8859-1"
bottom="&lt;font size=-1>Copyright (c) 1998-2004 IBM Corporation and others.&lt;/font>" />
</target>
<!-- richedit alphaworks distribution - jar and docs, but no source -->
@ -572,7 +680,7 @@
<target name="check" depends="tests, jar, deleteCore" description="run standard icu4j test suite">
<java classname="com.ibm.icu.dev.test.TestAll" fork="yes" failonerror="true">
<!-- enable assertion checks -->
<jvmarg value="-ea" />
<jvmarg value="${jvm.assertion.arg}" />
<jvmarg value="-Xms96m" />
<jvmarg value="-Xmx128m" />
<arg value="-n" />
@ -589,7 +697,7 @@
<target name="exhaustiveCheck" depends="tests, jar, deleteCore" description="run standard icu4j test suite in exhaustive mode">
<java classname="com.ibm.icu.dev.test.TestAll" fork="yes" failonerror="true">
<!-- enable assertion checks -->
<jvmarg value="-ea" />
<jvmarg value="${jvm.assertion.arg}" />
<jvmarg value="-Xms96m" />
<jvmarg value="-Xmx128m" />
<!-- set the max heap size to 128m -->
@ -645,11 +753,12 @@
</classpath>
</java>
</target>
<target name="_requires14" unless="version.1.4">
<echo message="One of your targets requires JAVA_HOME to be set to JDK version 1.4" />
<target name="_requires14" if="before.java14">
<echo message="One of your targets requires JAVA_HOME to be set to JDK version 1.4 or newer" />
</target>
<target name="_checktags" depends="anthack1,anthack2,tools" if="version.1.4">
<target name="_checktags" depends="tools" unless="before.java14">
<echo message="doc params: ${doc.params}" />
<javadoc sourcepath="${src.dir}" packagenames="com.ibm.icu.*" excludepackagenames="com.ibm.icu.dev.*,com.ibm.icu.impl.*" classpath="${build.dir}" source="1.4">
<doclet name="com.ibm.icu.dev.tool.docs.CheckTags" path="${build.dir}">
@ -658,9 +767,9 @@
</javadoc>
</target>
<target name="checktags" depends="anthack1,anthack2,_requires14,_checktags" description="check API tags before release" />
<target name="checktags" depends="_requires14,_checktags" description="check API tags before release" />
<target name="gatherapi" depends="tools" if="version.1.4" description="run API database generator tool">
<target name="gatherapi" depends="tools" unless="before.java14" description="run API database generator tool">
<javadoc classpath="${build.dir}" sourcepath="${src.dir}" packagenames="com.ibm.icu.lang,com.ibm.icu.math,com.ibm.icu.text,com.ibm.icu.util" source="1.4">
<doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${build.dir}">
<param name="-name" value="ICU4J ${icu4j.version.string}" />
@ -671,7 +780,7 @@
</javadoc>
</target>
<target name="gatherapi.with.version" depends="tools" if="version.1.4" description="run API database generator tool">
<target name="gatherapi.with.version" depends="tools" unless="before.java14" description="run API database generator tool">
<javadoc classpath="${build.dir}" sourcepath="${src.dir}" packagenames="com.ibm.icu.lang,com.ibm.icu.math,com.ibm.icu.text,com.ibm.icu.util" source="1.4">
<doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${build.dir}">
<param name="-name" value="ICU4J ${icu4j.version.string}" />
@ -682,7 +791,7 @@
</javadoc>
</target>
<target name="apireport" depends="tools, gatherapi" if="version.1.4" description="run API report generator tool">
<target name="apireport" depends="tools, gatherapi" unless="beofre.java14" description="run API report generator tool">
<java classname="com.ibm.icu.dev.tool.docs.ReportAPI" classpath="${build.dir}" failonerror="true">
<arg value="-old:" />
<arg value="${api.dir}/icu4j${icu4j.previous.version.number}.api.gz" />
@ -1301,7 +1410,7 @@
<!--run the tests -->
<java classname="TestDefaultPackageLoading" fork="yes" failonerror="true">
<!-- enable assertion checks -->
<jvmarg value="-ea" />
<jvmarg value="${jvm.assertion.arg}" />
<jvmarg value="-Xms96m" />
<jvmarg value="-Xmx128m" />
<arg value="-n" />
@ -1314,7 +1423,7 @@
</target>
<!-- convert @deprecated @draft tags to @provisional -->
<target name="swatDeprecated" depends="init, tools" if="version.1.4">
<target name="swatDeprecated" depends="init, tools" unless="before.java14">
<java classname="com.ibm.icu.dev.tool.docs.SwatDeprecated" classpath="${build.dir}" failonerror="true">
<arg value="-src" />
<arg value="${src.dir}" />
@ -1326,7 +1435,7 @@
</target>
<!-- convert @provisional tags to @deprecated -->
<target name="restoreDeprecated" depends="init, tools" if="version.1.4">
<target name="restoreDeprecated" depends="init, tools" unless="before.java14">
<java classname="com.ibm.icu.dev.tool.docs.SwatDeprecated" classpath="${build.dir}" failonerror="true">
<arg value="-prov" />
<arg value="-src" />
@ -1341,14 +1450,14 @@
<!-- for building eclipse distribution -->
<target name="eclipseProjects" depends="eclipseCoreProject,eclipseTestProject,eclipseWrapperProject" description="create all eclipse icu projects" />
<target name="undoEclipseMangle" depends="buildmangle" description="preprocess files back to default)">
<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">
<arg value="@eclipseCoreArgs.txt" />
<arg value="@eclipseTestArgs.txt" />
</java>
</target>
<target name="eclipseCoreMangle" depends="buildmangle">
<target name="eclipseCoreMangle" depends="buildMangle">
<java classname="com.ibm.icu.dev.tool.docs.CodeMangler" classpath="${build.dir}" logError="true">
<arg value="-dFOUNDATION" />
<arg value="-t" />
@ -1435,7 +1544,7 @@
<copy file="${eclipse.dir}/misc/about.html" todir="${eclipse.projects.dir}/com.ibm.icu.base-feature/sourceTemplatePlugin" />
</target>
<target name="eclipseTestMangle" depends="buildmangle">
<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" />
@ -1493,7 +1602,7 @@
<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">
<target name="gatherICU4JWrapperAPI" depends="tools" unless="before.java14">
<javadoc classpath="${build.dir}" sourcepath="${src.dir}" packagenames="com.ibm.icu.text,com.ibm.icu.util" source="1.4">
<doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${build.dir}">
<param name="-name" value="ICU4J 3.6" />
@ -1505,7 +1614,7 @@
</javadoc>
</target>
<target name="gatherEclipseWrapperAPI" depends="tools" if="version.1.4">
<target name="gatherEclipseWrapperAPI" depends="tools" unless="before.java14">
<javadoc classpath="${build.dir}" sourcepath="${src.dir}/com/ibm/icu/dev/eclipse/com.ibm.icu.base/src" packagenames="com.ibm.icu.text,com.ibm.icu.util" source="1.4">
<doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${build.dir}">
<param name="-name" value="ICU4J 3.6 Wrapper" />
@ -1516,7 +1625,7 @@
</javadoc>
</target>
<target name="reportWrapperAPI" depends="tools" if="version.1.4">
<target name="reportWrapperAPI" depends="tools" unless="before.java14">
<java classname="com.ibm.icu.dev.tool.docs.ReportAPI" classpath="${build.dir}" failonerror="true">
<arg value="-old:" />
<arg value="${api.dir}/icu4j${icu4j.previous.version.number}w_i.api" />
@ -1530,7 +1639,7 @@
<target name="runCheck" depends="init,tests">
<java classname="com.ibm.icu.dev.test.TestAll" fork="yes" failonerror="true">
<jvmarg value="-ea" />
<jvmarg value="${jvm.assertion.arg}" />
<jvmarg value="-Xms96m" />
<jvmarg value="-Xmx128m" />
<arg value="-n" />

82
icu4j/preprocessor.txt Normal file
View file

@ -0,0 +1,82 @@
# Copyright (C) 2007, International Business Machines Corporation and
# others. All Rights Reserved.
## core sources
src/com/ibm/icu/impl/ByteBuffer.java
src/com/ibm/icu/impl/DateNumberFormat.java
src/com/ibm/icu/impl/duration/BasicDurationFormat.java
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/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/Bidi.java
src/com/ibm/icu/text/ChineseDateFormat.java
src/com/ibm/icu/text/DateFormat.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/MessageFormat.java
src/com/ibm/icu/text/NumberFormat.java
src/com/ibm/icu/text/RuleBasedBreakIterator.java
src/com/ibm/icu/text/RuleBasedCollator.java
src/com/ibm/icu/text/RuleBasedNumberFormat.java
src/com/ibm/icu/text/SimpleDateFormat.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
src/com/ibm/icu/util/UResourceBundle.java
## test sources
src/com/ibm/icu/dev/test/bidi/TestAll.java
src/com/ibm/icu/dev/test/bidi/TestCompatibility.java
src/com/ibm/icu/dev/test/bigdec/DiagBigDecimal.java
src/com/ibm/icu/dev/test/charsetdet/TestCharsetDetector.java
src/com/ibm/icu/dev/test/cldr/TestCLDRVsICU.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/duration/ICUDurationTest.java
src/com/ibm/icu/dev/test/format/BigNumberFormatTest.java
src/com/ibm/icu/dev/test/format/DateFormatTest.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/IntlTestNumberFormatAPI.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
src/com/ibm/icu/dev/test/format/RbnfTest.java
src/com/ibm/icu/dev/test/format/TestAll.java
src/com/ibm/icu/dev/test/format/TestMessageFormat.java
src/com/ibm/icu/dev/test/ResourceModule.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/TestDataModule.java
src/com/ibm/icu/dev/test/TestFmwk.java
src/com/ibm/icu/dev/test/TestUtil.java
src/com/ibm/icu/dev/test/timezone/TimeZoneAliasTest.java
src/com/ibm/icu/dev/test/timezone/TimeZoneRegression.java
src/com/ibm/icu/dev/test/translit/UnicodeMapTest.java
src/com/ibm/icu/dev/test/util/BagFormatter.java
src/com/ibm/icu/dev/test/util/BNF.java
src/com/ibm/icu/dev/test/util/CollectionUtilities.java
src/com/ibm/icu/dev/test/util/DataInputCompressor.java
src/com/ibm/icu/dev/test/util/DataOutputCompressor.java
src/com/ibm/icu/dev/test/util/FileUtilities.java
src/com/ibm/icu/dev/test/util/ICUPropertyFactory.java
src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java
src/com/ibm/icu/dev/test/util/TestBagFormatter.java
src/com/ibm/icu/dev/test/util/TestBNF.java
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/TransliteratorUtilities.java
src/com/ibm/icu/dev/test/util/UnicodeMap.java
src/com/ibm/icu/dev/test/util/UnicodeProperty.java
src/com/ibm/icu/dev/test/util/UtilityTest.java
## tool sources
src/com/ibm/icu/dev/tool/docs/ICUTaglet.java

View file

@ -220,7 +220,7 @@ public abstract class CharsetICU extends Charset{
//## return icuCanonicalName.compareTo(((CharsetICU)otherObj).icuCanonicalName);
//## }
//#endif
/**
* This follows ucnv.c method ucnv_detectUnicodeSignature() to detect the
* start of the stream for example U+FEFF (the Unicode BOM/signature

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
**********************************************************************
* Copyright (c) 2006-2007, International Business Machines
@ -151,7 +151,7 @@ class ResourceModule implements TestDataModule {
isStrResPrepared = true; // toggle the tag
return true;
} catch (DataModuleFormatError e) {
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw new RuntimeException(e.getMessage());
//#else
throw new RuntimeException(e.getMessage(),e);
@ -176,7 +176,7 @@ class ResourceModule implements TestDataModule {
return true;
} catch (DataModuleFormatError e) {
// Sadly, we throw RuntimeException also
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw new RuntimeException(e.getMessage());
//#else
throw new RuntimeException(e.getMessage(),e);
@ -247,7 +247,7 @@ class ResourceModule implements TestDataModule {
if (Arrays.binarySearch(expResTypes, type) >= 0) {
return t;
} else {
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw new DataModuleFormatError("Actual type " + t.getType() + " != expected types " + expResTypes + ".");
//#else
throw new DataModuleFormatError(new UResourceTypeMismatchException("Actual type " + t.getType() + " != expected types " + expResTypes + "."));
@ -276,7 +276,7 @@ class ResourceModule implements TestDataModule {
throw new UResourceTypeMismatchException("Only accept ARRAY and STRING types.");
}
} catch (UResourceTypeMismatchException e){
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw new DataModuleFormatError(e.getMessage());
//#else
throw new DataModuleFormatError(e);

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -41,7 +41,8 @@ public class TestAll extends TestGroup {
"com.ibm.icu.dev.test.charsetdet.TestCharsetDetector",
"com.ibm.icu.dev.test.bidi.TestAll",
"com.ibm.icu.dev.test.duration.TestAll",
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
"com.ibm.icu.dev.test.charset.TestAll",
"com.ibm.icu.dev.test.serializable.SerializableTest" // *is* a group
//#endif

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines Corporation and *
@ -52,7 +52,8 @@ public interface TestDataModule {
public DataModuleFormatError(String msg){
super(msg);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public DataModuleFormatError(String msg, Throwable cause){
super(msg, cause);
}

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -27,7 +27,7 @@ import java.util.Comparator;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.Random;
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## import com.ibm.icu.impl.Utility;
//#endif
/**
@ -63,10 +63,10 @@ public class TestFmwk extends AbstractTestLog {
}
}
protected void handleException(Throwable e){
//#ifndef FOUNDATION
Throwable ex = e.getCause();
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## Throwable ex = null;
//#else
Throwable ex = e.getCause();
//#endif
if(ex==null){
ex = e;
@ -1073,10 +1073,10 @@ public class TestFmwk extends AbstractTestLog {
public static TestParams create(String arglist, PrintWriter log) {
String[] args = null;
if (arglist != null && arglist.length() > 0) {
//#ifndef FOUNDATION
args = arglist.split("\\s");
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## args = Utility.split(arglist, '\u0020');
//#else
args = arglist.split("\\s");
//#endif
}
return create(args, log);

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2001-2006, International Business Machines Corporation and *
@ -63,11 +63,11 @@ public final class TestUtil {
} catch (Throwable t) {
IOException ex =
new IOException("data resource '" + name + "' not found");
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## t.printStackTrace();
//#else
//initCause API was introduced in JDK 1.4
ex.initCause(t);
//#else
//## t.printStackTrace();
//#endif
throw ex;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines
@ -32,7 +32,10 @@ public class TestAll extends TestGroup {
"com.ibm.icu.dev.test.bidi.TestReorderRunsOnly",
"com.ibm.icu.dev.test.bidi.TestStreaming",
"com.ibm.icu.dev.test.bidi.TestClassOverride",
"com.ibm.icu.dev.test.bidi.TestCompatibility"
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
"com.ibm.icu.dev.test.bidi.TestCompatibility",
//#endif
},
"Bidi tests");
}

View file

@ -1,4 +1,6 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines
@ -8,13 +10,11 @@
package com.ibm.icu.dev.test.bidi;
//#ifndef FOUNDATION
import com.ibm.icu.text.Bidi;
import java.text.AttributedString;
import java.awt.font.TextAttribute;
import java.text.AttributedCharacterIterator;
import java.awt.font.NumericShaper;
//#endif
/**
* Regression test for java.text.Bidi compatibility
@ -24,7 +24,6 @@ import java.awt.font.NumericShaper;
public class TestCompatibility extends BidiTest {
//#ifndef FOUNDATION
void compareBidi(Bidi bidi, java.text.Bidi jbidi)
{
byte paraLevel = bidi.getParaLevel();
@ -136,12 +135,10 @@ public class TestCompatibility extends BidiTest {
}
*/
}
//#endif
public void testCompatibility()
{
logln("\nEntering TestCompatibility\n");
//#ifndef FOUNDATION
/* check constant field values */
int val;
val = Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT;
@ -269,7 +266,6 @@ public class TestCompatibility extends BidiTest {
"\n bidi: " + strbidi +
"\n jbidi: " + strjbidi);
}
//#endif
logln("\nExiting TestCompatibility\n");
}
@ -283,3 +279,4 @@ public class TestCompatibility extends BidiTest {
}
}
}
//#endif

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/* Generated from 'DiagBigDecimal.nrx' 27 Mar 2000 22:38:44 [v1.162] */
/* Options: Binary Comments Crossref Format Java Logo Trace1 Verbose3 */
package com.ibm.icu.dev.test.bigdec;
@ -407,7 +407,8 @@ public class DiagBigDecimal extends TestFmwk {
(new Test("con006")).ok = (com.ibm.icu.math.BigDecimal.TEN.intValueExact()) == 10;
// [java.math.] BigDecimal
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
(new Test("cbd001")).ok = ((new com.ibm.icu.math.BigDecimal(new java.math.BigDecimal("0"))).toString()).equals("0");
(new Test("cbd002")).ok = ((new com.ibm.icu.math.BigDecimal(new java.math.BigDecimal("1"))).toString()).equals("1");
(new Test("cbd003")).ok = ((new com.ibm.icu.math.BigDecimal(new java.math.BigDecimal("10"))).toString()).equals("10");
@ -587,7 +588,8 @@ public class DiagBigDecimal extends TestFmwk {
}/* checkbound3 */
(new Test("cca204")).ok = flag;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// double [deprecated]
// Note that many of these differ from the valueOf(double) results.
dzer = (double) 0;
@ -4254,7 +4256,8 @@ public class DiagBigDecimal extends TestFmwk {
/** Test the {@link com.ibm.icu.math.BigDecimal#toBigDecimal} method. */
public void diagtobigdecimal() {
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
(new Test("tbd001")).ok=((new com.ibm.icu.math.BigDecimal("0")).toBigDecimal().toString()).equals("0");
(new Test("tbd002")).ok=((new com.ibm.icu.math.BigDecimal("-1")).toBigDecimal().toString()).equals("-1");
(new Test("tbd003")).ok=((new com.ibm.icu.math.BigDecimal("+1")).toBigDecimal().toString()).equals("1");

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2005-2006, International Business Machines Corporation and *
@ -16,7 +16,7 @@ import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.text.CharsetDetector;
import com.ibm.icu.text.CharsetMatch;
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//##import com.ibm.icu.impl.Utility;
//#endif
@ -56,12 +56,12 @@ public class TestCharsetDetector extends TestFmwk
throw new Exception();
}
catch (Exception e) {
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## msg = "Test failure " + e.getMessage() ;
//#else
StackTraceElement failPoint = e.getStackTrace()[1];
msg = "Test failure in file " + failPoint.getFileName() +
" at line " + failPoint.getLineNumber();
//#else
//## msg = "Test failure " + e.getMessage() ;
//#endif
}
errln(msg);
@ -125,10 +125,10 @@ public class TestCharsetDetector extends TestFmwk
private void checkEncoding(String testString, String encoding, String id)
{
String enc = null, lang = null;
//#ifndef FOUNDATION
String[] split = encoding.split("/");
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## String[] split = Utility.split(encoding,'/');
//#else
String[] split = encoding.split("/");
//#endif
enc = split[0];
@ -358,10 +358,10 @@ public class TestCharsetDetector extends TestFmwk
// Process test text with each encoding / language pair.
String testString = testText.toString();
//#ifndef FOUNDATION
String[] encodingList = encodings.split(" ");
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## String[] encodingList = Utility.split(encodings, ' ');
//#else
String[] encodingList = encodings.split(" ");
//#endif
for (int e = 0; e < encodingList.length; e += 1) {

View file

@ -1,4 +1,6 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
**********************************************************************
* Copyright (c) 2002-2007, International Business Machines
@ -7,7 +9,6 @@
* Author: Mark Davis
**********************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.cldr;
import java.io.File;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.collator;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -41,7 +41,8 @@ public class TestAll extends TestGroup {
"CollationMiscTest",
"CollationChineseTest",
"CollationServiceTest",
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
//"RandomCollator", //Disabled until the problem in the test case is resolved #5747
//#endif
"UCAConformanceTest",

View file

@ -1,189 +1,190 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.dev.test.duration;
import java.util.Date;
// BEGIN JDK>1.5
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
// END JDK>1.5
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.text.DurationFormat;
import com.ibm.icu.util.ULocale;
/**
* @author srl
*
*/
public class ICUDurationTest extends TestFmwk {
/**
*
*/
public ICUDurationTest() {
}
/**
* @param args
*/
public static void main(String[] args) {
new ICUDurationTest().run(args);
}
/**
* Basic test
*/
public void TestBasics() {
DurationFormat df;
String expect;
String formatted;
df = DurationFormat.getInstance(new ULocale("it"));
formatted = df.formatDurationFromNow(4096);
expect = "fra quattro secondi";
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format duration -> " + formatted);
}
formatted = df.formatDurationFromNowTo(new Date(0));
expect = "fra 37 anni"; // will break next year.
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format date -> " + formatted);
}
formatted = df.formatDurationFrom(1000*3600*24, new Date(0).getTime());
expect = "fra un giorno";
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format date from -> " + formatted);
}
formatted = df.format(new Long(1000*3600*24*2));
expect = "fra due giorni";
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format long obj -> " + formatted);
}
}
// BEGIN JDK>1.5
public void TestSimpleXMLDuration() {
DatatypeFactory factory = null;
try {
factory = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException e) {
errln("Error instantiating XML DatatypeFactory.");
e.printStackTrace();
}
Duration d;
DurationFormat df;
String out;
String expected;
// test 1
d = factory.newDuration("PT2H46M40S");
df = DurationFormat.getInstance(new ULocale("en"));
expected = "2 hours, 46 minutes, and 40 seconds";
out = df.format(d);
if(out.equals(expected)) {
logln("out=expected: " + expected + " from " + d);
} else {
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
}
// test 2
d = factory.newDuration(10000);
df = DurationFormat.getInstance(new ULocale("en"));
expected = "10 seconds";
out = df.format(d);
if(out.equals(expected)) {
logln("out=expected: " + expected + " from " + d);
} else {
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
}
}
public void TestXMLDuration() {
DatatypeFactory factory = null;
try {
factory = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException e) {
errln("Error instantiating XML DatatypeFactory.");
e.printStackTrace();
}
String cases[] = {
"en", "PT10.00099S", "10 seconds",
"en", "#10000", "10 seconds",
"en", "-PT10.00099S", "10 seconds",
"en", "#-10000", "10 seconds",
// from BD req's
"en", "PT2H46M40S", "2 hours, 46 minutes, and 40 seconds",
"it", "PT2H46M40S", "due ore, 46 minuti e 40 secondi",
};
for(int n=0;n<cases.length;n+=3) {
String loc = cases[n+0];
String from = cases[n+1];
String to = cases[n+2];
ULocale locale = new ULocale(loc);
Duration d;
if(from.startsWith("#")) {
d = factory.newDuration(Long.parseLong(from.substring(1)));
} else {
d = factory.newDuration(from);
}
DurationFormat df = DurationFormat.getInstance(locale);
String output = df.format(d);
if(output.equals(to)) {
logln("SUCCESS: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +" to " + to + "= " + output);
} else {
logln("FAIL: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +": expected " + to + " got " + output);
}
}
}
// END JDK>1.5
public void TestBadObjectError() {
Runtime r = Runtime.getRuntime();
DurationFormat df = DurationFormat.getInstance(new ULocale("en"));
String output = null;
try {
output = df.format(r);
errln("FAIL: did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
} catch (IllegalArgumentException iae) {
logln("PASS: expected: Caught iae: " + iae.toString() );
}
// try a second time, because it is a different code path for java < 1.5
try {
output = df.format(r);
errln("FAIL: [#2] did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
} catch (IllegalArgumentException iae) {
logln("PASS: [#2] expected: Caught iae: " + iae.toString() );
}
}
}
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.dev.test.duration;
import java.util.Date;
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
//#else
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
//#endif
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.text.DurationFormat;
import com.ibm.icu.util.ULocale;
/**
* @author srl
*
*/
public class ICUDurationTest extends TestFmwk {
/**
*
*/
public ICUDurationTest() {
}
/**
* @param args
*/
public static void main(String[] args) {
new ICUDurationTest().run(args);
}
/**
* Basic test
*/
public void TestBasics() {
DurationFormat df;
String expect;
String formatted;
df = DurationFormat.getInstance(new ULocale("it"));
formatted = df.formatDurationFromNow(4096);
expect = "fra quattro secondi";
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format duration -> " + formatted);
}
formatted = df.formatDurationFromNowTo(new Date(0));
expect = "fra 37 anni"; // will break next year.
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format date -> " + formatted);
}
formatted = df.formatDurationFrom(1000*3600*24, new Date(0).getTime());
expect = "fra un giorno";
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format date from -> " + formatted);
}
formatted = df.format(new Long(1000*3600*24*2));
expect = "fra due giorni";
if(!expect.equals(formatted)) {
errln("Expected " + expect + " but got " + formatted);
} else {
logln("format long obj -> " + formatted);
}
}
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
//#else
public void TestSimpleXMLDuration() {
DatatypeFactory factory = null;
try {
factory = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException e) {
errln("Error instantiating XML DatatypeFactory.");
e.printStackTrace();
}
Duration d;
DurationFormat df;
String out;
String expected;
// test 1
d = factory.newDuration("PT2H46M40S");
df = DurationFormat.getInstance(new ULocale("en"));
expected = "2 hours, 46 minutes, and 40 seconds";
out = df.format(d);
if(out.equals(expected)) {
logln("out=expected: " + expected + " from " + d);
} else {
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
}
// test 2
d = factory.newDuration(10000);
df = DurationFormat.getInstance(new ULocale("en"));
expected = "10 seconds";
out = df.format(d);
if(out.equals(expected)) {
logln("out=expected: " + expected + " from " + d);
} else {
errln("FAIL: got " + out + " wanted " + expected + " from " + d);
}
}
public void TestXMLDuration() {
DatatypeFactory factory = null;
try {
factory = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException e) {
errln("Error instantiating XML DatatypeFactory.");
e.printStackTrace();
}
String cases[] = {
"en", "PT10.00099S", "10 seconds",
"en", "#10000", "10 seconds",
"en", "-PT10.00099S", "10 seconds",
"en", "#-10000", "10 seconds",
// from BD req's
"en", "PT2H46M40S", "2 hours, 46 minutes, and 40 seconds",
"it", "PT2H46M40S", "due ore, 46 minuti e 40 secondi",
};
for(int n=0;n<cases.length;n+=3) {
String loc = cases[n+0];
String from = cases[n+1];
String to = cases[n+2];
ULocale locale = new ULocale(loc);
Duration d;
if(from.startsWith("#")) {
d = factory.newDuration(Long.parseLong(from.substring(1)));
} else {
d = factory.newDuration(from);
}
DurationFormat df = DurationFormat.getInstance(locale);
String output = df.format(d);
if(output.equals(to)) {
logln("SUCCESS: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +" to " + to + "= " + output);
} else {
logln("FAIL: locale: " + loc + ", from " + from + " ["+d.toString()+"] " +": expected " + to + " got " + output);
}
}
}
//#endif
public void TestBadObjectError() {
Runtime r = Runtime.getRuntime();
DurationFormat df = DurationFormat.getInstance(new ULocale("en"));
String output = null;
try {
output = df.format(r);
errln("FAIL: did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
} catch (IllegalArgumentException iae) {
logln("PASS: expected: Caught iae: " + iae.toString() );
}
// try a second time, because it is a different code path for java < 1.5
try {
output = df.format(r);
errln("FAIL: [#2] did NOT get IllegalArgumentException! Should have. Formatted Runtime as " + output + " ???");
} catch (IllegalArgumentException iae) {
logln("PASS: [#2] expected: Caught iae: " + iae.toString() );
}
}
}

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2005, International Business Machines Corporation and *
@ -417,8 +417,8 @@ public class BigNumberFormatTest extends TestFmwk {
}
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public void TestBigDecimalRounding() {
// jb 3657
java.text.DecimalFormat jdkFormat=new java.text.DecimalFormat("###,###,###,##0");

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines Corporation and *
@ -272,7 +272,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
*/
static final String PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQq";
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* A list of the DateFormat.Field.
* This MUST be kept in sync with PATTERN_CHARS above.
@ -2907,7 +2908,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
}
*/
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
* Test case for formatToCharacterIterator
*/

View file

@ -1,6 +1,6 @@
//##header
//#header
//#ifndef FOUNDATION
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2006-2007, Google, International Business Machines Corporation *

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2004-2007, International Business Machines Corporation and *
@ -176,7 +176,8 @@ public class GlobalizationPreferencesTest extends TestFmwk {
errln("FAIL: setLocales(List) must be blocked after frozen");
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// setLocales(String)
logln("Call setLocales(String) after frozen");
bSet = true;
@ -330,7 +331,8 @@ public class GlobalizationPreferencesTest extends TestFmwk {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// setLocales(String)
for (int i = 0; i < ACCEPT_LANGUAGES.length; i++) {
String acceptLanguage = ACCEPT_LANGUAGES[i];

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines Corporation and *
@ -276,7 +276,8 @@ public class IntlTestDecimalFormatAPIC extends com.ibm.icu.dev.test.TestFmwk {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public void testFormatToCharacterIterator() {
Number number = new Double(350.76);

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*****************************************************************************************
*
* Copyright (C) 1996-2007, International Business Machines
@ -219,7 +219,8 @@ public class IntlTestNumberFormatAPI extends com.ibm.icu.dev.test.TestFmwk
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) {return null;}
public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) {return null;}
public StringBuffer format(BigInteger number, StringBuffer toAppendTo, FieldPosition pos) {return null;}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public StringBuffer format(java.math.BigDecimal number, StringBuffer toAppendTo, FieldPosition pos) {return null;}
//#endif
public StringBuffer format(com.ibm.icu.math.BigDecimal number, StringBuffer toAppendTo, FieldPosition pos) {return null;}

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines Corporation and *
@ -161,7 +161,8 @@ public class NumberFormatRegressionTest extends com.ibm.icu.dev.test.TestFmwk {
//Test New serialized DecimalFormat(2.0) read old serialized forms of DecimalFormat(1.3.1.1)
public void TestSerialization() throws IOException{
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
byte[][] contents = NumberFormatSerialTestData.getContent();
double data = 1234.56;
String[] expected = {

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines Corporation and *
@ -874,10 +874,10 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
expect2(df, 2.0, "2.00 *&' Rs. '&*");
expect2(df, -1.0, "-1.00 *&' Re. '&*");
//#ifndef FOUNDATION
java.math.BigDecimal r = df.getRoundingIncrement();
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## com.ibm.icu.math.BigDecimal r = df.getRoundingIncrement();
//#else
java.math.BigDecimal r = df.getRoundingIncrement();
//#endif
if (r != null) {
errln("FAIL: rounding = " + r + ", expect null");
@ -1274,10 +1274,10 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
}
}
} catch (java.io.IOException e) {
//#ifndef FOUNDATION
throw new RuntimeException(e);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw new RuntimeException(e.getMessage());
//#else
throw new RuntimeException(e);
//#endif
}
}
@ -1306,7 +1306,7 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
}
void checkRounding(DecimalFormat nf, BigDecimal base, int iterations, BigDecimal increment) {
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## nf.setRoundingIncrement(increment);
//#else
nf.setRoundingIncrement(increment.toBigDecimal());
@ -1357,7 +1357,8 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
static BigDecimal toBigDecimal(Number number) {
return number instanceof BigDecimal ? (BigDecimal) number
: number instanceof BigInteger ? new BigDecimal((BigInteger)number)
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
: number instanceof java.math.BigDecimal ? new BigDecimal((java.math.BigDecimal)number)
//#endif
: number instanceof Double ? new BigDecimal(number.doubleValue())

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*****************************************************************************************
*
* Copyright (C) 1996-2007, International Business Machines
@ -1107,7 +1107,8 @@ public class NumberRegression extends com.ibm.icu.dev.test.TestFmwk {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* BigDecimal numbers get their fractions truncated by NumberFormat.
*/
@ -1844,7 +1845,8 @@ class MyNumberFormatTest extends NumberFormat {
public Number parse(String text, ParsePosition parsePosition) {
return new Integer(0);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public StringBuffer format(java.math.BigDecimal number, StringBuffer toAppendTo, FieldPosition pos) {
return new StringBuffer("");
}

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -718,7 +718,8 @@ public class RbnfTest extends TestFmwk {
fmt.format(bigI, buf, null);
logln("big int: " + buf.toString());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
buf.setLength(0);
java.math.BigDecimal bigD = new java.math.BigDecimal(bigI);
fmt.format(bigD, buf, null);

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -72,7 +72,8 @@ public class TestAll extends TestGroup {
"IntlTestDateFormatAPI",
"IntlTestDateFormatAPIC",
"IntlTestDateFormatSymbols",
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
"DateTimeGeneratorTest",
//#endif
"IntlTestSimpleDateFormatAPI",

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
**********************************************************************
* Copyright (c) 2004-2007, International Business Machines
@ -1293,7 +1293,8 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// Test case for formatToCharacterIterator
public void TestFormatToCharacterIterator() {
MessageFormat[] msgfmts = {

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -924,7 +924,8 @@ public class FormatTests
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public static class MessageFormatFieldHandler implements SerializableTest.Handler
{
public Object[] getTestObjects()
@ -966,7 +967,8 @@ public class FormatTests
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public static class DateFormatFieldHandler implements SerializableTest.Handler
{
public Object[] getTestObjects() {
@ -1415,7 +1417,8 @@ public class FormatTests
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public static class ChineseDateFormatFieldHandler implements SerializableTest.Handler
{
public Object[] getTestObjects() {
@ -1461,7 +1464,8 @@ public class FormatTests
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public static class NumberFormatFieldHandler implements SerializableTest.Handler
{
public Object[] getTestObjects()

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -628,7 +628,8 @@ public class SerializableTest extends TestFmwk.TestGroup
map.put("com.ibm.icu.util.UResourceTypeMismatchException", new ExceptionTests.UResourceTypeMismatchExceptionHandler());
map.put("com.ibm.icu.impl.InvalidFormatException", new ExceptionTests.InvalidFormatExceptionHandler());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
map.put("com.ibm.icu.text.NumberFormat$Field", new FormatTests.NumberFormatFieldHandler());
map.put("com.ibm.icu.text.DateFormat$Field", new FormatTests.DateFormatFieldHandler());
map.put("com.ibm.icu.text.ChineseDateFormat$Field", new FormatTests.ChineseDateFormatFieldHandler());

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.timezone;
import java.util.ArrayList;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2000-2007, International Business Machines Corporation and *
@ -1020,9 +1020,10 @@ public class TimeZoneRegression extends TestFmwk {
errln("FAIL: DST is observed in time zone America/New_York on Jan 1, 1900");
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (System.getProperty("java.vendor", "").startsWith("IBM") &&
System.getProperty("java.version", "").equals("1.4.1")) {
System.getProperty("java.version", "").equals("1.4.1")) {
// IBM JDK 1.4.1 has a bug and fails to run this test case.
return;
}

View file

@ -1,3 +1,6 @@
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -67,4 +70,5 @@ public class UnicodeMapTest extends TestFmwk {
}
return true;
}
}
}
//#endif

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.util.ArrayList;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.io.BufferedReader;
@ -35,13 +36,13 @@ public class BagFormatter {
static final boolean DEBUG = false;
public static final boolean SHOW_FILES;
static {
boolean showFiles = false;
try {
showFiles = System.getProperty("SHOW_FILES") != null;
}
catch (SecurityException e) {
}
SHOW_FILES = showFiles;
boolean showFiles = false;
try {
showFiles = System.getProperty("SHOW_FILES") != null;
}
catch (SecurityException e) {
}
SHOW_FILES = showFiles;
}
public static final PrintWriter CONSOLE = new PrintWriter(System.out,true);
@ -105,7 +106,7 @@ public class BagFormatter {
UnicodeSet set1,
String name2,
UnicodeSet set2) {
showSetDifferences(pw, name1, set1, name2, set2, -1);
showSetDifferences(pw, name1, set1, name2, set2, -1);
}
/**
* Compare two UnicodeSets, and show the differences
@ -120,7 +121,7 @@ public class BagFormatter {
UnicodeSet set1,
String name2,
UnicodeSet set2,
int flags)
int flags)
{
if (pw == null) pw = CONSOLE;
String[] names = { name1, name2 };
@ -128,27 +129,27 @@ public class BagFormatter {
UnicodeSet temp;
if ((flags&1) != 0) {
temp = new UnicodeSet(set1).removeAll(set2);
pw.print(lineSeparator);
pw.print(inOut.format(names));
pw.print(lineSeparator);
showSetNames(pw, temp);
temp = new UnicodeSet(set1).removeAll(set2);
pw.print(lineSeparator);
pw.print(inOut.format(names));
pw.print(lineSeparator);
showSetNames(pw, temp);
}
if ((flags&2) != 0) {
temp = new UnicodeSet(set2).removeAll(set1);
pw.print(lineSeparator);
pw.print(outIn.format(names));
pw.print(lineSeparator);
showSetNames(pw, temp);
}
temp = new UnicodeSet(set2).removeAll(set1);
pw.print(lineSeparator);
pw.print(outIn.format(names));
pw.print(lineSeparator);
showSetNames(pw, temp);
}
if ((flags&4) != 0) {
temp = new UnicodeSet(set2).retainAll(set1);
pw.print(lineSeparator);
pw.print(inIn.format(names));
pw.print(lineSeparator);
showSetNames(pw, temp);
temp = new UnicodeSet(set2).retainAll(set1);
pw.print(lineSeparator);
pw.print(inIn.format(names));
pw.print(lineSeparator);
showSetNames(pw, temp);
}
pw.flush();
}
@ -365,12 +366,12 @@ public class BagFormatter {
// refactored
public String getName(int codePoint, boolean withCodePoint) {
String result = getNameSource().getValue(codePoint, !withCodePoint);
String result = getNameSource().getValue(codePoint, !withCodePoint);
return fixName == null ? result : fixName.transliterate(result);
}
public String getName(String s, boolean withCodePoint) {
String result = getNameSource().getValue(s, separator, !withCodePoint);
String result = getNameSource().getValue(s, separator, !withCodePoint);
return fixName == null ? result : fixName.transliterate(result);
}
@ -1096,18 +1097,18 @@ public class BagFormatter {
return this;
}
/**
* @return Returns the fixName.
*/
public Transliterator getFixName() {
return fixName;
}
/**
* @param fixName The fixName to set.
*/
public void setFixName(Transliterator fixName) {
this.fixName = fixName;
}
/**
* @return Returns the fixName.
*/
public Transliterator getFixName() {
return fixName;
}
/**
* @param fixName The fixName to set.
*/
public void setFixName(Transliterator fixName) {
this.fixName = fixName;
}
public Tabber getTabber() {
return tabber;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -14,7 +14,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.SortedSet;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
import java.util.regex.Matcher;
//#endif
@ -328,7 +329,8 @@ public final class CollectionUtilities {
return result.toString();
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Does one string contain another, starting at a specific offset?
* @param text
@ -479,7 +481,8 @@ public final class CollectionUtilities {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public static class RegexIterator extends FilteredIterator {
private Matcher matcher;
public RegexIterator set(Iterator baseIterator, Matcher matcher) {

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.io.DataInput;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.io.DataOutput;

View file

@ -6,6 +6,8 @@
*/
package com.ibm.icu.dev.test.util;
import com.ibm.icu.impl.Utility;
/**
* @author srl
*
@ -116,10 +118,10 @@ public class FieldsSet {
public int parseFrom(String str, FieldsSet inheritFrom) {
int goodFields = 0;
String[] fields = str.split(",");
String[] fields = Utility.split(str, ',');
for(int i=0;i<fields.length;i++) {
String fieldStr = fields[i];
String kv[] = fieldStr.split("=");
String kv[] = Utility.split(fieldStr, '=');
if(kv.length < 1 || kv.length > 2) {
throw new InternalError("split around '=' failed: " + fieldStr);
}

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.io.BufferedReader;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2006, International Business Machines Corporation and *
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.util.ArrayList;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines Corporation and *
@ -13,10 +13,10 @@ import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.JarURLConnection;
//#ifndef FOUNDATION
import java.nio.ByteBuffer;
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//##import com.ibm.icu.impl.ByteBuffer;
//#else
import java.nio.ByteBuffer;
//#endif
import java.util.MissingResourceException;
import java.util.Enumeration;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.util.Random;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
// TODO integrate this into the test framework

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.text.NumberFormat;

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.text.ParsePosition;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
@ -11,95 +11,95 @@ import java.io.BufferedReader;
import java.io.IOException;
import com.ibm.icu.text.Transliterator;
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//##import com.ibm.icu.dev.test.TestUtil;
//#endif
public class TransliteratorUtilities {
public static boolean DEBUG = false;
public static void registerTransliteratorFromFile(String dir, String id) {
try {
String filename = id.replace('-', '_') + ".txt";
String rules = getFileContents(dir, filename);
Transliterator t;
int pos = id.indexOf('-');
String rid;
if (pos < 0) {
rid = id + "-Any";
id = "Any-" + id;
} else {
rid = id.substring(pos+1) + "-" + id.substring(0, pos);
}
t = Transliterator.createFromRules(id, rules, Transliterator.FORWARD);
Transliterator.unregister(id);
Transliterator.registerInstance(t);
public static boolean DEBUG = false;
/*String test = "\u049A\u0430\u0437\u0430\u049B";
System.out.println(t.transliterate(test));
t = Transliterator.getInstance(id);
System.out.println(t.transliterate(test));
*/
public static void registerTransliteratorFromFile(String dir, String id) {
try {
String filename = id.replace('-', '_') + ".txt";
String rules = getFileContents(dir, filename);
Transliterator t;
int pos = id.indexOf('-');
String rid;
if (pos < 0) {
rid = id + "-Any";
id = "Any-" + id;
} else {
rid = id.substring(pos+1) + "-" + id.substring(0, pos);
}
t = Transliterator.createFromRules(id, rules, Transliterator.FORWARD);
Transliterator.unregister(id);
Transliterator.registerInstance(t);
t = Transliterator.createFromRules(rid, rules, Transliterator.REVERSE);
Transliterator.unregister(rid);
Transliterator.registerInstance(t);
if (DEBUG) System.out.println("Registered new Transliterator: " + id + ", " + rid);
} catch (IOException e) {
//#ifndef FOUNDATION
throw (IllegalArgumentException) new IllegalArgumentException("Can't open " + dir + ", " + id).initCause(e);
//#else
/*String test = "\u049A\u0430\u0437\u0430\u049B";
System.out.println(t.transliterate(test));
t = Transliterator.getInstance(id);
System.out.println(t.transliterate(test));
*/
t = Transliterator.createFromRules(rid, rules, Transliterator.REVERSE);
Transliterator.unregister(rid);
Transliterator.registerInstance(t);
if (DEBUG) System.out.println("Registered new Transliterator: " + id + ", " + rid);
} catch (IOException e) {
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw (IllegalArgumentException) new IllegalArgumentException("Can't open " + dir + ", " + id+" "+ e.getMessage());
//#endif
}
}
/**
*
*/
public static String getFileContents(String dir, String filename) throws IOException {
//#ifndef FOUNDATION
BufferedReader br = BagFormatter.openUTF8Reader(dir, filename);
//#else
throw (IllegalArgumentException) new IllegalArgumentException("Can't open " + dir + ", " + id).initCause(e);
//#endif
}
}
/**
*
*/
public static String getFileContents(String dir, String filename) throws IOException {
//#if defined(FOUNDATION10) || defined(J2SE13)
//## BufferedReader br = TestUtil.openUTF8Reader(dir, filename);
//#else
BufferedReader br = BagFormatter.openUTF8Reader(dir, filename);
//#endif
StringBuffer buffer = new StringBuffer();
while (true) {
String line = br.readLine();
if (line == null) break;
if (line.length() > 0 && line.charAt(0) == '\uFEFF') line = line.substring(1);
buffer.append(line).append("\r\n");
}
br.close();
return buffer.toString();
StringBuffer buffer = new StringBuffer();
while (true) {
String line = br.readLine();
if (line == null) break;
if (line.length() > 0 && line.charAt(0) == '\uFEFF') line = line.substring(1);
buffer.append(line).append("\r\n");
}
br.close();
return buffer.toString();
}
}
private static final String BASE_RULES =
":: (hex-any/xml);" +
":: (hex-any/xml10);" +
"'<' > '&lt;' ;" +
"'<' < '&'[lL][Tt]';' ;" +
"'&' > '&amp;' ;" +
"'&' < '&'[aA][mM][pP]';' ;" +
"'>' < '&'[gG][tT]';' ;" +
"'\"' < '&'[qQ][uU][oO][tT]';' ; " +
"'' < '&'[aA][pP][oO][sS]';' ; ";
":: (hex-any/xml);" +
":: (hex-any/xml10);" +
"'<' > '&lt;' ;" +
"'<' < '&'[lL][Tt]';' ;" +
"'&' > '&amp;' ;" +
"'&' < '&'[aA][mM][pP]';' ;" +
"'>' < '&'[gG][tT]';' ;" +
"'\"' < '&'[qQ][uU][oO][tT]';' ; " +
"'' < '&'[aA][pP][oO][sS]';' ; ";
private static final String CONTENT_RULES =
"'>' > '&gt;' ;";
private static final String HTML_RULES = BASE_RULES + CONTENT_RULES +
"'\"' > '&quot;' ; ";
"'\"' > '&quot;' ; ";
private static final String HTML_RULES_CONTROLS = HTML_RULES +
":: [[:C:][:Z:][:whitespace:][:Default_Ignorable_Code_Point:]] hex/unicode ; ";
":: [[:C:][:Z:][:whitespace:][:Default_Ignorable_Code_Point:]] hex/unicode ; ";
private static final String HTML_RULES_ASCII = HTML_RULES +
":: [[:C:][:^ASCII:]] any-hex/xml ; ";
":: [[:C:][:^ASCII:]] any-hex/xml ; ";
private static final String XML_RULES = HTML_RULES +
"'' > '&apos;' ; "
"'' > '&apos;' ; "
;
/*
@ -138,16 +138,16 @@ the double-quote character (") as "&quot;".
*/
public static final Transliterator toXML = Transliterator.createFromRules(
"any-xml", XML_RULES, Transliterator.FORWARD);
public static final Transliterator fromXML = Transliterator.createFromRules(
"xml-any", XML_RULES, Transliterator.REVERSE);
public static final Transliterator toHTML = Transliterator.createFromRules(
"any-html", HTML_RULES, Transliterator.FORWARD);
public static final Transliterator toHTMLControl = Transliterator.createFromRules(
"any-html", HTML_RULES_CONTROLS, Transliterator.FORWARD);
public static final Transliterator toHTMLAscii = Transliterator.createFromRules(
"any-html", HTML_RULES_ASCII, Transliterator.FORWARD);
public static final Transliterator fromHTML = Transliterator.createFromRules(
"html-any", HTML_RULES, Transliterator.REVERSE);
public static final Transliterator toXML = Transliterator.createFromRules(
"any-xml", XML_RULES, Transliterator.FORWARD);
public static final Transliterator fromXML = Transliterator.createFromRules(
"xml-any", XML_RULES, Transliterator.REVERSE);
public static final Transliterator toHTML = Transliterator.createFromRules(
"any-html", HTML_RULES, Transliterator.FORWARD);
public static final Transliterator toHTMLControl = Transliterator.createFromRules(
"any-html", HTML_RULES_CONTROLS, Transliterator.FORWARD);
public static final Transliterator toHTMLAscii = Transliterator.createFromRules(
"any-html", HTML_RULES_ASCII, Transliterator.FORWARD);
public static final Transliterator fromHTML = Transliterator.createFromRules(
"html-any", HTML_RULES, Transliterator.REVERSE);
}

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.io.*;
@ -57,7 +58,7 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
errorOnReset = false;
lastIndex = 0;
return this;
return this;
}
/* Boilerplate */
@ -77,14 +78,14 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
}
public int getHashCode(Object o) {
return o.hashCode();
//equator.getHashCode
return o.hashCode();
//equator.getHashCode
}
public static boolean areEqual(Object a , Object b) {
if (a == b) return true;
if (a == null || b == null) return false;
return a.equals(b);
if (a == b) return true;
if (a == null || b == null) return false;
return a.equals(b);
}
public int hashCode() {
@ -262,8 +263,8 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
if (areEqual(values[baseIndex], value)) return this;
if (locked) throw new UnsupportedOperationException("Attempt to modify locked object");
if (errorOnReset && values[baseIndex] != null) {
throw new IllegalArgumentException("Attempt to reset value for " + Utility.hex(codepoint)
+ " when that is disallowed. Old: " + values[baseIndex] + "; New: " + value);
throw new IllegalArgumentException("Attempt to reset value for " + Utility.hex(codepoint)
+ " when that is disallowed. Old: " + values[baseIndex] + "; New: " + value);
}
// adjust the available values
@ -423,17 +424,17 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
* @return this (for chaining)
*/
public UnicodeMap setMissing(Object value) {
// fast path, if value not yet present
if (!getAvailableValues().contains(value)) {
staleAvailableValues = true;
availableValues.add(value);
for (int i = 0; i < length; ++i) {
if (values[i] == null) values[i] = value;
}
return this;
} else {
return putAll(getSet(null), value);
}
// fast path, if value not yet present
if (!getAvailableValues().contains(value)) {
staleAvailableValues = true;
availableValues.add(value);
for (int i = 0; i < length; ++i) {
if (values[i] == null) values[i] = value;
}
return this;
} else {
return putAll(getSet(null), value);
}
}
/**
* Returns the set associated with a given value. Deposits into
@ -468,17 +469,17 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
* @return result
*/
public Collection getAvailableValues(Collection result) {
if (staleAvailableValues) {
// collect all the current values
// retain them in the availableValues
Set temp = new HashSet();
if (staleAvailableValues) {
// collect all the current values
// retain them in the availableValues
Set temp = new HashSet();
for (int i = 0; i < length - 1; ++i) {
if (values[i] != null) temp.add(values[i]);
}
availableValues.retainAll(temp);
staleAvailableValues = false;
}
if (result == null) result = new ArrayList(availableValues.size());
}
if (result == null) result = new ArrayList(availableValues.size());
result.addAll(availableValues);
return result;
}
@ -523,27 +524,27 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
}
public interface Composer {
Object compose(int codePoint, Object a, Object b);
Object compose(int codePoint, Object a, Object b);
}
public UnicodeMap composeWith(UnicodeMap other, Composer composer) {
for (int i = 0; i <= 0x10FFFF; ++i) {
Object v1 = getValue(i);
Object v2 = other.getValue(i);
Object v3 = composer.compose(i, v1, v2);
if (v1 != v3 && (v1 == null || !v1.equals(v3))) put(i, v3);
}
return this;
for (int i = 0; i <= 0x10FFFF; ++i) {
Object v1 = getValue(i);
Object v2 = other.getValue(i);
Object v3 = composer.compose(i, v1, v2);
if (v1 != v3 && (v1 == null || !v1.equals(v3))) put(i, v3);
}
return this;
}
public UnicodeMap composeWith(UnicodeSet set, Object value, Composer composer) {
for (UnicodeSetIterator it = new UnicodeSetIterator(set); it.next();) {
int i = it.codepoint;
Object v1 = getValue(i);
Object v3 = composer.compose(i, v1, value);
if (v1 != v3 && (v1 == null || !v1.equals(v3))) put(i, v3);
}
return this;
for (UnicodeSetIterator it = new UnicodeSetIterator(set); it.next();) {
int i = it.codepoint;
Object v1 = getValue(i);
Object v3 = composer.compose(i, v1, value);
if (v1 != v3 && (v1 == null || !v1.equals(v3))) put(i, v3);
}
return this;
}
/**
@ -627,34 +628,34 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
}
return result.toString();
}
/**
* @return Returns the errorOnReset.
*/
public boolean getErrorOnReset() {
return errorOnReset;
}
/**
* @param errorOnReset The errorOnReset to set.
*/
public void setErrorOnReset(boolean errorOnReset) {
this.errorOnReset = errorOnReset;
}
/**
* @return Returns the errorOnReset.
*/
public boolean getErrorOnReset() {
return errorOnReset;
}
/**
* @param errorOnReset The errorOnReset to set.
*/
public void setErrorOnReset(boolean errorOnReset) {
this.errorOnReset = errorOnReset;
}
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.util.Lockable#isLocked()
*/
public boolean isFrozen() {
// TODO Auto-generated method stub
return locked;
}
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.util.Lockable#isLocked()
*/
public boolean isFrozen() {
// TODO Auto-generated method stub
return locked;
}
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.util.Lockable#lock()
*/
public Object freeze() {
locked = true;
return this;
}
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.util.Lockable#lock()
*/
public Object freeze() {
locked = true;
return this;
}
static final boolean DEBUG_WRITE = false;
@ -692,8 +693,8 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
sc.writeInt(deltaValueNumber);
if (DEBUG_WRITE) System.out.println("deltaValueNumber: " + deltaValueNumber);
if (!canCombine) {
sc.writeUInt(deltaTransition);
if (DEBUG_WRITE) System.out.println("deltaTransition: " + deltaTransition);
sc.writeUInt(deltaTransition);
if (DEBUG_WRITE) System.out.println("deltaTransition: " + deltaTransition);
}
}
sc.flush();
@ -766,7 +767,7 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
// }
// //public void readObject(ObjectInputStream in) throws IOException {
// public static class StreamCompressor {
// transient byte[] buffer = new byte[1];
// transient byte[] buffer = new byte[1];
// transient StringBuffer stringBuffer = new StringBuffer();
//
// transient byte[] readWriteBuffer = new byte[8];
@ -781,10 +782,10 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
// public void writeInt(int i) throws IOException {
// while (true) {
// if (position == readWriteBuffer.length) {
// out.write(readWriteBuffer);
// out.write(readWriteBuffer);
// position = 0;
// }
// if ((i & ~0x7F) == 0) {
// if ((i & ~0x7F) == 0) {
// readWriteBuffer[position++] = (byte)i;
// break;
// }
@ -792,47 +793,47 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
// i >>>= 7;
// }
// }
// /**
// * @throws IOException
// *
// */
// public int readNInt(ObjectInput in) throws IOException {
// int result = readInt(in);
// /**
// * @throws IOException
// *
// */
// public int readNInt(ObjectInput in) throws IOException {
// int result = readInt(in);
// boolean negative = (result & 1) != 0;
// result >>>= 1;
// if (negative) result = ~result;
// return result;
// }
// /**
// * @throws IOException
// *
// */
// public void writeNInt(int input) throws IOException {
// }
// /**
// * @throws IOException
// *
// */
// public void writeNInt(int input) throws IOException {
// int flag = 0;
// if (input < 0) {
// input = ~input;
// flag = 1;
// }
// input = (input << 1) | flag;
// writeInt(out, input);
// }
// /**
// * @throws IOException
// *
// */
// public void flush() throws IOException {
// input = (input << 1) | flag;
// writeInt(out, input);
// }
// /**
// * @throws IOException
// *
// */
// public void flush() throws IOException {
// out.write(readWriteBuffer);
// position = 0;
// }
// }
//
// int readPosition = readWriteBuffer.length;
//
// public int readInt(ObjectInput in) throws IOException {
// public int readInt(ObjectInput in) throws IOException {
// int result = 0;
// int offset = 0;
// while (true) {
// if (readPosition == readWriteBuffer.length) {
// in.read(readWriteBuffer);
// in.read(readWriteBuffer);
// readPosition = 0;
// }
// //in.read(buffer);
@ -854,16 +855,16 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
// writeCodePoints(s);
// }
// /**
// *
// */
// private void writeCodePoints(String s) throws IOException {
// int cp = 0;
// *
// */
// private void writeCodePoints(String s) throws IOException {
// int cp = 0;
// for (int i = 0; i < s.length(); i += UTF16.getCharCount(cp)) {
// cp = UTF16.charAt(s, i);
// writeInt(cp);
// }
// }
// /**
// }
// /**
// * @throws IOException
// *
// */
@ -871,26 +872,26 @@ public final class UnicodeMap implements Cloneable, Freezable, Externalizable {
// int len = readInt(in);
// return readCodePoints(in, len);
// }
// /**
// *
// */
// private String readCodePoints(int len) throws IOException {
// stringBuffer.setLength(0);
// /**
// *
// */
// private String readCodePoints(int len) throws IOException {
// stringBuffer.setLength(0);
// for (int i = 0; i < len; ++i) {
// int cp = readInt(in);
// int cp = readInt(in);
// UTF16.append(stringBuffer, cp);
// }
// return stringBuffer.toString();
// }
// /**
// * @param this
// * @throws IOException
// *
// */
// private void showSize(UnicodeMap map, String title, ObjectOutput out) throws IOException {
// out.flush();
// System.out.println(title + ": " + (map.debugOut.size() + position));
// }
// }
// /**
// * @param this
// * @throws IOException
// *
// */
// private void showSize(UnicodeMap map, String title, ObjectOutput out) throws IOException {
// out.flush();
// System.out.println(title + ": " + (map.debugOut.size() + position));
// }
// }
}
//#endif

View file

@ -1,11 +1,12 @@
//##header
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
//#ifndef FOUNDATION
package com.ibm.icu.dev.test.util;
import java.io.PrintWriter;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
**********************************************************************
* Copyright (c) 2003-2006, International Business Machines
@ -116,10 +116,10 @@ public class UtilityTest extends TestFmwk {
{
byte[] ba = {0x00, 0x01, 0x02};
byte[] bb = {0x00, 0x01, 0x02, -1};
//#ifndef FOUNDATION
java.nio.ByteBuffer buffer = java.nio.ByteBuffer.wrap(ba);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## com.ibm.icu.impl.ByteBuffer buffer = com.ibm.icu.impl.ByteBuffer.wrap(ba);
//#else
java.nio.ByteBuffer buffer = java.nio.ByteBuffer.wrap(ba);
//#endif
ByteArrayWrapper x = new ByteArrayWrapper(buffer);

View file

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 2004-2006, International Business Machines Corporation and *
* Copyright (C) 2004-2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -21,7 +21,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import java.util.TreeMap;
// import java.util.regex.*;
/**
* A simple facility for adding C-like preprocessing to .java files.
@ -47,127 +47,10 @@ public class CodeMangler {
private static final String IGNORE_PREFIX = "//##";
private static final String HEADER_PREFIX = "//##header";
// static final Pattern pat = Pattern.compile(
// "(?i)^(\\s*(?://+)??\\s*)#(ifdef\\s|ifndef\\s|else|endif|undef\\s|define\\s|if\\s|elif\\s)\\s*(.*)$");
// // static final Pattern pat2 = Pattern.compile("([^=!]+)\\s*([!=]?=)??\\s*(\\w+)");
// static final Pattern pat2 = Pattern.compile("\\s*(\\w+)\\s*([!=]?=)??\\s*([^\\s]?.*$)");
// static final Pattern pat3 = Pattern.compile("^(\\s*//##).*");
public static void main(String[] args) {
// test();
new CodeMangler(args).run();
}
// private static final void test() {
// testPat();
// testPat2();
// testPat3();
// }
// private static final void testPat() {
// System.out.println("test pat");
// String[] tests = {
// "",
// " ",
// "#endif",
// "# endif",
// "#ENDIF",
// "#eNdIf",
// "//#endif",
// "// #endif",
// "// # endif",
// " // #ifdef foo",
// " // #ifndef foo",
// " // #else",
// " // #endif",
// " // #undef foo",
// " // #define foo bar",
// " // #if foo == bar",
// " // #elif bar != baz",
// };
// for (int i = 0; i < tests.length; ++i) {
// System.out.print("pat '" + tests[i] + "' --> ");
// Matcher m = pat.matcher(tests[i]);
// if (m.find()) {
// System.out.println("'" + m.group(1) + "' '" + m.group(2) + "' '" + m.group(3) + "'");
// } else {
// System.out.println("didn't match");
// }
// System.out.print("dug '" + tests[i] + "' --> ");
// String[] res = new String[3];
// if (patMatch(tests[i], res)) {
// System.out.println("'" + res[0] + "' '" + res[1] + "' '" + res[2] + "'");
// } else {
// System.out.println("didn't match");
// }
// }
// }
// private static final void testPat2() {
// System.out.println("test pat2");
// String[] tests = {
// "",
// " ",
// "test",
// " test",
// "test ",
// " test ",
// " test ==",
// " !=",
// " !=foo",
// "foo==bar",
// "foo ==bar",
// "foo== bar",
// "foo == bar",
// "foo bar baz, wompf",
// "foo=bar=baz, wompf a loo",
// };
// for (int i = 0; i < tests.length; ++i) {
// System.out.print("pat '" + tests[i] + "' --> ");
// Matcher m2 = pat2.matcher(tests[i]);
// if (m2.find()) {
// System.out.println("'" + m2.group(1) + "' '" + m2.group(2) + "' '" + m2.group(3) + "'");
// } else {
// System.out.println("didn't match");
// }
// System.out.print("dug '" + tests[i] + "' --> ");
// String[] res = new String[3];
// if (pat2Match(tests[i], res)) {
// System.out.println("'" + res[0] + "' '" + res[1] + "' '" + res[2] + "'");
// } else {
// System.out.println("didn't match");
// }
// }
// }
// private static final void testPat3() {
// System.out.println("test pat3");
// String[] tests = {
// "",
// " ",
// " //#",
// " /##",
// "//##",
// " //##",
// " //##//",
// " /////##",
// };
// for (int i = 0; i < tests.length; ++i) {
// System.out.print("pat '" + tests[i] + "' --> ");
// Matcher m = pat3.matcher(tests[i]);
// if (m.find()) {
// System.out.println("'" + m.group(1) + "'");
// } else {
// System.out.println("didn't match");
// }
// System.out.print("dug '" + tests[i] + "' --> ");
// String match = pat3Match(tests[i]);
// if (match != null) {
// System.out.println("'" + match + "'");
// } else {
// System.out.println("didn't match");
// }
// }
// }
private static final String usage = "Usage:\n" +
" CodeMangler [flags] file... dir... @argfile... \n" +
"-in[dir] path - root directory of input files, otherwise use current directory\n" +
@ -467,9 +350,8 @@ public class CodeMangler {
boolean hasHeader = line.startsWith(HEADER_PREFIX);
if (hasHeader && !force) {
long expectLastModified = ((infile.lastModified() + 999)/1000)*1000;
String headerline = HEADER_PREFIX + ' ' +
(timestamp ? String.valueOf(expectLastModified) : "")
+ ' ' + header;
String headerline = HEADER_PREFIX + ' ' + header + ' ' +
(timestamp ? String.valueOf(expectLastModified) : "");
headerline = headerline.trim();
if (line.equals(headerline)) {
if (verbose) System.out.println("no changes necessary to " + infile.getCanonicalPath());
@ -503,12 +385,11 @@ public class CodeMangler {
return false;
}
}
outModTime = ((outfile.lastModified()+999)/1000)*1000; // round up
outstream = new PrintStream(new FileOutputStream(outfile));
String headerline = HEADER_PREFIX + ' ' +
(timestamp ? String.valueOf(outModTime) : "")
+ ' ' + header;
String headerline = HEADER_PREFIX + ' ' + header + ' ' +
(timestamp ? String.valueOf(outModTime) : "");
headerline = headerline.trim();
outstream.println(headerline);
if (verbose) System.out.println("header: " + headerline);
@ -526,12 +407,6 @@ public class CodeMangler {
String key = res[1];
String val = res[2];
// Matcher m = pat.matcher(line);
// if (m.find()) {
// String lead = m.group(1);
// String key = m.group(2).toLowerCase().trim();
// String val = m.group(3).trim();
if (verbose) System.out.println("directive: " + line
+ " key: '" + key
+ "' val: '" + val
@ -551,34 +426,83 @@ public class CodeMangler {
}
map.remove(val);
}
} else { // #define, #if, #elif
} else if (key.equals("define")) {
if (pat2Match(val, res)) {
String key2 = res[0];
boolean neq = "!=".equals(res[1]); // optional
String val2 = res[2];
// Matcher m2 = pat2.matcher(val);
// if (m2.find()) {
// String key2 = m2.group(1).trim();
// boolean neq = "!=".equals(m2.group(2)); // optional
// String val2 = m2.group(3).trim();
if (verbose) System.out.println("val2: '" + val2
+ "' neq: '" + neq
+ "' key2: '" + key2
+ "'");
if (key.equals("if")) {
state = state.push(lc, line, val2.equals(map.get(key2)) != neq);
} else if (key.equals("elif")) {
state.trip(val2.equals(map.get(key2)) != neq);
} else if (key.equals("define")) {
if (state.emit) {
if (oldMap == null) {
oldMap = (HashMap)map.clone();
}
map.put(key2, val2);
if (state.emit) {
if (oldMap == null) {
oldMap = (HashMap)map.clone();
}
map.put(key2, val2);
}
}
} else { // #if, #elif
// only top level OR (||) operator is supported for now
int count = 1;
int index = 0;
while ((index = val.indexOf("||", index)) > 0) {
count++;
index++;
}
String[] expressions = new String[count];
if (count == 1) {
expressions[0] = val;
} else {
int start = 0;
index = 0;
count = 0;
while (true) {
index = val.indexOf("||", start);
if (index > 0) {
expressions[count++] = val.substring(start, index);
start = index + 2;
} else {
expressions[count++] = val.substring(start);
break;
}
}
}
boolean eval = false;
for (count = 0; count < expressions.length && !eval; count++) {
if (pat2Match(expressions[count], res)) {
String key2 = res[0];
String val2 = res[2];
if (key2.equals("defined")) {
// defined command
if (verbose) System.out.println(
"index: '" + count
+ "' val2: '" + val2
+ "' key2: '" + key2
+ "'");
eval = map.containsKey(val2);
} else {
boolean neq = false;
if (res[1].equals("!=")) {
neq = true;
} else if (!res[1].equals("==")) {
System.err.println("Invalid expression: '" + val);
}
if (verbose) System.out.println(
"index: '" + count
+ "' val2: '" + val2
+ "' neq: '" + neq
+ "' key2: '" + key2
+ "'");
eval = (val2.equals(map.get(key2)) != neq);
}
}
}
if (key.equals("if")) {
state = state.push(lc, line, eval);
} else if (key.equals("elif")) {
state.trip(eval);
}
}
if (!clean) {
lc++;
@ -603,17 +527,6 @@ public class CodeMangler {
} else if (hasIgnore && !found.equals(IGNORE_PREFIX)) {
line = IGNORE_PREFIX + line.substring(found.length());
}
// m = pat3.matcher(line);
// boolean hasIgnore = m.find();
// if (state.emit == hasIgnore) {
// if (state.emit) {
// line = line.substring(m.group(1).length());
// } else {
// line = IGNORE_PREFIX + line;
// }
// } else if (hasIgnore && !m.group(1).equals(IGNORE_PREFIX)) {
// line = IGNORE_PREFIX + line.substring(m.group(1).length());
// }
if (!clean || state.emit) {
outstream.println(line);
}
@ -667,9 +580,6 @@ public class CodeMangler {
* there is a match, return true, else return false.
*/
static boolean patMatch(String line, String[] leadKeyValue) {
// final Pattern pat = Pattern.compile(
// "(?i)^(\\s*(?://+)??\\s*)#(ifdef\\s|ifndef\\s|else|endif|undef\\s|define\\s|if\\s|elif\\s)\\s*(.*)$");
if (line.length() == 0) {
return false;
}
@ -740,9 +650,6 @@ public class CodeMangler {
* word. if there is a match, return true, else return false.
*/
static boolean pat2Match(String line, String[] keyRelVal) {
// final Pattern pat2 = Pattern.compile("([^=!]+)\\s*([!=]?=)??\\s*(\\w+)");
// hmmm, this pattern doesn't look right. a pattern consisting of 'abcd' should
// return {"abcd", "", ""} but it looks like it returns {"", "", "abcd"}.
if (line.length() == 0) {
return false;
@ -750,6 +657,7 @@ public class CodeMangler {
keyRelVal[0] = keyRelVal[1] = keyRelVal[2] = "";
int mark = 0;
int state = 0;
String command = null;
loop: for (int i = 0; i < line.length(); ++i) {
char c = line.charAt(i);
switch (state) {
@ -765,7 +673,15 @@ public class CodeMangler {
case 1: // saw start of a word
if (c == ' ' || c == '\t') {
state = 2;
}
}
else if (c == '(') {
command = line.substring(0, i).trim();
if (!command.equals("defined")) {
return false;
}
keyRelVal[0] = command;
state = 2;
}
else if (c == '!' || c == '=') {
state = 3;
}
@ -774,6 +690,9 @@ public class CodeMangler {
if (c == ' ' || c == '\t') {
continue;
}
else if (command == null && c == '(') {
continue;
}
else if (c == '!' || c == '=') {
state = 3;
continue;
@ -804,7 +723,16 @@ public class CodeMangler {
case 3:
return false; // found a word and '!' or '=" then end of line, incomplete
case 4:
keyRelVal[2] = line.substring(mark).trim(); break; // found a word, possible rel, and who knows what
keyRelVal[2] = line.substring(mark).trim(); // found a word, possible rel, and who knows what
if (command != null) {
int len = keyRelVal[2].length();
if (keyRelVal[2].charAt(len - 1) != ')') {
// closing parenthesis is missing
return false;
}
keyRelVal[2] = keyRelVal[2].substring(0, len - 1).trim();
}
break;
default:
throw new IllegalStateException();
}
@ -834,8 +762,4 @@ public class CodeMangler {
}
return null;
}
// final Pattern pat3 = Pattern.compile("^(\\s*//##).*");
}

View file

@ -1,4 +1,4 @@
//##header VERSION_1.5
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2002-2007, International Business Machines Corporation and *
@ -15,19 +15,16 @@
package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.*;
//#ifndef VERSION_1.5
//#if defined(J2SE13) || defined(J2SE14)
//##import com.sun.tools.doclets.*;
//#endif
//#ifdef VERSION_1.5
import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
//#else
// jdk 1.5 contains both com.sun.tools.doclets.Taglet and
// com.sun.tools.doclets.internal.toolkit.taglets.Taglet.
// Their registration code casts to the second, not the first, and the
// second doesn't implement the first, so if you just implement the
// first, you die.
import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
//#endif
import java.text.BreakIterator;
@ -53,7 +50,7 @@ public abstract class ICUTaglet implements Taglet {
ICUInternalTaglet.register(taglets);
ICUDraftTaglet.register(taglets);
ICUStableTaglet.register(taglets);
//#ifndef VERSION_1.5
//#if defined(J2SE13) || defined(J2SE14)
//## ICUDeprecatedTaglet.register(taglets);
//#endif
ICUProvisionalTaglet.register(taglets);
@ -116,22 +113,23 @@ public abstract class ICUTaglet implements Taglet {
}
return null;
}
//#ifdef VERSION_1.5
//#if defined(J2SE13) || defined(J2SE14)
//#else
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) throws IllegalArgumentException {
TagletOutput out = writer.getTagletOutputInstance();
out.setOutput(toString(tag));
return out;
TagletOutput out = writer.getTagletOutputInstance();
out.setOutput(toString(tag));
return out;
}
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) throws IllegalArgumentException {
TagletOutput out = writer.getTagletOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
out.setOutput(toString(tags[0]));
return out;
TagletOutput out = writer.getTagletOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
out.setOutput(toString(tags[0]));
return out;
}
//#endif
@ -193,8 +191,7 @@ public abstract class ICUTaglet implements Taglet {
}
}
}
//#ifndef VERSION_1.5
//##
//#if defined(J2SE13) || defined(J2SE14)
//## /*
//## * sigh, in JDK 1.5 we can't override the standard deprecated taglet
//## * so easily. I'm not impressed with the javadoc code.

View file

@ -1,13 +1,13 @@
//##header
/*
* *****************************************************************************
* Copyright (C) 2006-2007, International Business Machines
* Corporation and others. All Rights Reserved.
* *****************************************************************************
*/
// dlf13 internal 1.3 compatibility only
//#ifdef FOUNDATION
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//##/*
//## * *****************************************************************************
//## * Copyright (C) 2006-2007, International Business Machines
//## * Corporation and others. All Rights Reserved.
//## * *****************************************************************************
//## */
//##// dlf13 internal 1.3 compatibility only
//##
//##package com.ibm.icu.impl;
//##
//##/**

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines
@ -136,7 +136,8 @@ public final class DateNumberFormat extends NumberFormat {
throw new UnsupportedOperationException("StringBuffer format(BigInteger, StringBuffer, FieldPostion) is not implemented");
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
public StringBuffer format(java.math.BigDecimal number, StringBuffer toAppendTo,
FieldPosition pos) {
throw new UnsupportedOperationException("StringBuffer format(BigDecimal, StringBuffer, FieldPostion) is not implemented");

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
* *****************************************************************************
* Copyright (C) 2005-2007, International Business Machines Corporation and * others.

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 2004-2007, International Business Machines Corporation and *
@ -15,7 +15,8 @@ import com.ibm.icu.util.UResourceBundle;
import com.ibm.icu.util.UResourceBundleIterator;
import com.ibm.icu.util.UResourceTypeMismatchException;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
import java.nio.ByteBuffer;
//#endif

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2004-2007, International Business Machines Corporation and *
@ -178,10 +178,10 @@ public final class ICUResourceBundleReader implements ICUBinary.Authenticate{
readData(bs);
stream.close();
}catch(IOException ex){
//#ifndef FOUNDATION
throw new RuntimeException("Data file "+ resolvedName+ " is corrupt.", ex);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## throw new RuntimeException("Data file "+ resolvedName+ " is corrupt.");
//#else
throw new RuntimeException("Data file "+ resolvedName+ " is corrupt.", ex);
//#endif
}
}

View file

@ -1,5 +1,6 @@
//##header
//#ifndef FOUNDATION
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2006-2007, Google, International Business Machines Corporation *

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -1805,45 +1805,43 @@ public final class Utility {
// !!! 1.3 compatibility
public static int indexOf(StringBuffer buf, String s) {
//#ifndef FOUNDATION
return buf.indexOf(s);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## return buf.toString().indexOf(s);
//#else
return buf.indexOf(s);
//#endif
}
// !!! 1.3 compatibility
public static int lastIndexOf(StringBuffer buf, String s) {
//#ifndef FOUNDATION
return buf.lastIndexOf(s);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## return buf.toString().lastIndexOf(s);
//#else
return buf.lastIndexOf(s);
//#endif
}
// !!! 1.3 compatibility
public static int indexOf(StringBuffer buf, String s, int i) {
//#ifndef FOUNDATION
return buf.indexOf(s, i);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## return buf.toString().indexOf(s, i);
//#else
return buf.indexOf(s, i);
//#endif
}
// !!! 1.3 compatibility
public static int lastIndexOf(StringBuffer buf, String s, int i) {
//#ifndef FOUNDATION
return buf.lastIndexOf(s, i);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## return buf.toString().lastIndexOf(s, i);
//#else
return buf.lastIndexOf(s, i);
//#endif
}
// !!! 1.3 compatibility
public static String replaceAll(String src, String target, String replacement) {
//#ifndef FOUNDATION
return src.replaceAll(target, replacement);
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## int i = src.indexOf(target);
//## if (i == -1) {
//## return src;
@ -1860,6 +1858,8 @@ public final class Utility {
//## buf.append(src.substring(n));
//## }
//## return buf.toString();
//#else
return src.replaceAll(target, replacement);
//#endif
}
@ -1868,9 +1868,7 @@ public final class Utility {
// !!! 1.3 compatibility
// Note: target is not a string literal, not a regular expression.
public static String[] splitString(String src, String target) {
//#ifndef FOUNDATION
return src.split("\\Q" + target + "\\E");
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## int i = src.indexOf(target);
//## if (i == -1) {
//## return new String[] { src };
@ -1886,6 +1884,8 @@ public final class Utility {
//## output.add(src.substring(n));
//## }
//## return (String[]) output.toArray(new String[output.size()]);
//#else
return src.split("\\Q" + target + "\\E");
//#endif
}
@ -1894,9 +1894,7 @@ public final class Utility {
* Split the string at runs of ascii whitespace characters.
*/
public static String[] splitWhitespace(String src) {
//#ifndef FOUNDATION
return src.split("\\s+");
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## char ws[] = "\u0020\u0009\n\u000b\u000c\r".toCharArray();
//## ArrayList output = new ArrayList();
//## boolean inWhitespace = true;
@ -1922,6 +1920,8 @@ public final class Utility {
//## output.add(src.substring(n));
//## }
//## return (String[]) output.toArray(new String[output.size()]);
//#else
return src.split("\\s+");
//#endif
}
}

View file

@ -1,160 +1,162 @@
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.impl.duration;
import java.text.FieldPosition;
import java.util.Date;
import com.ibm.icu.text.DurationFormat;
import com.ibm.icu.util.ULocale;
/**
* @author srl
* @internal
* @deprecated this API is for ICU internal use only
*/
public class BasicDurationFormat extends DurationFormat {
/**
*
*/
private static final long serialVersionUID = -3146984141909457700L;
transient DurationFormatter formatter;
transient PeriodFormatter pformatter;
transient PeriodFormatterService pfs = null;
public static DurationFormat getInstance(ULocale locale) {
return new BasicDurationFormat(locale);
}
// BEGIN JDK>1.5
private static boolean checkXMLDuration = true;
// END JDK>1.5
public StringBuffer format(Object object, StringBuffer toAppend, FieldPosition pos) {
if(object instanceof Long) {
String res = formatDurationFromNow(((Long)object).longValue());
return toAppend.append(res);
} else if(object instanceof Date) {
String res = formatDurationFromNowTo(((Date)object));
return toAppend.append(res);
}
// BEGIN JDK>1.5
if(checkXMLDuration) try {
if(object instanceof javax.xml.datatype.Duration) {
String res = formatDuration(object);
return toAppend.append(res);
}
} catch ( NoClassDefFoundError ncdfe ) {
System.err.println("Skipping XML capability");
checkXMLDuration = false; // don't try again
}
// END JDK>1.5
throw new IllegalArgumentException("Cannot format given Object as a Duration");
}
public BasicDurationFormat() {
pfs = BasicPeriodFormatterService.getInstance();
formatter = pfs.newDurationFormatterFactory().getFormatter();
pformatter = pfs.newPeriodFormatterFactory().setDisplayPastFuture(false).getFormatter();
}
/**
*
*/
public BasicDurationFormat(ULocale locale) {
super(locale);
pfs = BasicPeriodFormatterService.getInstance();
formatter = pfs.newDurationFormatterFactory().setLocale(locale.getName()).getFormatter();
pformatter = pfs.newPeriodFormatterFactory().setDisplayPastFuture(false).setLocale(locale.getName()).getFormatter();
}
/* (non-Javadoc)
* @see com.ibm.icu.text.DurationFormat#formatDurationFrom(long, long)
*/
public String formatDurationFrom(long duration, long referenceDate) {
return formatter.formatDurationFrom(duration, referenceDate);
}
/* (non-Javadoc)
* @see com.ibm.icu.text.DurationFormat#formatDurationFromNow(long)
*/
public String formatDurationFromNow(long duration) {
return formatter.formatDurationFromNow(duration);
}
/* (non-Javadoc)
* @see com.ibm.icu.text.DurationFormat#formatDurationFromNowTo(java.util.Date)
*/
public String formatDurationFromNowTo(Date targetDate) {
return formatter.formatDurationFromNowTo(targetDate);
}
// BEGIN JDK>1.5
/**
* JDK 1.5+ only
* @param o
* @return
* @see http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/Duration.html
*/
public String formatDuration(Object obj) {
javax.xml.datatype.DatatypeConstants.Field inFields[] = {
javax.xml.datatype.DatatypeConstants.YEARS,
javax.xml.datatype.DatatypeConstants.MONTHS,
javax.xml.datatype.DatatypeConstants.DAYS,
javax.xml.datatype.DatatypeConstants.HOURS,
javax.xml.datatype.DatatypeConstants.MINUTES,
javax.xml.datatype.DatatypeConstants.SECONDS,
};
TimeUnit outFields[] = {
TimeUnit.YEAR,
TimeUnit.MONTH,
TimeUnit.DAY,
TimeUnit.HOUR,
TimeUnit.MINUTE,
TimeUnit.SECOND,
};
javax.xml.datatype.Duration inDuration = (javax.xml.datatype.Duration)obj;
Period p = null;
javax.xml.datatype.Duration duration = inDuration;
boolean inPast = false;
if(inDuration.getSign()<0) {
duration = inDuration.negate();
inPast = true;
}
// convert a Duration to a Period
for(int i=0;i<inFields.length;i++) {
if(duration.isSet(inFields[i])) {
Number n = duration.getField(inFields[i]);
if(p == null) {
p = Period.at(n.floatValue(), outFields[i]);
} else {
p = p.and(n.floatValue(), outFields[i]);
}
}
}
if(p == null) {
// no fields set = 0 seconds
return formatDurationFromNow(0);
} else {
if(inPast) {// was negated, above.
p = p.inPast();
} else {
p = p.inFuture();
}
}
// now, format it.
return pformatter.format(p);
}
// END JDK>1.5
}
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.impl.duration;
import java.text.FieldPosition;
import java.util.Date;
import com.ibm.icu.text.DurationFormat;
import com.ibm.icu.util.ULocale;
/**
* @author srl
* @internal
* @deprecated this API is for ICU internal use only
*/
public class BasicDurationFormat extends DurationFormat {
/**
*
*/
private static final long serialVersionUID = -3146984141909457700L;
transient DurationFormatter formatter;
transient PeriodFormatter pformatter;
transient PeriodFormatterService pfs = null;
public static DurationFormat getInstance(ULocale locale) {
return new BasicDurationFormat(locale);
}
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
//#else
private static boolean checkXMLDuration = true;
//#endif
public StringBuffer format(Object object, StringBuffer toAppend, FieldPosition pos) {
if(object instanceof Long) {
String res = formatDurationFromNow(((Long)object).longValue());
return toAppend.append(res);
} else if(object instanceof Date) {
String res = formatDurationFromNowTo(((Date)object));
return toAppend.append(res);
}
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
//#else
if(checkXMLDuration) try {
if(object instanceof javax.xml.datatype.Duration) {
String res = formatDuration(object);
return toAppend.append(res);
}
} catch ( NoClassDefFoundError ncdfe ) {
System.err.println("Skipping XML capability");
checkXMLDuration = false; // don't try again
}
//#endif
throw new IllegalArgumentException("Cannot format given Object as a Duration");
}
public BasicDurationFormat() {
pfs = BasicPeriodFormatterService.getInstance();
formatter = pfs.newDurationFormatterFactory().getFormatter();
pformatter = pfs.newPeriodFormatterFactory().setDisplayPastFuture(false).getFormatter();
}
/**
*
*/
public BasicDurationFormat(ULocale locale) {
super(locale);
pfs = BasicPeriodFormatterService.getInstance();
formatter = pfs.newDurationFormatterFactory().setLocale(locale.getName()).getFormatter();
pformatter = pfs.newPeriodFormatterFactory().setDisplayPastFuture(false).setLocale(locale.getName()).getFormatter();
}
/* (non-Javadoc)
* @see com.ibm.icu.text.DurationFormat#formatDurationFrom(long, long)
*/
public String formatDurationFrom(long duration, long referenceDate) {
return formatter.formatDurationFrom(duration, referenceDate);
}
/* (non-Javadoc)
* @see com.ibm.icu.text.DurationFormat#formatDurationFromNow(long)
*/
public String formatDurationFromNow(long duration) {
return formatter.formatDurationFromNow(duration);
}
/* (non-Javadoc)
* @see com.ibm.icu.text.DurationFormat#formatDurationFromNowTo(java.util.Date)
*/
public String formatDurationFromNowTo(Date targetDate) {
return formatter.formatDurationFromNowTo(targetDate);
}
//#if defined(FOUNDATION10) || defined(J2SE13) || defined(J2SE14)
//#else
/**
* JDK 1.5+ only
* @param o
* @return
* @see http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/datatype/Duration.html
*/
public String formatDuration(Object obj) {
javax.xml.datatype.DatatypeConstants.Field inFields[] = {
javax.xml.datatype.DatatypeConstants.YEARS,
javax.xml.datatype.DatatypeConstants.MONTHS,
javax.xml.datatype.DatatypeConstants.DAYS,
javax.xml.datatype.DatatypeConstants.HOURS,
javax.xml.datatype.DatatypeConstants.MINUTES,
javax.xml.datatype.DatatypeConstants.SECONDS,
};
TimeUnit outFields[] = {
TimeUnit.YEAR,
TimeUnit.MONTH,
TimeUnit.DAY,
TimeUnit.HOUR,
TimeUnit.MINUTE,
TimeUnit.SECOND,
};
javax.xml.datatype.Duration inDuration = (javax.xml.datatype.Duration)obj;
Period p = null;
javax.xml.datatype.Duration duration = inDuration;
boolean inPast = false;
if(inDuration.getSign()<0) {
duration = inDuration.negate();
inPast = true;
}
// convert a Duration to a Period
for(int i=0;i<inFields.length;i++) {
if(duration.isSet(inFields[i])) {
Number n = duration.getField(inFields[i]);
if(p == null) {
p = Period.at(n.floatValue(), outFields[i]);
} else {
p = p.and(n.floatValue(), outFields[i]);
}
}
}
if(p == null) {
// no fields set = 0 seconds
return formatDurationFromNow(0);
} else {
if(inPast) {// was negated, above.
p = p.inPast();
} else {
p = p.inFuture();
}
}
// now, format it.
return pformatter.format(p);
}
//#endif
}

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -5383,10 +5383,10 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
* @return the code point at the index
* @stable ICU 3.0
*/
//#ifndef FOUNDATION
public static final int codePointAt(CharSequence seq, int index) {
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public static final int codePointAt(String seq, int index) {
//#else
public static final int codePointAt(CharSequence seq, int index) {
//#endif
char c1 = seq.charAt(index++);
if (isHighSurrogate(c1)) {
@ -5399,7 +5399,7 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
}
return c1;
}
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public static final int codePointAt(StringBuffer seq, int index) {
//## return codePointAt(seq.toString(), index);
//## }
@ -5462,10 +5462,10 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
* @return the code point before the index
* @stable ICU 3.0
*/
//#ifndef FOUNDATION
public static final int codePointBefore(CharSequence seq, int index) {
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public static final int codePointBefore(String seq, int index) {
//#else
public static final int codePointBefore(CharSequence seq, int index) {
//#endif
char c2 = seq.charAt(--index);
if (isLowSurrogate(c2)) {
@ -5478,7 +5478,7 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
}
return c2;
}
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public static final int codePointBefore(StringBuffer seq, int index) {
//## return codePointBefore(seq.toString(), index);
//## }
@ -5605,10 +5605,10 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
* @return the number of code points in the range
* @stable ICU 3.0
*/
//#ifndef FOUNDATION
public static int codePointCount(CharSequence text, int start, int limit) {
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public static int codePointCount(String text, int start, int limit) {
//#else
public static int codePointCount(CharSequence text, int start, int limit) {
//#endif
if (start < 0 || limit < start || limit > text.length()) {
throw new IndexOutOfBoundsException("start (" + start +
@ -5667,10 +5667,10 @@ public final class UCharacter implements ECharacterCategory, ECharacterDirection
* @return the adjusted index
* @stable ICU 3.0
*/
//#ifndef FOUNDATION
public static int offsetByCodePoints(CharSequence text, int index, int codePointOffset) {
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public static int offsetByCodePoints(String text, int index, int codePointOffset) {
//#else
public static int offsetByCodePoints(CharSequence text, int index, int codePointOffset) {
//#endif
if (index < 0 || index > text.length()) {
throw new IndexOutOfBoundsException("index ( " + index +

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/* Generated from 'BigDecimal.nrx' 8 Sep 2000 11:10:50 [v2.00] */
/* Options: Binary Comments Crossref Format Java Logo Strictargs Strictcase Trace2 Verbose3 */
package com.ibm.icu.math;
@ -450,7 +450,8 @@ public class BigDecimal extends java.lang.Number implements java.io.Serializable
/* Constructors */
/* ---------------------------------------------------------------- */
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Constructs a <code>BigDecimal</code> object from a
* <code>java.math.BigDecimal</code>.
@ -831,10 +832,10 @@ public class BigDecimal extends java.lang.Number implements java.io.Serializable
// 2000.01.01: note that this constructor does give an exact result,
// so perhaps it should not be deprecated
// 2000.06.18: no longer deprecated
//#ifndef FOUNDATION
this((new java.math.BigDecimal(num)).toString());
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## this(String.valueOf(num));
//#else
this((new java.math.BigDecimal(num)).toString());
//#endif
return;}
/**
@ -3146,7 +3147,8 @@ public class BigDecimal extends java.lang.Number implements java.io.Serializable
return (int)this.ind; // [note this assumes values for ind.]
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Converts this <code>BigDecimal</code> to a
* <code>java.math.BigDecimal</code>.

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2001-2007, International Business Machines
@ -26,10 +26,14 @@
package com.ibm.icu.text;
//#ifndef FOUNDATION
import java.awt.font.NumericShaper;
//#if defined(FOUNDATION10)
//#else
import java.awt.font.TextAttribute;
//#endif
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
import java.awt.font.NumericShaper;
//#endif
import java.io.IOException;
import java.lang.reflect.Array;
import java.text.AttributedCharacterIterator;
@ -3341,7 +3345,8 @@ public class Bidi {
paraBidi = this; /* mark successful setPara */
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10)
//#else
/**
* Perform the Unicode Bidi algorithm on a given paragraph, as defined in the
* <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,
@ -3419,10 +3424,13 @@ public class Bidi {
++i;
}
//#if defined(J2SE13)
//#else
NumericShaper shaper = (NumericShaper) paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
if (shaper != null) {
shaper.shape(text, 0, length);
}
//#endif
setPara(text, paraLevel, levels);
}
//#endif
@ -4390,7 +4398,8 @@ public class Bidi {
this(paragraph.toCharArray(), 0, null, 0, paragraph.length(), flags);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10)
//#else
/**
* Create Bidi from the given paragraph of text.<p>
*

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*********************************************************************
* Copyright (C) 2000-2007, International Business Machines Corporation and
* others. All Rights Reserved.
@ -175,7 +175,8 @@ public class ChineseDateFormat extends SimpleDateFormat {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* {@inheritDoc}
*

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
* Copyright (C) 1996-2007, International Business Machines
* Corporation and others. All Rights Reserved.
@ -1208,7 +1208,8 @@ public abstract class DateFormat extends UFormat {
return getDateTimeInstance(cal, dateStyle, timeStyle, ULocale.getDefault());
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* The instances of this inner class are used as attribute keys and values
* in AttributedCharacterIterator that

View file

@ -1,5 +1,6 @@
//##header
//#ifndef FOUNDATION
//##header J2SE15
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
*******************************************************************************
* Copyright (C) 2006-2007, Google, International Business Machines Corporation *

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -716,7 +716,8 @@ public class DecimalFormat extends NumberFormat {
result.append(symbols.getNaN());
// [Spark/CDL] Add attribute for NaN here.
// result.append(symbols.getNaN());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (parseAttr) {
addAttribute(Field.INTEGER, result.length()
- symbols.getNaN().length(), result.length());
@ -765,7 +766,8 @@ public class DecimalFormat extends NumberFormat {
// [Spark/CDL] Add attribute for infinity here.
result.append(symbols.getInfinity());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (parseAttr) {
addAttribute(Field.INTEGER, result.length()
- symbols.getInfinity().length(), result.length());
@ -974,7 +976,8 @@ public class DecimalFormat extends NumberFormat {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* Format a BigDecimal number.
@ -1204,7 +1207,8 @@ public class DecimalFormat extends NumberFormat {
if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) {
fieldPosition.setEndIndex(result.length());
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add attribute for integer part
if (parseAttr) {
intEnd = result.length();
@ -1212,7 +1216,8 @@ public class DecimalFormat extends NumberFormat {
}
//#endif
result.append(decimal);
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add attribute for decimal separator
if (parseAttr) {
// Length of decimal separator is 1.
@ -1248,7 +1253,8 @@ public class DecimalFormat extends NumberFormat {
}
fieldPosition.setEndIndex(result.length());
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Calcuate the end index of integer part and fractional
// part if they are not properly processed yet.
if (parseAttr) {
@ -1266,7 +1272,8 @@ public class DecimalFormat extends NumberFormat {
// digits, since truncating the exponent would result in an
// unacceptable inaccuracy.
result.append(symbols.getExponentSeparator());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] For exponent symbol, add an attribute.
if (parseAttr) {
addAttribute(Field.EXPONENT_SYMBOL, result.length()
@ -1283,7 +1290,8 @@ public class DecimalFormat extends NumberFormat {
if (negativeExponent) {
exponent = -exponent;
result.append(symbols.getMinusSign());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] If exponent has sign, then add an exponent sign
// attribute.
if (parseAttr) {
@ -1294,7 +1302,8 @@ public class DecimalFormat extends NumberFormat {
//#endif
} else if (exponentSignAlwaysShown) {
result.append(symbols.getPlusSign());
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add an plus sign attribute.
if (parseAttr) {
// Length of exponent sign is 1.
@ -1318,7 +1327,8 @@ public class DecimalFormat extends NumberFormat {
result.append((i < digitList.count) ?
(char)(digitList.digits[i] + zeroDelta) : zero);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add attribute for exponent part.
if (parseAttr) {
addAttribute(Field.EXPONENT, expBegin, result.length());
@ -1385,7 +1395,8 @@ public class DecimalFormat extends NumberFormat {
// Output grouping separator if necessary.
if (isGroupingPosition(i)) {
result.append(grouping);
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add grouping separator attribute here.
if (parseAttr) {
// Length of grouping separator is 1.
@ -1411,7 +1422,8 @@ 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
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add attribute for integer part.
if (parseAttr) {
addAttribute(Field.INTEGER, intBegin, result.length());
@ -1421,7 +1433,8 @@ public class DecimalFormat extends NumberFormat {
if (decimalSeparatorAlwaysShown || fractionPresent)
{
result.append(decimal);
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add attribute for decimal separator
if (parseAttr) {
addAttribute(Field.DECIMAL_SEPARATOR, result.length() - 1,
@ -1488,7 +1501,8 @@ public class DecimalFormat extends NumberFormat {
if (fieldPosition.getField() == NumberFormat.FRACTION_FIELD) {
fieldPosition.setEndIndex(result.length());
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Add attribute information if necessary.
if (parseAttr && (decimalSeparatorAlwaysShown || fractionPresent)) {
addAttribute(Field.FRACTION, fracBegin, result.length());
@ -2506,19 +2520,20 @@ public class DecimalFormat extends NumberFormat {
* @see #setRoundingMode
* @stable ICU 2.0
*/
//#ifndef FOUNDATION
public java.math.BigDecimal getRoundingIncrement() {
if (roundingIncrementICU == null) return null;
return roundingIncrementICU.toBigDecimal();
}
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//## public BigDecimal getRoundingIncrement() {
//## if (roundingIncrementICU == null) return null;
//## return new BigDecimal(roundingIncrementICU.toString());
//## }
//#else
public java.math.BigDecimal getRoundingIncrement() {
if (roundingIncrementICU == null) return null;
return roundingIncrementICU.toBigDecimal();
}
//#endif
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* Set the rounding increment. This method also controls whether
@ -3282,7 +3297,8 @@ public class DecimalFormat extends NumberFormat {
} else {
affix = isNegative ? negativeSuffix : positiveSuffix;
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// [Spark/CDL] Invoke formatAffix2Attribute to add attributes for affix
if (parseAttr) {
int offset = affix.indexOf(symbols.getCurrencySymbol());
@ -3300,7 +3316,8 @@ public class DecimalFormat extends NumberFormat {
return affix.length();
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
* [Spark/CDL] This is a newly added method, used to add attributes for
* prefix and suffix.
@ -3322,7 +3339,8 @@ public class DecimalFormat extends NumberFormat {
}
//#endif
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/*
* [Spark/CDL] Use this method to add attribute.
*/
@ -3334,7 +3352,8 @@ public class DecimalFormat extends NumberFormat {
}
//#endif
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Format the object to an attributed string, and return the corresponding iterator
* Overrides superclass method.
@ -4376,7 +4395,8 @@ public class DecimalFormat extends NumberFormat {
return parseBigDecimal;
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
private void writeObject(ObjectOutputStream stream) throws IOException {
// Doug, do we need this anymore?
// if (roundingIncrementICU != null) {
@ -4440,7 +4460,8 @@ public class DecimalFormat extends NumberFormat {
serialVersionOnStream = currentSerialVersion;
digitList = new DigitList();
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (roundingIncrement != null) {
setInternalRoundingIncrement(new BigDecimal(roundingIncrement));
setRoundingDouble();
@ -4451,7 +4472,8 @@ public class DecimalFormat extends NumberFormat {
private void setInternalRoundingIncrement(BigDecimal value) {
roundingIncrementICU = value;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
roundingIncrement = value == null ? null : value.toBigDecimal();
//#endif
}
@ -4669,7 +4691,8 @@ public class DecimalFormat extends NumberFormat {
*/
private boolean exponentSignAlwaysShown = false;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* The value to which numbers are rounded during formatting. For example,
@ -4898,7 +4921,7 @@ public class DecimalFormat extends NumberFormat {
*/
static final int MAX_SCIENTIFIC_INTEGER_DIGITS = 8;
//#ifdef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## // we're not compatible with other versions, since we have no java.math.BigDecimal field
//## private static final long serialVersionUID = 2;
//#else

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2005, International Business Machines Corporation and *
@ -228,7 +228,8 @@ final class DigitList {
return stringRep.toString();
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Return a <code>BigDecimal</code> representing the value stored in this
* <code>DigitList</code>.
@ -660,7 +661,8 @@ final class DigitList {
round(fixedPoint ? (maximumDigits + decimalAt) : maximumDigits == 0 ? -1 : maximumDigits);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Set the digit list to a representation of the given BigDecimal value.
* [bnf]

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
**********************************************************************
* Copyright (c) 2004-2007, International Business Machines
@ -1125,7 +1125,8 @@ public class MessageFormat extends UFormat {
}
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Formats an array of objects and inserts them into the
* <code>MessageFormat</code>'s pattern, producing an
@ -1477,7 +1478,8 @@ public class MessageFormat extends UFormat {
return pattern.hashCode(); // enough for reasonable distribution
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Defines constants that are used as attribute keys in the
* <code>AttributedCharacterIterator</code> returned
@ -1686,7 +1688,12 @@ public class MessageFormat extends UFormat {
// is non-null indicating we should format obj using it,
// or arg is non-null and we should use it as the value.
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//## if (subFormatter != null) {
//## arg = subFormatter.format(obj);
//## }
//## result.append(arg);
//#else
if (characterIterators != null) {
// If characterIterators is non-null, it indicates we need
// to get the CharacterIterator from the child formatter.
@ -1731,16 +1738,12 @@ public class MessageFormat extends UFormat {
}
last = result.length();
}
//#else
//## if (subFormatter != null) {
//## arg = subFormatter.format(obj);
//## }
//## result.append(arg);
//#endif
}
}
result.append(pattern.substring(lastOffset, pattern.length()));
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (characterIterators != null && last != result.length()) {
characterIterators.add(_createAttributedCharacterIterator(
result.substring(last)));
@ -2208,7 +2211,8 @@ public class MessageFormat extends UFormat {
return new String(buf);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
//
// private methods for AttributedCharacterIterator support
//

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -192,7 +192,8 @@ public abstract class NumberFormat extends UFormat {
return format(((Long)number).longValue(), toAppendTo, pos);
} else if (number instanceof BigInteger) {
return format((BigInteger) number, toAppendTo, pos);
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
} else if (number instanceof java.math.BigDecimal) {
return format((java.math.BigDecimal) number, toAppendTo, pos);
//#endif
@ -248,7 +249,8 @@ public abstract class NumberFormat extends UFormat {
new FieldPosition(0)).toString();
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* Convenience method to format a BigDecimal.
@ -307,7 +309,8 @@ public abstract class NumberFormat extends UFormat {
public abstract StringBuffer format(BigInteger number,
StringBuffer toAppendTo,
FieldPosition pos);
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* Format a BigDecimal.
@ -1537,7 +1540,8 @@ public abstract class NumberFormat extends UFormat {
// new in ICU4J 3.6
private boolean parseStrict;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* The instances of this inner class are used as attribute keys and values
* in AttributedCharacterIterator that

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2005-2007 International Business Machines Corporation and *
@ -72,7 +72,7 @@ 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
//#if defined(FOUNDATION10) || defined(J2SE13)
//## RuntimeException rte = new RuntimeException("RuleBasedBreakIterator rule compilation internal error:");
//#else
RuntimeException rte = new RuntimeException("RuleBasedBreakIterator rule compilation internal error:", e);

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -13,10 +13,10 @@ import java.text.ParseException;
import java.util.Arrays;
import java.util.MissingResourceException;
//#ifndef FOUNDATION
import java.nio.ByteBuffer;
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//##import com.ibm.icu.impl.ByteBuffer;
//#else
import java.nio.ByteBuffer;
//#endif
import com.ibm.icu.impl.BOCU;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -1083,7 +1083,8 @@ public class RuleBasedNumberFormat extends NumberFormat {
return format(new com.ibm.icu.math.BigDecimal(number), toAppendTo, pos);
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* <strong><font face=helvetica color=red>NEW</font></strong>
* Implement com.ibm.icu.text.NumberFormat:

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -553,7 +553,8 @@ public class SimpleDateFormat extends DateFormat {
toAppendTo.append((String)items[i]);
} else {
PatternItem item = (PatternItem)items[i];
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
int start = 0;
if (attributes != null) {
// Save the current length
@ -565,7 +566,8 @@ public class SimpleDateFormat extends DateFormat {
} else {
toAppendTo.append(subFormat(item.type, item.length, toAppendTo.length(), pos, formatData, cal));
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (attributes != null) {
// Check the sub format length
int end = toAppendTo.length();
@ -632,7 +634,8 @@ public class SimpleDateFormat extends DateFormat {
/*Qq*/ DateFormat.QUARTER_FIELD, DateFormat.STANDALONE_QUARTER_FIELD,
};
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// Map pattern character index to DateFormat.Field
private static final DateFormat.Field[] PATTERN_INDEX_TO_DATE_FORMAT_ATTRIBUTE = {
/*GyM*/ DateFormat.Field.ERA, DateFormat.Field.YEAR, DateFormat.Field.MONTH,
@ -2159,7 +2162,8 @@ public class SimpleDateFormat extends DateFormat {
initLocalZeroPaddingNumberFormat();
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Format the object to an attributed string, and return the corresponding iterator
* Overrides superclass method.

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -258,7 +258,8 @@ public final class UTF16 {
return single; // return unmatched surrogate
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Extract a single UTF-32 value from a string. Used when iterating forwards or backwards (with
* <code>UTF16.getCharCount()</code>, as well as random access. If a validity check is

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 1996-2007, International Business Machines Corporation and *
@ -917,7 +917,8 @@ public class UnicodeSet extends UnicodeFilter implements Freezable {
return maxLen;
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Tests whether the text matches at the offset. If so, returns the end of the longest substring that it matches. If not, returns -1.
* @internal

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/**
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
@ -8,10 +8,10 @@
package com.ibm.icu.util;
//#ifndef FOUNDATION
import java.nio.ByteBuffer;
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//##import com.ibm.icu.impl.ByteBuffer;
//#else
import java.nio.ByteBuffer;
//#endif
import com.ibm.icu.impl.Utility;

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2004-2007, International Business Machines Corporation and *
@ -18,7 +18,8 @@ import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.TreeMap;
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//#endif
@ -249,7 +250,8 @@ public class GlobalizationPreferences implements Freezable {
return setLocales(new ULocale[]{uLocale});
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
/**
* Convenience routine for setting the locale priority list from
* an Accept-Language string.
@ -654,7 +656,8 @@ public class GlobalizationPreferences implements Freezable {
// fix other hacks
// hack for couldn't match
// note, compiling with FOUNDATION omits this check for now
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
if (badTimeZone.reset(result).matches()) continue;
//#endif
break;
@ -670,7 +673,8 @@ public class GlobalizationPreferences implements Freezable {
}
return result;
}
//#ifndef FOUNDATION
//#if defined(FOUNDATION10) || defined(J2SE13)
//#else
// TODO remove need for this
private static final Matcher badTimeZone = Pattern.compile("[A-Z]{2}|.*\\s\\([A-Z]{2}\\)").matcher("");
//#endif

View file

@ -1,4 +1,4 @@
//##header
//##header J2SE15
/*
*******************************************************************************
* Copyright (C) 2004-2007, International Business Machines Corporation and *
@ -22,10 +22,10 @@ import com.ibm.icu.impl.ICUResourceBundleReader;
import com.ibm.icu.impl.ResourceBundleWrapper;
import com.ibm.icu.util.ULocale;
//#ifndef FOUNDATION
import java.nio.ByteBuffer;
//#else
//#if defined(FOUNDATION10) || defined(J2SE13)
//##import com.ibm.icu.impl.ByteBuffer;
//#else
import java.nio.ByteBuffer;
//#endif
/**