Compare commits

...

12 Commits

Author SHA1 Message Date
Severin Gehwolf
19a1861dc6 8220283: ZGC fails to build on GCC 4.4.7: ATTRIBUTE_ALIGNED compatibility issue
Reviewed-by: shade, kbarrett
2019-03-07 16:15:43 +01:00
Thomas Stuefe
a044cb6765 8219650: [Testbug] Fix potential crashes in new test hotspot gtest "test_print_hex_dump"
Reviewed-by: clanger, shade
2019-02-28 14:22:03 +01:00
Goetz Lindenmaier
90a85a8562 8219651: compiler/ciReplay/TestServerVM.java is failing on windows
Reviewed-by: thartmann, kvn
2019-03-06 16:01:01 +01:00
Gerard Ziemski
a433cf3043 8219789: [TESTBUG] TestOptionsWithRanges.java produces hs_err_pidXXXXX.log file for VMThreadStackSize=9007199254740991
Excluded test of mac range for VMThreadStackSize

Reviewed-by: coleenp, mseledtsov
2019-02-28 10:55:07 -06:00
Goetz Lindenmaier
25a64a5c95 Merge 2019-03-06 08:34:36 +01:00
Goetz Lindenmaier
3135657b8c Added tag jdk-11.0.3+2 for changeset 9de3f198995c 2019-03-06 08:31:59 +01:00
Goetz Lindenmaier
5783d96313 8219714: [testbug] com/sun/jdi/RedefineNestmateAttr/TestNestmateAttr.java must pass classpath to subprocess
Reviewed-by: dholmes, dcubed
2019-02-28 13:53:38 +01:00
Naoto Sato
bc51902963 8217609: New era placeholder not recognized by java.text.SimpleDateFormat
Reviewed-by: nishjain, rriggs
2019-01-29 07:46:50 -08:00
Man Cao
ed67ef92eb 8210192: Hsperf counter ParNew::CMS should be ParNew:CMS
Rename the counter back to ParNew:CMS and added a test

Reviewed-by: sjohanss, tschatzl
2018-09-04 14:17:45 -07:00
Alexey Ivanov
7ba299958a 8214122: JDWP is broken on 32 bit Windows: transport library missing onLoad entry
Reviewed-by: ihse, dcubed
2018-12-20 12:44:41 +00:00
Deepak Kejriwal
6999da7599 8206120: Add test cases for lenient Japanese era parsing
8211398: Square character support for the Japanese new era
8218915: Change isJavaIdentifierStart and isJavaIdentifierPart to handle new code points

Reviewed-by: coffeys, naoto
2019-02-22 16:15:00 +05:30
Christoph Langer
3de15e37c0 Added tag jdk-11.0.3+1 for changeset cd1c042181e9 2019-02-27 12:43:47 +01:00
24 changed files with 572 additions and 29 deletions

View File

@@ -533,3 +533,5 @@ fe85e2f43a1c893cb410308106b0f31b814aebb8 jdk-11.0.2+8
a01e0cc0105972acc3b5e213dbe2b84acaee5be3 jdk-11.0.2-ga
0000000000000000000000000000000000000000 jdk-11.0.2-ga
144d476b6efe527c5e9ebf19af93398913c5450f jdk-11.0.2-ga
cd1c042181e934a1a91f9ee59a0066f64c8bad7a jdk-11.0.3+1
9de3f198995c6c384fd6431c97089c311ec6a7ff jdk-11.0.3+2

View File

@@ -105,11 +105,21 @@ class CharacterData00 extends CharacterData {
}
boolean isJavaIdentifierStart(int ch) {
// isJavaIdentifierStart strictly conforms to code points assigned
// in Unicode 10.0. Since code point {32FF} is not from Unicode 10.0,
// return false.
if(ch == 0x32FF)
return false;
int props = getProperties(ch);
return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
}
boolean isJavaIdentifierPart(int ch) {
// isJavaIdentifierPart strictly conforms to code points assigned
// in Unicode 10.0. Since code point {32FF} is not from Unicode 10.0,
// return false.
if(ch == 0x32FF)
return false;
int props = getProperties(ch);
return ((props & $$nonzeroJavaPart) != 0);
}

