From a017433ed5056c15b17bc36cf1313edba6f3aa4f Mon Sep 17 00:00:00 2001 From: Yoshito Umaoka Date: Wed, 24 Sep 2008 22:25:52 +0000 Subject: [PATCH] ICU-6549 Fix Java 1.3/1.4 build and test issues. Fix some JavaDoc warnings. X-SVN-Rev: 24638 --- icu4j/preprocessor.txt | 5 +++ .../dev/test/calendar/CalendarRegression.java | 9 +++++ .../dev/test/calendar/CompatibilityTest.java | 9 +++++ .../test/collator/IndexCharactersTest.java | 4 ++ .../dev/test/serializable/FormatTests.java | 5 ++- .../test/timezone/TimeZoneBoundaryTest.java | 10 ++++- .../icu/dev/test/timezone/TimeZoneTest.java | 2 +- icu4j/src/com/ibm/icu/text/DecimalFormat.java | 2 +- .../src/com/ibm/icu/text/IndexCharacters.java | 37 ++++++++++--------- .../com/ibm/icu/text/SimpleDateFormat.java | 2 +- .../src/com/ibm/icu/text/TimeUnitFormat.java | 2 +- 11 files changed, 63 insertions(+), 24 deletions(-) diff --git a/icu4j/preprocessor.txt b/icu4j/preprocessor.txt index 800c024169d..909c8b6d286 100644 --- a/icu4j/preprocessor.txt +++ b/icu4j/preprocessor.txt @@ -17,6 +17,7 @@ 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/IndexCharacters.java src/com/ibm/icu/text/MessageFormat.java src/com/ibm/icu/text/NumberFormat.java src/com/ibm/icu/text/RuleBasedCollator.java @@ -31,8 +32,11 @@ src/com/ibm/icu/util/UResourceBundle.java 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/calendar/CalendarRegression.java +src/com/ibm/icu/dev/test/calendar/CompatibilityTest.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/IndexCharactersTest.java src/com/ibm/icu/dev/test/collator/RandomCollator.java src/com/ibm/icu/dev/test/duration/ICUDurationTest.java src/com/ibm/icu/dev/test/format/BigNumberFormatTest.java @@ -52,6 +56,7 @@ 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/TimeZoneBoundaryTest.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 diff --git a/icu4j/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java b/icu4j/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java index 7bce6e6d09a..346b5591034 100644 --- a/icu4j/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java +++ b/icu4j/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java @@ -1,3 +1,4 @@ +//##header J2SE15 /** ******************************************************************************* * Copyright (C) 2000-2008, International Business Machines Corporation and * @@ -815,6 +816,13 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk { if (!cal.getTime().equals(epoch)) errln("Fail: after clear() expect " + epoch + ", got " + cal.getTime()); +//#if defined(FOUNDATION10) || defined(J2SE13) +//## // This test case does not work well with JRE1.3 with +//## // the timezone update for US 2007 rule. Java 1.3 only +//## // supports single DST rule for all years. March 15 +//## // was not in DST before, but with the new rule, it is +//## // in DST. +//#else cal.setTime(d11); cal.clear( Calendar.MONTH ); logln(cal.getTime().toString()); @@ -822,6 +830,7 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk { errln("Fail: " + d11 + " clear(MONTH) => expect " + dM + ", got " + cal.getTime()); } +//#endif } public void Test4114578() { diff --git a/icu4j/src/com/ibm/icu/dev/test/calendar/CompatibilityTest.java b/icu4j/src/com/ibm/icu/dev/test/calendar/CompatibilityTest.java index e77bf835da7..f9f96302033 100644 --- a/icu4j/src/com/ibm/icu/dev/test/calendar/CompatibilityTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/calendar/CompatibilityTest.java @@ -1,3 +1,4 @@ +//##header J2SE15 /** ******************************************************************************* * Copyright (C) 2000-2008, International Business Machines Corporation and * @@ -338,6 +339,13 @@ public class CompatibilityTest extends com.ibm.icu.dev.test.TestFmwk { logln(" Got: " + cal.getTime() + " Expected: " + tempcal.getTime()); } +//#if defined(FOUNDATION10) || defined(J2SE13) +//## // This test case does not work well with JRE1.3 with +//## // the timezone update for US 2007 rule. Java 1.3 only +//## // supports single DST rule for all years. April 2, 1985 +//## // was actually not in DST, but with the new rule, the date +//## // is in DST (which is actually wrong). +//#else cal.clear(); cal.set(1985, 3, 2, 11, 49); tempcal.clear(); @@ -346,6 +354,7 @@ public class CompatibilityTest extends com.ibm.icu.dev.test.TestFmwk { errln("FAIL: Calendar.set(5 args) failed"); logln(" Got: " + cal.getTime() + " Expected: " + tempcal.getTime()); } +//#endif cal.clear(); cal.set(1995, 9, 12, 1, 39, 55); diff --git a/icu4j/src/com/ibm/icu/dev/test/collator/IndexCharactersTest.java b/icu4j/src/com/ibm/icu/dev/test/collator/IndexCharactersTest.java index 04cbf79d1e3..3316a4bf69f 100644 --- a/icu4j/src/com/ibm/icu/dev/test/collator/IndexCharactersTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/collator/IndexCharactersTest.java @@ -1,3 +1,6 @@ +//##header J2SE15 +//#if defined(FOUNDATION10) || defined(J2SE13) +//#else /* ******************************************************************************* * Copyright (C) 2008, International Business Machines Corporation and * @@ -78,3 +81,4 @@ public class IndexCharactersTest extends TestFmwk { } } } +//#endif diff --git a/icu4j/src/com/ibm/icu/dev/test/serializable/FormatTests.java b/icu4j/src/com/ibm/icu/dev/test/serializable/FormatTests.java index 65f9c89ef71..3b6820497a8 100644 --- a/icu4j/src/com/ibm/icu/dev/test/serializable/FormatTests.java +++ b/icu4j/src/com/ibm/icu/dev/test/serializable/FormatTests.java @@ -1100,7 +1100,8 @@ public class FormatTests formats[i] = getCannedDecimalFormat("#,##0.###", uloc); } - +//#if defined(FOUNDATION10) || defined(J2SE13) +//#else if (formats[0] != null) { // Ticket#6449 // Once formatToCharacterIterator is called, NumberFormat.Field @@ -1113,7 +1114,7 @@ public class FormatTests AttributedCharacterIterator aci = formats[0].formatToCharacterIterator(new Double(12.345D)); if (aci == null) {} // NOP - for resolving 'Unused local variable' warning. } - +//#endif return formats; } } diff --git a/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneBoundaryTest.java b/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneBoundaryTest.java index 85a5a3c7847..5f470329d30 100644 --- a/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneBoundaryTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneBoundaryTest.java @@ -1,6 +1,7 @@ +//##header J2SE15 /** ******************************************************************************* - * Copyright (C) 2000-2005, International Business Machines Corporation and * + * Copyright (C) 2000-2008, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -430,6 +431,12 @@ public class TimeZoneBoundaryTest extends TestFmwk TimeZone.setDefault(save); } +//#if defined(FOUNDATION10) || defined(J2SE13) +//## // This test case does not work well with JRE1.3 with +//## // the timezone update for US 2007 rule. Java 1.3 only +//## // supports single DST rule for all years. Thus, the +//## // new rule is also applied to year 1997 incorrectly. +//#else if (true) { // This only works in PST/PDT @@ -441,6 +448,7 @@ public class TimeZoneBoundaryTest extends TestFmwk tempcal.set(1997, 6, 1); findDaylightBoundaryUsingDate(tempcal.getTime(), "PDT", PST_1997_END); } +//#endif // if (true) // { diff --git a/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java b/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java index 4a299e8603c..58216ac0163 100644 --- a/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java @@ -1439,7 +1439,7 @@ public class TimeZoneTest extends TestFmwk int dstSavings = jdkCal.get(java.util.Calendar.DST_OFFSET); int[] offsets = new int[2]; - icuCaracas.getOffset(jdkCal.getTimeInMillis(), false, offsets); + icuCaracas.getOffset(jdkCal.getTime().getTime()/*jdkCal.getTimeInMillis()*/, false, offsets); boolean isTimeZoneSynchronized = true; diff --git a/icu4j/src/com/ibm/icu/text/DecimalFormat.java b/icu4j/src/com/ibm/icu/text/DecimalFormat.java index 83001e054e5..09af677e41b 100644 --- a/icu4j/src/com/ibm/icu/text/DecimalFormat.java +++ b/icu4j/src/com/ibm/icu/text/DecimalFormat.java @@ -4487,7 +4487,7 @@ public class DecimalFormat extends NumberFormat { return parseBigDecimal; } -//#if defined(FOUNDATION10) +//#if defined(FOUNDATION10) || defined(J2SE13) //#else private void writeObject(ObjectOutputStream stream) throws IOException { // Doug, do we need this anymore? diff --git a/icu4j/src/com/ibm/icu/text/IndexCharacters.java b/icu4j/src/com/ibm/icu/text/IndexCharacters.java index c12b9b011a9..db5cdaeb8ad 100644 --- a/icu4j/src/com/ibm/icu/text/IndexCharacters.java +++ b/icu4j/src/com/ibm/icu/text/IndexCharacters.java @@ -1,3 +1,6 @@ +//##header J2SE15 +//#if defined(FOUNDATION10) || defined(J2SE13) +//#else /* ******************************************************************************* * Copyright (C) 2008, Google Inc, International Business Machines Corporation @@ -58,7 +61,8 @@ import com.ibm.icu.impl.CollectionUtilities.MultiComparator; * * * @author markdavis - * @draft + * @draft ICU 4.2 + * @provisional This API might change or be removed in a future release. */ //TODO(markdavis) return an additional character that is the "least greater" character than //the last character. @@ -79,7 +83,8 @@ public class IndexCharacters { /** * Create the index object. * @param locale - * @draft + * @draft ICU 4.2 + * @provisional This API might change or be removed in a future release. */ public IndexCharacters(ULocale locale) { this.locale = locale; @@ -168,13 +173,11 @@ public class IndexCharacters { indexCharacters = Collections.unmodifiableSet(indexCharacters); } - /** + /* * Return the string with interspersed CGJs. Input must have more than 2 codepoints. - * @param item - * @return */ private String separated(String item) { - StringBuilder result = new StringBuilder(); + StringBuffer result = new StringBuffer(); // add a CGJ except within surrogates char last = item.charAt(0); result.append(last); @@ -191,8 +194,9 @@ public class IndexCharacters { /** * Get the index characters. - * @return - * @draft + * @return A collection including the index characters + * @draft ICU 4.2 + * @provisional This API might change or be removed in a future release. */ public Collection getIndexCharacters() { return indexCharacters; @@ -200,8 +204,9 @@ public class IndexCharacters { /** * Get the locale - * @return - * @draft + * @return The locale. + * @draft ICU 4.2 + * @provisional This API might change or be removed in a future release. */ public ULocale getLocale() { return locale; @@ -210,8 +215,7 @@ public class IndexCharacters { /** * As the index is built, items may be discarded from the exemplars. * This contains some of the discards, and is intended for debugging. - * @return - * @draft + * @internal */ public Map getAlreadyIn() { return alreadyIn; @@ -220,8 +224,7 @@ public class IndexCharacters { /** * As the index is built, items may be discarded from the exemplars. * This contains some of the discards, and is intended for debugging. - * @return - * @draft + * @internal */ public List getNoDistinctSorting() { return noDistinctSorting; @@ -230,14 +233,13 @@ public class IndexCharacters { /** * As the index is built, items may be discarded from the exemplars. * This contains some of the discards, and is intended for debugging. - * @return - * @draft + * @internal */ public List getNotAlphabetic() { return notAlphabetic; } - /** + /* * Comparator that returns "better" items first, where shorter NFKD is better, * and otherwise NFKD binary order is better, and otherwise binary order is better. */ @@ -269,3 +271,4 @@ public class IndexCharacters { } } } +//#endif diff --git a/icu4j/src/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/src/com/ibm/icu/text/SimpleDateFormat.java index 356527ea1d1..37f2b9a7f33 100644 --- a/icu4j/src/com/ibm/icu/text/SimpleDateFormat.java +++ b/icu4j/src/com/ibm/icu/text/SimpleDateFormat.java @@ -175,7 +175,7 @@ import com.ibm.icu.util.ULocale; * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" * would be interpreted as May 4, 1964. * During parsing, only strings consisting of exactly two digits, as defined by - * {@link UCharacter#isDigit(char)}, will be parsed into the default + * {@link com.ibm.icu.lang.UCharacter#isDigit(int)}, will be parsed into the default * century. * Any other numeric string, such as a one digit string, a three or more digit * string, or a two digit string that isn't all digits (for example, "-1"), is diff --git a/icu4j/src/com/ibm/icu/text/TimeUnitFormat.java b/icu4j/src/com/ibm/icu/text/TimeUnitFormat.java index 7bcae35f320..9ed3ed8048c 100644 --- a/icu4j/src/com/ibm/icu/text/TimeUnitFormat.java +++ b/icu4j/src/com/ibm/icu/text/TimeUnitFormat.java @@ -246,7 +246,7 @@ public class TimeUnitFormat extends MeasureFormat { /** * Parse a TimeUnitAmount. - * @see java.text.Format#parse(java.lang.String, java.text.FieldPosition) + * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition) * @draft ICU 4.0 * @provisional This API might change or be removed in a future release. */