View File

@@ -11729,6 +11729,7 @@
32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;;
32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;;
32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;;
32FF;SQUARE ERA NAME NEWERA;So;0;L;<square> 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;;
3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;;
3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;;
3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ enum CalendarType {
{0, 2}, // generic
{0, 2}, // gregorian
{0, 1}, // buddhist
{232, 4}, // japanese (eras from Meiji)
{232, 5}, // japanese (eras from Meiji)
{0, 2}, // roc (Minguo)
{0, 1}, // islamic (Hijrah)
{0, 1}, // islamic-civil (same as islamic)

View File

@@ -69,7 +69,7 @@ CMSHeap::CMSHeap(GenCollectorPolicy *policy) :
GenCollectedHeap(policy,
Generation::ParNew,
Generation::ConcurrentMarkSweep,
"ParNew::CMS"),
"ParNew:CMS"),
_eden_pool(NULL),
_survivor_pool(NULL),
_old_pool(NULL) {

View File

@@ -873,6 +873,8 @@ void os::abort(bool dump_core) {
void os::print_hex_dump(outputStream* st, address start, address end, int unitsize) {
assert(unitsize == 1 || unitsize == 2 || unitsize == 4 || unitsize == 8, "just checking");
start = align_down(start, unitsize);
int cols = 0;
int cols_per_line = 0;
switch (unitsize) {

View File

@@ -280,6 +280,9 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 and
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017
//
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x+0)))
// GCC versions older than 4.6.4 would fail even with "+0", and needs additional
// cast to typeof(x) to work around the similar bug.
//
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned((typeof(x))x+0)))
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP

View File

@@ -5396,7 +5396,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
0x3260, // 3260..327E; HANGUL
0x327F, // 327F..32CF; COMMON
0x32D0, // 32D0..32FE; KATAKANA
0x32FF, // 32FF ; UNKNOWN
0x32FF, // 32FF ; COMMON
0x3300, // 3300..3357; KATAKANA
0x3358, // 3358..33FF; COMMON
0x3400, // 3400..4DB5; HAN
@@ -6913,7 +6913,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
HANGUL, // 3260..327E
COMMON, // 327F..32CF
KATAKANA, // 32D0..32FE
UNKNOWN, // 32FF
COMMON, // 32FF
KATAKANA, // 3300..3357
COMMON, // 3358..33FF
HAN, // 3400..4DB5

View File

@@ -95,6 +95,13 @@ findTransportOnLoad(void *handle)
if (handle == NULL) {
return onLoad;
}
#if defined(_WIN32) && !defined(_WIN64)
onLoad = (jdwpTransport_OnLoad_t)
dbgsysFindLibraryEntry(handle, "_jdwpTransport_OnLoad@16");
if (onLoad != NULL) {
return onLoad;
}
#endif
onLoad = (jdwpTransport_OnLoad_t)
dbgsysFindLibraryEntry(handle, "jdwpTransport_OnLoad");
return onLoad;

View File

@@ -3633,6 +3633,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/
<era type="233">大正</era>
<era type="234">昭和</era>
<era type="235">平成</era>
<era type="236">元号</era> <!-- NewEra -->
</eraAbbr>
<eraNarrow>
<era type="0">大化</era>
@@ -3871,6 +3872,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/
<era type="233">T</era>
<era type="234">S</era>
<era type="235">H</era>
<era type="236">N</era> <!-- NewEra -->
</eraNarrow>
</eras>
<dateFormats>

View File

@@ -2030,6 +2030,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/
<era type="233">Taishō</era>
<era type="234">Shōwa</era>
<era type="235">Heisei</era>
<era type="236">NewEra</era> <!-- NewEra -->
</eraAbbr>
<eraNarrow>
<era type="0">Taika (645650)</era>
@@ -2268,6 +2269,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/
<era type="233">T</era>
<era type="234">S</era>
<era type="235">H</era>
<era type="236">N</era> <!-- NewEra -->
</eraNarrow>
</eras>
<dateFormats>

View File

@@ -153,28 +153,81 @@ TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") {
}
#endif
TEST(os, test_print_hex_dump) {
static void do_test_print_hex_dump(address addr, size_t len, int unitsize, const char* expected) {
char buf[256];
buf[0] = '\0';
stringStream ss(buf, sizeof(buf));
os::print_hex_dump(&ss, addr, addr + len, unitsize);
// tty->print_cr("expected: %s", expected);
// tty->print_cr("result: %s", buf);
ASSERT_NE(strstr(buf, expected), (char*)NULL);
}
TEST_VM(os, test_print_hex_dump) {
const char* pattern [4] = {
#ifdef VM_LITTLE_ENDIAN
"00 01 02 03 04 05 06 07",
"0100 0302 0504 0706",
"03020100 07060504",
"0706050403020100"
#else
"00 01 02 03 04 05 06 07",
"0001 0203 0405 0607",
"00010203 04050607",
"0001020304050607"
#endif
};
const char* pattern_not_readable [4] = {
"?? ?? ?? ?? ?? ?? ?? ??",
"???? ???? ???? ????",
"???????? ????????",
"????????????????"
};
// On AIX, zero page is readable.
address unreadable =
#ifdef AIX
(address) 0xFFFFFFFFFFFF0000ULL;
#else
(address) 0
#endif
;
ResourceMark rm;
stringStream ss;
char buf[64];
stringStream ss(buf, sizeof(buf));
outputStream* out = &ss;
// outputStream* out = tty; // enable for printout
// Test dumping unreadable memory does not fail
os::print_hex_dump(out, (address)0, (address)100, 1);
os::print_hex_dump(out, (address)0, (address)100, 2);
os::print_hex_dump(out, (address)0, (address)100, 4);
os::print_hex_dump(out, (address)0, (address)100, 8);
// Test dumping unreadable memory
// Exclude test for Windows for now, since it needs SEH handling to work which cannot be
// guaranteed when we call directly into VM code. (see JDK-8220220)
#ifndef _WIN32
do_test_print_hex_dump(unreadable, 100, 1, pattern_not_readable[0]);
do_test_print_hex_dump(unreadable, 100, 2, pattern_not_readable[1]);
do_test_print_hex_dump(unreadable, 100, 4, pattern_not_readable[2]);
do_test_print_hex_dump(unreadable, 100, 8, pattern_not_readable[3]);
#endif
// Test dumping readable memory does not fail
char arr[100];
// Test dumping readable memory
address arr = (address)os::malloc(100, mtInternal);
for (int c = 0; c < 100; c++) {
arr[c] = c;
}
address addr = (address)&arr;
os::print_hex_dump(out, addr, addr + 100, 1);
os::print_hex_dump(out, addr, addr + 100, 2);
os::print_hex_dump(out, addr, addr + 100, 4);
os::print_hex_dump(out, addr, addr + 100, 8);
// properly aligned
do_test_print_hex_dump(arr, 100, 1, pattern[0]);
do_test_print_hex_dump(arr, 100, 2, pattern[1]);
do_test_print_hex_dump(arr, 100, 4, pattern[2]);
do_test_print_hex_dump(arr, 100, 8, pattern[3]);
// Not properly aligned. Should automatically down-align by unitsize
do_test_print_hex_dump(arr + 1, 100, 2, pattern[1]);
do_test_print_hex_dump(arr + 1, 100, 4, pattern[2]);
do_test_print_hex_dump(arr + 1, 100, 8, pattern[3]);
os::free(arr);
}
//////////////////////////////////////////////////////////////////////////////

View File

@@ -289,7 +289,7 @@ public abstract class CiReplayBase {
try {
String cmd = ProcessTools.getCommandLine(ProcessTools.createJavaProcessBuilder(true, args));
return new String[]{"sh", "-c", prefix
+ (Platform.isWindows() ? cmd.replace('\\', '/').replace(";", "\\;") : cmd)};
+ (Platform.isWindows() ? cmd.replace('\\', '/').replace(";", "\\;").replace("|", "\\|") : cmd)};
} catch(Throwable t) {
throw new Error("Can't create process builder: " + t, t);
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import static jdk.test.lib.Asserts.*;
import gc.testlibrary.PerfCounter;
import gc.testlibrary.PerfCounters;
/* @test TestPolicyNamePerfCounter
* @bug 8210192
* @requires vm.gc=="null"
* @library /test/lib /
* @summary Tests that sun.gc.policy.name returns expected values for different GCs.
* @modules java.base/jdk.internal.misc
* java.compiler
* java.management/sun.management
* jdk.internal.jvmstat/sun.jvmstat.monitor
* @run main/othervm -XX:+UsePerfData -XX:+UseSerialGC TestPolicyNamePerfCounter Copy:MSC
* @run main/othervm -XX:+UsePerfData -XX:+UseParallelGC TestPolicyNamePerfCounter ParScav:MSC
* @run main/othervm -XX:+UsePerfData -XX:+UseG1GC TestPolicyNamePerfCounter GarbageFirst
*/
/* @test TestPolicyNamePerfCounterCMS
* @bug 8210192
* @comment Graal does not support CMS
* @requires vm.gc=="null" & !vm.graal.enabled
* @library /test/lib /
* @summary Tests that sun.gc.policy.name returns expected values for different GCs.
* @modules java.base/jdk.internal.misc
* java.compiler
* java.management/sun.management
* jdk.internal.jvmstat/sun.jvmstat.monitor
* @run main/othervm -XX:+UsePerfData -XX:+UseConcMarkSweepGC TestPolicyNamePerfCounter ParNew:CMS
*/
public class TestPolicyNamePerfCounter {
public static void main(String[] args) throws Exception {
if (args.length != 1) {
throw new IllegalArgumentException("Expected 1 arg: <expectedName>");
}
assertEQ(PerfCounters.findByName("sun.gc.policy.name").value(), args[0]);
}
}

View File

@@ -40,6 +40,15 @@ public class PerfCounter {
this.name = name;
}
/**
* Returns the value of this performance counter as an Object.
*
* @return The value of this performance counter
*/
public Object value() {
return monitor.getValue();
}
/**
* Returns the value of this performance counter as a long.
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -203,7 +203,13 @@ public class TestOptionsWithRanges {
allOptionsAsMap = JVMOptionsUtils.getOptionsWithRangeAsMap(origin -> (!(origin.contains("develop") || origin.contains("notproduct"))));
/*
* Remove CICompilerCount from testing because currently it can hang system
* Exclude VMThreadStackSize from max range testing, because it will always exit with code 1,
* which technically passes, but really it fails, and worse yet, it produces hs_err_pid file.
*/
excludeTestMaxRange("VMThreadStackSize");
/*
* Exclude CICompilerCount from testing because currently it can hang system
*/
excludeTestMaxRange("CICompilerCount");

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -212,6 +212,8 @@ public class TestNestmateAttr extends TestScaffold {
protected void startUp(String targetName) {
List<String> argList = new ArrayList<>(Arrays.asList(args));
argList.add(0, targetName); // pre-pend so it becomes the first "app" arg
// We need the class path that contains the path to jdk.test.lib.Asserts.
argList.add(0, " -cp " + System.getProperty("test.class.path"));
println("run args: " + argList);
connect((String[]) argList.toArray(args));
waitForVMStart();

View File

@@ -402,6 +402,7 @@
328A..32B0 ; Common # So [39] CIRCLED IDEOGRAPH MOON..CIRCLED IDEOGRAPH NIGHT
32B1..32BF ; Common # No [15] CIRCLED NUMBER THIRTY SIX..CIRCLED NUMBER FIFTY
32C0..32CF ; Common # So [16] IDEOGRAPHIC TELEGRAPH SYMBOL FOR JANUARY..LIMITED LIABILITY SIGN
32FF ; Common # So SQUARE ERA NAME NEWERA
3358..33FF ; Common # So [168] IDEOGRAPHIC TELEGRAPH SYMBOL FOR HOUR ZERO..SQUARE GAL
4DC0..4DFF ; Common # So [64] HEXAGRAM FOR THE CREATIVE HEAVEN..HEXAGRAM FOR BEFORE COMPLETION
A700..A716 ; Common # Sk [23] MODIFIER LETTER CHINESE TONE YIN PING..MODIFIER LETTER EXTRA-LOW LEFT-STEM TONE BAR

View File

@@ -0,0 +1,290 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @summary Test behavior of isJavaIdentifierXX, isJavaLetter, and
* isJavaLetterOrDigit methods for all code points.
* @bug 8218915
*/
public class TestIsJavaIdentifierMethods {
// Japanese Era Square character code point not present in Unicode 10.0
private static final int JAPANESE_ERA_CODEPOINT = 0x32FF;
public static void main(String[] args) {
testIsJavaIdentifierPart_int();
testIsJavaIdentifierPart_char();
testIsJavaIdentifierStart_int();
testIsJavaIdentifierStart_char();
testIsJavaLetter();
testIsJavaLetterOrDigit();
}
/**
* Assertion testing for public static boolean isJavaIdentifierPart(int
* codePoint), A character may be part of a Java identifier if any of the
* following are true:
* <ul>
* <li>it is a letter</li>
* <li>it is a currency symbol (such as <code>'$'</code>)</li>
* <li>it is a connecting punctuation character (such as <code>'_'</code>)
* </li>
* <li>it is a digit</li>
* <li>it is a numeric letter (such as a Roman numeral character)</li>
* <li>it is a combining mark</li>
* <li>it is a non-spacing mark</li>
* <li><code>isIdentifierIgnorable</code> returns <code>true</code> for the
* character</li>
* </ul>
* All code points from (0x0000..0x10FFFF) are tested.
*/
public static void testIsJavaIdentifierPart_int() {
for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
boolean expected = false;
// Since Character.isJavaIdentifierPart(int) strictly conforms to
// character information from version 10.0 of the Unicode Standard,
// check if code point is "Japanese Era Square character code
// point". If the code point is "Japanese Era Square character code
// point", value of variable "expected" is considered false.
if (cp != JAPANESE_ERA_CODEPOINT) {
byte type = (byte) Character.getType(cp);
expected = Character.isLetter(cp)
|| type == Character.CURRENCY_SYMBOL
|| type == Character.CONNECTOR_PUNCTUATION
|| Character.isDigit(cp)
|| type == Character.LETTER_NUMBER
|| type == Character.COMBINING_SPACING_MARK
|| type == Character.NON_SPACING_MARK
|| Character.isIdentifierIgnorable(cp);
}
if (Character.isJavaIdentifierPart(cp) != expected) {
throw new RuntimeException(
"Character.isJavaIdentifierPart(int) failed for codepoint "
+ Integer.toHexString(cp));
}
}
}
/**
* Assertion testing for public static boolean isJavaIdentifierPart(char
* ch), A character may be part of a Java identifier if any of the
* following are true:
* <ul>
* <li>it is a letter;
* <li>it is a currency symbol (such as "$");
* <li>it is a connecting punctuation character (such as "_");
* <li>it is a digit;
* <li>it is a numeric letter (such as a Roman numeral character);
* <li>it is a combining mark;
* <li>it is a non-spacing mark;
* <li>isIdentifierIgnorable returns true for the character.
* </ul>
* All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
*/
public static void testIsJavaIdentifierPart_char() {
for (int i = 0; i <= Character.MAX_VALUE; ++i) {
char ch = (char) i;
boolean expected = false;
// Since Character.isJavaIdentifierPart(char) strictly conforms to
// character information from version 10.0 of the Unicode Standard,
// check if code point is "Japanese Era Square character code
// point". If the code point is "Japanese Era Square character code
// point", value of variable "expected" is considered false.
if (i != JAPANESE_ERA_CODEPOINT) {
byte type = (byte) Character.getType(ch);
expected = Character.isLetter(ch)
|| type == Character.CURRENCY_SYMBOL
|| type == Character.CONNECTOR_PUNCTUATION
|| Character.isDigit(ch)
|| type == Character.LETTER_NUMBER
|| type == Character.COMBINING_SPACING_MARK
|| type == Character.NON_SPACING_MARK
|| Character.isIdentifierIgnorable(ch);
}
if (Character.isJavaIdentifierPart((char) i) != expected) {
throw new RuntimeException(
"Character.isJavaIdentifierPart(char) failed for codepoint "
+ Integer.toHexString(i));
}
}
}
/**
* Assertion testing for public static boolean isJavaIdentifierStart(int
* codePoint), A character may start a Java identifier if and only if it is
* one of the following:
* <ul>
* <li>it is a letter;</li>
* <li>getType(ch) returns LETTER_NUMBER;</li>
* <li>it is a currency symbol (such as "$");</li>
* <li>it is a connecting punctuation character (such as "_");</li>
* </ul>
* All Code points from (0x0000..0x10FFFF) are tested.
*/
public static void testIsJavaIdentifierStart_int() {
for (int cp = 0; cp <= Character.MAX_CODE_POINT; cp++) {
boolean expected = false;
// Since Character.isJavaIdentifierStart(int) strictly conforms to
// character information from version 10.0 of the Unicode Standard,
// check if code point is "Japanese Era Square character code
// point". If the code point is "Japanese Era Square character code
// point", value of variable "expected" is considered false.
if (cp != JAPANESE_ERA_CODEPOINT) {
byte type = (byte) Character.getType(cp);
expected = Character.isLetter(cp)
|| type == Character.LETTER_NUMBER
|| type == Character.CURRENCY_SYMBOL
|| type == Character.CONNECTOR_PUNCTUATION;
}
if (Character.isJavaIdentifierStart(cp) != expected) {
throw new RuntimeException(
"Character.isJavaIdentifierStart(int) failed for codepoint "
+ Integer.toHexString(cp));
}
}
}
/**
* Assertion testing for public static boolean isJavaIdentifierStart(char),
* A character may start a Java identifier if and only if it is
* one of the following:
* <ul>
* <li>it is a letter;</li>
* <li>getType(ch) returns LETTER_NUMBER;</li>
* <li>it is a currency symbol (such as "$");</li>
* <li>it is a connecting punctuation character (such as "_");</li>
* </ul>
* All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
*/
public static void testIsJavaIdentifierStart_char() {
for (int i = 0; i <= Character.MAX_VALUE; i++) {
char ch = (char) i;
boolean expected = false;
// Since Character.isJavaIdentifierStart(char) strictly conforms to
// character information from version 10.0 of the Unicode Standard,
// check if code point is "Japanese Era Square character code
// point". If the code point is "Japanese Era Square character code
// point", value of variable "expected" is considered false.
if (i != JAPANESE_ERA_CODEPOINT) {
byte type = (byte) Character.getType(ch);
expected = Character.isLetter(ch)
|| type == Character.LETTER_NUMBER
|| type == Character.CURRENCY_SYMBOL
|| type == Character.CONNECTOR_PUNCTUATION;
}
if (Character.isJavaIdentifierStart(ch) != expected) {
throw new RuntimeException(
"Character.isJavaIdentifierStart(char) failed for codepoint "
+ Integer.toHexString(i));
}
}
}
/**
* Assertion testing for public static boolean isJavaLetter(char ch), A
* character may start a Java identifier if and only if one of the following
* is true:
* <ul>
* <li>isLetter(ch) returns true
* <li>getType(ch) returns LETTER_NUMBER
* <li>ch is a currency symbol (such as "$")
* <li>ch is a connecting punctuation character (such as "_").
* </ul>
* All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
*/
public static void testIsJavaLetter() {
for (int i = 0; i <= Character.MAX_VALUE; ++i) {
char ch = (char) i;
boolean expected = false;
// Since Character.isJavaLetter(char) strictly conforms to
// character information from version 10.0 of the Unicode Standard,
// check if code point is "Japanese Era Square character code
// point". If the code point is "Japanese Era Square character code
// point", value of variable "expected" is considered false.
if (i != JAPANESE_ERA_CODEPOINT) {
byte type = (byte) Character.getType(ch);
expected = Character.isLetter(ch)
|| type == Character.LETTER_NUMBER
|| type == Character.CURRENCY_SYMBOL
|| type == Character.CONNECTOR_PUNCTUATION;
}
if (Character.isJavaLetter(ch) != expected) {
throw new RuntimeException(
"Character.isJavaLetter(ch) failed for codepoint "
+ Integer.toHexString(i));
}
}
}
/**
* Assertion testing for public static boolean isJavaLetterOrDigit(char ch),
* A character may be part of a Java identifier if and only if any of the
* following are true:
* <ul>
* <li>it is a letter
* <li>it is a currency symbol (such as '$')
* <li>it is a connecting punctuation character (such as '_')
* <li>it is a digit
* <li>it is a numeric letter (such as a Roman numeral character)
* <li>it is a combining mark
* <li>it is a non-spacing mark
* <li>isIdentifierIgnorable returns true for the character.
* </ul>
* All Unicode code points in the BMP (0x0000..0xFFFF) are tested.
*/
public static void testIsJavaLetterOrDigit() {
for (int i = 0; i <= Character.MAX_VALUE; ++i) {
char ch = (char) i;
boolean expected = false;
// Since Character.isJavaLetterOrDigit(char) strictly conforms to
// character information from version 10.0 of the Unicode Standard,
// check if code point is "Japanese Era Square character code
// point". If the code point is "Japanese Era Square character code
// point", value of variable "expected" is considered false.
if (i != JAPANESE_ERA_CODEPOINT) {
byte type = (byte) Character.getType(ch);
expected = Character.isLetter(ch)
|| type == Character.CURRENCY_SYMBOL
|| type == Character.CONNECTOR_PUNCTUATION
|| Character.isDigit(ch)
|| type == Character.LETTER_NUMBER
|| type == Character.COMBINING_SPACING_MARK
|| type == Character.NON_SPACING_MARK
|| Character.isIdentifierIgnorable(ch);
}
if (Character.isJavaLetterOrDigit(ch) != expected) {
throw new RuntimeException(
"Character.isJavaLetterOrDigit(ch) failed for codepoint "
+ Integer.toHexString(i));
}
}
}
}

View File

@@ -11729,6 +11729,7 @@
32FC;CIRCLED KATAKANA WI;So;0;L;<circle> 30F0;;;;N;;;;;
32FD;CIRCLED KATAKANA WE;So;0;L;<circle> 30F1;;;;N;;;;;
32FE;CIRCLED KATAKANA WO;So;0;L;<circle> 30F2;;;;N;;;;;
32FF;SQUARE ERA NAME NEWERA;So;0;L;<square> 5143 53F7;;;;N;SQUARED TWO IDEOGRAPHS ERA NAME NEWERA;;;;
3300;SQUARE APAATO;So;0;L;<square> 30A2 30D1 30FC 30C8;;;;N;SQUARED APAATO;;;;
3301;SQUARE ARUHUA;So;0;L;<square> 30A2 30EB 30D5 30A1;;;;N;SQUARED ARUHUA;;;;
3302;SQUARE ANPEA;So;0;L;<square> 30A2 30F3 30DA 30A2;;;;N;SQUARED ANPEA;;;;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/*
*
* @test
* @bug 8206120
* @modules jdk.localedata
*/
@@ -44,6 +45,7 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
import java.time.format.FormatStyle;
import java.time.format.ResolverStyle;
import java.time.format.TextStyle;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQueries;
@@ -135,6 +137,16 @@ public class TestNonIsoFormatter {
};
}
@DataProvider(name="lenient_eraYear")
Object[][] lenientEraYear() {
return new Object[][] {
// Chronology, lenient era/year, strict era/year
{ JAPANESE, "Meiji 123", "Heisei 2" },
{ JAPANESE, "Showa 65", "Heisei 2" },
{ JAPANESE, "Heisei 32", "NewEra 2" }, // NewEra
};
}
@Test(dataProvider="format_data")
public void test_formatLocalizedDate(Chronology chrono, Locale formatLocale, Locale numberingLocale,
ChronoLocalDate date, String expected) {
@@ -173,4 +185,15 @@ public class TestNonIsoFormatter {
Chronology cal = ta.query(TemporalQueries.chronology());
assertEquals(cal, chrono);
}
@Test(dataProvider="lenient_eraYear")
public void test_lenientEraYear(Chronology chrono, String lenient, String strict) {
String mdStr = "-01-01";
DateTimeFormatter dtf = new DateTimeFormatterBuilder()
.appendPattern("GGGG y-M-d")
.toFormatter()
.withChronology(chrono);
DateTimeFormatter dtfLenient = dtf.withResolverStyle(ResolverStyle.LENIENT);
assertEquals(LocalDate.parse(lenient+mdStr, dtfLenient), LocalDate.parse(strict+mdStr, dtf));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
* @bug 8202088 8207152
* @bug 8202088 8207152 8217609
* @summary Test the localized Japanese new era name (May 1st. 2019-)
* is retrieved no matter CLDR provider contains the name or not.
* @modules jdk.localedata
@@ -53,8 +53,8 @@ public class JapaneseEraNameTest {
// type, locale, name
{ LONG, JAPAN, "\u5143\u53f7" }, // NewEra
{ LONG, US, "NewEra" },
{ SHORT, JAPAN, "N" },
{ SHORT, US, "N" },
{ SHORT, JAPAN, "\u5143\u53f7" },
{ SHORT, US, "NewEra" },
};
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8206120
* @summary Test whether lenient era is accepted in JapaneseImperialCalendar
* @run testng/othervm JapaneseLenientEraTest
*/
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
@Test
public class JapaneseLenientEraTest {
@DataProvider(name="lenientEra")
Object[][] names() {
return new Object[][] {
// lenient era/year, strict era/year
{ "Meiji 123", "Heisei 2" },
{ "Sh\u014dwa 65", "Heisei 2" },
{ "Heisei 32", "NewEra 2" }, // NewEra
};
}
@Test(dataProvider="lenientEra")
public void testLenientEra(String lenient, String strict) throws Exception {
Calendar c = new Calendar.Builder()
.setCalendarType("japanese")
.build();
DateFormat df = new SimpleDateFormat("GGGG y-M-d", Locale.ROOT);
df.setCalendar(c);
Date lenDate = df.parse(lenient + "-01-01");
df.setLenient(false);
Date strDate = df.parse(strict + "-01-01");
assertEquals(lenDate, strDate);
}
}