mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
Merge
This commit is contained in:
commit
7052a83930
162 changed files with 11706 additions and 1685 deletions
1
.hgtags
1
.hgtags
|
@ -466,3 +466,4 @@ d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
|
||||||
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
|
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
|
||||||
5b834ec962366e00d4445352a999a3ac14e26f64 jdk-10+39
|
5b834ec962366e00d4445352a999a3ac14e26f64 jdk-10+39
|
||||||
860326263d1f6a83996d7da0f4c66806ae4aa1eb jdk-10+40
|
860326263d1f6a83996d7da0f4c66806ae4aa1eb jdk-10+40
|
||||||
|
3eae36c6baa5f916a3024cf1513e22357e00185d jdk-10+41
|
||||||
|
|
|
@ -26,13 +26,16 @@
|
||||||
ifndef _SETUP_GMK
|
ifndef _SETUP_GMK
|
||||||
_SETUP_GMK := 1
|
_SETUP_GMK := 1
|
||||||
|
|
||||||
|
# Include custom extension hook
|
||||||
|
$(eval $(call IncludeCustomExtension, common/SetupJavaCompilers.gmk))
|
||||||
|
|
||||||
include JavaCompilation.gmk
|
include JavaCompilation.gmk
|
||||||
|
|
||||||
DISABLE_WARNINGS := -Xlint:all,-deprecation,-removal,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
|
DISABLE_WARNINGS ?= -Xlint:all,-deprecation,-removal,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
|
||||||
|
|
||||||
# If warnings needs to be non-fatal for testing purposes use a command like:
|
# If warnings needs to be non-fatal for testing purposes use a command like:
|
||||||
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
|
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
|
||||||
JAVAC_WARNINGS := -Xlint:all -Werror
|
JAVAC_WARNINGS ?= -Xlint:all -Werror
|
||||||
|
|
||||||
# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
|
# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
|
||||||
# and the interim javac, to be run by the boot jdk.
|
# and the interim javac, to be run by the boot jdk.
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package java.lang;
|
package java.lang;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/** The CharacterData class encapsulates the large tables found in
|
/** The CharacterData class encapsulates the large tables found in
|
||||||
Java.lang.Character. */
|
Java.lang.Character. */
|
||||||
|
|
||||||
|
@ -159,20 +161,39 @@ class CharacterDataLatin1 extends CharacterData {
|
||||||
return toUpperCase(ch);
|
return toUpperCase(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Digit values for codePoints in the 0-255 range. Contents generated using:
|
||||||
|
// for (char i = 0; i < 256; i++) {
|
||||||
|
// int v = -1;
|
||||||
|
// if (i >= '0' && i <= '9') { v = i - '0'; }
|
||||||
|
// else if (i >= 'A' && i <= 'Z') { v = i - 'A' + 10; }
|
||||||
|
// else if (i >= 'a' && i <= 'z') { v = i - 'a' + 10; }
|
||||||
|
// if (i % 20 == 0) System.out.println();
|
||||||
|
// System.out.printf("%2d, ", v);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Analysis has shown that generating the whole array allows the JIT to generate
|
||||||
|
// better code compared to a slimmed down array, such as one cutting off after 'z'
|
||||||
|
private static final byte[] DIGITS = new byte[] {
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||||
|
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, 10, 11, 12,
|
||||||
|
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||||
|
33, 34, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||||
|
|
||||||
int digit(int ch, int radix) {
|
int digit(int ch, int radix) {
|
||||||
int value = -1;
|
int value = DIGITS[ch];
|
||||||
if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
|
if (value >= 0 && radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
|
||||||
int val = getProperties(ch);
|
value = (value < radix) ? value : -1;
|
||||||
int kind = val & $$maskType;
|
|
||||||
if (kind == Character.DECIMAL_DIGIT_NUMBER) {
|
|
||||||
value = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
|
|
||||||
}
|
|
||||||
else if ((val & $$maskNumericType) == $$valueJavaSupradecimal) {
|
|
||||||
// Java supradecimal digit
|
|
||||||
value = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (value < radix) ? value : -1;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNumericValue(int ch) {
|
int getNumericValue(int ch) {
|
||||||
|
|
|
@ -21,4 +21,4 @@
|
||||||
# or visit www.oracle.com if you need additional information or have any
|
# or visit www.oracle.com if you need additional information or have any
|
||||||
# questions.
|
# questions.
|
||||||
#
|
#
|
||||||
tzdata2017c
|
tzdata2018c
|
||||||
|
|
|
@ -181,7 +181,6 @@ Link Africa/Abidjan Africa/Freetown # Sierra Leone
|
||||||
Link Africa/Abidjan Africa/Lome # Togo
|
Link Africa/Abidjan Africa/Lome # Togo
|
||||||
Link Africa/Abidjan Africa/Nouakchott # Mauritania
|
Link Africa/Abidjan Africa/Nouakchott # Mauritania
|
||||||
Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso
|
Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso
|
||||||
Link Africa/Abidjan Africa/Sao_Tome # São Tomé and Príncipe
|
|
||||||
Link Africa/Abidjan Atlantic/St_Helena # St Helena
|
Link Africa/Abidjan Atlantic/St_Helena # St Helena
|
||||||
|
|
||||||
# Djibouti
|
# Djibouti
|
||||||
|
@ -448,7 +447,7 @@ Link Africa/Nairobi Indian/Mayotte
|
||||||
#
|
#
|
||||||
# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
|
# The Nautical Almanac for the Year 1970, p 264, is the source for -0:44:30.
|
||||||
#
|
#
|
||||||
# In 1972 Liberia was the last country to switch from a UTC offset
|
# In 1972 Liberia was the last country to switch from a UT offset
|
||||||
# that was not a multiple of 15 or 20 minutes. The 1972 change was on
|
# that was not a multiple of 15 or 20 minutes. The 1972 change was on
|
||||||
# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
|
# 1972-01-07, according to an entry dated 1972-01-04 on p 330 of:
|
||||||
# Presidential Papers: First year of the administration of
|
# Presidential Papers: First year of the administration of
|
||||||
|
@ -1060,6 +1059,19 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis
|
||||||
# Inaccessible, Nightingale: uninhabited
|
# Inaccessible, Nightingale: uninhabited
|
||||||
|
|
||||||
# São Tomé and Príncipe
|
# São Tomé and Príncipe
|
||||||
|
|
||||||
|
# From Steffen Thorsen (2018-01-08):
|
||||||
|
# Multiple sources tell that São Tomé changed from UTC to UTC+1 as
|
||||||
|
# they entered the year 2018.
|
||||||
|
# From Michael Deckers (2018-01-08):
|
||||||
|
# the switch is from 01:00 to 02:00 ... [Decree No. 25/2017]
|
||||||
|
# http://www.mnec.gov.st/index.php/publicacoes/documentos/file/90-decreto-lei-n-25-2017
|
||||||
|
|
||||||
|
Zone Africa/Sao_Tome 0:26:56 - LMT 1884
|
||||||
|
-0:36:45 - LMT 1912 # Lisbon Mean Time
|
||||||
|
0:00 - GMT 2018 Jan 1 01:00
|
||||||
|
1:00 - WAT
|
||||||
|
|
||||||
# Senegal
|
# Senegal
|
||||||
# See Africa/Abidjan.
|
# See Africa/Abidjan.
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
# 9:00 KST KDT Korea when at +09
|
# 9:00 KST KDT Korea when at +09
|
||||||
# 9:30 ACST Australian Central Standard Time
|
# 9:30 ACST Australian Central Standard Time
|
||||||
# Otherwise, these tables typically use numeric abbreviations like +03
|
# Otherwise, these tables typically use numeric abbreviations like +03
|
||||||
# and +0330 for integer hour and minute UTC offsets. Although earlier
|
# and +0330 for integer hour and minute UT offsets. Although earlier
|
||||||
# editions invented alphabetic time zone abbreviations for every
|
# editions invented alphabetic time zone abbreviations for every
|
||||||
# offset, this did not reflect common practice.
|
# offset, this did not reflect common practice.
|
||||||
#
|
#
|
||||||
|
@ -670,17 +670,17 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30
|
||||||
# time", in which abolished the adoption of Western Standard Time in
|
# time", in which abolished the adoption of Western Standard Time in
|
||||||
# western islands (listed above), which means the whole Japan
|
# western islands (listed above), which means the whole Japan
|
||||||
# territory, including later occupations, adopt Japan Central Time
|
# territory, including later occupations, adopt Japan Central Time
|
||||||
# (UTC+9). The adoption began on Oct 1, 1937. The original text can
|
# (UT+9). The adoption began on Oct 1, 1937. The original text can
|
||||||
# be found on Wikisource:
|
# be found on Wikisource:
|
||||||
# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
|
# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
|
||||||
#
|
#
|
||||||
# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937.
|
# That is, the time zone of Taipei switched to UT+9 on Oct 1, 1937.
|
||||||
|
|
||||||
# From Yu-Cheng Chuang (2014-07-02):
|
# From Yu-Cheng Chuang (2014-07-02):
|
||||||
# I've found more evidence about when the time zone was switched from UTC+9
|
# I've found more evidence about when the time zone was switched from UT+9
|
||||||
# back to UTC+8 after WW2. I believe it was on Sep 21, 1945. In a document
|
# back to UT+8 after WW2. I believe it was on Sep 21, 1945. In a document
|
||||||
# during Japanese era [1] in which the officer told the staff to change time
|
# during Japanese era [1] in which the officer told the staff to change time
|
||||||
# zone back to Western Standard Time (UTC+8) on Sep 21. And in another
|
# zone back to Western Standard Time (UT+8) on Sep 21. And in another
|
||||||
# history page of National Cheng Kung University [2], on Sep 21 there is a
|
# history page of National Cheng Kung University [2], on Sep 21 there is a
|
||||||
# note "from today, switch back to Western Standard Time". From these two
|
# note "from today, switch back to Western Standard Time". From these two
|
||||||
# materials, I believe that the time zone change happened on Sep 21. And
|
# materials, I believe that the time zone change happened on Sep 21. And
|
||||||
|
@ -1487,17 +1487,17 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880
|
||||||
# of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who
|
# of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who
|
||||||
# wanted to keep it.)
|
# wanted to keep it.)
|
||||||
|
|
||||||
# From Paul Eggert (2006-03-22):
|
# From Takayuki Nikai (2018-01-19):
|
||||||
# Shanks & Pottenger write that DST in Japan during those years was as follows:
|
# The source of information is Japanese law.
|
||||||
|
# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00219480428029.htm
|
||||||
|
# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm
|
||||||
|
# ... In summary, it is written as follows. From 24:00 on the first Saturday
|
||||||
|
# in May, until 0:00 on the day after the second Saturday in September.
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
Rule Japan 1948 only - May Sun>=1 2:00 1:00 D
|
Rule Japan 1948 only - May Sat>=1 24:00 1:00 D
|
||||||
Rule Japan 1948 1951 - Sep Sat>=8 2:00 0 S
|
Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S
|
||||||
Rule Japan 1949 only - Apr Sun>=1 2:00 1:00 D
|
Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D
|
||||||
Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D
|
Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D
|
||||||
# but the only locations using it (for birth certificates, presumably, since
|
|
||||||
# their audience is astrologers) were US military bases. For now, assume
|
|
||||||
# that for most purposes daylight-saving time was observed; otherwise, what
|
|
||||||
# would have been the point of the 1951 poll?
|
|
||||||
|
|
||||||
# From Hideyuki Suzuki (1998-11-09):
|
# From Hideyuki Suzuki (1998-11-09):
|
||||||
# 'Tokyo' usually stands for the former location of Tokyo Astronomical
|
# 'Tokyo' usually stands for the former location of Tokyo Astronomical
|
||||||
|
@ -1528,7 +1528,7 @@ Rule Japan 1950 1951 - May Sun>=1 2:00 1:00 D
|
||||||
#
|
#
|
||||||
# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
|
# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
|
||||||
# means the whole Japan territory, including later occupations, adopt Japan
|
# means the whole Japan territory, including later occupations, adopt Japan
|
||||||
# Central Time (UTC+9). The adoption began on Oct 1, 1937.
|
# Central Time (UT+9). The adoption began on Oct 1, 1937.
|
||||||
# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
|
# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
|
||||||
|
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
|
@ -2089,8 +2089,8 @@ Zone Asia/Kuching 7:21:20 - LMT 1926 Mar
|
||||||
|
|
||||||
# Maldives
|
# Maldives
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
Zone Indian/Maldives 4:54:00 - LMT 1880 # Male
|
Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé
|
||||||
4:54:00 - MMT 1960 # Male Mean Time
|
4:54:00 - MMT 1960 # Malé Mean Time
|
||||||
5:00 - +05
|
5:00 - +05
|
||||||
|
|
||||||
# Mongolia
|
# Mongolia
|
||||||
|
|
|
@ -706,8 +706,8 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct # Honiara
|
||||||
# From Steffen Thorsen (2012-07-25)
|
# From Steffen Thorsen (2012-07-25)
|
||||||
# ... we double checked by calling hotels and offices based in Tokelau asking
|
# ... we double checked by calling hotels and offices based in Tokelau asking
|
||||||
# about the time there, and they all told a time that agrees with UTC+13....
|
# about the time there, and they all told a time that agrees with UTC+13....
|
||||||
# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change
|
# Shanks says UT-10 from 1901 [but] ... there is a good chance the change
|
||||||
# actually was to UTC-11 back then.
|
# actually was to UT-11 back then.
|
||||||
#
|
#
|
||||||
# From Paul Eggert (2012-07-25)
|
# From Paul Eggert (2012-07-25)
|
||||||
# A Google Books snippet of Appendix to the Journals of the House of
|
# A Google Books snippet of Appendix to the Journals of the House of
|
||||||
|
@ -1473,7 +1473,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
|
||||||
#
|
#
|
||||||
# From Paul Eggert (2006-03-22):
|
# From Paul Eggert (2006-03-22):
|
||||||
# The Department of Internal Affairs (DIA) maintains a brief history,
|
# The Department of Internal Affairs (DIA) maintains a brief history,
|
||||||
# as does Carol Squires; see tz-link.htm for the full references.
|
# as does Carol Squires; see tz-link.html for the full references.
|
||||||
# Use these sources in preference to Shanks & Pottenger.
|
# Use these sources in preference to Shanks & Pottenger.
|
||||||
#
|
#
|
||||||
# For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with
|
# For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with
|
||||||
|
|
|
@ -91,14 +91,15 @@
|
||||||
# 0:00 WET WEST WEMT Western Europe
|
# 0:00 WET WEST WEMT Western Europe
|
||||||
# 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937)
|
# 0:19:32.13 AMT* NST* Amsterdam, Netherlands Summer (1835-1937)
|
||||||
# 1:00 BST British Standard (1968-1971)
|
# 1:00 BST British Standard (1968-1971)
|
||||||
|
# 1:00 IST GMT Irish Standard (1968-) with winter DST
|
||||||
# 1:00 CET CEST CEMT Central Europe
|
# 1:00 CET CEST CEMT Central Europe
|
||||||
# 1:00:14 SET Swedish (1879-1899)
|
# 1:00:14 SET Swedish (1879-1899)
|
||||||
# 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)*
|
# 1:36:34 RMT* LST* Riga, Latvian Summer (1880-1926)*
|
||||||
# 2:00 EET EEST Eastern Europe
|
# 2:00 EET EEST Eastern Europe
|
||||||
# 3:00 MSK MSD MDST* Moscow
|
# 3:00 MSK MSD MDST* Moscow
|
||||||
|
|
||||||
# From Peter Ilieve (1994-12-04),
|
# From Peter Ilieve (1994-12-04), re EEC/EC/EU members:
|
||||||
# The original six [EU members]: Belgium, France, (West) Germany, Italy,
|
# The original six: Belgium, France, (West) Germany, Italy,
|
||||||
# Luxembourg, the Netherlands.
|
# Luxembourg, the Netherlands.
|
||||||
# Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom.
|
# Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom.
|
||||||
# Plus, from 1 Jan 81: Greece.
|
# Plus, from 1 Jan 81: Greece.
|
||||||
|
@ -301,16 +302,31 @@
|
||||||
# The following claim by Shanks & Pottenger is possible though doubtful;
|
# The following claim by Shanks & Pottenger is possible though doubtful;
|
||||||
# we'll ignore it for now.
|
# we'll ignore it for now.
|
||||||
# * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00.
|
# * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00.
|
||||||
|
|
||||||
|
# From Paul Eggert (2017-12-04):
|
||||||
#
|
#
|
||||||
#
|
# Dunsink Observatory (8 km NW of Dublin's center) was to Dublin as
|
||||||
# Whitman says Dublin Mean Time was -0:25:21, which is more precise than
|
# Greenwich was to London. For example:
|
||||||
# Shanks & Pottenger.
|
|
||||||
# Perhaps this was Dunsink Observatory Time, as Dunsink Observatory
|
|
||||||
# (8 km NW of Dublin's center) seemingly was to Dublin as Greenwich was
|
|
||||||
# to London. For example:
|
|
||||||
#
|
#
|
||||||
# "Timeball on the ballast office is down. Dunsink time."
|
# "Timeball on the ballast office is down. Dunsink time."
|
||||||
# -- James Joyce, Ulysses
|
# -- James Joyce, Ulysses
|
||||||
|
#
|
||||||
|
# The abbreviation DMT stood for "Dublin Mean Time" or "Dunsink Mean Time";
|
||||||
|
# this being Ireland, opinions differed.
|
||||||
|
#
|
||||||
|
# Whitman says Dublin/Dunsink Mean Time was UT-00:25:21, which agrees
|
||||||
|
# with measurements of recent visitors to the Meridian Room of Dunsink
|
||||||
|
# Observatory; see Malone D. Dunsink and timekeeping. 2016-01-24.
|
||||||
|
# <https://www.maths.tcd.ie/~dwmalone/time/dunsink.html>. Malone
|
||||||
|
# writes that the Nautical Almanac listed UT-00:25:22 until 1896, when
|
||||||
|
# it moved to UT-00:25:21.1 (I confirmed that the 1893 edition used
|
||||||
|
# the former and the 1896 edition used the latter). Evidently the
|
||||||
|
# news of this change propagated slowly, as Milne 1899 still lists
|
||||||
|
# UT-00:25:22 and cites the International Telegraph Bureau. As it is
|
||||||
|
# not clear that there was any practical significance to the change
|
||||||
|
# from UT-00:25:22 to UT-00:25:21.1 in civil timekeeping, omit this
|
||||||
|
# transition for now and just use the latter value, omitting its
|
||||||
|
# fraction since our format cannot represent fractions.
|
||||||
|
|
||||||
# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time
|
# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time
|
||||||
# was among various actions undertaken by the 'English' government that
|
# was among various actions undertaken by the 'English' government that
|
||||||
|
@ -370,12 +386,28 @@
|
||||||
# regulations. I spoke this morning with the Secretary of the Department of
|
# regulations. I spoke this morning with the Secretary of the Department of
|
||||||
# Justice (tel +353 1 678 9711) who confirmed to me that the correct name is
|
# Justice (tel +353 1 678 9711) who confirmed to me that the correct name is
|
||||||
# "Irish Summer Time", abbreviated to "IST".
|
# "Irish Summer Time", abbreviated to "IST".
|
||||||
|
#
|
||||||
|
# From Paul Eggert (2017-12-07):
|
||||||
|
# The 1996 anonymous contributor's goal was to determine the correct
|
||||||
|
# abbreviation for summer time in Dublin and so the contributor
|
||||||
|
# focused on the "IST", not on the "Irish Summer Time". Though the
|
||||||
|
# "IST" was correct, the "Irish Summer Time" appears to have been an
|
||||||
|
# error, as Ireland's Standard Time (Amendment) Act, 1971 states that
|
||||||
|
# standard time in Ireland remains at UT +01 and is observed in
|
||||||
|
# summer, and that Greenwich mean time is observed in winter. (Thanks
|
||||||
|
# to Derick Rethans for pointing out the error.) That is, when
|
||||||
|
# Ireland amended the 1968 act that established UT +01 as Irish
|
||||||
|
# Standard Time, it left standard time unchanged and established GMT
|
||||||
|
# as a negative daylight saving time in winter. So, in this database
|
||||||
|
# IST stands for Irish Summer Time for timestamps before 1968, and for
|
||||||
|
# Irish Standard Time after that. See:
|
||||||
|
# http://www.irishstatutebook.ie/eli/1971/act/17/enacted/en/print
|
||||||
|
|
||||||
# Michael Deckers (2017-06-01) gave the following URLs for Ireland's
|
# Michael Deckers (2017-06-01) gave the following URLs for Ireland's
|
||||||
# Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947:
|
# Summer Time Act, 1925 and Summer Time Orders, 1926 and 1947:
|
||||||
# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print.html
|
# http://www.irishstatutebook.ie/eli/1925/act/8/enacted/en/print
|
||||||
# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print.html
|
# http://www.irishstatutebook.ie/eli/1926/sro/919/made/en/print
|
||||||
# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print.html
|
# http://www.irishstatutebook.ie/eli/1947/sro/71/made/en/print
|
||||||
|
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
# Summer Time Act, 1916
|
# Summer Time Act, 1916
|
||||||
|
@ -499,9 +531,23 @@ Link Europe/London Europe/Jersey
|
||||||
Link Europe/London Europe/Guernsey
|
Link Europe/London Europe/Guernsey
|
||||||
Link Europe/London Europe/Isle_of_Man
|
Link Europe/London Europe/Isle_of_Man
|
||||||
|
|
||||||
|
# From Paul Eggert (2018-01-19):
|
||||||
|
# The following is like GB-Eire and EU, except with standard time in
|
||||||
|
# summer and negative daylight saving time in winter.
|
||||||
|
# Although currently commented out, this will need to become uncommented
|
||||||
|
# once the ICU/OpenJDK workaround is removed; see below.
|
||||||
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
|
#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT
|
||||||
|
#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST
|
||||||
|
#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT
|
||||||
|
#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST
|
||||||
|
#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT
|
||||||
|
#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT
|
||||||
|
#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT
|
||||||
|
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2
|
Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2
|
||||||
-0:25:21 - DMT 1916 May 21 2:00s # Dublin MT
|
-0:25:21 - DMT 1916 May 21 2:00s
|
||||||
-0:25:21 1:00 IST 1916 Oct 1 2:00s
|
-0:25:21 1:00 IST 1916 Oct 1 2:00s
|
||||||
0:00 GB-Eire %s 1921 Dec 6 # independence
|
0:00 GB-Eire %s 1921 Dec 6 # independence
|
||||||
0:00 GB-Eire GMT/IST 1940 Feb 25 2:00s
|
0:00 GB-Eire GMT/IST 1940 Feb 25 2:00s
|
||||||
|
@ -510,16 +556,33 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2
|
||||||
0:00 1:00 IST 1947 Nov 2 2:00s
|
0:00 1:00 IST 1947 Nov 2 2:00s
|
||||||
0:00 - GMT 1948 Apr 18 2:00s
|
0:00 - GMT 1948 Apr 18 2:00s
|
||||||
0:00 GB-Eire GMT/IST 1968 Oct 27
|
0:00 GB-Eire GMT/IST 1968 Oct 27
|
||||||
|
# From Paul Eggert (2018-01-18):
|
||||||
|
# The next line should look like this:
|
||||||
|
# 1:00 Eire IST/GMT
|
||||||
|
# However, in January 2018 we discovered that the Eire rules cause
|
||||||
|
# problems with tests for ICU:
|
||||||
|
# https://mm.icann.org/pipermail/tz/2018-January/025825.html
|
||||||
|
# and with tests for OpenJDK:
|
||||||
|
# https://mm.icann.org/pipermail/tz/2018-January/025822.html
|
||||||
|
# To work around this problem, use a traditional approximation for
|
||||||
|
# time stamps after 1971-10-31 02:00 UTC, to give ICU and OpenJDK
|
||||||
|
# developers breathing room to fix bugs. This approximation has
|
||||||
|
# correct UTC offsets, but results in tm_isdst flags are the reverse
|
||||||
|
# of what they should be. This workaround is temporary and should be
|
||||||
|
# removed reasonably soon.
|
||||||
1:00 - IST 1971 Oct 31 2:00u
|
1:00 - IST 1971 Oct 31 2:00u
|
||||||
0:00 GB-Eire GMT/IST 1996
|
0:00 GB-Eire GMT/IST 1996
|
||||||
0:00 EU GMT/IST
|
0:00 EU GMT/IST
|
||||||
|
# End of workaround for ICU and OpenJDK bugs.
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# Europe
|
# Europe
|
||||||
|
|
||||||
# EU rules are for the European Union, previously known as the EC, EEC,
|
# The following rules are for the European Union and for its
|
||||||
# Common Market, etc.
|
# predecessor organization, the European Communities.
|
||||||
|
# For brevity they are called "EU rules" elsewhere in this file.
|
||||||
|
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S
|
Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S
|
||||||
|
@ -952,7 +1015,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850
|
||||||
# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL
|
# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL
|
||||||
# confirms this, and states that the law was put forth 1893-03-29.
|
# confirms this, and states that the law was put forth 1893-03-29.
|
||||||
#
|
#
|
||||||
# The EU treaty with effect from 1973:
|
# The EU [actually, EEC and Euratom] treaty with effect from 1973:
|
||||||
# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL
|
# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL
|
||||||
#
|
#
|
||||||
# This provoked a new law from 1974 to make possible summer time changes
|
# This provoked a new law from 1974 to make possible summer time changes
|
||||||
|
@ -1008,9 +1071,10 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn
|
||||||
# East Greenland and Franz Josef Land, but we don't know their time zones.
|
# East Greenland and Franz Josef Land, but we don't know their time zones.
|
||||||
# My source for this is Wilhelm Dege's book mentioned under Svalbard.
|
# My source for this is Wilhelm Dege's book mentioned under Svalbard.
|
||||||
#
|
#
|
||||||
# From Paul Eggert (2006-03-22):
|
# From Paul Eggert (2017-12-10):
|
||||||
# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01,
|
# Greenland joined the European Communities as part of Denmark,
|
||||||
# and left the EU on 1985-02-01. It therefore should have been using EU
|
# obtained home rule on 1979-05-01, and left the European Communities
|
||||||
|
# on 1985-02-01. It therefore should have been using EU
|
||||||
# rules at least through 1984. Shanks & Pottenger say Scoresbysund and Godthåb
|
# rules at least through 1984. Shanks & Pottenger say Scoresbysund and Godthåb
|
||||||
# used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU
|
# used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU
|
||||||
# rules since at least 1991. Assume EU rules since 1980.
|
# rules since at least 1991. Assume EU rules since 1980.
|
||||||
|
@ -1324,7 +1388,7 @@ Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01
|
||||||
# From Markus Kuhn (1998-09-29):
|
# From Markus Kuhn (1998-09-29):
|
||||||
# The German time zone web site by the Physikalisch-Technische
|
# The German time zone web site by the Physikalisch-Technische
|
||||||
# Bundesanstalt contains DST information back to 1916.
|
# Bundesanstalt contains DST information back to 1916.
|
||||||
# [See tz-link.htm for the URL.]
|
# [See tz-link.html for the URL.]
|
||||||
|
|
||||||
# From Jörg Schilling (2002-10-23):
|
# From Jörg Schilling (2002-10-23):
|
||||||
# In 1945, Berlin was switched to Moscow Summer time (GMT+4) by
|
# In 1945, Berlin was switched to Moscow Summer time (GMT+4) by
|
||||||
|
@ -1421,7 +1485,7 @@ Zone Europe/Athens 1:34:52 - LMT 1895 Sep 14
|
||||||
1:00 Greece CE%sT 1944 Apr 4
|
1:00 Greece CE%sT 1944 Apr 4
|
||||||
2:00 Greece EE%sT 1981
|
2:00 Greece EE%sT 1981
|
||||||
# Shanks & Pottenger say it switched to C-Eur in 1981;
|
# Shanks & Pottenger say it switched to C-Eur in 1981;
|
||||||
# go with EU instead, since Greece joined it on Jan 1.
|
# go with EU rules instead, since Greece joined Jan 1.
|
||||||
2:00 EU EE%sT
|
2:00 EU EE%sT
|
||||||
|
|
||||||
# Hungary
|
# Hungary
|
||||||
|
@ -2120,7 +2184,7 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880
|
||||||
# IATA SSIM (1991/1992) reports that the Azores were at -1:00.
|
# IATA SSIM (1991/1992) reports that the Azores were at -1:00.
|
||||||
# IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00.
|
# IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00.
|
||||||
# Guess that the Azores changed to EU rules in 1992 (since that's when Portugal
|
# Guess that the Azores changed to EU rules in 1992 (since that's when Portugal
|
||||||
# harmonized with the EU), and that they stayed +0:00 that winter.
|
# harmonized with EU rules), and that they stayed +0:00 that winter.
|
||||||
#
|
#
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
# DSH writes that despite Decree 1,469 (1915), the change to the clocks was not
|
# DSH writes that despite Decree 1,469 (1915), the change to the clocks was not
|
||||||
|
@ -2795,9 +2859,9 @@ Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14
|
||||||
#
|
#
|
||||||
# https://regnum.ru/news/society/1957270.html
|
# https://regnum.ru/news/society/1957270.html
|
||||||
# has some historical data for Altai Krai:
|
# has some historical data for Altai Krai:
|
||||||
# before 1957: west part on UTC+6, east on UTC+7
|
# before 1957: west part on UT+6, east on UT+7
|
||||||
# after 1957: UTC+7
|
# after 1957: UT+7
|
||||||
# since 1995: UTC+6
|
# since 1995: UT+6
|
||||||
# http://barnaul.rusplt.ru/index/pochemu_altajskij_kraj_okazalsja_v_neprivychnom_chasovom_pojase-17648.html
|
# http://barnaul.rusplt.ru/index/pochemu_altajskij_kraj_okazalsja_v_neprivychnom_chasovom_pojase-17648.html
|
||||||
# confirms that and provides more details including 1995-05-28 transition date.
|
# confirms that and provides more details including 1995-05-28 transition date.
|
||||||
|
|
||||||
|
@ -3605,6 +3669,17 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
|
||||||
# The change is permanent, so this is the new standard time in Turkey.
|
# The change is permanent, so this is the new standard time in Turkey.
|
||||||
# It takes effect today, which is not much notice.
|
# It takes effect today, which is not much notice.
|
||||||
|
|
||||||
|
# From Kıvanç Yazan (2017-10-28):
|
||||||
|
# Turkey will go back to Daylight Saving Time starting 2018-10.
|
||||||
|
# http://www.resmigazete.gov.tr/eskiler/2017/10/20171028-5.pdf
|
||||||
|
#
|
||||||
|
# From Even Scharning (2017-11-08):
|
||||||
|
# ... today it was announced that the DST will become "continuous":
|
||||||
|
# http://www.hurriyet.com.tr/son-dakika-yaz-saati-uygulamasi-surekli-hale-geldi-40637482
|
||||||
|
# From Paul Eggert (2017-11-08):
|
||||||
|
# Although Google Translate misfires on that source, it looks like
|
||||||
|
# Turkey reversed last month's decision, and so will stay at +03.
|
||||||
|
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
Rule Turkey 1916 only - May 1 0:00 1:00 S
|
Rule Turkey 1916 only - May 1 0:00 1:00 S
|
||||||
Rule Turkey 1916 only - Oct 1 0:00 0 -
|
Rule Turkey 1916 only - Oct 1 0:00 0 -
|
||||||
|
|
|
@ -80,5 +80,5 @@ Leap 2012 Jun 30 23:59:60 + S
|
||||||
Leap 2015 Jun 30 23:59:60 + S
|
Leap 2015 Jun 30 23:59:60 + S
|
||||||
Leap 2016 Dec 31 23:59:60 + S
|
Leap 2016 Dec 31 23:59:60 + S
|
||||||
|
|
||||||
# Updated through IERS Bulletin C54
|
# Updated through IERS Bulletin C55
|
||||||
# File expires on: 28 June 2018
|
# File expires on: 28 December 2018
|
||||||
|
|
|
@ -371,6 +371,18 @@ Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03:58
|
||||||
# Nebraska, eastern North Dakota, Oklahoma, eastern South Dakota,
|
# Nebraska, eastern North Dakota, Oklahoma, eastern South Dakota,
|
||||||
# western Tennessee, most of Texas, Wisconsin
|
# western Tennessee, most of Texas, Wisconsin
|
||||||
|
|
||||||
|
# From Paul Eggert (2018-01-07):
|
||||||
|
# In 1869 the Chicago Astronomical Society contracted with the city to keep
|
||||||
|
# time. Though delayed by the Great Fire, by 1880 a wire ran from the
|
||||||
|
# Dearborn Observatory (on the University of Chicago campus) to City Hall,
|
||||||
|
# which then sent signals to police and fire stations. However, railroads got
|
||||||
|
# their time signals from the Allegheny Observatory, the Madison Observatory,
|
||||||
|
# the Ann Arbor Observatory, etc., so their clocks did not agree with each
|
||||||
|
# other or with the city's official time. The confusion took some years to
|
||||||
|
# clear up. See:
|
||||||
|
# Moser M. How Chicago gave America its time zones. Chicago. 2018-01-04.
|
||||||
|
# http://www.chicagomag.com/city-life/January-2018/How-Chicago-Gave-America-Its-Time-Zones/
|
||||||
|
|
||||||
# From Larry M. Smith (2006-04-26) re Wisconsin:
|
# From Larry M. Smith (2006-04-26) re Wisconsin:
|
||||||
# https://docs.legis.wisconsin.gov/statutes/statutes/175.pdf
|
# https://docs.legis.wisconsin.gov/statutes/statutes/175.pdf
|
||||||
# is currently enforced at the 01:00 time of change. Because the local
|
# is currently enforced at the 01:00 time of change. Because the local
|
||||||
|
@ -1919,7 +1931,7 @@ Zone America/Edmonton -7:33:52 - LMT 1906 Sep
|
||||||
# manager of the Creston & District Museum. The article was written in May 2009.
|
# manager of the Creston & District Museum. The article was written in May 2009.
|
||||||
# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
|
# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
|
||||||
# According to the article, Creston has not changed its clocks since June 1918.
|
# According to the article, Creston has not changed its clocks since June 1918.
|
||||||
# i.e. Creston has been stuck on UTC-7 for 93 years.
|
# i.e. Creston has been stuck on UT-7 for 93 years.
|
||||||
# Dawson Creek, on the other hand, changed its clocks as recently as April 1972.
|
# Dawson Creek, on the other hand, changed its clocks as recently as April 1972.
|
||||||
|
|
||||||
# Unfortunately the exact date for the time change in June 1918 remains
|
# Unfortunately the exact date for the time change in June 1918 remains
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
# https://www.jstor.org/stable/1774359
|
# https://www.jstor.org/stable/1774359
|
||||||
#
|
#
|
||||||
# These tables use numeric abbreviations like -03 and -0330 for
|
# These tables use numeric abbreviations like -03 and -0330 for
|
||||||
# integer hour and minute UTC offsets. Although earlier editions used
|
# integer hour and minute UT offsets. Although earlier editions used
|
||||||
# alphabetic time zone abbreviations, these abbreviations were
|
# alphabetic time zone abbreviations, these abbreviations were
|
||||||
# invented and did not reflect common practice.
|
# invented and did not reflect common practice.
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ Link America/Curacao America/Aruba
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
Zone America/La_Paz -4:32:36 - LMT 1890
|
Zone America/La_Paz -4:32:36 - LMT 1890
|
||||||
-4:32:36 - CMT 1931 Oct 15 # Calamarca MT
|
-4:32:36 - CMT 1931 Oct 15 # Calamarca MT
|
||||||
-4:32:36 1:00 BOST 1932 Mar 21 # Bolivia ST
|
-4:32:36 1:00 BST 1932 Mar 21 # Bolivia ST
|
||||||
-4:00 - -04
|
-4:00 - -04
|
||||||
|
|
||||||
# Brazil
|
# Brazil
|
||||||
|
@ -931,12 +931,25 @@ Rule Brazil 2007 only - Oct Sun>=8 0:00 1:00 S
|
||||||
# [t]he DST period in Brazil now on will be from the 3rd Oct Sunday to the
|
# [t]he DST period in Brazil now on will be from the 3rd Oct Sunday to the
|
||||||
# 3rd Feb Sunday. There is an exception on the return date when this is
|
# 3rd Feb Sunday. There is an exception on the return date when this is
|
||||||
# the Carnival Sunday then the return date will be the next Sunday...
|
# the Carnival Sunday then the return date will be the next Sunday...
|
||||||
Rule Brazil 2008 max - Oct Sun>=15 0:00 1:00 S
|
Rule Brazil 2008 2017 - Oct Sun>=15 0:00 1:00 S
|
||||||
Rule Brazil 2008 2011 - Feb Sun>=15 0:00 0 -
|
Rule Brazil 2008 2011 - Feb Sun>=15 0:00 0 -
|
||||||
|
# Decree 7,584 <http://pcdsh01.on.br/HVdecreto7584_20111013.jpg> (2011-10-13)
|
||||||
|
# added Bahia.
|
||||||
Rule Brazil 2012 only - Feb Sun>=22 0:00 0 -
|
Rule Brazil 2012 only - Feb Sun>=22 0:00 0 -
|
||||||
|
# Decree 7,826 <http://pcdsh01.on.br/HVdecreto7826_20121015.jpg> (2012-10-15)
|
||||||
|
# removed Bahia and added Tocantins.
|
||||||
|
# Decree 8,112 <http://pcdsh01.on.br/HVdecreto8112_20130930.JPG> (2013-09-30)
|
||||||
|
# removed Tocantins.
|
||||||
Rule Brazil 2013 2014 - Feb Sun>=15 0:00 0 -
|
Rule Brazil 2013 2014 - Feb Sun>=15 0:00 0 -
|
||||||
Rule Brazil 2015 only - Feb Sun>=22 0:00 0 -
|
Rule Brazil 2015 only - Feb Sun>=22 0:00 0 -
|
||||||
Rule Brazil 2016 2022 - Feb Sun>=15 0:00 0 -
|
Rule Brazil 2016 2022 - Feb Sun>=15 0:00 0 -
|
||||||
|
# From Steffen Thorsen (2017-12-18):
|
||||||
|
# According to many media sources, next year's DST start in Brazil will move to
|
||||||
|
# the first Sunday of November, and it will stay like that for the years after.
|
||||||
|
# ... https://www.timeanddate.com/news/time/brazil-delays-dst-2018.html
|
||||||
|
# From Steffen Thorsen (2017-12-20):
|
||||||
|
# http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2017/decreto/D9242.htm
|
||||||
|
Rule Brazil 2018 max - Nov Sun>=1 0:00 1:00 S
|
||||||
Rule Brazil 2023 only - Feb Sun>=22 0:00 0 -
|
Rule Brazil 2023 only - Feb Sun>=22 0:00 0 -
|
||||||
Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 -
|
Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 -
|
||||||
Rule Brazil 2026 only - Feb Sun>=22 0:00 0 -
|
Rule Brazil 2026 only - Feb Sun>=22 0:00 0 -
|
||||||
|
@ -1091,7 +1104,7 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
|
||||||
|
|
||||||
# From Paul Eggert (2015-04-03):
|
# From Paul Eggert (2015-04-03):
|
||||||
# Shanks & Pottenger says America/Santiago introduced standard time in
|
# Shanks & Pottenger says America/Santiago introduced standard time in
|
||||||
# 1890 and rounds its UTC offset to 70W40; guess that in practice this
|
# 1890 and rounds its UT offset to 70W40; guess that in practice this
|
||||||
# was the same offset as in 1916-1919. It also says Pacific/Easter
|
# was the same offset as in 1916-1919. It also says Pacific/Easter
|
||||||
# standardized on 109W22 in 1890; assume this didn't change the clocks.
|
# standardized on 109W22 in 1890; assume this didn't change the clocks.
|
||||||
#
|
#
|
||||||
|
|
|
@ -395,7 +395,7 @@ SM +4355+01228 Europe/San_Marino
|
||||||
SN +1440-01726 Africa/Dakar
|
SN +1440-01726 Africa/Dakar
|
||||||
SO +0204+04522 Africa/Mogadishu
|
SO +0204+04522 Africa/Mogadishu
|
||||||
SR +0550-05510 America/Paramaribo
|
SR +0550-05510 America/Paramaribo
|
||||||
SS +0451+03136 Africa/Juba
|
SS +0451+03137 Africa/Juba
|
||||||
ST +0020+00644 Africa/Sao_Tome
|
ST +0020+00644 Africa/Sao_Tome
|
||||||
SV +1342-08912 America/El_Salvador
|
SV +1342-08912 America/El_Salvador
|
||||||
SX +180305-0630250 America/Lower_Princes
|
SX +180305-0630250 America/Lower_Princes
|
||||||
|
|
|
@ -168,3 +168,7 @@ $(foreach t, $(VARHANDLES_BYTE_ARRAY_TYPES), \
|
||||||
$(eval $(call GenerateVarHandleByteArray,VAR_HANDLE_BYTE_ARRAY_$t,$t)))
|
$(eval $(call GenerateVarHandleByteArray,VAR_HANDLE_BYTE_ARRAY_$t,$t)))
|
||||||
|
|
||||||
GENSRC_JAVA_BASE += $(GENSRC_VARHANDLES)
|
GENSRC_JAVA_BASE += $(GENSRC_VARHANDLES)
|
||||||
|
|
||||||
|
# Include custom extension post hook
|
||||||
|
$(eval $(call IncludeCustomExtension, gensrc/GensrcVarHandles-post.gmk))
|
||||||
|
|
||||||
|
|
|
@ -70,3 +70,7 @@ $(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
|
||||||
TARGETS += $(BUILD_LIBMANAGEMENT)
|
TARGETS += $(BUILD_LIBMANAGEMENT)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# Include custom extension post hook
|
||||||
|
$(eval $(call IncludeCustomExtension, lib/Lib-java.management-post.gmk))
|
||||||
|
|
||||||
|
|
|
@ -80,3 +80,7 @@ $(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java)
|
||||||
TARGETS += $(BUILD_LIBMANAGEMENT_EXT)
|
TARGETS += $(BUILD_LIBMANAGEMENT_EXT)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# Include custom extension post hook
|
||||||
|
$(eval $(call IncludeCustomExtension, lib/Lib-jdk.management-post.gmk))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2017 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -104,7 +104,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
|
||||||
|
|
||||||
int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
|
int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
|
||||||
|
|
||||||
__ ld(R19_method, v_off, rcvr_klass);
|
__ ld(R19_method, (RegisterOrConstant)v_off, rcvr_klass);
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (DebugVtables) {
|
if (DebugVtables) {
|
||||||
|
|
|
@ -183,3 +183,9 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PRODUCT
|
||||||
|
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
|
||||||
|
// This is just a stub.
|
||||||
|
}
|
||||||
|
#endif //PRODUCT
|
||||||
|
|
|
@ -2535,13 +2535,35 @@ run:
|
||||||
|
|
||||||
// this could definitely be cleaned up QQQ
|
// this could definitely be cleaned up QQQ
|
||||||
Method* callee;
|
Method* callee;
|
||||||
Klass* iclass = cache->f1_as_klass();
|
Method *interface_method = cache->f2_as_interface_method();
|
||||||
// InstanceKlass* interface = (InstanceKlass*) iclass;
|
InstanceKlass* iclass = interface_method->method_holder();
|
||||||
|
|
||||||
// get receiver
|
// get receiver
|
||||||
int parms = cache->parameter_size();
|
int parms = cache->parameter_size();
|
||||||
oop rcvr = STACK_OBJECT(-parms);
|
oop rcvr = STACK_OBJECT(-parms);
|
||||||
CHECK_NULL(rcvr);
|
CHECK_NULL(rcvr);
|
||||||
InstanceKlass* int2 = (InstanceKlass*) rcvr->klass();
|
InstanceKlass* int2 = (InstanceKlass*) rcvr->klass();
|
||||||
|
|
||||||
|
// Receiver subtype check against resolved interface klass (REFC).
|
||||||
|
{
|
||||||
|
Klass* refc = cache->f1_as_klass();
|
||||||
|
itableOffsetEntry* scan;
|
||||||
|
for (scan = (itableOffsetEntry*) int2->start_of_itable();
|
||||||
|
scan->interface_klass() != NULL;
|
||||||
|
scan++) {
|
||||||
|
if (scan->interface_klass() == refc) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check that the entry is non-null. A null entry means
|
||||||
|
// that the receiver class doesn't implement the
|
||||||
|
// interface, and wasn't the same as when the caller was
|
||||||
|
// compiled.
|
||||||
|
if (scan->interface_klass() == NULL) {
|
||||||
|
VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
itableOffsetEntry* ki = (itableOffsetEntry*) int2->start_of_itable();
|
itableOffsetEntry* ki = (itableOffsetEntry*) int2->start_of_itable();
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0 ; i < int2->itable_length() ; i++, ki++ ) {
|
for ( i = 0 ; i < int2->itable_length() ; i++, ki++ ) {
|
||||||
|
@ -2553,7 +2575,8 @@ run:
|
||||||
if (i == int2->itable_length()) {
|
if (i == int2->itable_length()) {
|
||||||
VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
|
VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
|
||||||
}
|
}
|
||||||
int mindex = cache->f2_as_index();
|
int mindex = interface_method->itable_index();
|
||||||
|
|
||||||
itableMethodEntry* im = ki->first_method_entry(rcvr->klass());
|
itableMethodEntry* im = ki->first_method_entry(rcvr->klass());
|
||||||
callee = im[mindex].method();
|
callee = im[mindex].method();
|
||||||
if (callee == NULL) {
|
if (callee == NULL) {
|
||||||
|
|
|
@ -1260,6 +1260,10 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) {
|
||||||
assert(inner_cl->is_strip_mined(), "inner loop should be strip mined");
|
assert(inner_cl->is_strip_mined(), "inner loop should be strip mined");
|
||||||
Node* inner_iv_phi = inner_cl->phi();
|
Node* inner_iv_phi = inner_cl->phi();
|
||||||
if (inner_iv_phi == NULL) {
|
if (inner_iv_phi == NULL) {
|
||||||
|
IfNode* outer_le = outer_loop_end();
|
||||||
|
Node* iff = igvn->transform(new IfNode(outer_le->in(0), outer_le->in(1), outer_le->_prob, outer_le->_fcnt));
|
||||||
|
igvn->replace_node(outer_le, iff);
|
||||||
|
inner_cl->clear_strip_mined();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CountedLoopEndNode* inner_cle = inner_cl->loopexit();
|
CountedLoopEndNode* inner_cle = inner_cl->loopexit();
|
||||||
|
|
|
@ -1036,7 +1036,7 @@ Node *PhaseIdealLoop::place_near_use( Node *useblock ) const {
|
||||||
|
|
||||||
|
|
||||||
bool PhaseIdealLoop::identical_backtoback_ifs(Node *n) {
|
bool PhaseIdealLoop::identical_backtoback_ifs(Node *n) {
|
||||||
if (!n->is_If()) {
|
if (!n->is_If() || n->is_CountedLoopEnd()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!n->in(0)->is_Region()) {
|
if (!n->in(0)->is_Region()) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -117,23 +117,33 @@ bool OverflowSubLNode::will_overflow(jlong v1, jlong v2) const {
|
||||||
return SubHelper<OverflowSubLNode>::will_overflow(v1, v2);
|
return SubHelper<OverflowSubLNode>::will_overflow(v1, v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverflowMulLNode::will_overflow(jlong val1, jlong val2) const {
|
bool OverflowMulLNode::is_overflow(jlong val1, jlong val2) {
|
||||||
jlong result = val1 * val2;
|
// x * { 0, 1 } will never overflow. Even for x = min_jlong
|
||||||
jlong ax = (val1 < 0 ? -val1 : val1);
|
if (val1 == 0 || val2 == 0 || val1 == 1 || val2 == 1) {
|
||||||
jlong ay = (val2 < 0 ? -val2 : val2);
|
return false;
|
||||||
|
|
||||||
bool overflow = false;
|
|
||||||
if ((ax | ay) & CONST64(0xFFFFFFFF00000000)) {
|
|
||||||
// potential overflow if any bit in upper 32 bits are set
|
|
||||||
if ((val1 == min_jlong && val2 == -1) || (val2 == min_jlong && val1 == -1)) {
|
|
||||||
// -1 * Long.MIN_VALUE will overflow
|
|
||||||
overflow = true;
|
|
||||||
} else if (val2 != 0 && (result / val2 != val1)) {
|
|
||||||
overflow = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return overflow;
|
// x * min_jlong for x not in { 0, 1 } overflows
|
||||||
|
// even -1 as -1 * min_jlong is an overflow
|
||||||
|
if (val1 == min_jlong || val2 == min_jlong) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (x * y) / y == x there is no overflow
|
||||||
|
//
|
||||||
|
// the multiplication here is done as unsigned to avoid undefined behaviour which
|
||||||
|
// can be used by the compiler to assume that the check further down (result / val2 != val1)
|
||||||
|
// is always false and breaks the overflow check
|
||||||
|
julong v1 = (julong) val1;
|
||||||
|
julong v2 = (julong) val2;
|
||||||
|
julong tmp = v1 * v2;
|
||||||
|
jlong result = (jlong) tmp;
|
||||||
|
|
||||||
|
if (result / val2 != val1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverflowAddINode::can_overflow(const Type* t1, const Type* t2) const {
|
bool OverflowAddINode::can_overflow(const Type* t1, const Type* t2) const {
|
||||||
|
|
|
@ -129,8 +129,10 @@ public:
|
||||||
OverflowMulLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {}
|
OverflowMulLNode(Node* in1, Node* in2) : OverflowLNode(in1, in2) {}
|
||||||
virtual int Opcode() const;
|
virtual int Opcode() const;
|
||||||
|
|
||||||
virtual bool will_overflow(jlong v1, jlong v2) const;
|
virtual bool will_overflow(jlong v1, jlong v2) const { return is_overflow(v1, v2); }
|
||||||
virtual bool can_overflow(const Type* t1, const Type* t2) const;
|
virtual bool can_overflow(const Type* t1, const Type* t2) const;
|
||||||
|
|
||||||
|
static bool is_overflow(jlong v1, jlong v2);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -63,7 +63,8 @@ public abstract class InputStream implements Closeable {
|
||||||
*
|
*
|
||||||
* <p> While the stream is open, the {@code available()}, {@code read()},
|
* <p> While the stream is open, the {@code available()}, {@code read()},
|
||||||
* {@code read(byte[])}, {@code read(byte[], int, int)},
|
* {@code read(byte[])}, {@code read(byte[], int, int)},
|
||||||
* {@code readAllBytes()}, {@code readNBytes()}, {@code skip()}, and
|
* {@code readAllBytes()}, {@code readNBytes(byte[], int, int)},
|
||||||
|
* {@code readNBytes(int)}, {@code skip(long)}, and
|
||||||
* {@code transferTo()} methods all behave as if end of stream has been
|
* {@code transferTo()} methods all behave as if end of stream has been
|
||||||
* reached. After the stream has been closed, these methods all throw
|
* reached. After the stream has been closed, these methods all throw
|
||||||
* {@code IOException}.
|
* {@code IOException}.
|
||||||
|
@ -122,6 +123,15 @@ public abstract class InputStream implements Closeable {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] readNBytes(int len) throws IOException {
|
||||||
|
if (len < 0) {
|
||||||
|
throw new IllegalArgumentException("len < 0");
|
||||||
|
}
|
||||||
|
ensureOpen();
|
||||||
|
return new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long skip(long n) throws IOException {
|
public long skip(long n) throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -233,8 +243,8 @@ public abstract class InputStream implements Closeable {
|
||||||
* <code>b</code> and the number of bytes read before the exception
|
* <code>b</code> and the number of bytes read before the exception
|
||||||
* occurred is returned. The default implementation of this method blocks
|
* occurred is returned. The default implementation of this method blocks
|
||||||
* until the requested amount of input data <code>len</code> has been read,
|
* until the requested amount of input data <code>len</code> has been read,
|
||||||
* end of file is detected, or an exception is thrown. Subclasses are encouraged
|
* end of file is detected, or an exception is thrown. Subclasses are
|
||||||
* to provide a more efficient implementation of this method.
|
* encouraged to provide a more efficient implementation of this method.
|
||||||
*
|
*
|
||||||
* @param b the buffer into which the data is read.
|
* @param b the buffer into which the data is read.
|
||||||
* @param off the start offset in array <code>b</code>
|
* @param off the start offset in array <code>b</code>
|
||||||
|
@ -308,26 +318,85 @@ public abstract class InputStream implements Closeable {
|
||||||
* It is strongly recommended that the stream be promptly closed if an I/O
|
* It is strongly recommended that the stream be promptly closed if an I/O
|
||||||
* error occurs.
|
* error occurs.
|
||||||
*
|
*
|
||||||
|
* @implSpec
|
||||||
|
* This method invokes {@link #readNBytes(int)} with a length of
|
||||||
|
* {@link Integer#MAX_VALUE}.
|
||||||
|
*
|
||||||
* @return a byte array containing the bytes read from this input stream
|
* @return a byte array containing the bytes read from this input stream
|
||||||
* @throws IOException if an I/O error occurs
|
* @throws IOException if an I/O error occurs
|
||||||
* @throws OutOfMemoryError if an array of the required size cannot be
|
* @throws OutOfMemoryError if an array of the required size cannot be
|
||||||
* allocated. For example, if an array larger than {@code 2GB} would
|
* allocated.
|
||||||
* be required to store the bytes.
|
|
||||||
*
|
*
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
public byte[] readAllBytes() throws IOException {
|
public byte[] readAllBytes() throws IOException {
|
||||||
|
return readNBytes(Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads up to a specified number of bytes from the input stream. This
|
||||||
|
* method blocks until the requested number of bytes have been read, end
|
||||||
|
* of stream is detected, or an exception is thrown. This method does not
|
||||||
|
* close the input stream.
|
||||||
|
*
|
||||||
|
* <p> The length of the returned array equals the number of bytes read
|
||||||
|
* from the stream. If {@code len} is zero, then no bytes are read and
|
||||||
|
* an empty byte array is returned. Otherwise, up to {@code len} bytes
|
||||||
|
* are read from the stream. Fewer than {@code len} bytes may be read if
|
||||||
|
* end of stream is encountered.
|
||||||
|
*
|
||||||
|
* <p> When this stream reaches end of stream, further invocations of this
|
||||||
|
* method will return an empty byte array.
|
||||||
|
*
|
||||||
|
* <p> Note that this method is intended for simple cases where it is
|
||||||
|
* convenient to read the specified number of bytes into a byte array. The
|
||||||
|
* total amount of memory allocated by this method is proportional to the
|
||||||
|
* number of bytes read from the stream which is bounded by {@code len}.
|
||||||
|
* Therefore, the method may be safely called with very large values of
|
||||||
|
* {@code len} provided sufficient memory is available.
|
||||||
|
*
|
||||||
|
* <p> The behavior for the case where the input stream is <i>asynchronously
|
||||||
|
* closed</i>, or the thread interrupted during the read, is highly input
|
||||||
|
* stream specific, and therefore not specified.
|
||||||
|
*
|
||||||
|
* <p> If an I/O error occurs reading from the input stream, then it may do
|
||||||
|
* so after some, but not all, bytes have been read. Consequently the input
|
||||||
|
* stream may not be at end of stream and may be in an inconsistent state.
|
||||||
|
* It is strongly recommended that the stream be promptly closed if an I/O
|
||||||
|
* error occurs.
|
||||||
|
*
|
||||||
|
* @implNote
|
||||||
|
* The number of bytes allocated to read data from this stream and return
|
||||||
|
* the result is bounded by {@code 2*(long)len}, inclusive.
|
||||||
|
*
|
||||||
|
* @param len the maximum number of bytes to read
|
||||||
|
* @return a byte array containing the bytes read from this input stream
|
||||||
|
* @throws IllegalArgumentException if {@code length} is negative
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
* @throws OutOfMemoryError if an array of the required size cannot be
|
||||||
|
* allocated.
|
||||||
|
*
|
||||||
|
* @since 11
|
||||||
|
*/
|
||||||
|
public byte[] readNBytes(int len) throws IOException {
|
||||||
|
if (len < 0) {
|
||||||
|
throw new IllegalArgumentException("len < 0");
|
||||||
|
}
|
||||||
|
|
||||||
List<byte[]> bufs = null;
|
List<byte[]> bufs = null;
|
||||||
byte[] result = null;
|
byte[] result = null;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
int remaining = len;
|
||||||
int n;
|
int n;
|
||||||
do {
|
do {
|
||||||
byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
|
byte[] buf = new byte[Math.min(remaining, DEFAULT_BUFFER_SIZE)];
|
||||||
int nread = 0;
|
int nread = 0;
|
||||||
|
|
||||||
// read to EOF which may read more or less than buffer size
|
// read to EOF which may read more or less than buffer size
|
||||||
while ((n = read(buf, nread, buf.length - nread)) > 0) {
|
while ((n = read(buf, nread,
|
||||||
|
Math.min(buf.length - nread, remaining))) > 0) {
|
||||||
nread += n;
|
nread += n;
|
||||||
|
remaining -= n;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nread > 0) {
|
if (nread > 0) {
|
||||||
|
@ -345,7 +414,9 @@ public abstract class InputStream implements Closeable {
|
||||||
bufs.add(buf);
|
bufs.add(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (n >= 0); // if the last call to read returned -1, then break
|
// if the last call to read returned -1 or the number of bytes
|
||||||
|
// requested have been read then break
|
||||||
|
} while (n >= 0 && remaining > 0);
|
||||||
|
|
||||||
if (bufs == null) {
|
if (bufs == null) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
@ -357,12 +428,12 @@ public abstract class InputStream implements Closeable {
|
||||||
|
|
||||||
result = new byte[total];
|
result = new byte[total];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int remaining = total;
|
remaining = total;
|
||||||
for (byte[] b : bufs) {
|
for (byte[] b : bufs) {
|
||||||
int len = Math.min(b.length, remaining);
|
int count = Math.min(b.length, remaining);
|
||||||
System.arraycopy(b, 0, result, offset, len);
|
System.arraycopy(b, 0, result, offset, count);
|
||||||
offset += len;
|
offset += count;
|
||||||
remaining -= len;
|
remaining -= count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -534,7 +534,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ get(ByteBufferHandle handle, Object obb, int index) {
|
static $type$ get(ByteBufferHandle handle, Object obb, int index) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
#if[floatingPoint]
|
#if[floatingPoint]
|
||||||
$rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
|
$rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -551,7 +551,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static void set(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static void set(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
#if[floatingPoint]
|
#if[floatingPoint]
|
||||||
UNSAFE.put$RawType$Unaligned(
|
UNSAFE.put$RawType$Unaligned(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -569,7 +569,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getVolatile(ByteBufferHandle handle, Object obb, int index) {
|
static $type$ getVolatile(ByteBufferHandle handle, Object obb, int index) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.get$RawType$Volatile(
|
UNSAFE.get$RawType$Volatile(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -578,7 +578,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
UNSAFE.put$RawType$Volatile(
|
UNSAFE.put$RawType$Volatile(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -587,7 +587,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAcquire(ByteBufferHandle handle, Object obb, int index) {
|
static $type$ getAcquire(ByteBufferHandle handle, Object obb, int index) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.get$RawType$Acquire(
|
UNSAFE.get$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -596,7 +596,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
UNSAFE.put$RawType$Release(
|
UNSAFE.put$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -605,7 +605,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getOpaque(ByteBufferHandle handle, Object obb, int index) {
|
static $type$ getOpaque(ByteBufferHandle handle, Object obb, int index) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.get$RawType$Opaque(
|
UNSAFE.get$RawType$Opaque(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -614,7 +614,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
UNSAFE.put$RawType$Opaque(
|
UNSAFE.put$RawType$Opaque(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -624,7 +624,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return UNSAFE.compareAndSet$RawType$(
|
return UNSAFE.compareAndSet$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -633,7 +633,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.compareAndExchange$RawType$(
|
UNSAFE.compareAndExchange$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -643,7 +643,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ compareAndExchangeAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static $type$ compareAndExchangeAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.compareAndExchange$RawType$Acquire(
|
UNSAFE.compareAndExchange$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -653,7 +653,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ compareAndExchangeRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static $type$ compareAndExchangeRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.compareAndExchange$RawType$Release(
|
UNSAFE.compareAndExchange$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -663,7 +663,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return UNSAFE.weakCompareAndSet$RawType$Plain(
|
return UNSAFE.weakCompareAndSet$RawType$Plain(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -672,7 +672,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return UNSAFE.weakCompareAndSet$RawType$(
|
return UNSAFE.weakCompareAndSet$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -681,7 +681,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return UNSAFE.weakCompareAndSet$RawType$Acquire(
|
return UNSAFE.weakCompareAndSet$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -690,7 +690,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return UNSAFE.weakCompareAndSet$RawType$Release(
|
return UNSAFE.weakCompareAndSet$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
address(bb, indexRO(bb, index)),
|
address(bb, indexRO(bb, index)),
|
||||||
|
@ -699,7 +699,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.getAndSet$RawType$(
|
UNSAFE.getAndSet$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -709,7 +709,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.getAndSet$RawType$Acquire(
|
UNSAFE.getAndSet$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -719,7 +719,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
return convEndian(handle.be,
|
return convEndian(handle.be,
|
||||||
UNSAFE.getAndSet$RawType$Release(
|
UNSAFE.getAndSet$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -731,7 +731,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndAdd$RawType$(
|
return UNSAFE.getAndAdd$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -744,7 +744,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndAdd$RawType$Acquire(
|
return UNSAFE.getAndAdd$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -757,7 +757,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndAdd$RawType$Release(
|
return UNSAFE.getAndAdd$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -785,7 +785,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseOr$RawType$(
|
return UNSAFE.getAndBitwiseOr$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -798,7 +798,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseOr$RawType$Release(
|
return UNSAFE.getAndBitwiseOr$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -811,7 +811,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseOr$RawType$Acquire(
|
return UNSAFE.getAndBitwiseOr$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -837,7 +837,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseAnd$RawType$(
|
return UNSAFE.getAndBitwiseAnd$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -850,7 +850,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseAnd$RawType$Release(
|
return UNSAFE.getAndBitwiseAnd$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -863,7 +863,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
|
return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -890,7 +890,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseXor$RawType$(
|
return UNSAFE.getAndBitwiseXor$RawType$(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -903,7 +903,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseXor$RawType$Release(
|
return UNSAFE.getAndBitwiseXor$RawType$Release(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
@ -916,7 +916,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
||||||
|
|
||||||
@ForceInline
|
@ForceInline
|
||||||
static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||||
ByteBuffer bb = (ByteBuffer) obb;
|
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||||
if (handle.be == BE) {
|
if (handle.be == BE) {
|
||||||
return UNSAFE.getAndBitwiseXor$RawType$Acquire(
|
return UNSAFE.getAndBitwiseXor$RawType$Acquire(
|
||||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1802,11 +1802,11 @@ public class KeyStore {
|
||||||
|
|
||||||
// Load the keystore data
|
// Load the keystore data
|
||||||
if (keystore != null) {
|
if (keystore != null) {
|
||||||
|
dataStream.reset(); // prepare the stream for loading
|
||||||
if (hasPassword) {
|
if (hasPassword) {
|
||||||
dataStream.reset(); // prepare the stream for loading
|
|
||||||
keystore.load(dataStream, password);
|
keystore.load(dataStream, password);
|
||||||
} else {
|
} else {
|
||||||
keystore.load(param);
|
keystore.keyStoreSpi.engineLoad(dataStream, param);
|
||||||
}
|
}
|
||||||
return keystore;
|
return keystore;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -395,6 +395,12 @@ public abstract class KeyStoreSpi {
|
||||||
public void engineLoad(KeyStore.LoadStoreParameter param)
|
public void engineLoad(KeyStore.LoadStoreParameter param)
|
||||||
throws IOException, NoSuchAlgorithmException,
|
throws IOException, NoSuchAlgorithmException,
|
||||||
CertificateException {
|
CertificateException {
|
||||||
|
engineLoad(null, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
void engineLoad(InputStream stream, KeyStore.LoadStoreParameter param)
|
||||||
|
throws IOException, NoSuchAlgorithmException,
|
||||||
|
CertificateException {
|
||||||
|
|
||||||
if (param == null) {
|
if (param == null) {
|
||||||
engineLoad((InputStream)null, (char[])null);
|
engineLoad((InputStream)null, (char[])null);
|
||||||
|
@ -425,7 +431,7 @@ public abstract class KeyStoreSpi {
|
||||||
throw new NoSuchAlgorithmException("ProtectionParameter must"
|
throw new NoSuchAlgorithmException("ProtectionParameter must"
|
||||||
+ " be PasswordProtection or CallbackHandlerProtection");
|
+ " be PasswordProtection or CallbackHandlerProtection");
|
||||||
}
|
}
|
||||||
engineLoad(null, password);
|
engineLoad(stream, password);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -411,7 +411,7 @@ class ZoneName {
|
||||||
"Pacific/Wake", "Wake", "Pacific/Wake",
|
"Pacific/Wake", "Wake", "Pacific/Wake",
|
||||||
"Pacific/Pago_Pago", "Samoa", "Pacific/Apia",
|
"Pacific/Pago_Pago", "Samoa", "Pacific/Apia",
|
||||||
"America/Moncton", "Atlantic", "America/Halifax",
|
"America/Moncton", "Atlantic", "America/Halifax",
|
||||||
"Africa/Sao_Tome", "GMT", "Atlantic/Reykjavik",
|
"Africa/Sao_Tome", "Africa_Western", "Africa/Lagos",
|
||||||
"America/Glace_Bay", "Atlantic", "America/Halifax",
|
"America/Glace_Bay", "Atlantic", "America/Halifax",
|
||||||
"Asia/Jakarta", "Indonesia_Western", "Asia/Jakarta",
|
"Asia/Jakarta", "Indonesia_Western", "Asia/Jakarta",
|
||||||
"Africa/Asmera", "Africa_Eastern", "Africa/Nairobi",
|
"Africa/Asmera", "Africa_Eastern", "Africa/Nairobi",
|
||||||
|
@ -494,7 +494,6 @@ class ZoneName {
|
||||||
"America/Kralendijk", "Atlantic", "America/Halifax",
|
"America/Kralendijk", "Atlantic", "America/Halifax",
|
||||||
};
|
};
|
||||||
private static final String[] mzoneMap = new String[] {
|
private static final String[] mzoneMap = new String[] {
|
||||||
"GMT", "ST", "Africa/Sao_Tome",
|
|
||||||
"GMT", "ML", "Africa/Bamako",
|
"GMT", "ML", "Africa/Bamako",
|
||||||
"GMT", "IE", "Europe/Dublin",
|
"GMT", "IE", "Europe/Dublin",
|
||||||
"GMT", "SN", "Africa/Dakar",
|
"GMT", "SN", "Africa/Dakar",
|
||||||
|
@ -509,6 +508,7 @@ class ZoneName {
|
||||||
"GMT", "GB", "Europe/London",
|
"GMT", "GB", "Europe/London",
|
||||||
"GMT", "LR", "Africa/Monrovia",
|
"GMT", "LR", "Africa/Monrovia",
|
||||||
"GMT", "TG", "Africa/Lome",
|
"GMT", "TG", "Africa/Lome",
|
||||||
|
"Africa_Western", "ST", "Africa/Sao_Tome",
|
||||||
"Africa_Western", "CF", "Africa/Bangui",
|
"Africa_Western", "CF", "Africa/Bangui",
|
||||||
"Africa_Western", "NE", "Africa/Niamey",
|
"Africa_Western", "NE", "Africa/Niamey",
|
||||||
"Africa_Western", "CM", "Africa/Douala",
|
"Africa_Western", "CM", "Africa/Douala",
|
||||||
|
|
|
@ -1143,6 +1143,23 @@ public class ArrayList<E> extends AbstractList<E>
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object[] toArray() {
|
||||||
|
checkForComodification();
|
||||||
|
return Arrays.copyOfRange(root.elementData, offset, offset + size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T[] toArray(T[] a) {
|
||||||
|
checkForComodification();
|
||||||
|
if (a.length < size)
|
||||||
|
return (T[]) Arrays.copyOfRange(
|
||||||
|
root.elementData, offset, offset + size, a.getClass());
|
||||||
|
System.arraycopy(root.elementData, offset, a, 0, size);
|
||||||
|
if (a.length > size)
|
||||||
|
a[size] = null;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
public Iterator<E> iterator() {
|
public Iterator<E> iterator() {
|
||||||
return listIterator();
|
return listIterator();
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,8 @@ public class Base64 {
|
||||||
*
|
*
|
||||||
* @param lineLength
|
* @param lineLength
|
||||||
* the length of each output line (rounded down to nearest multiple
|
* the length of each output line (rounded down to nearest multiple
|
||||||
* of 4). If {@code lineLength <= 0} the output will not be separated
|
* of 4). If the rounded down line length is not a positive value,
|
||||||
* in lines
|
* the output will not be separated in lines
|
||||||
* @param lineSeparator
|
* @param lineSeparator
|
||||||
* the line separator for each output line
|
* the line separator for each output line
|
||||||
*
|
*
|
||||||
|
@ -135,10 +135,12 @@ public class Base64 {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
|
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
|
||||||
}
|
}
|
||||||
|
// round down to nearest multiple of 4
|
||||||
|
lineLength &= ~0b11;
|
||||||
if (lineLength <= 0) {
|
if (lineLength <= 0) {
|
||||||
return Encoder.RFC4648;
|
return Encoder.RFC4648;
|
||||||
}
|
}
|
||||||
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
|
return new Encoder(false, lineSeparator, lineLength, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -236,10 +236,8 @@ public class DoubleByte {
|
||||||
int b2 = src[sp++] & 0xff;
|
int b2 = src[sp++] & 0xff;
|
||||||
if (b2 < b2Min || b2 > b2Max ||
|
if (b2 < b2Min || b2 > b2Max ||
|
||||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||||
if (b2c[b1] == B2C_UNMAPPABLE || // isNotLeadingByte
|
if (crMalformedOrUnmappable(b1, b2).length() == 1) {
|
||||||
b2c[b2] != B2C_UNMAPPABLE || // isLeadingByte
|
sp--;
|
||||||
decodeSingle(b2) != UNMAPPABLE_DECODING) {
|
|
||||||
sp--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -472,6 +470,13 @@ public class DoubleByte {
|
||||||
b2cSB_UNMAPPABLE = new char[0x100];
|
b2cSB_UNMAPPABLE = new char[0x100];
|
||||||
Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
|
Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// always returns unmappableForLenth(2) for doublebyte_only
|
||||||
|
@Override
|
||||||
|
protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
|
||||||
|
return CoderResult.unmappableForLength(2);
|
||||||
|
}
|
||||||
|
|
||||||
public Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max,
|
public Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max,
|
||||||
boolean isASCIICompatible) {
|
boolean isASCIICompatible) {
|
||||||
super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max, isASCIICompatible);
|
super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max, isASCIICompatible);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -370,7 +370,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -83,6 +83,10 @@ import sun.security.util.SecurityConstants;
|
||||||
* application is executed, it will be executed on the same system as
|
* application is executed, it will be executed on the same system as
|
||||||
* the one on which the Java application was launched.
|
* the one on which the Java application was launched.
|
||||||
*
|
*
|
||||||
|
* <p> Note: the methods in the {@code Desktop} class may require
|
||||||
|
* platform-dependent permissions in addition to those described in the
|
||||||
|
* specification.
|
||||||
|
*
|
||||||
* @see Action
|
* @see Action
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## libpng v1.6.23
|
## libpng v1.6.34
|
||||||
|
|
||||||
### libpng License
|
### libpng License
|
||||||
<pre>
|
<pre>
|
||||||
|
@ -14,8 +14,8 @@ this sentence.
|
||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are
|
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
added to the list of Contributing Authors:
|
added to the list of Contributing Authors:
|
||||||
|
@ -26,6 +26,9 @@ added to the list of Contributing Authors:
|
||||||
Cosmin Truta
|
Cosmin Truta
|
||||||
Gilles Vollant
|
Gilles Vollant
|
||||||
James Yu
|
James Yu
|
||||||
|
Mandar Sahastrabuddhe
|
||||||
|
Google Inc.
|
||||||
|
Vadim Barkov
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
|
|
|
@ -630,19 +630,6 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
|
||||||
super.focusLost(e);
|
super.focusLost(e);
|
||||||
getComponent().repaint();
|
getComponent().repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for 5100950: textarea.getSelectedText() returns the de-selected text, on XToolkit
|
|
||||||
// Restoring Motif behaviour
|
|
||||||
// If the text is unhighlighted then we should sets the selection range to zero
|
|
||||||
@Override
|
|
||||||
public void setSelectionVisible(boolean vis) {
|
|
||||||
if (vis){
|
|
||||||
super.setSelectionVisible(vis);
|
|
||||||
}else{
|
|
||||||
// In order to de-select the selection
|
|
||||||
setDot(getDot());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("serial") // JDK-implementation class
|
@SuppressWarnings("serial") // JDK-implementation class
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ScriptEngineManager {
|
||||||
|
|
||||||
private void init(final ClassLoader loader) {
|
private void init(final ClassLoader loader) {
|
||||||
globalScope = new SimpleBindings();
|
globalScope = new SimpleBindings();
|
||||||
engineSpis = new HashSet<ScriptEngineFactory>();
|
engineSpis = new TreeSet<ScriptEngineFactory>(Comparator.comparing(ScriptEngineFactory::getEngineName));
|
||||||
nameAssociations = new HashMap<String, ScriptEngineFactory>();
|
nameAssociations = new HashMap<String, ScriptEngineFactory>();
|
||||||
extensionAssociations = new HashMap<String, ScriptEngineFactory>();
|
extensionAssociations = new HashMap<String, ScriptEngineFactory>();
|
||||||
mimeTypeAssociations = new HashMap<String, ScriptEngineFactory>();
|
mimeTypeAssociations = new HashMap<String, ScriptEngineFactory>();
|
||||||
|
@ -400,7 +400,7 @@ public class ScriptEngineManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set of script engine factories discovered. */
|
/** Set of script engine factories discovered. */
|
||||||
private HashSet<ScriptEngineFactory> engineSpis;
|
private TreeSet<ScriptEngineFactory> engineSpis;
|
||||||
|
|
||||||
/** Map of engine name to script engine factory. */
|
/** Map of engine name to script engine factory. */
|
||||||
private HashMap<String, ScriptEngineFactory> nameAssociations;
|
private HashMap<String, ScriptEngineFactory> nameAssociations;
|
||||||
|
|
|
@ -97,7 +97,6 @@ final class FunctionAvailableCall extends FunctionCall {
|
||||||
* the specified method is found in the specifed class.
|
* the specified method is found in the specifed class.
|
||||||
*/
|
*/
|
||||||
private boolean hasMethods() {
|
private boolean hasMethods() {
|
||||||
LiteralExpr arg = (LiteralExpr)_arg;
|
|
||||||
|
|
||||||
// Get the class name from the namespace uri
|
// Get the class name from the namespace uri
|
||||||
String className = getClassNameFromUri(_namespaceOfFunct);
|
String className = getClassNameFromUri(_namespaceOfFunct);
|
||||||
|
@ -110,7 +109,7 @@ final class FunctionAvailableCall extends FunctionCall {
|
||||||
int lastDotIndex = functionName.lastIndexOf('.');
|
int lastDotIndex = functionName.lastIndexOf('.');
|
||||||
if (lastDotIndex > 0) {
|
if (lastDotIndex > 0) {
|
||||||
methodName = functionName.substring(lastDotIndex+1);
|
methodName = functionName.substring(lastDotIndex+1);
|
||||||
if (className != null && !className.equals(""))
|
if (className != null && className.length() != 0)
|
||||||
className = className + "." + functionName.substring(0, lastDotIndex);
|
className = className + "." + functionName.substring(0, lastDotIndex);
|
||||||
else
|
else
|
||||||
className = functionName.substring(0, lastDotIndex);
|
className = functionName.substring(0, lastDotIndex);
|
||||||
|
|
|
@ -66,7 +66,7 @@ final class Sort extends Instruction implements Closure {
|
||||||
private AttributeValue _order;
|
private AttributeValue _order;
|
||||||
private AttributeValue _caseOrder;
|
private AttributeValue _caseOrder;
|
||||||
private AttributeValue _dataType;
|
private AttributeValue _dataType;
|
||||||
private String _lang; // bug! see 26869
|
private AttributeValue _lang; // bug! see 26869, see XALANJ-2546
|
||||||
|
|
||||||
private String _className = null;
|
private String _className = null;
|
||||||
private List<VariableRefBase> _closureVars = null;
|
private List<VariableRefBase> _closureVars = null;
|
||||||
|
@ -154,13 +154,11 @@ final class Sort extends Instruction implements Closure {
|
||||||
}
|
}
|
||||||
_dataType = AttributeValue.create(this, val, parser);
|
_dataType = AttributeValue.create(this, val, parser);
|
||||||
|
|
||||||
_lang = getAttribute("lang"); // bug! see 26869
|
val = getAttribute("lang");
|
||||||
// val = getAttribute("lang");
|
_lang = AttributeValue.create(this, val, parser);
|
||||||
// _lang = AttributeValue.create(this, val, parser);
|
|
||||||
// Get the case order; default is language dependant
|
// Get the case order; default is language dependant
|
||||||
val = getAttribute("case-order");
|
val = getAttribute("case-order");
|
||||||
_caseOrder = AttributeValue.create(this, val, parser);
|
_caseOrder = AttributeValue.create(this, val, parser);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,6 +177,7 @@ final class Sort extends Instruction implements Closure {
|
||||||
_order.typeCheck(stable);
|
_order.typeCheck(stable);
|
||||||
_caseOrder.typeCheck(stable);
|
_caseOrder.typeCheck(stable);
|
||||||
_dataType.typeCheck(stable);
|
_dataType.typeCheck(stable);
|
||||||
|
_lang.typeCheck(stable);
|
||||||
return Type.Void;
|
return Type.Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,16 +195,14 @@ final class Sort extends Instruction implements Closure {
|
||||||
_order.translate(classGen, methodGen);
|
_order.translate(classGen, methodGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void translateCaseOrder(ClassGenerator classGen,
|
public void translateCaseOrder(ClassGenerator classGen,
|
||||||
MethodGenerator methodGen) {
|
MethodGenerator methodGen) {
|
||||||
_caseOrder.translate(classGen, methodGen);
|
_caseOrder.translate(classGen, methodGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void translateLang(ClassGenerator classGen,
|
public void translateLang(ClassGenerator classGen,
|
||||||
MethodGenerator methodGen) {
|
MethodGenerator methodGen) {
|
||||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
_lang.translate(classGen, methodGen);
|
||||||
final InstructionList il = methodGen.getInstructionList();
|
|
||||||
il.append(new PUSH(cpg, _lang)); // bug! see 26869
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -570,7 +570,7 @@ public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl
|
||||||
if (_openElementName != null) {
|
if (_openElementName != null) {
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
if ((index =_openElementName.indexOf(":")) < 0)
|
if ((index =_openElementName.indexOf(':')) < 0)
|
||||||
_dom.startElement(null, _openElementName, _openElementName, _attributes);
|
_dom.startElement(null, _openElementName, _openElementName, _attributes);
|
||||||
else {
|
else {
|
||||||
String uri =_dom.getNamespaceURI(_openElementName.substring(0,index));
|
String uri =_dom.getNamespaceURI(_openElementName.substring(0,index));
|
||||||
|
@ -682,7 +682,7 @@ public class AdaptiveResultTreeImpl extends SimpleResultTreeImpl
|
||||||
public void addAttribute(String qName, String value)
|
public void addAttribute(String qName, String value)
|
||||||
{
|
{
|
||||||
// "prefix:localpart" or "localpart"
|
// "prefix:localpart" or "localpart"
|
||||||
int colonpos = qName.indexOf(":");
|
int colonpos = qName.indexOf(':');
|
||||||
String uri = EMPTY_STRING;
|
String uri = EMPTY_STRING;
|
||||||
String localName = qName;
|
String localName = qName;
|
||||||
if (colonpos >0)
|
if (colonpos >0)
|
||||||
|
|
|
@ -1425,8 +1425,8 @@ public final class BasisLibrary {
|
||||||
* This method should only be invoked if the name attribute is an AVT
|
* This method should only be invoked if the name attribute is an AVT
|
||||||
*/
|
*/
|
||||||
public static void checkAttribQName(String name) {
|
public static void checkAttribQName(String name) {
|
||||||
final int firstOccur = name.indexOf(":");
|
final int firstOccur = name.indexOf(':');
|
||||||
final int lastOccur = name.lastIndexOf(":");
|
final int lastOccur = name.lastIndexOf(':');
|
||||||
final String localName = name.substring(lastOccur + 1);
|
final String localName = name.substring(lastOccur + 1);
|
||||||
|
|
||||||
if (firstOccur > 0) {
|
if (firstOccur > 0) {
|
||||||
|
|
|
@ -354,7 +354,7 @@ public abstract class DTMDefaultBase implements DTM
|
||||||
|
|
||||||
while (low <= high)
|
while (low <= high)
|
||||||
{
|
{
|
||||||
int mid = (low + high) / 2;
|
int mid = (low + high) >>> 1;
|
||||||
int c = list[mid];
|
int c = list[mid];
|
||||||
|
|
||||||
if (c > value)
|
if (c > value)
|
||||||
|
|
|
@ -669,9 +669,10 @@ public class NodeVector implements Serializable, Cloneable
|
||||||
/*
|
/*
|
||||||
* Pick a pivot and move it out of the way
|
* Pick a pivot and move it out of the way
|
||||||
*/
|
*/
|
||||||
int pivot = a[(lo + hi) / 2];
|
int mid = (lo + hi) >>> 1;
|
||||||
|
int pivot = a[mid];
|
||||||
|
|
||||||
a[(lo + hi) / 2] = a[hi];
|
a[mid] = a[hi];
|
||||||
a[hi] = pivot;
|
a[hi] = pivot;
|
||||||
|
|
||||||
while (lo < hi)
|
while (lo < hi)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## Apache Xalan v2.7.1
|
## Apache Xalan v2.7.2
|
||||||
|
|
||||||
### Apache Xalan Notice
|
### Apache Xalan Notice
|
||||||
<pre>
|
<pre>
|
||||||
|
@ -11,6 +11,11 @@
|
||||||
This product includes software developed by
|
This product includes software developed by
|
||||||
The Apache Software Foundation (http://www.apache.org/).
|
The Apache Software Foundation (http://www.apache.org/).
|
||||||
|
|
||||||
|
Specifically, we only include the XSLTC portion of the source from the Xalan distribution.
|
||||||
|
The Xalan project has two processors: an interpretive one (Xalan Interpretive) and a
|
||||||
|
compiled one (The XSLT Compiler (XSLTC)). We *only* use the XSLTC part of Xalan; We use
|
||||||
|
the source from the packages that are part of the XSLTC sources.
|
||||||
|
|
||||||
Portions of this software was originally based on the following:
|
Portions of this software was originally based on the following:
|
||||||
|
|
||||||
- software copyright (c) 1999-2002, Lotus Development Corporation., http://www.lotus.com.
|
- software copyright (c) 1999-2002, Lotus Development Corporation., http://www.lotus.com.
|
||||||
|
|
|
@ -59,7 +59,9 @@ import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
|
||||||
import com.sun.tools.javac.util.*;
|
import com.sun.tools.javac.util.*;
|
||||||
import com.sun.tools.javac.util.DefinedBy.Api;
|
import com.sun.tools.javac.util.DefinedBy.Api;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Error;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.Fragment;
|
import com.sun.tools.javac.util.JCDiagnostic.Fragment;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Warning;
|
||||||
import com.sun.tools.javac.util.List;
|
import com.sun.tools.javac.util.List;
|
||||||
|
|
||||||
import static com.sun.tools.javac.code.Flags.*;
|
import static com.sun.tools.javac.code.Flags.*;
|
||||||
|
@ -1417,7 +1419,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
if (!pattype.hasTag(ERROR)) {
|
if (!pattype.hasTag(ERROR)) {
|
||||||
if (pattype.constValue() == null) {
|
if (pattype.constValue() == null) {
|
||||||
log.error(c.pat.pos(),
|
log.error(c.pat.pos(),
|
||||||
(stringSwitch ? "string.const.req" : "const.expr.req"));
|
(stringSwitch ? Errors.StringConstReq : Errors.ConstExprReq));
|
||||||
} else if (!labels.add(pattype.constValue())) {
|
} else if (!labels.add(pattype.constValue())) {
|
||||||
log.error(c.pos(), Errors.DuplicateCaseLabel);
|
log.error(c.pos(), Errors.DuplicateCaseLabel);
|
||||||
}
|
}
|
||||||
|
@ -3675,8 +3677,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
sym.name != names._class) {
|
sym.name != names._class) {
|
||||||
// If the qualified item is not a type and the selected item is static, report
|
// If the qualified item is not a type and the selected item is static, report
|
||||||
// a warning. Make allowance for the class of an array type e.g. Object[].class)
|
// a warning. Make allowance for the class of an array type e.g. Object[].class)
|
||||||
chk.warnStatic(tree, "static.not.qualified.by.type",
|
chk.warnStatic(tree, Warnings.StaticNotQualifiedByType(sym.kind.kindName(), sym.owner));
|
||||||
sym.kind.kindName(), sym.owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are selecting an instance member via a `super', ...
|
// If we are selecting an instance member via a `super', ...
|
||||||
|
@ -3925,9 +3926,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
if (s != null &&
|
if (s != null &&
|
||||||
s.isRaw() &&
|
s.isRaw() &&
|
||||||
!types.isSameType(v.type, v.erasure(types))) {
|
!types.isSameType(v.type, v.erasure(types))) {
|
||||||
chk.warnUnchecked(tree.pos(),
|
chk.warnUnchecked(tree.pos(), Warnings.UncheckedAssignToVar(v, s));
|
||||||
"unchecked.assign.to.var",
|
|
||||||
v, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The computed type of a variable is the type of the
|
// The computed type of a variable is the type of the
|
||||||
|
@ -4002,12 +4001,14 @@ public class Attr extends JCTree.Visitor {
|
||||||
((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
|
((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
|
||||||
(!env.tree.hasTag(ASSIGN) ||
|
(!env.tree.hasTag(ASSIGN) ||
|
||||||
TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
|
TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
|
||||||
String suffix = (initEnv.info.enclVar == v) ?
|
|
||||||
"self.ref" : "forward.ref";
|
|
||||||
if (!onlyWarning || isStaticEnumField(v)) {
|
if (!onlyWarning || isStaticEnumField(v)) {
|
||||||
log.error(tree.pos(), "illegal." + suffix);
|
Error errkey = (initEnv.info.enclVar == v) ?
|
||||||
|
Errors.IllegalSelfRef : Errors.IllegalForwardRef;
|
||||||
|
log.error(tree.pos(), errkey);
|
||||||
} else if (useBeforeDeclarationWarning) {
|
} else if (useBeforeDeclarationWarning) {
|
||||||
log.warning(tree.pos(), suffix, v);
|
Warning warnkey = (initEnv.info.enclVar == v) ?
|
||||||
|
Warnings.SelfRef(v) : Warnings.ForwardRef(v);
|
||||||
|
log.warning(tree.pos(), warnkey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4117,9 +4118,7 @@ public class Attr extends JCTree.Visitor {
|
||||||
if (s != null && s.isRaw() &&
|
if (s != null && s.isRaw() &&
|
||||||
!types.isSameTypes(sym.type.getParameterTypes(),
|
!types.isSameTypes(sym.type.getParameterTypes(),
|
||||||
sym.erasure(types).getParameterTypes())) {
|
sym.erasure(types).getParameterTypes())) {
|
||||||
chk.warnUnchecked(env.tree.pos(),
|
chk.warnUnchecked(env.tree.pos(), Warnings.UncheckedCallMbrOfRawType(sym, s));
|
||||||
"unchecked.call.mbr.of.raw.type",
|
|
||||||
sym, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4169,14 +4168,12 @@ public class Attr extends JCTree.Visitor {
|
||||||
argtypes = argtypes.map(checkDeferredMap);
|
argtypes = argtypes.map(checkDeferredMap);
|
||||||
|
|
||||||
if (noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
|
if (noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
|
||||||
chk.warnUnchecked(env.tree.pos(),
|
chk.warnUnchecked(env.tree.pos(), Warnings.UncheckedMethInvocationApplied(kindName(sym),
|
||||||
"unchecked.meth.invocation.applied",
|
|
||||||
kindName(sym),
|
|
||||||
sym.name,
|
sym.name,
|
||||||
rs.methodArguments(sym.type.getParameterTypes()),
|
rs.methodArguments(sym.type.getParameterTypes()),
|
||||||
rs.methodArguments(argtypes.map(checkDeferredMap)),
|
rs.methodArguments(argtypes.map(checkDeferredMap)),
|
||||||
kindName(sym.location()),
|
kindName(sym.location()),
|
||||||
sym.location());
|
sym.location()));
|
||||||
if (resultInfo.pt != Infer.anyPoly ||
|
if (resultInfo.pt != Infer.anyPoly ||
|
||||||
!owntype.hasTag(METHOD) ||
|
!owntype.hasTag(METHOD) ||
|
||||||
!owntype.isPartial()) {
|
!owntype.isPartial()) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -43,7 +43,9 @@ import com.sun.tools.javac.tree.*;
|
||||||
import com.sun.tools.javac.util.*;
|
import com.sun.tools.javac.util.*;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Error;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.Fragment;
|
import com.sun.tools.javac.util.JCDiagnostic.Fragment;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Warning;
|
||||||
import com.sun.tools.javac.util.List;
|
import com.sun.tools.javac.util.List;
|
||||||
|
|
||||||
import com.sun.tools.javac.code.Lint;
|
import com.sun.tools.javac.code.Lint;
|
||||||
|
@ -205,16 +207,16 @@ public class Check {
|
||||||
if (sym.isDeprecatedForRemoval()) {
|
if (sym.isDeprecatedForRemoval()) {
|
||||||
if (!lint.isSuppressed(LintCategory.REMOVAL)) {
|
if (!lint.isSuppressed(LintCategory.REMOVAL)) {
|
||||||
if (sym.kind == MDL) {
|
if (sym.kind == MDL) {
|
||||||
removalHandler.report(pos, "has.been.deprecated.for.removal.module", sym);
|
removalHandler.report(pos, Warnings.HasBeenDeprecatedForRemovalModule(sym));
|
||||||
} else {
|
} else {
|
||||||
removalHandler.report(pos, "has.been.deprecated.for.removal", sym, sym.location());
|
removalHandler.report(pos, Warnings.HasBeenDeprecatedForRemoval(sym, sym.location()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!lint.isSuppressed(LintCategory.DEPRECATION)) {
|
} else if (!lint.isSuppressed(LintCategory.DEPRECATION)) {
|
||||||
if (sym.kind == MDL) {
|
if (sym.kind == MDL) {
|
||||||
deprecationHandler.report(pos, "has.been.deprecated.module", sym);
|
deprecationHandler.report(pos, Warnings.HasBeenDeprecatedModule(sym));
|
||||||
} else {
|
} else {
|
||||||
deprecationHandler.report(pos, "has.been.deprecated", sym, sym.location());
|
deprecationHandler.report(pos, Warnings.HasBeenDeprecated(sym, sym.location()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,22 +225,22 @@ public class Check {
|
||||||
* @param pos Position to be used for error reporting.
|
* @param pos Position to be used for error reporting.
|
||||||
* @param msg A string describing the problem.
|
* @param msg A string describing the problem.
|
||||||
*/
|
*/
|
||||||
public void warnUnchecked(DiagnosticPosition pos, String msg, Object... args) {
|
public void warnUnchecked(DiagnosticPosition pos, Warning warnKey) {
|
||||||
if (!lint.isSuppressed(LintCategory.UNCHECKED))
|
if (!lint.isSuppressed(LintCategory.UNCHECKED))
|
||||||
uncheckedHandler.report(pos, msg, args);
|
uncheckedHandler.report(pos, warnKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Warn about unsafe vararg method decl.
|
/** Warn about unsafe vararg method decl.
|
||||||
* @param pos Position to be used for error reporting.
|
* @param pos Position to be used for error reporting.
|
||||||
*/
|
*/
|
||||||
void warnUnsafeVararg(DiagnosticPosition pos, String key, Object... args) {
|
void warnUnsafeVararg(DiagnosticPosition pos, Warning warnKey) {
|
||||||
if (lint.isEnabled(LintCategory.VARARGS) && Feature.SIMPLIFIED_VARARGS.allowedInSource(source))
|
if (lint.isEnabled(LintCategory.VARARGS) && Feature.SIMPLIFIED_VARARGS.allowedInSource(source))
|
||||||
log.warning(LintCategory.VARARGS, pos, key, args);
|
log.warning(LintCategory.VARARGS, pos, warnKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warnStatic(DiagnosticPosition pos, String msg, Object... args) {
|
public void warnStatic(DiagnosticPosition pos, Warning warnKey) {
|
||||||
if (lint.isEnabled(LintCategory.STATIC))
|
if (lint.isEnabled(LintCategory.STATIC))
|
||||||
log.warning(LintCategory.STATIC, pos, msg, args);
|
log.warning(LintCategory.STATIC, pos, warnKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Warn about division by integer constant zero.
|
/** Warn about division by integer constant zero.
|
||||||
|
@ -903,14 +905,13 @@ public class Check {
|
||||||
}
|
}
|
||||||
} else if (hasTrustMeAnno && varargElemType != null &&
|
} else if (hasTrustMeAnno && varargElemType != null &&
|
||||||
types.isReifiable(varargElemType)) {
|
types.isReifiable(varargElemType)) {
|
||||||
warnUnsafeVararg(tree,
|
warnUnsafeVararg(tree, Warnings.VarargsRedundantTrustmeAnno(
|
||||||
"varargs.redundant.trustme.anno",
|
syms.trustMeType.tsym,
|
||||||
syms.trustMeType.tsym,
|
diags.fragment(Fragments.VarargsTrustmeOnReifiableVarargs(varargElemType))));
|
||||||
diags.fragment(Fragments.VarargsTrustmeOnReifiableVarargs(varargElemType)));
|
|
||||||
}
|
}
|
||||||
else if (!hasTrustMeAnno && varargElemType != null &&
|
else if (!hasTrustMeAnno && varargElemType != null &&
|
||||||
!types.isReifiable(varargElemType)) {
|
!types.isReifiable(varargElemType)) {
|
||||||
warnUnchecked(tree.params.head.pos(), "unchecked.varargs.non.reifiable.type", varargElemType);
|
warnUnchecked(tree.params.head.pos(), Warnings.UncheckedVarargsNonReifiableType(varargElemType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//where
|
//where
|
||||||
|
@ -998,9 +999,7 @@ public class Check {
|
||||||
(!Feature.SIMPLIFIED_VARARGS.allowedInSource(source) ||
|
(!Feature.SIMPLIFIED_VARARGS.allowedInSource(source) ||
|
||||||
sym.baseSymbol().attribute(syms.trustMeType.tsym) == null ||
|
sym.baseSymbol().attribute(syms.trustMeType.tsym) == null ||
|
||||||
!isTrustMeAllowedOnMethod(sym))) {
|
!isTrustMeAllowedOnMethod(sym))) {
|
||||||
warnUnchecked(env.tree.pos(),
|
warnUnchecked(env.tree.pos(), Warnings.UncheckedGenericArrayCreation(argtype));
|
||||||
"unchecked.generic.array.creation",
|
|
||||||
argtype);
|
|
||||||
}
|
}
|
||||||
if ((sym.baseSymbol().flags() & SIGNATURE_POLYMORPHIC) == 0) {
|
if ((sym.baseSymbol().flags() & SIGNATURE_POLYMORPHIC) == 0) {
|
||||||
TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype));
|
TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype));
|
||||||
|
@ -1761,9 +1760,7 @@ public class Check {
|
||||||
return;
|
return;
|
||||||
} else if (overrideWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
|
} else if (overrideWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
|
||||||
warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
|
warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
|
||||||
"override.unchecked.ret",
|
Warnings.OverrideUncheckedRet(uncheckedOverrides(m, other), mtres, otres));
|
||||||
uncheckedOverrides(m, other),
|
|
||||||
mtres, otres);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error if overriding method throws an exception not reported
|
// Error if overriding method throws an exception not reported
|
||||||
|
@ -1779,9 +1776,7 @@ public class Check {
|
||||||
}
|
}
|
||||||
else if (unhandledUnerased.nonEmpty()) {
|
else if (unhandledUnerased.nonEmpty()) {
|
||||||
warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
|
warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
|
||||||
"override.unchecked.thrown",
|
Warnings.OverrideUncheckedThrown(cannotOverride(m, other), unhandledUnerased.head));
|
||||||
cannotOverride(m, other),
|
|
||||||
unhandledUnerased.head);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3237,10 +3232,10 @@ public class Check {
|
||||||
missingDefaults = missingDefaults.reverse();
|
missingDefaults = missingDefaults.reverse();
|
||||||
if (missingDefaults.nonEmpty()) {
|
if (missingDefaults.nonEmpty()) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
String key = (missingDefaults.size() > 1)
|
Error errorKey = (missingDefaults.size() > 1)
|
||||||
? "annotation.missing.default.value.1"
|
? Errors.AnnotationMissingDefaultValue1(a.type, missingDefaults)
|
||||||
: "annotation.missing.default.value";
|
: Errors.AnnotationMissingDefaultValue(a.type, missingDefaults);
|
||||||
log.error(a.pos(), key, a.type, missingDefaults);
|
log.error(a.pos(), errorKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isValid && validateTargetAnnotationValue(a);
|
return isValid && validateTargetAnnotationValue(a);
|
||||||
|
@ -3605,14 +3600,14 @@ public class Check {
|
||||||
if (warned) return; // suppress redundant diagnostics
|
if (warned) return; // suppress redundant diagnostics
|
||||||
switch (lint) {
|
switch (lint) {
|
||||||
case UNCHECKED:
|
case UNCHECKED:
|
||||||
Check.this.warnUnchecked(pos(), "prob.found.req", diags.fragment(uncheckedKey), found, expected);
|
Check.this.warnUnchecked(pos(), Warnings.ProbFoundReq(diags.fragment(uncheckedKey), found, expected));
|
||||||
break;
|
break;
|
||||||
case VARARGS:
|
case VARARGS:
|
||||||
if (method != null &&
|
if (method != null &&
|
||||||
method.attribute(syms.trustMeType.tsym) != null &&
|
method.attribute(syms.trustMeType.tsym) != null &&
|
||||||
isTrustMeAllowedOnMethod(method) &&
|
isTrustMeAllowedOnMethod(method) &&
|
||||||
!types.isReifiable(method.type.getParameterTypes().last())) {
|
!types.isReifiable(method.type.getParameterTypes().last())) {
|
||||||
Check.this.warnUnsafeVararg(pos(), "varargs.unsafe.use.varargs.param", method.params.last());
|
Check.this.warnUnsafeVararg(pos(), Warnings.VarargsUnsafeUseVarargsParam(method.params.last()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -38,6 +38,8 @@ import com.sun.tools.javac.resources.CompilerProperties.Warnings;
|
||||||
import com.sun.tools.javac.tree.*;
|
import com.sun.tools.javac.tree.*;
|
||||||
import com.sun.tools.javac.util.*;
|
import com.sun.tools.javac.util.*;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Error;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Warning;
|
||||||
|
|
||||||
import com.sun.tools.javac.code.Symbol.*;
|
import com.sun.tools.javac.code.Symbol.*;
|
||||||
import com.sun.tools.javac.tree.JCTree.*;
|
import com.sun.tools.javac.tree.JCTree.*;
|
||||||
|
@ -1183,10 +1185,10 @@ public class Flow {
|
||||||
// exception, that would have been covered in the branch above
|
// exception, that would have been covered in the branch above
|
||||||
if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() &&
|
if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() &&
|
||||||
!isExceptionOrThrowable(exc)) {
|
!isExceptionOrThrowable(exc)) {
|
||||||
String key = catchableThrownTypes.length() == 1 ?
|
Warning key = catchableThrownTypes.length() == 1 ?
|
||||||
"unreachable.catch" :
|
Warnings.UnreachableCatch(catchableThrownTypes) :
|
||||||
"unreachable.catch.1";
|
Warnings.UnreachableCatch1(catchableThrownTypes);
|
||||||
log.warning(pos, key, catchableThrownTypes);
|
log.warning(pos, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1617,7 +1619,7 @@ public class Flow {
|
||||||
Errors.FinalParameterMayNotBeAssigned(sym));
|
Errors.FinalParameterMayNotBeAssigned(sym));
|
||||||
}
|
}
|
||||||
} else if (!uninits.isMember(sym.adr)) {
|
} else if (!uninits.isMember(sym.adr)) {
|
||||||
log.error(pos, flowKind.errKey, sym);
|
log.error(pos, diags.errorKey(flowKind.errKey, sym));
|
||||||
} else {
|
} else {
|
||||||
uninit(sym);
|
uninit(sym);
|
||||||
}
|
}
|
||||||
|
@ -1656,14 +1658,14 @@ public class Flow {
|
||||||
/** Check that trackable variable is initialized.
|
/** Check that trackable variable is initialized.
|
||||||
*/
|
*/
|
||||||
void checkInit(DiagnosticPosition pos, VarSymbol sym) {
|
void checkInit(DiagnosticPosition pos, VarSymbol sym) {
|
||||||
checkInit(pos, sym, "var.might.not.have.been.initialized");
|
checkInit(pos, sym, Errors.VarMightNotHaveBeenInitialized(sym));
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) {
|
void checkInit(DiagnosticPosition pos, VarSymbol sym, Error errkey) {
|
||||||
if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
|
if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
|
||||||
trackable(sym) &&
|
trackable(sym) &&
|
||||||
!inits.isMember(sym.adr)) {
|
!inits.isMember(sym.adr)) {
|
||||||
log.error(pos, errkey, sym);
|
log.error(pos, errkey);
|
||||||
inits.incl(sym.adr);
|
inits.incl(sym.adr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1894,7 +1896,7 @@ public class Flow {
|
||||||
// the ctor is default(synthesized) or not
|
// the ctor is default(synthesized) or not
|
||||||
if (isSynthesized) {
|
if (isSynthesized) {
|
||||||
checkInit(TreeInfo.diagnosticPositionFor(var, vardecl),
|
checkInit(TreeInfo.diagnosticPositionFor(var, vardecl),
|
||||||
var, "var.not.initialized.in.default.constructor");
|
var, Errors.VarNotInitializedInDefaultConstructor(var));
|
||||||
} else {
|
} else {
|
||||||
checkInit(TreeInfo.diagEndPos(tree.body), var);
|
checkInit(TreeInfo.diagEndPos(tree.body), var);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1410,7 +1410,7 @@ public class LambdaToMethod extends TreeTranslator {
|
||||||
super.visitLambda(tree);
|
super.visitLambda(tree);
|
||||||
context.complete();
|
context.complete();
|
||||||
if (dumpLambdaToMethodStats) {
|
if (dumpLambdaToMethodStats) {
|
||||||
log.note(tree, statKey, context.needsAltMetafactory(), context.translatedSym);
|
log.note(tree, diags.noteKey(statKey, context.needsAltMetafactory(), context.translatedSym));
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -33,6 +33,7 @@ import com.sun.tools.javac.code.Scope.WriteableScope;
|
||||||
import com.sun.tools.javac.tree.*;
|
import com.sun.tools.javac.tree.*;
|
||||||
import com.sun.tools.javac.util.*;
|
import com.sun.tools.javac.util.*;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Error;
|
||||||
|
|
||||||
import com.sun.tools.javac.code.Symbol.*;
|
import com.sun.tools.javac.code.Symbol.*;
|
||||||
import com.sun.tools.javac.code.Type.*;
|
import com.sun.tools.javac.code.Type.*;
|
||||||
|
@ -305,9 +306,9 @@ public class MemberEnter extends JCTree.Visitor {
|
||||||
v.pos = tree.pos;
|
v.pos = tree.pos;
|
||||||
}
|
}
|
||||||
// where
|
// where
|
||||||
void checkType(JCTree tree, Type type, String diag) {
|
void checkType(JCTree tree, Type type, Error errorKey) {
|
||||||
if (!tree.type.isErroneous() && !types.isSameType(tree.type, type)) {
|
if (!tree.type.isErroneous() && !types.isSameType(tree.type, type)) {
|
||||||
log.error(tree, diag, type, tree.type);
|
log.error(tree, errorKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void checkReceiver(JCVariableDecl tree, Env<AttrContext> localEnv) {
|
void checkReceiver(JCVariableDecl tree, Env<AttrContext> localEnv) {
|
||||||
|
@ -320,14 +321,14 @@ public class MemberEnter extends JCTree.Visitor {
|
||||||
outertype = m.owner.owner.owner.type;
|
outertype = m.owner.owner.owner.type;
|
||||||
}
|
}
|
||||||
if (outertype.hasTag(TypeTag.CLASS)) {
|
if (outertype.hasTag(TypeTag.CLASS)) {
|
||||||
checkType(tree.vartype, outertype, "incorrect.constructor.receiver.type");
|
checkType(tree.vartype, outertype, Errors.IncorrectConstructorReceiverType(outertype, tree.vartype.type));
|
||||||
checkType(tree.nameexpr, outertype, "incorrect.constructor.receiver.name");
|
checkType(tree.nameexpr, outertype, Errors.IncorrectConstructorReceiverName(outertype, tree.nameexpr.type));
|
||||||
} else {
|
} else {
|
||||||
log.error(tree, Errors.ReceiverParameterNotApplicableConstructorToplevelClass);
|
log.error(tree, Errors.ReceiverParameterNotApplicableConstructorToplevelClass);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
checkType(tree.vartype, m.owner.type, "incorrect.receiver.type");
|
checkType(tree.vartype, m.owner.type, Errors.IncorrectReceiverType(m.owner.type, tree.vartype.type));
|
||||||
checkType(tree.nameexpr, m.owner.type, "incorrect.receiver.name");
|
checkType(tree.nameexpr, m.owner.type, Errors.IncorrectReceiverName(m.owner.type, tree.nameexpr.type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||||
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
|
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
|
||||||
import com.sun.tools.javac.util.DefinedBy;
|
import com.sun.tools.javac.util.DefinedBy;
|
||||||
import com.sun.tools.javac.util.DefinedBy.Api;
|
import com.sun.tools.javac.util.DefinedBy.Api;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Warning;
|
||||||
import com.sun.tools.javac.util.ListBuffer;
|
import com.sun.tools.javac.util.ListBuffer;
|
||||||
import com.sun.tools.javac.util.Log;
|
import com.sun.tools.javac.util.Log;
|
||||||
import com.sun.tools.javac.jvm.ModuleNameReader;
|
import com.sun.tools.javac.jvm.ModuleNameReader;
|
||||||
|
@ -1600,10 +1601,10 @@ public class Locations {
|
||||||
void add(Map<String, List<Path>> map, Path prefix, Path suffix) {
|
void add(Map<String, List<Path>> map, Path prefix, Path suffix) {
|
||||||
if (!Files.isDirectory(prefix)) {
|
if (!Files.isDirectory(prefix)) {
|
||||||
if (warn) {
|
if (warn) {
|
||||||
String key = Files.exists(prefix)
|
Warning key = Files.exists(prefix)
|
||||||
? "dir.path.element.not.directory"
|
? Warnings.DirPathElementNotDirectory(prefix)
|
||||||
: "dir.path.element.not.found";
|
: Warnings.DirPathElementNotFound(prefix);
|
||||||
log.warning(Lint.LintCategory.PATH, key, prefix);
|
log.warning(Lint.LintCategory.PATH, key);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
package com.sun.tools.javac.parser;
|
package com.sun.tools.javac.parser;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
|
import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
|
||||||
|
@ -39,12 +37,16 @@ import com.sun.tools.javac.parser.Tokens.*;
|
||||||
import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
|
import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
|
||||||
import com.sun.tools.javac.resources.CompilerProperties;
|
import com.sun.tools.javac.resources.CompilerProperties;
|
||||||
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||||
|
import com.sun.tools.javac.resources.CompilerProperties.Fragments;
|
||||||
|
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
|
||||||
import com.sun.tools.javac.tree.*;
|
import com.sun.tools.javac.tree.*;
|
||||||
import com.sun.tools.javac.tree.JCTree.*;
|
import com.sun.tools.javac.tree.JCTree.*;
|
||||||
import com.sun.tools.javac.util.*;
|
import com.sun.tools.javac.util.*;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.Error;
|
import com.sun.tools.javac.util.JCDiagnostic.Error;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Warning;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Fragment;
|
||||||
import com.sun.tools.javac.util.List;
|
import com.sun.tools.javac.util.List;
|
||||||
|
|
||||||
import static com.sun.tools.javac.parser.Tokens.TokenKind.*;
|
import static com.sun.tools.javac.parser.Tokens.TokenKind.*;
|
||||||
|
@ -365,14 +367,14 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JCErroneous syntaxError(int pos, String key, TokenKind... args) {
|
protected JCErroneous syntaxError(int pos, Error errorKey) {
|
||||||
return syntaxError(pos, List.nil(), key, args);
|
return syntaxError(pos, List.nil(), errorKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) {
|
protected JCErroneous syntaxError(int pos, List<JCTree> errs, Error errorKey) {
|
||||||
setErrorEndPos(pos);
|
setErrorEndPos(pos);
|
||||||
JCErroneous err = F.at(pos).Erroneous(errs);
|
JCErroneous err = F.at(pos).Erroneous(errs);
|
||||||
reportSyntaxError(err, key, (Object[])args);
|
reportSyntaxError(err, errorKey);
|
||||||
if (errs != null) {
|
if (errs != null) {
|
||||||
JCTree last = errs.last();
|
JCTree last = errs.last();
|
||||||
if (last != null)
|
if (last != null)
|
||||||
|
@ -389,22 +391,22 @@ public class JavacParser implements Parser {
|
||||||
* Report a syntax using the given the position parameter and arguments,
|
* Report a syntax using the given the position parameter and arguments,
|
||||||
* unless one was already reported at the same position.
|
* unless one was already reported at the same position.
|
||||||
*/
|
*/
|
||||||
protected void reportSyntaxError(int pos, String key, Object... args) {
|
protected void reportSyntaxError(int pos, Error errorKey) {
|
||||||
JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
|
JCDiagnostic.DiagnosticPosition diag = new JCDiagnostic.SimpleDiagnosticPosition(pos);
|
||||||
reportSyntaxError(diag, key, args);
|
reportSyntaxError(diag, errorKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report a syntax error using the given DiagnosticPosition object and
|
* Report a syntax error using the given DiagnosticPosition object and
|
||||||
* arguments, unless one was already reported at the same position.
|
* arguments, unless one was already reported at the same position.
|
||||||
*/
|
*/
|
||||||
protected void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
|
protected void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, Error errorKey) {
|
||||||
int pos = diagPos.getPreferredPosition();
|
int pos = diagPos.getPreferredPosition();
|
||||||
if (pos > S.errPos() || pos == Position.NOPOS) {
|
if (pos > S.errPos() || pos == Position.NOPOS) {
|
||||||
if (token.kind == EOF) {
|
if (token.kind == EOF) {
|
||||||
error(diagPos, "premature.eof");
|
log.error(DiagnosticFlag.SYNTAX, diagPos, Errors.PrematureEof);
|
||||||
} else {
|
} else {
|
||||||
error(diagPos, key, args);
|
log.error(DiagnosticFlag.SYNTAX, diagPos, errorKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
S.errPos(pos);
|
S.errPos(pos);
|
||||||
|
@ -417,21 +419,6 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Generate a syntax error at current position unless one was already
|
|
||||||
* reported at the same position.
|
|
||||||
*/
|
|
||||||
protected JCErroneous syntaxError(String key) {
|
|
||||||
return syntaxError(token.pos, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Generate a syntax error at current position unless one was
|
|
||||||
* already reported at the same position.
|
|
||||||
*/
|
|
||||||
protected JCErroneous syntaxError(String key, TokenKind arg) {
|
|
||||||
return syntaxError(token.pos, key, arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If next input token matches given token, skip it, otherwise report
|
/** If next input token matches given token, skip it, otherwise report
|
||||||
* an error.
|
* an error.
|
||||||
*/
|
*/
|
||||||
|
@ -440,7 +427,7 @@ public class JavacParser implements Parser {
|
||||||
nextToken();
|
nextToken();
|
||||||
} else {
|
} else {
|
||||||
setErrorEndPos(token.pos);
|
setErrorEndPos(token.pos);
|
||||||
reportSyntaxError(S.prevToken().endPos, "expected", tk);
|
reportSyntaxError(S.prevToken().endPos, Errors.Expected(tk));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,9 +436,9 @@ public class JavacParser implements Parser {
|
||||||
JCExpression illegal(int pos) {
|
JCExpression illegal(int pos) {
|
||||||
setErrorEndPos(pos);
|
setErrorEndPos(pos);
|
||||||
if ((mode & EXPR) != 0)
|
if ((mode & EXPR) != 0)
|
||||||
return syntaxError(pos, "illegal.start.of.expr");
|
return syntaxError(pos, Errors.IllegalStartOfExpr);
|
||||||
else
|
else
|
||||||
return syntaxError(pos, "illegal.start.of.type");
|
return syntaxError(pos, Errors.IllegalStartOfType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,8 +452,7 @@ public class JavacParser implements Parser {
|
||||||
protected void checkNoMods(long mods) {
|
protected void checkNoMods(long mods) {
|
||||||
if (mods != 0) {
|
if (mods != 0) {
|
||||||
long lowestMod = mods & -mods;
|
long lowestMod = mods & -mods;
|
||||||
error(token.pos, "mod.not.allowed.here",
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.ModNotAllowedHere(Flags.asFlagSet(lowestMod)));
|
||||||
Flags.asFlagSet(lowestMod));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,11 +532,11 @@ public class JavacParser implements Parser {
|
||||||
nextToken();
|
nextToken();
|
||||||
return name;
|
return name;
|
||||||
} else if (token.kind == ASSERT) {
|
} else if (token.kind == ASSERT) {
|
||||||
error(token.pos, "assert.as.identifier");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.AssertAsIdentifier);
|
||||||
nextToken();
|
nextToken();
|
||||||
return names.error;
|
return names.error;
|
||||||
} else if (token.kind == ENUM) {
|
} else if (token.kind == ENUM) {
|
||||||
error(token.pos, "enum.as.identifier");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.EnumAsIdentifier);
|
||||||
nextToken();
|
nextToken();
|
||||||
return names.error;
|
return names.error;
|
||||||
} else if (token.kind == THIS) {
|
} else if (token.kind == THIS) {
|
||||||
|
@ -561,15 +547,15 @@ public class JavacParser implements Parser {
|
||||||
nextToken();
|
nextToken();
|
||||||
return name;
|
return name;
|
||||||
} else {
|
} else {
|
||||||
error(token.pos, "this.as.identifier");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.ThisAsIdentifier);
|
||||||
nextToken();
|
nextToken();
|
||||||
return names.error;
|
return names.error;
|
||||||
}
|
}
|
||||||
} else if (token.kind == UNDERSCORE) {
|
} else if (token.kind == UNDERSCORE) {
|
||||||
if (Feature.UNDERSCORE_IDENTIFIER.allowedInSource(source)) {
|
if (Feature.UNDERSCORE_IDENTIFIER.allowedInSource(source)) {
|
||||||
warning(token.pos, "underscore.as.identifier");
|
log.warning(token.pos, Warnings.UnderscoreAsIdentifier);
|
||||||
} else {
|
} else {
|
||||||
error(token.pos, "underscore.as.identifier");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.UnderscoreAsIdentifier);
|
||||||
}
|
}
|
||||||
Name name = token.name();
|
Name name = token.name();
|
||||||
nextToken();
|
nextToken();
|
||||||
|
@ -628,7 +614,7 @@ public class JavacParser implements Parser {
|
||||||
TypeTag.INT,
|
TypeTag.INT,
|
||||||
Convert.string2int(strval(prefix), token.radix()));
|
Convert.string2int(strval(prefix), token.radix()));
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
error(token.pos, "int.number.too.large", strval(prefix));
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.IntNumberTooLarge(strval(prefix)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LONGLITERAL:
|
case LONGLITERAL:
|
||||||
|
@ -637,7 +623,7 @@ public class JavacParser implements Parser {
|
||||||
TypeTag.LONG,
|
TypeTag.LONG,
|
||||||
Long.valueOf(Convert.string2long(strval(prefix), token.radix())));
|
Long.valueOf(Convert.string2long(strval(prefix), token.radix())));
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
error(token.pos, "int.number.too.large", strval(prefix));
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.IntNumberTooLarge(strval(prefix)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FLOATLITERAL: {
|
case FLOATLITERAL: {
|
||||||
|
@ -652,9 +638,9 @@ public class JavacParser implements Parser {
|
||||||
n = Float.NaN;
|
n = Float.NaN;
|
||||||
}
|
}
|
||||||
if (n.floatValue() == 0.0f && !isZero(proper))
|
if (n.floatValue() == 0.0f && !isZero(proper))
|
||||||
error(token.pos, "fp.number.too.small");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.FpNumberTooSmall);
|
||||||
else if (n.floatValue() == Float.POSITIVE_INFINITY)
|
else if (n.floatValue() == Float.POSITIVE_INFINITY)
|
||||||
error(token.pos, "fp.number.too.large");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.FpNumberTooLarge);
|
||||||
else
|
else
|
||||||
t = F.at(pos).Literal(TypeTag.FLOAT, n);
|
t = F.at(pos).Literal(TypeTag.FLOAT, n);
|
||||||
break;
|
break;
|
||||||
|
@ -671,9 +657,9 @@ public class JavacParser implements Parser {
|
||||||
n = Double.NaN;
|
n = Double.NaN;
|
||||||
}
|
}
|
||||||
if (n.doubleValue() == 0.0d && !isZero(proper))
|
if (n.doubleValue() == 0.0d && !isZero(proper))
|
||||||
error(token.pos, "fp.number.too.small");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.FpNumberTooSmall);
|
||||||
else if (n.doubleValue() == Double.POSITIVE_INFINITY)
|
else if (n.doubleValue() == Double.POSITIVE_INFINITY)
|
||||||
error(token.pos, "fp.number.too.large");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.FpNumberTooLarge);
|
||||||
else
|
else
|
||||||
t = F.at(pos).Literal(TypeTag.DOUBLE, n);
|
t = F.at(pos).Literal(TypeTag.DOUBLE, n);
|
||||||
break;
|
break;
|
||||||
|
@ -762,7 +748,7 @@ public class JavacParser implements Parser {
|
||||||
JCExpression result = term(TYPE);
|
JCExpression result = term(TYPE);
|
||||||
|
|
||||||
if (!allowVar && isRestrictedLocalVarTypeName(result)) {
|
if (!allowVar && isRestrictedLocalVarTypeName(result)) {
|
||||||
syntaxError(result.pos, "var.not.allowed.here");
|
syntaxError(result.pos, Errors.VarNotAllowedHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1770,7 +1756,7 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
accept(RPAREN);
|
accept(RPAREN);
|
||||||
} else {
|
} else {
|
||||||
syntaxError(token.pos, "expected", LPAREN);
|
syntaxError(token.pos, Errors.Expected(LPAREN));
|
||||||
}
|
}
|
||||||
return args.toList();
|
return args.toList();
|
||||||
}
|
}
|
||||||
|
@ -1839,13 +1825,13 @@ public class JavacParser implements Parser {
|
||||||
nextToken();
|
nextToken();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
args.append(syntaxError(token.pos, "expected", GT));
|
args.append(syntaxError(token.pos, Errors.Expected(GT)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return args.toList();
|
return args.toList();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return List.of(syntaxError(token.pos, "expected", LT));
|
return List.of(syntaxError(token.pos, Errors.Expected(LT)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1879,7 +1865,7 @@ public class JavacParser implements Parser {
|
||||||
JCExpression wc = toP(F.at(pos).Wildcard(t, null));
|
JCExpression wc = toP(F.at(pos).Wildcard(t, null));
|
||||||
JCIdent id = toP(F.at(token.pos).Ident(ident()));
|
JCIdent id = toP(F.at(token.pos).Ident(ident()));
|
||||||
JCErroneous err = F.at(pos).Erroneous(List.<JCTree>of(wc, id));
|
JCErroneous err = F.at(pos).Erroneous(List.<JCTree>of(wc, id));
|
||||||
reportSyntaxError(err, "expected3", GT, EXTENDS, SUPER);
|
reportSyntaxError(err, Errors.Expected3(GT, EXTENDS, SUPER));
|
||||||
result = err;
|
result = err;
|
||||||
} else {
|
} else {
|
||||||
TypeBoundKind t = toP(F.at(pos).TypeBoundKind(BoundKind.UNBOUND));
|
TypeBoundKind t = toP(F.at(pos).TypeBoundKind(BoundKind.UNBOUND));
|
||||||
|
@ -1969,7 +1955,7 @@ public class JavacParser implements Parser {
|
||||||
// are complained about directly in term3(), Here check for type annotations on dimensions
|
// are complained about directly in term3(), Here check for type annotations on dimensions
|
||||||
// taking care to handle some interior dimension(s) being annotated.
|
// taking care to handle some interior dimension(s) being annotated.
|
||||||
if ((tag == TYPEARRAY && TreeInfo.containsTypeAnnotation(t)) || tag == ANNOTATED_TYPE)
|
if ((tag == TYPEARRAY && TreeInfo.containsTypeAnnotation(t)) || tag == ANNOTATED_TYPE)
|
||||||
syntaxError("no.annotations.on.dot.class");
|
syntaxError(token.pos, Errors.NoAnnotationsOnDotClass);
|
||||||
t = toP(F.at(pos).Select(t, names._class));
|
t = toP(F.at(pos).Select(t, names._class));
|
||||||
}
|
}
|
||||||
} else if ((mode & TYPE) != 0) {
|
} else if ((mode & TYPE) != 0) {
|
||||||
|
@ -1977,7 +1963,7 @@ public class JavacParser implements Parser {
|
||||||
mode = TYPE;
|
mode = TYPE;
|
||||||
}
|
}
|
||||||
} else if (token.kind != COLCOL) {
|
} else if (token.kind != COLCOL) {
|
||||||
syntaxError(token.pos, "dot.class.expected");
|
syntaxError(token.pos, Errors.DotClassExpected);
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -2070,7 +2056,7 @@ public class JavacParser implements Parser {
|
||||||
|
|
||||||
JCExpression e = arrayCreatorRest(newpos, t);
|
JCExpression e = arrayCreatorRest(newpos, t);
|
||||||
if (diamondFound) {
|
if (diamondFound) {
|
||||||
reportSyntaxError(lastTypeargsPos, "cannot.create.array.with.diamond");
|
reportSyntaxError(lastTypeargsPos, Errors.CannotCreateArrayWithDiamond);
|
||||||
return toP(F.at(newpos).Erroneous(List.of(e)));
|
return toP(F.at(newpos).Erroneous(List.of(e)));
|
||||||
}
|
}
|
||||||
else if (typeArgs != null) {
|
else if (typeArgs != null) {
|
||||||
|
@ -2083,7 +2069,7 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
setErrorEndPos(S.prevToken().endPos);
|
setErrorEndPos(S.prevToken().endPos);
|
||||||
JCErroneous err = F.at(pos).Erroneous(typeArgs.prepend(e));
|
JCErroneous err = F.at(pos).Erroneous(typeArgs.prepend(e));
|
||||||
reportSyntaxError(err, "cannot.create.array.with.type.arguments");
|
reportSyntaxError(err, Errors.CannotCreateArrayWithTypeArguments);
|
||||||
return toP(err);
|
return toP(err);
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
|
@ -2109,7 +2095,7 @@ public class JavacParser implements Parser {
|
||||||
return newClass;
|
return newClass;
|
||||||
} else {
|
} else {
|
||||||
setErrorEndPos(token.pos);
|
setErrorEndPos(token.pos);
|
||||||
reportSyntaxError(token.pos, "expected2", LPAREN, LBRACKET);
|
reportSyntaxError(token.pos, Errors.Expected2(LPAREN, LBRACKET));
|
||||||
t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.nil(), null));
|
t = toP(F.at(newpos).NewClass(null, typeArgs, t, List.nil(), null));
|
||||||
return toP(F.at(newpos).Erroneous(List.<JCTree>of(t)));
|
return toP(F.at(newpos).Erroneous(List.<JCTree>of(t)));
|
||||||
}
|
}
|
||||||
|
@ -2161,7 +2147,7 @@ public class JavacParser implements Parser {
|
||||||
return na;
|
return na;
|
||||||
} else {
|
} else {
|
||||||
JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.nil(), null));
|
JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.nil(), null));
|
||||||
return syntaxError(token.pos, List.of(t), "array.dimension.missing");
|
return syntaxError(token.pos, List.of(t), Errors.ArrayDimensionMissing);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ListBuffer<JCExpression> dims = new ListBuffer<>();
|
ListBuffer<JCExpression> dims = new ListBuffer<>();
|
||||||
|
@ -2201,7 +2187,7 @@ public class JavacParser implements Parser {
|
||||||
na.dimAnnotations = dimAnnotations.toList();
|
na.dimAnnotations = dimAnnotations.toList();
|
||||||
|
|
||||||
if (elems != null) {
|
if (elems != null) {
|
||||||
return syntaxError(errpos, List.of(na), "illegal.array.creation.both.dimension.and.initialization");
|
return syntaxError(errpos, List.of(na), Errors.IllegalArrayCreationBothDimensionAndInitialization);
|
||||||
}
|
}
|
||||||
|
|
||||||
return na;
|
return na;
|
||||||
|
@ -2273,7 +2259,7 @@ public class JavacParser implements Parser {
|
||||||
List<JCStatement> stats = blockStatements();
|
List<JCStatement> stats = blockStatements();
|
||||||
JCBlock t = F.at(pos).Block(flags, stats);
|
JCBlock t = F.at(pos).Block(flags, stats);
|
||||||
while (token.kind == CASE || token.kind == DEFAULT) {
|
while (token.kind == CASE || token.kind == DEFAULT) {
|
||||||
syntaxError("orphaned", token.kind);
|
syntaxError(token.pos, Errors.Orphaned(token.kind));
|
||||||
switchBlockStatementGroups();
|
switchBlockStatementGroups();
|
||||||
}
|
}
|
||||||
// the Block node has a field "endpos" for first char of last token, which is
|
// the Block node has a field "endpos" for first char of last token, which is
|
||||||
|
@ -2327,21 +2313,21 @@ public class JavacParser implements Parser {
|
||||||
int pos = token.pos;
|
int pos = token.pos;
|
||||||
List<JCStatement> stats = blockStatement();
|
List<JCStatement> stats = blockStatement();
|
||||||
if (stats.isEmpty()) {
|
if (stats.isEmpty()) {
|
||||||
JCErroneous e = syntaxError(pos, "illegal.start.of.stmt");
|
JCErroneous e = syntaxError(pos, Errors.IllegalStartOfStmt);
|
||||||
return toP(F.at(pos).Exec(e));
|
return toP(F.at(pos).Exec(e));
|
||||||
} else {
|
} else {
|
||||||
JCStatement first = stats.head;
|
JCStatement first = stats.head;
|
||||||
String error = null;
|
Error error = null;
|
||||||
switch (first.getTag()) {
|
switch (first.getTag()) {
|
||||||
case CLASSDEF:
|
case CLASSDEF:
|
||||||
error = "class.not.allowed";
|
error = Errors.ClassNotAllowed;
|
||||||
break;
|
break;
|
||||||
case VARDEF:
|
case VARDEF:
|
||||||
error = "variable.not.allowed";
|
error = Errors.VariableNotAllowed;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error(first, error);
|
log.error(DiagnosticFlag.SYNTAX, first, error);
|
||||||
List<JCBlock> blist = List.of(F.at(first.pos).Block(0, stats));
|
List<JCBlock> blist = List.of(F.at(first.pos).Block(0, stats));
|
||||||
return toP(F.at(pos).Exec(F.at(first.pos).Erroneous(blist)));
|
return toP(F.at(pos).Exec(F.at(first.pos).Erroneous(blist)));
|
||||||
}
|
}
|
||||||
|
@ -2385,7 +2371,7 @@ public class JavacParser implements Parser {
|
||||||
Comment dc = token.comment(CommentStyle.JAVADOC);
|
Comment dc = token.comment(CommentStyle.JAVADOC);
|
||||||
return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
|
return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
|
||||||
case ENUM:
|
case ENUM:
|
||||||
error(token.pos, "local.enum");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.LocalEnum);
|
||||||
dc = token.comment(CommentStyle.JAVADOC);
|
dc = token.comment(CommentStyle.JAVADOC);
|
||||||
return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
|
return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
|
||||||
default:
|
default:
|
||||||
|
@ -2513,9 +2499,9 @@ public class JavacParser implements Parser {
|
||||||
} else {
|
} else {
|
||||||
if (resources.isEmpty()) {
|
if (resources.isEmpty()) {
|
||||||
if (Feature.TRY_WITH_RESOURCES.allowedInSource(source)) {
|
if (Feature.TRY_WITH_RESOURCES.allowedInSource(source)) {
|
||||||
error(pos, "try.without.catch.finally.or.resource.decls");
|
log.error(DiagnosticFlag.SYNTAX, pos, Errors.TryWithoutCatchFinallyOrResourceDecls);
|
||||||
} else {
|
} else {
|
||||||
error(pos, "try.without.catch.or.finally");
|
log.error(DiagnosticFlag.SYNTAX, pos, Errors.TryWithoutCatchOrFinally);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2570,13 +2556,13 @@ public class JavacParser implements Parser {
|
||||||
case ELSE:
|
case ELSE:
|
||||||
int elsePos = token.pos;
|
int elsePos = token.pos;
|
||||||
nextToken();
|
nextToken();
|
||||||
return doRecover(elsePos, BasicErrorRecoveryAction.BLOCK_STMT, "else.without.if");
|
return doRecover(elsePos, BasicErrorRecoveryAction.BLOCK_STMT, Errors.ElseWithoutIf);
|
||||||
case FINALLY:
|
case FINALLY:
|
||||||
int finallyPos = token.pos;
|
int finallyPos = token.pos;
|
||||||
nextToken();
|
nextToken();
|
||||||
return doRecover(finallyPos, BasicErrorRecoveryAction.BLOCK_STMT, "finally.without.try");
|
return doRecover(finallyPos, BasicErrorRecoveryAction.BLOCK_STMT, Errors.FinallyWithoutTry);
|
||||||
case CATCH:
|
case CATCH:
|
||||||
return doRecover(token.pos, BasicErrorRecoveryAction.CATCH_CLAUSE, "catch.without.try");
|
return doRecover(token.pos, BasicErrorRecoveryAction.CATCH_CLAUSE, Errors.CatchWithoutTry);
|
||||||
case ASSERT: {
|
case ASSERT: {
|
||||||
nextToken();
|
nextToken();
|
||||||
JCExpression assertion = parseExpression();
|
JCExpression assertion = parseExpression();
|
||||||
|
@ -2600,11 +2586,11 @@ public class JavacParser implements Parser {
|
||||||
return parseStatementAsBlock();
|
return parseStatementAsBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
private JCStatement doRecover(int startPos, ErrorRecoveryAction action, String key) {
|
private JCStatement doRecover(int startPos, ErrorRecoveryAction action, Error errorKey) {
|
||||||
int errPos = S.errPos();
|
int errPos = S.errPos();
|
||||||
JCTree stm = action.doRecover(this);
|
JCTree stm = action.doRecover(this);
|
||||||
S.errPos(errPos);
|
S.errPos(errPos);
|
||||||
return toP(F.Exec(syntaxError(startPos, List.of(stm), key)));
|
return toP(F.Exec(syntaxError(startPos, List.of(stm), errorKey)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** CatchClause = CATCH "(" FormalParameter ")" Block
|
/** CatchClause = CATCH "(" FormalParameter ")" Block
|
||||||
|
@ -2655,8 +2641,7 @@ public class JavacParser implements Parser {
|
||||||
return cases.toList();
|
return cases.toList();
|
||||||
default:
|
default:
|
||||||
nextToken(); // to ensure progress
|
nextToken(); // to ensure progress
|
||||||
syntaxError(pos, "expected3",
|
syntaxError(pos, Errors.Expected3(CASE, DEFAULT, RBRACE));
|
||||||
CASE, DEFAULT, RBRACE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2717,7 +2702,7 @@ public class JavacParser implements Parser {
|
||||||
if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
|
if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
|
||||||
return variableDeclarators(modifiersOpt(), t, stats, true).toList();
|
return variableDeclarators(modifiersOpt(), t, stats, true).toList();
|
||||||
} else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
|
} else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
|
||||||
error(pos, "bad.initializer", "for-loop");
|
log.error(DiagnosticFlag.SYNTAX, pos, Errors.BadInitializer("for-loop"));
|
||||||
return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null));
|
return List.of((JCStatement)F.at(pos).VarDef(null, null, t, null));
|
||||||
} else {
|
} else {
|
||||||
return moreStatementExpressions(pos, t, stats).toList();
|
return moreStatementExpressions(pos, t, stats).toList();
|
||||||
|
@ -2802,7 +2787,7 @@ public class JavacParser implements Parser {
|
||||||
case ERROR : flag = 0; nextToken(); break;
|
case ERROR : flag = 0; nextToken(); break;
|
||||||
default: break loop;
|
default: break loop;
|
||||||
}
|
}
|
||||||
if ((flags & flag) != 0) error(token.pos, "repeated.modifier");
|
if ((flags & flag) != 0) log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.RepeatedModifier);
|
||||||
lastPos = token.pos;
|
lastPos = token.pos;
|
||||||
nextToken();
|
nextToken();
|
||||||
if (flag == Flags.ANNOTATION) {
|
if (flag == Flags.ANNOTATION) {
|
||||||
|
@ -2960,7 +2945,7 @@ public class JavacParser implements Parser {
|
||||||
vdefs.append(head);
|
vdefs.append(head);
|
||||||
while (token.kind == COMMA) {
|
while (token.kind == COMMA) {
|
||||||
if (implicit) {
|
if (implicit) {
|
||||||
reportSyntaxError(pos, "var.not.allowed.compound");
|
reportSyntaxError(pos, Errors.VarNotAllowedCompound);
|
||||||
}
|
}
|
||||||
// All but last of multiple declarators subsume a comma
|
// All but last of multiple declarators subsume a comma
|
||||||
storeEnd((JCTree)vdefs.last(), token.endPos);
|
storeEnd((JCTree)vdefs.last(), token.endPos);
|
||||||
|
@ -2991,7 +2976,7 @@ public class JavacParser implements Parser {
|
||||||
nextToken();
|
nextToken();
|
||||||
init = variableInitializer();
|
init = variableInitializer();
|
||||||
}
|
}
|
||||||
else if (reqInit) syntaxError(token.pos, "expected", EQ);
|
else if (reqInit) syntaxError(token.pos, Errors.Expected(EQ));
|
||||||
JCTree elemType = TreeInfo.innermostType(type, true);
|
JCTree elemType = TreeInfo.innermostType(type, true);
|
||||||
int startPos = Position.NOPOS;
|
int startPos = Position.NOPOS;
|
||||||
if (Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source) && elemType.hasTag(IDENT)) {
|
if (Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source) && elemType.hasTag(IDENT)) {
|
||||||
|
@ -2999,7 +2984,7 @@ public class JavacParser implements Parser {
|
||||||
if (isRestrictedLocalVarTypeName(typeName)) {
|
if (isRestrictedLocalVarTypeName(typeName)) {
|
||||||
if (type.hasTag(TYPEARRAY)) {
|
if (type.hasTag(TYPEARRAY)) {
|
||||||
//error - 'var' and arrays
|
//error - 'var' and arrays
|
||||||
reportSyntaxError(pos, "var.not.allowed.array");
|
reportSyntaxError(pos, Errors.VarNotAllowedArray);
|
||||||
} else {
|
} else {
|
||||||
startPos = TreeInfo.getStartPos(mods);
|
startPos = TreeInfo.getStartPos(mods);
|
||||||
if (startPos == Position.NOPOS)
|
if (startPos == Position.NOPOS)
|
||||||
|
@ -3177,7 +3162,7 @@ public class JavacParser implements Parser {
|
||||||
consumedToplevelDoc = true;
|
consumedToplevelDoc = true;
|
||||||
break;
|
break;
|
||||||
} else if (kind != ModuleKind.STRONG) {
|
} else if (kind != ModuleKind.STRONG) {
|
||||||
reportSyntaxError(token.pos, "expected.module");
|
reportSyntaxError(token.pos, Errors.ExpectedModule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JCTree def = typeDeclaration(mods, docComment);
|
JCTree def = typeDeclaration(mods, docComment);
|
||||||
|
@ -3246,7 +3231,7 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
case STATIC:
|
case STATIC:
|
||||||
if (isStaticPhase) {
|
if (isStaticPhase) {
|
||||||
error(token.pos, "repeated.modifier");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.RepeatedModifier);
|
||||||
}
|
}
|
||||||
isStaticPhase = true;
|
isStaticPhase = true;
|
||||||
break;
|
break;
|
||||||
|
@ -3284,7 +3269,7 @@ public class JavacParser implements Parser {
|
||||||
accept(SEMI);
|
accept(SEMI);
|
||||||
defs.append(toP(F.at(pos).Provides(serviceName, implNames)));
|
defs.append(toP(F.at(pos).Provides(serviceName, implNames)));
|
||||||
} else {
|
} else {
|
||||||
error(token.pos, "expected", "'" + names.with + "'");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.ExpectedStr("'" + names.with + "'"));
|
||||||
skip(false, false, false, false);
|
skip(false, false, false, false);
|
||||||
}
|
}
|
||||||
} else if (token.name() == names.uses) {
|
} else if (token.name() == names.uses) {
|
||||||
|
@ -3294,7 +3279,7 @@ public class JavacParser implements Parser {
|
||||||
defs.append(toP(F.at(pos).Uses(service)));
|
defs.append(toP(F.at(pos).Uses(service)));
|
||||||
} else {
|
} else {
|
||||||
setErrorEndPos(pos);
|
setErrorEndPos(pos);
|
||||||
reportSyntaxError(pos, "invalid.module.directive");
|
reportSyntaxError(pos, Errors.InvalidModuleDirective);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3363,9 +3348,9 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
final JCErroneous erroneousTree;
|
final JCErroneous erroneousTree;
|
||||||
if (parseModuleInfo) {
|
if (parseModuleInfo) {
|
||||||
erroneousTree = syntaxError(pos, errs, "expected.module.or.open");
|
erroneousTree = syntaxError(pos, errs, Errors.ExpectedModuleOrOpen);
|
||||||
} else {
|
} else {
|
||||||
erroneousTree = syntaxError(pos, errs, "expected3", CLASS, INTERFACE, ENUM);
|
erroneousTree = syntaxError(pos, errs, Errors.Expected3(CLASS, INTERFACE, ENUM));
|
||||||
}
|
}
|
||||||
return toP(F.Exec(erroneousTree));
|
return toP(F.Exec(erroneousTree));
|
||||||
}
|
}
|
||||||
|
@ -3405,9 +3390,9 @@ public class JavacParser implements Parser {
|
||||||
Name name = ident();
|
Name name = ident();
|
||||||
if (name == names.var) {
|
if (name == names.var) {
|
||||||
if (Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source)) {
|
if (Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source)) {
|
||||||
reportSyntaxError(pos, "var.not.allowed", name);
|
reportSyntaxError(pos, Errors.VarNotAllowed(name));
|
||||||
} else {
|
} else {
|
||||||
warning(pos, "var.not.allowed");
|
log.warning(pos, Warnings.VarNotAllowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
@ -3479,8 +3464,7 @@ public class JavacParser implements Parser {
|
||||||
defs.append(enumeratorDeclaration(enumName));
|
defs.append(enumeratorDeclaration(enumName));
|
||||||
}
|
}
|
||||||
if (token.kind != SEMI && token.kind != RBRACE) {
|
if (token.kind != SEMI && token.kind != RBRACE) {
|
||||||
defs.append(syntaxError(token.pos, "expected3",
|
defs.append(syntaxError(token.pos, Errors.Expected3(COMMA, RBRACE, SEMI)));
|
||||||
COMMA, RBRACE, SEMI));
|
|
||||||
nextToken();
|
nextToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3614,7 +3598,7 @@ public class JavacParser implements Parser {
|
||||||
(mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
|
(mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
|
||||||
mods.annotations.isEmpty()) {
|
mods.annotations.isEmpty()) {
|
||||||
if (isInterface) {
|
if (isInterface) {
|
||||||
error(token.pos, "initializer.not.allowed");
|
log.error(DiagnosticFlag.SYNTAX, token.pos, Errors.InitializerNotAllowed);
|
||||||
}
|
}
|
||||||
return List.of(block(pos, mods.flags));
|
return List.of(block(pos, mods.flags));
|
||||||
} else {
|
} else {
|
||||||
|
@ -3648,7 +3632,7 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
if (token.kind == LPAREN && !isInterface && type.hasTag(IDENT)) {
|
if (token.kind == LPAREN && !isInterface && type.hasTag(IDENT)) {
|
||||||
if (isInterface || tk.name() != className)
|
if (isInterface || tk.name() != className)
|
||||||
error(pos, "invalid.meth.decl.ret.type.req");
|
log.error(DiagnosticFlag.SYNTAX, pos, Errors.InvalidMethDeclRetTypeReq);
|
||||||
else if (annosAfterParams.nonEmpty())
|
else if (annosAfterParams.nonEmpty())
|
||||||
illegal(annosAfterParams.head.pos);
|
illegal(annosAfterParams.head.pos);
|
||||||
return List.of(methodDeclaratorRest(
|
return List.of(methodDeclaratorRest(
|
||||||
|
@ -3674,7 +3658,7 @@ public class JavacParser implements Parser {
|
||||||
? List.of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
|
? List.of(toP(F.at(pos).MethodDef(mods, name, type, typarams,
|
||||||
List.nil(), List.nil(), null, null)))
|
List.nil(), List.nil(), null, null)))
|
||||||
: null;
|
: null;
|
||||||
return List.of(syntaxError(token.pos, err, "expected", LPAREN));
|
return List.of(syntaxError(token.pos, err, Errors.Expected(LPAREN)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3841,7 +3825,7 @@ public class JavacParser implements Parser {
|
||||||
this.allowThisIdent = false;
|
this.allowThisIdent = false;
|
||||||
while (token.kind == COMMA) {
|
while (token.kind == COMMA) {
|
||||||
if ((lastParam.mods.flags & Flags.VARARGS) != 0) {
|
if ((lastParam.mods.flags & Flags.VARARGS) != 0) {
|
||||||
error(lastParam, "varargs.must.be.last");
|
log.error(DiagnosticFlag.SYNTAX, lastParam, Errors.VarargsMustBeLast);
|
||||||
}
|
}
|
||||||
nextToken();
|
nextToken();
|
||||||
params.append(lastParam = formalParameter(lambdaParameters));
|
params.append(lastParam = formalParameter(lambdaParameters));
|
||||||
|
@ -3851,7 +3835,7 @@ public class JavacParser implements Parser {
|
||||||
nextToken();
|
nextToken();
|
||||||
} else {
|
} else {
|
||||||
setErrorEndPos(token.pos);
|
setErrorEndPos(token.pos);
|
||||||
reportSyntaxError(S.prevToken().endPos, "expected3", COMMA, RPAREN, LBRACKET);
|
reportSyntaxError(S.prevToken().endPos, Errors.Expected3(COMMA, RPAREN, LBRACKET));
|
||||||
}
|
}
|
||||||
return params.toList();
|
return params.toList();
|
||||||
}
|
}
|
||||||
|
@ -3976,8 +3960,7 @@ public class JavacParser implements Parser {
|
||||||
} else {
|
} else {
|
||||||
// if not a var arg, then typeAnnotationsPushedBack should be null
|
// if not a var arg, then typeAnnotationsPushedBack should be null
|
||||||
if (typeAnnotationsPushedBack.nonEmpty()) {
|
if (typeAnnotationsPushedBack.nonEmpty()) {
|
||||||
reportSyntaxError(typeAnnotationsPushedBack.head.pos,
|
reportSyntaxError(typeAnnotationsPushedBack.head.pos, Errors.IllegalStartOfType);
|
||||||
"illegal.start.of.type");
|
|
||||||
}
|
}
|
||||||
typeAnnotationsPushedBack = List.nil();
|
typeAnnotationsPushedBack = List.nil();
|
||||||
}
|
}
|
||||||
|
@ -3990,25 +3973,12 @@ public class JavacParser implements Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- auxiliary methods -------------- */
|
/* ---------- auxiliary methods -------------- */
|
||||||
|
|
||||||
void error(int pos, String key, Object ... args) {
|
|
||||||
log.error(DiagnosticFlag.SYNTAX, pos, key, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void error(DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
log.error(DiagnosticFlag.SYNTAX, pos, key, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void warning(int pos, String key, Object ... args) {
|
|
||||||
log.warning(pos, key, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check that given tree is a legal expression statement.
|
/** Check that given tree is a legal expression statement.
|
||||||
*/
|
*/
|
||||||
protected JCExpression checkExprStat(JCExpression t) {
|
protected JCExpression checkExprStat(JCExpression t) {
|
||||||
if (!TreeInfo.isExpressionStatement(t)) {
|
if (!TreeInfo.isExpressionStatement(t)) {
|
||||||
JCExpression ret = F.at(t.pos).Erroneous(List.<JCTree>of(t));
|
JCExpression ret = F.at(t.pos).Erroneous(List.<JCTree>of(t));
|
||||||
error(ret, "not.stmt");
|
log.error(DiagnosticFlag.SYNTAX, ret, Errors.NotStmt);
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,6 +31,7 @@ import com.sun.tools.javac.code.Source;
|
||||||
import com.sun.tools.javac.tree.DocTreeMaker;
|
import com.sun.tools.javac.tree.DocTreeMaker;
|
||||||
import com.sun.tools.javac.tree.TreeMaker;
|
import com.sun.tools.javac.tree.TreeMaker;
|
||||||
import com.sun.tools.javac.util.Context;
|
import com.sun.tools.javac.util.Context;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic;
|
||||||
import com.sun.tools.javac.util.Log;
|
import com.sun.tools.javac.util.Log;
|
||||||
import com.sun.tools.javac.util.Names;
|
import com.sun.tools.javac.util.Names;
|
||||||
import com.sun.tools.javac.util.Options;
|
import com.sun.tools.javac.util.Options;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -724,7 +724,7 @@ public class JavacFiler implements Filer, Closeable {
|
||||||
throw new FilerException("Attempt to recreate a file for type " + typename);
|
throw new FilerException("Attempt to recreate a file for type " + typename);
|
||||||
}
|
}
|
||||||
if (lint && existing != null) {
|
if (lint && existing != null) {
|
||||||
log.warning("proc.type.already.exists", typename);
|
log.warning(Warnings.ProcTypeAlreadyExists(typename));
|
||||||
}
|
}
|
||||||
if (!mod.isUnnamed() && !typename.contains(".")) {
|
if (!mod.isUnnamed() && !typename.contains(".")) {
|
||||||
throw new FilerException("Attempt to create a type in unnamed package of a named module: " + typename);
|
throw new FilerException("Attempt to create a type in unnamed package of a named module: " + typename);
|
||||||
|
|
|
@ -624,9 +624,9 @@ compiler.err.improperly.formed.type.inner.raw.param=\
|
||||||
compiler.err.incomparable.types=\
|
compiler.err.incomparable.types=\
|
||||||
incomparable types: {0} and {1}
|
incomparable types: {0} and {1}
|
||||||
|
|
||||||
# 0: number
|
# 0: string
|
||||||
compiler.err.int.number.too.large=\
|
compiler.err.int.number.too.large=\
|
||||||
integer number too large: {0}
|
integer number too large
|
||||||
|
|
||||||
compiler.err.intf.annotation.members.cant.have.params=\
|
compiler.err.intf.annotation.members.cant.have.params=\
|
||||||
elements in annotation type declarations cannot declare formal parameters
|
elements in annotation type declarations cannot declare formal parameters
|
||||||
|
@ -1207,7 +1207,7 @@ compiler.err.undef.label=\
|
||||||
compiler.err.illegal.ref.to.var.type=\
|
compiler.err.illegal.ref.to.var.type=\
|
||||||
illegal reference to restricted type ''{0}''
|
illegal reference to restricted type ''{0}''
|
||||||
|
|
||||||
# 0: token
|
# 0: name
|
||||||
compiler.err.var.not.allowed=\
|
compiler.err.var.not.allowed=\
|
||||||
''{0}'' not allowed here\n\
|
''{0}'' not allowed here\n\
|
||||||
as of release 10, ''{0}'' is a restricted local variable type and cannot be used for type declarations
|
as of release 10, ''{0}'' is a restricted local variable type and cannot be used for type declarations
|
||||||
|
@ -1734,7 +1734,7 @@ compiler.warn.big.major.version=\
|
||||||
{0}: major version {1} is newer than {2}, the highest major version supported by this compiler.\n\
|
{0}: major version {1} is newer than {2}, the highest major version supported by this compiler.\n\
|
||||||
It is recommended that the compiler be upgraded.
|
It is recommended that the compiler be upgraded.
|
||||||
|
|
||||||
# 0: symbol kind, 1: symbol
|
# 0: kind name, 1: symbol
|
||||||
compiler.warn.static.not.qualified.by.type=\
|
compiler.warn.static.not.qualified.by.type=\
|
||||||
static {0} should be qualified by type name, {1}, instead of by an expression
|
static {0} should be qualified by type name, {1}, instead of by an expression
|
||||||
|
|
||||||
|
@ -1780,7 +1780,7 @@ compiler.warn.proc.package.does.not.exist=\
|
||||||
compiler.warn.proc.file.reopening=\
|
compiler.warn.proc.file.reopening=\
|
||||||
Attempt to create a file for ''{0}'' multiple times
|
Attempt to create a file for ''{0}'' multiple times
|
||||||
|
|
||||||
# 0: name
|
# 0: string
|
||||||
compiler.warn.proc.type.already.exists=\
|
compiler.warn.proc.type.already.exists=\
|
||||||
A file for type ''{0}'' already exists on the sourcepath or classpath
|
A file for type ''{0}'' already exists on the sourcepath or classpath
|
||||||
|
|
||||||
|
@ -1861,7 +1861,7 @@ compiler.warn.unchecked.call.mbr.of.raw.type=\
|
||||||
compiler.warn.unchecked.cast.to.type=\
|
compiler.warn.unchecked.cast.to.type=\
|
||||||
unchecked cast to type {0}
|
unchecked cast to type {0}
|
||||||
|
|
||||||
# 0: symbol kind, 1: name, 2: list of type, 3: list of type, 4: symbol kind, 5: symbol
|
# 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol
|
||||||
compiler.warn.unchecked.meth.invocation.applied=\
|
compiler.warn.unchecked.meth.invocation.applied=\
|
||||||
unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
|
unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
|
||||||
required: {2}\n\
|
required: {2}\n\
|
||||||
|
@ -1998,6 +1998,10 @@ compiler.misc.token.end-of-input=\
|
||||||
compiler.err.expected=\
|
compiler.err.expected=\
|
||||||
{0} expected
|
{0} expected
|
||||||
|
|
||||||
|
# 0: string
|
||||||
|
compiler.err.expected.str=\
|
||||||
|
{0} expected
|
||||||
|
|
||||||
# 0: token, 1: token
|
# 0: token, 1: token
|
||||||
compiler.err.expected2=\
|
compiler.err.expected2=\
|
||||||
{0} or {1} expected
|
{0} or {1} expected
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -107,16 +107,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.error(null, source, null, errorKey));
|
report(diags.error(null, source, null, errorKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report an error, unless another error was already reported at same
|
|
||||||
* source position.
|
|
||||||
* @param pos The source position at which to report the error.
|
|
||||||
* @param key The key for the localized error message.
|
|
||||||
* @param args Fields of the error message.
|
|
||||||
*/
|
|
||||||
public void error(DiagnosticPosition pos, String key, Object... args) {
|
|
||||||
error(pos, diags.errorKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report an error, unless another error was already reported at same
|
/** Report an error, unless another error was already reported at same
|
||||||
* source position.
|
* source position.
|
||||||
* @param pos The source position at which to report the error.
|
* @param pos The source position at which to report the error.
|
||||||
|
@ -126,17 +116,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.error(null, source, pos, errorKey));
|
report(diags.error(null, source, pos, errorKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report an error, unless another error was already reported at same
|
|
||||||
* source position.
|
|
||||||
* @param flag A flag to set on the diagnostic
|
|
||||||
* @param pos The source position at which to report the error.
|
|
||||||
* @param key The key for the localized error message.
|
|
||||||
* @param args Fields of the error message.
|
|
||||||
*/
|
|
||||||
public void error(DiagnosticFlag flag, DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
error(flag, pos, diags.errorKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report an error, unless another error was already reported at same
|
/** Report an error, unless another error was already reported at same
|
||||||
* source position.
|
* source position.
|
||||||
* @param flag A flag to set on the diagnostic
|
* @param flag A flag to set on the diagnostic
|
||||||
|
@ -166,17 +145,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.error(null, source, wrap(pos), errorKey));
|
report(diags.error(null, source, wrap(pos), errorKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report an error, unless another error was already reported at same
|
|
||||||
* source position.
|
|
||||||
* @param flag A flag to set on the diagnostic
|
|
||||||
* @param pos The source position at which to report the error.
|
|
||||||
* @param key The key for the localized error message.
|
|
||||||
* @param args Fields of the error message.
|
|
||||||
*/
|
|
||||||
public void error(DiagnosticFlag flag, int pos, String key, Object ... args) {
|
|
||||||
error(flag, pos, diags.errorKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report an error, unless another error was already reported at same
|
/** Report an error, unless another error was already reported at same
|
||||||
* source position.
|
* source position.
|
||||||
* @param flag A flag to set on the diagnostic
|
* @param flag A flag to set on the diagnostic
|
||||||
|
@ -187,15 +155,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.error(flag, source, wrap(pos), errorKey));
|
report(diags.error(flag, source, wrap(pos), errorKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a warning, unless suppressed by the -nowarn option or the
|
|
||||||
* maximum number of warnings has been reached.
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void warning(String key, Object ... args) {
|
|
||||||
warning(diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a warning, unless suppressed by the -nowarn option or the
|
/** Report a warning, unless suppressed by the -nowarn option or the
|
||||||
* maximum number of warnings has been reached.
|
* maximum number of warnings has been reached.
|
||||||
* @param warningKey The key for the localized warning message.
|
* @param warningKey The key for the localized warning message.
|
||||||
|
@ -204,16 +163,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.warning(null, source, null, warningKey));
|
report(diags.warning(null, source, null, warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a lint warning, unless suppressed by the -nowarn option or the
|
|
||||||
* maximum number of warnings has been reached.
|
|
||||||
* @param lc The lint category for the diagnostic
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void warning(LintCategory lc, String key, Object ... args) {
|
|
||||||
warning(lc, diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a lint warning, unless suppressed by the -nowarn option or the
|
/** Report a lint warning, unless suppressed by the -nowarn option or the
|
||||||
* maximum number of warnings has been reached.
|
* maximum number of warnings has been reached.
|
||||||
* @param lc The lint category for the diagnostic
|
* @param lc The lint category for the diagnostic
|
||||||
|
@ -223,16 +172,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.warning(lc, null, null, warningKey));
|
report(diags.warning(lc, null, null, warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a warning, unless suppressed by the -nowarn option or the
|
|
||||||
* maximum number of warnings has been reached.
|
|
||||||
* @param pos The source position at which to report the warning.
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void warning(DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
warning(pos, diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a warning, unless suppressed by the -nowarn option or the
|
/** Report a warning, unless suppressed by the -nowarn option or the
|
||||||
* maximum number of warnings has been reached.
|
* maximum number of warnings has been reached.
|
||||||
* @param pos The source position at which to report the warning.
|
* @param pos The source position at which to report the warning.
|
||||||
|
@ -242,17 +181,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.warning(null, source, pos, warningKey));
|
report(diags.warning(null, source, pos, warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a lint warning, unless suppressed by the -nowarn option or the
|
|
||||||
* maximum number of warnings has been reached.
|
|
||||||
* @param lc The lint category for the diagnostic
|
|
||||||
* @param pos The source position at which to report the warning.
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void warning(LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
warning(lc, pos, diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a lint warning, unless suppressed by the -nowarn option or the
|
/** Report a lint warning, unless suppressed by the -nowarn option or the
|
||||||
* maximum number of warnings has been reached.
|
* maximum number of warnings has been reached.
|
||||||
* @param lc The lint category for the diagnostic
|
* @param lc The lint category for the diagnostic
|
||||||
|
@ -263,16 +191,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.warning(lc, source, pos, warningKey));
|
report(diags.warning(lc, source, pos, warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a warning, unless suppressed by the -nowarn option or the
|
|
||||||
* maximum number of warnings has been reached.
|
|
||||||
* @param pos The source position at which to report the warning.
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void warning(int pos, String key, Object ... args) {
|
|
||||||
warning(pos, diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a warning, unless suppressed by the -nowarn option or the
|
/** Report a warning, unless suppressed by the -nowarn option or the
|
||||||
* maximum number of warnings has been reached.
|
* maximum number of warnings has been reached.
|
||||||
* @param pos The source position at which to report the warning.
|
* @param pos The source position at which to report the warning.
|
||||||
|
@ -282,15 +200,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.warning(null, source, wrap(pos), warningKey));
|
report(diags.warning(null, source, wrap(pos), warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a warning.
|
|
||||||
* @param pos The source position at which to report the warning.
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void mandatoryWarning(DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
mandatoryWarning(pos, diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a warning.
|
/** Report a warning.
|
||||||
* @param pos The source position at which to report the warning.
|
* @param pos The source position at which to report the warning.
|
||||||
* @param warningKey The key for the localized warning message.
|
* @param warningKey The key for the localized warning message.
|
||||||
|
@ -299,16 +208,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.mandatoryWarning(null, source, pos, warningKey));
|
report(diags.mandatoryWarning(null, source, pos, warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Report a warning.
|
|
||||||
* @param lc The lint category for the diagnostic
|
|
||||||
* @param pos The source position at which to report the warning.
|
|
||||||
* @param key The key for the localized warning message.
|
|
||||||
* @param args Fields of the warning message.
|
|
||||||
*/
|
|
||||||
public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
mandatoryWarning(lc, pos, diags.warningKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a warning.
|
/** Report a warning.
|
||||||
* @param lc The lint category for the diagnostic
|
* @param lc The lint category for the diagnostic
|
||||||
* @param pos The source position at which to report the warning.
|
* @param pos The source position at which to report the warning.
|
||||||
|
@ -318,14 +217,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.mandatoryWarning(lc, source, pos, warningKey));
|
report(diags.mandatoryWarning(lc, source, pos, warningKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
|
||||||
* @param key The key for the localized notification message.
|
|
||||||
* @param args Fields of the notint an error or warning message:
|
|
||||||
*/
|
|
||||||
public void note(String key, Object ... args) {
|
|
||||||
note(diags.noteKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
||||||
* @param noteKey The key for the localized notification message.
|
* @param noteKey The key for the localized notification message.
|
||||||
*/
|
*/
|
||||||
|
@ -333,14 +224,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.note(source, null, noteKey));
|
report(diags.note(source, null, noteKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
|
||||||
* @param key The key for the localized notification message.
|
|
||||||
* @param args Fields of the notification message.
|
|
||||||
*/
|
|
||||||
public void note(DiagnosticPosition pos, String key, Object ... args) {
|
|
||||||
note(pos, diags.noteKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
||||||
* @param noteKey The key for the localized notification message.
|
* @param noteKey The key for the localized notification message.
|
||||||
*/
|
*/
|
||||||
|
@ -348,14 +231,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.note(source, pos, noteKey));
|
report(diags.note(source, pos, noteKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
|
||||||
* @param key The key for the localized notification message.
|
|
||||||
* @param args Fields of the notification message.
|
|
||||||
*/
|
|
||||||
public void note(int pos, String key, Object ... args) {
|
|
||||||
note(pos, diags.noteKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
||||||
* @param noteKey The key for the localized notification message.
|
* @param noteKey The key for the localized notification message.
|
||||||
*/
|
*/
|
||||||
|
@ -363,14 +238,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.note(source, wrap(pos), noteKey));
|
report(diags.note(source, wrap(pos), noteKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
|
||||||
* @param key The key for the localized notification message.
|
|
||||||
* @param args Fields of the notification message.
|
|
||||||
*/
|
|
||||||
public void note(JavaFileObject file, String key, Object ... args) {
|
|
||||||
note(file, diags.noteKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
||||||
* @param noteKey The key for the localized notification message.
|
* @param noteKey The key for the localized notification message.
|
||||||
*/
|
*/
|
||||||
|
@ -378,14 +245,6 @@ public abstract class AbstractLog {
|
||||||
report(diags.note(getSource(file), null, noteKey));
|
report(diags.note(getSource(file), null, noteKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
|
||||||
* @param key The key for the localized notification message.
|
|
||||||
* @param args Fields of the notification message.
|
|
||||||
*/
|
|
||||||
public void mandatoryNote(final JavaFileObject file, String key, Object ... args) {
|
|
||||||
mandatoryNote(file, diags.noteKey(key, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
|
||||||
* @param noteKey The key for the localized notification message.
|
* @param noteKey The key for the localized notification message.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -295,7 +295,7 @@ public class JCDiagnostic implements Diagnostic<JavaFileObject> {
|
||||||
/**
|
/**
|
||||||
* Create a new error key.
|
* Create a new error key.
|
||||||
*/
|
*/
|
||||||
Error errorKey(String code, Object... args) {
|
public Error errorKey(String code, Object... args) {
|
||||||
return (Error)DiagnosticInfo.of(ERROR, prefix, code, args);
|
return (Error)DiagnosticInfo.of(ERROR, prefix, code, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ public class JCDiagnostic implements Diagnostic<JavaFileObject> {
|
||||||
/**
|
/**
|
||||||
* Create a new note key.
|
* Create a new note key.
|
||||||
*/
|
*/
|
||||||
Note noteKey(String code, Object... args) {
|
public Note noteKey(String code, Object... args) {
|
||||||
return (Note)DiagnosticInfo.of(NOTE, prefix, code, args);
|
return (Note)DiagnosticInfo.of(NOTE, prefix, code, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,6 +527,23 @@ public class JCDiagnostic implements Diagnostic<JavaFileObject> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the code for this diagnostic info, provided mainly for backward compatibility
|
||||||
|
*/
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the arguments for this diagnostic info, provided mainly for backward compatibility
|
||||||
|
*/
|
||||||
|
public Object[] getArgs() {
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArgs(Object[] args) {
|
||||||
|
this.args = args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,6 +31,8 @@ import javax.tools.JavaFileObject;
|
||||||
|
|
||||||
import com.sun.tools.javac.code.Lint.LintCategory;
|
import com.sun.tools.javac.code.Lint.LintCategory;
|
||||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Note;
|
||||||
|
import com.sun.tools.javac.util.JCDiagnostic.Warning;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +123,7 @@ public class MandatoryWarningHandler {
|
||||||
/**
|
/**
|
||||||
* Report a mandatory warning.
|
* Report a mandatory warning.
|
||||||
*/
|
*/
|
||||||
public void report(DiagnosticPosition pos, String msg, Object... args) {
|
public void report(DiagnosticPosition pos, Warning warnKey) {
|
||||||
JavaFileObject currentSource = log.currentSourceFile();
|
JavaFileObject currentSource = log.currentSourceFile();
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
@ -130,7 +132,7 @@ public class MandatoryWarningHandler {
|
||||||
|
|
||||||
if (log.nwarnings < log.MaxWarnings) {
|
if (log.nwarnings < log.MaxWarnings) {
|
||||||
// generate message and remember the source file
|
// generate message and remember the source file
|
||||||
logMandatoryWarning(pos, msg, args);
|
logMandatoryWarning(pos, warnKey);
|
||||||
sourcesWithReportedWarnings.add(currentSource);
|
sourcesWithReportedWarnings.add(currentSource);
|
||||||
} else if (deferredDiagnosticKind == null) {
|
} else if (deferredDiagnosticKind == null) {
|
||||||
// set up deferred message
|
// set up deferred message
|
||||||
|
@ -248,13 +250,12 @@ public class MandatoryWarningHandler {
|
||||||
* Reports a mandatory warning to the log. If mandatory warnings
|
* Reports a mandatory warning to the log. If mandatory warnings
|
||||||
* are not being enforced, treat this as an ordinary warning.
|
* are not being enforced, treat this as an ordinary warning.
|
||||||
*/
|
*/
|
||||||
private void logMandatoryWarning(DiagnosticPosition pos, String msg,
|
private void logMandatoryWarning(DiagnosticPosition pos, Warning warnKey) {
|
||||||
Object... args) {
|
|
||||||
// Note: the following log methods are safe if lintCategory is null.
|
// Note: the following log methods are safe if lintCategory is null.
|
||||||
if (enforceMandatory)
|
if (enforceMandatory)
|
||||||
log.mandatoryWarning(lintCategory, pos, msg, args);
|
log.mandatoryWarning(lintCategory, pos, warnKey);
|
||||||
else
|
else
|
||||||
log.warning(lintCategory, pos, msg, args);
|
log.warning(lintCategory, pos, warnKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,8 +264,8 @@ public class MandatoryWarningHandler {
|
||||||
*/
|
*/
|
||||||
private void logMandatoryNote(JavaFileObject file, String msg, Object... args) {
|
private void logMandatoryNote(JavaFileObject file, String msg, Object... args) {
|
||||||
if (enforceMandatory)
|
if (enforceMandatory)
|
||||||
log.mandatoryNote(file, msg, args);
|
log.mandatoryNote(file, new Note("compiler", msg, args));
|
||||||
else
|
else
|
||||||
log.note(file, msg, args);
|
log.note(file, new Note("compiler", msg, args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -85,6 +85,8 @@ module jdk.compiler {
|
||||||
exports com.sun.tools.javac.api to
|
exports com.sun.tools.javac.api to
|
||||||
jdk.javadoc,
|
jdk.javadoc,
|
||||||
jdk.jshell;
|
jdk.jshell;
|
||||||
|
exports com.sun.tools.javac.resources to
|
||||||
|
jdk.jshell;
|
||||||
exports com.sun.tools.javac.code to
|
exports com.sun.tools.javac.code to
|
||||||
jdk.javadoc,
|
jdk.javadoc,
|
||||||
jdk.jshell;
|
jdk.jshell;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -307,7 +307,7 @@ class ResponseContent {
|
||||||
|
|
||||||
int bytes2return = Math.min(bytesread, unfulfilled);
|
int bytes2return = Math.min(bytesread, unfulfilled);
|
||||||
debug.log(Level.DEBUG, "Returning chunk bytes: %d", bytes2return);
|
debug.log(Level.DEBUG, "Returning chunk bytes: %d", bytes2return);
|
||||||
returnBuffer = Utils.slice(chunk, bytes2return);
|
returnBuffer = Utils.sliceWithLimitedCapacity(chunk, bytes2return);
|
||||||
unfulfilled = bytesremaining -= bytes2return;
|
unfulfilled = bytesremaining -= bytes2return;
|
||||||
if (unfulfilled == 0) bytesToConsume = 2;
|
if (unfulfilled == 0) bytesToConsume = 2;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ class ResponseContent {
|
||||||
assert hasDemand;
|
assert hasDemand;
|
||||||
int amount = Math.min(b.remaining(), unfulfilled);
|
int amount = Math.min(b.remaining(), unfulfilled);
|
||||||
unfulfilled = remaining -= amount;
|
unfulfilled = remaining -= amount;
|
||||||
ByteBuffer buffer = Utils.slice(b, amount);
|
ByteBuffer buffer = Utils.sliceWithLimitedCapacity(b, amount);
|
||||||
pusher.onNext(List.of(buffer));
|
pusher.onNext(List.of(buffer));
|
||||||
}
|
}
|
||||||
if (unfulfilled == 0) {
|
if (unfulfilled == 0) {
|
||||||
|
|
|
@ -767,7 +767,7 @@ class Stream<T> extends ExchangeImpl<T> {
|
||||||
// blocks waiting for stream send window, if exhausted
|
// blocks waiting for stream send window, if exhausted
|
||||||
int actualAmount = windowController.tryAcquire(requestAmount, streamid, this);
|
int actualAmount = windowController.tryAcquire(requestAmount, streamid, this);
|
||||||
if (actualAmount <= 0) return null;
|
if (actualAmount <= 0) return null;
|
||||||
ByteBuffer outBuf = Utils.slice(buffer, actualAmount);
|
ByteBuffer outBuf = Utils.sliceWithLimitedCapacity(buffer, actualAmount);
|
||||||
DataFrame df = new DataFrame(streamid, 0 , outBuf);
|
DataFrame df = new DataFrame(streamid, 0 , outBuf);
|
||||||
return df;
|
return df;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -464,10 +464,28 @@ public final class Utils {
|
||||||
public static final List<ByteBuffer> EMPTY_BB_LIST = List.of();
|
public static final List<ByteBuffer> EMPTY_BB_LIST = List.of();
|
||||||
public static final ByteBufferReference[] EMPTY_BBR_ARRAY = new ByteBufferReference[0];
|
public static final ByteBufferReference[] EMPTY_BBR_ARRAY = new ByteBufferReference[0];
|
||||||
|
|
||||||
public static ByteBuffer slice(ByteBuffer buffer, int amount) {
|
/**
|
||||||
|
* Returns a slice of size {@code amount} from the given buffer. If the
|
||||||
|
* buffer contains more data than {@code amount}, then the slice's capacity
|
||||||
|
* ( and, but not just, its limit ) is set to {@code amount}. If the buffer
|
||||||
|
* does not contain more data than {@code amount}, then the slice's capacity
|
||||||
|
* will be the same as the given buffer's capacity.
|
||||||
|
*/
|
||||||
|
public static ByteBuffer sliceWithLimitedCapacity(ByteBuffer buffer, int amount) {
|
||||||
|
final int index = buffer.position() + amount;
|
||||||
|
final int limit = buffer.limit();
|
||||||
|
if (index != limit) {
|
||||||
|
// additional data in the buffer
|
||||||
|
buffer.limit(index); // ensures that the slice does not go beyond
|
||||||
|
} else {
|
||||||
|
// no additional data in the buffer
|
||||||
|
buffer.limit(buffer.capacity()); // allows the slice full capacity
|
||||||
|
}
|
||||||
|
|
||||||
ByteBuffer newb = buffer.slice();
|
ByteBuffer newb = buffer.slice();
|
||||||
newb.limit(amount);
|
buffer.position(index);
|
||||||
buffer.position(buffer.position() + amount);
|
buffer.limit(limit); // restore the original buffer's limit
|
||||||
|
newb.limit(amount); // slices limit to amount (capacity may be greater)
|
||||||
return newb;
|
return newb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -281,14 +281,14 @@ public class FramesDecoder {
|
||||||
int extract = Math.min(remaining, bytecount);
|
int extract = Math.min(remaining, bytecount);
|
||||||
ByteBuffer extractedBuf;
|
ByteBuffer extractedBuf;
|
||||||
if (isDataFrame) {
|
if (isDataFrame) {
|
||||||
extractedBuf = Utils.slice(currentBuffer, extract);
|
extractedBuf = Utils.sliceWithLimitedCapacity(currentBuffer, extract);
|
||||||
slicedToDataFrame = true;
|
slicedToDataFrame = true;
|
||||||
} else {
|
} else {
|
||||||
// Header frames here
|
// Header frames here
|
||||||
// HPACK decoding should performed under lock and immediately after frame decoding.
|
// HPACK decoding should performed under lock and immediately after frame decoding.
|
||||||
// in that case it is safe to release original buffer,
|
// in that case it is safe to release original buffer,
|
||||||
// because of sliced buffer has a very short life
|
// because of sliced buffer has a very short life
|
||||||
extractedBuf = Utils.slice(currentBuffer, extract);
|
extractedBuf = Utils.sliceWithLimitedCapacity(currentBuffer, extract);
|
||||||
}
|
}
|
||||||
res.add(extractedBuf);
|
res.add(extractedBuf);
|
||||||
bytecount -= extract;
|
bytecount -= extract;
|
||||||
|
|
|
@ -1,222 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017, 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. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
package org.graalvm.options;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents metadata for a single option.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public final class OptionDescriptor {
|
|
||||||
|
|
||||||
private final OptionKey<?> key;
|
|
||||||
private final String name;
|
|
||||||
private final String help;
|
|
||||||
private final OptionCategory kind;
|
|
||||||
private final boolean deprecated;
|
|
||||||
|
|
||||||
OptionDescriptor(OptionKey<?> key, String name, String help, OptionCategory kind, boolean deprecated) {
|
|
||||||
this.key = key;
|
|
||||||
this.name = name;
|
|
||||||
this.help = help;
|
|
||||||
this.kind = kind;
|
|
||||||
this.deprecated = deprecated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of the option that this descriptor represents.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the key for this option.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionKey<?> getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> if this option was marked deprecated. This indicates that the
|
|
||||||
* option is going to be removed in a future release or its use is not recommended.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public boolean isDeprecated() {
|
|
||||||
return deprecated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the user category of this option.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionCategory getCategory() {
|
|
||||||
return kind;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a human-readable description on how to use the option.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public String getHelp() {
|
|
||||||
return help;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "OptionDescriptor [key=" + key + ", help=" + help + ", kind=" + kind + ", deprecated=" + deprecated + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + (deprecated ? 1231 : 1237);
|
|
||||||
result = prime * result + ((help == null) ? 0 : help.hashCode());
|
|
||||||
result = prime * result + ((key == null) ? 0 : key.hashCode());
|
|
||||||
result = prime * result + ((kind == null) ? 0 : kind.hashCode());
|
|
||||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
} else if (obj == null) {
|
|
||||||
return false;
|
|
||||||
} else if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
OptionDescriptor other = (OptionDescriptor) obj;
|
|
||||||
return Objects.equals(name, other.name) &&
|
|
||||||
Objects.equals(deprecated, other.deprecated) &&
|
|
||||||
Objects.equals(help, other.help) &&
|
|
||||||
Objects.equals(key, other.key) &&
|
|
||||||
Objects.equals(kind, other.kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new option descriptor builder by key. The option group and name is inferred by the
|
|
||||||
* key.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public static <T> Builder newBuilder(OptionKey<T> key, String name) {
|
|
||||||
Objects.requireNonNull(key);
|
|
||||||
Objects.requireNonNull(name);
|
|
||||||
return EMPTY.new Builder(key, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final OptionDescriptor EMPTY = new OptionDescriptor(null, null, null, null, false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an option descriptor builder.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public final class Builder {
|
|
||||||
|
|
||||||
private final OptionKey<?> key;
|
|
||||||
private final String name;
|
|
||||||
private boolean deprecated;
|
|
||||||
private OptionCategory category;
|
|
||||||
private String help;
|
|
||||||
|
|
||||||
Builder(OptionKey<?> key, String name) {
|
|
||||||
this.key = key;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines the user category for this option. The default value is
|
|
||||||
* {@link OptionCategory#DEBUG}.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public Builder category(@SuppressWarnings("hiding") OptionCategory category) {
|
|
||||||
Objects.requireNonNull(category);
|
|
||||||
this.category = category;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defines if this option is deprecated. The default value for deprecated is
|
|
||||||
* <code>false</code>. This can be used to evolve options between releases.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public Builder deprecated(@SuppressWarnings("hiding") boolean deprecated) {
|
|
||||||
this.deprecated = deprecated;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies a human-readable description on how to use the option.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public Builder help(@SuppressWarnings("hiding") String help) {
|
|
||||||
Objects.requireNonNull(help);
|
|
||||||
this.help = help;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds and returns a new option descriptor.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionDescriptor build() {
|
|
||||||
return new OptionDescriptor(key, name, help == null ? "" : help, category == null ? OptionCategory.DEBUG : category, deprecated);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,186 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017, 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. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
package org.graalvm.options;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An interface to a set of {@link OptionDescriptor}s.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public interface OptionDescriptors extends Iterable<OptionDescriptor> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An empty set of option descriptors.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
OptionDescriptors EMPTY = new OptionDescriptors() {
|
|
||||||
|
|
||||||
public Iterator<OptionDescriptor> iterator() {
|
|
||||||
return Collections.<OptionDescriptor> emptyList().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionDescriptor get(String key) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the {@link OptionDescriptor} matching a given option name or {@code null} if this option
|
|
||||||
* descriptor set does not contain a matching option name.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
OptionDescriptor get(String optionName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a union options descriptor out of multiple given descriptors. The operation
|
|
||||||
* descriptors are not checked for duplicate keys. The option descriptors are iterated in
|
|
||||||
* declaration order.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
static OptionDescriptors createUnion(OptionDescriptors... descriptors) {
|
|
||||||
if (descriptors.length == 0) {
|
|
||||||
return EMPTY;
|
|
||||||
} else if (descriptors.length == 1) {
|
|
||||||
return descriptors[0];
|
|
||||||
} else {
|
|
||||||
return new UnionOptionDescriptors(descriptors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
Iterator<OptionDescriptor> iterator();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an {@link OptionDescriptors} instance from a list. The option descriptors
|
|
||||||
* implementation is backed by a {@link LinkedHashMap} that preserves ordering.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
static OptionDescriptors create(List<OptionDescriptor> descriptors) {
|
|
||||||
if (descriptors == null || descriptors.isEmpty()) {
|
|
||||||
return EMPTY;
|
|
||||||
}
|
|
||||||
return new OptionDescriptorsMap(descriptors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OptionDescriptorsMap implements OptionDescriptors {
|
|
||||||
|
|
||||||
final Map<String, OptionDescriptor> descriptors = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
OptionDescriptorsMap(List<OptionDescriptor> descriptorList) {
|
|
||||||
for (OptionDescriptor descriptor : descriptorList) {
|
|
||||||
descriptors.put(descriptor.getName(), descriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OptionDescriptor get(String optionName) {
|
|
||||||
return descriptors.get(optionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<OptionDescriptor> iterator() {
|
|
||||||
return descriptors.values().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
final class UnionOptionDescriptors implements OptionDescriptors {
|
|
||||||
|
|
||||||
final OptionDescriptors[] descriptorsList;
|
|
||||||
|
|
||||||
UnionOptionDescriptors(OptionDescriptors[] descriptors) {
|
|
||||||
// defensive copy
|
|
||||||
this.descriptorsList = Arrays.copyOf(descriptors, descriptors.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterator<OptionDescriptor> iterator() {
|
|
||||||
return new Iterator<OptionDescriptor>() {
|
|
||||||
|
|
||||||
Iterator<OptionDescriptor> descriptors = descriptorsList[0].iterator();
|
|
||||||
int descriptorsIndex = 0;
|
|
||||||
OptionDescriptor next = null;
|
|
||||||
|
|
||||||
public boolean hasNext() {
|
|
||||||
return fetchNext() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private OptionDescriptor fetchNext() {
|
|
||||||
if (next != null) {
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
if (descriptors.hasNext()) {
|
|
||||||
next = descriptors.next();
|
|
||||||
return next;
|
|
||||||
} else if (descriptorsIndex < descriptorsList.length - 1) {
|
|
||||||
descriptorsIndex++;
|
|
||||||
descriptors = descriptorsList[descriptorsIndex].iterator();
|
|
||||||
return fetchNext();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionDescriptor next() {
|
|
||||||
OptionDescriptor fetchedNext = fetchNext();
|
|
||||||
if (fetchedNext != null) {
|
|
||||||
// consume next
|
|
||||||
this.next = null;
|
|
||||||
return fetchedNext;
|
|
||||||
} else {
|
|
||||||
throw new NoSuchElementException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionDescriptor get(String value) {
|
|
||||||
for (OptionDescriptors descriptors : descriptorsList) {
|
|
||||||
OptionDescriptor descriptor = descriptors.get(value);
|
|
||||||
if (descriptor != null) {
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,103 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017, 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. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
package org.graalvm.options;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the option key for an option specification.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public final class OptionKey<T> {
|
|
||||||
|
|
||||||
private final OptionType<T> type;
|
|
||||||
private final T defaultValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new option key given a default value. Throws {@link IllegalArgumentException} if
|
|
||||||
* no default {@link OptionType} could be {@link OptionType#defaultType(Object) resolved} for
|
|
||||||
* the given type. The default value must not be <code>null</code>.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionKey(T defaultValue) {
|
|
||||||
Objects.requireNonNull(defaultValue);
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
this.type = OptionType.defaultType(defaultValue);
|
|
||||||
if (type == null) {
|
|
||||||
throw new IllegalArgumentException("No default type specified for type " + defaultValue.getClass().getName() + ". Specify the option type explicitly to resolve this.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new option key given a default value and option key.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionKey(T defaultValue, OptionType<T> type) {
|
|
||||||
Objects.requireNonNull(type);
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the option type of this key.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionType<T> getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the default value for this option.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public T getDefaultValue() {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of this key given the {@link OptionValues values}.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public T getValue(OptionValues values) {
|
|
||||||
return values.get(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> if a value for this key has been set for the given option values or
|
|
||||||
* <code>false</code> if no value has been set.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public boolean hasBeenSet(OptionValues values) {
|
|
||||||
return values.hasBeenSet(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,222 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017, 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. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
package org.graalvm.options;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a type of an option that allows to convert string values to Java values.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public final class OptionType<T> {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
private final Function<String, T> stringConverter;
|
|
||||||
private final Consumer<T> validator;
|
|
||||||
private final T defaultValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new option type with name, defaultValue, and function that allows to convert a
|
|
||||||
* string to the option type.
|
|
||||||
*
|
|
||||||
* @param name the name of the type.
|
|
||||||
* @param defaultValue the default value to use if no value is given.
|
|
||||||
* @param stringConverter a function that converts a string value to the option value. Can throw
|
|
||||||
* {@link IllegalArgumentException} to indicate an invalid string.
|
|
||||||
* @param validator used for validating the option value. Throws
|
|
||||||
* {@link IllegalArgumentException} if the value is invalid.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionType(String name, T defaultValue, Function<String, T> stringConverter, Consumer<T> validator) {
|
|
||||||
Objects.requireNonNull(name);
|
|
||||||
Objects.requireNonNull(stringConverter);
|
|
||||||
Objects.requireNonNull(validator);
|
|
||||||
this.name = name;
|
|
||||||
this.stringConverter = stringConverter;
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
this.validator = validator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new option type with name, defaultValue, and function that allows to convert a
|
|
||||||
* string to the option type.
|
|
||||||
*
|
|
||||||
* @param name the name of the type.
|
|
||||||
* @param defaultValue the default value to use if no value is given.
|
|
||||||
* @param stringConverter a function that converts a string value to the option value. Can throw
|
|
||||||
* {@link IllegalArgumentException} to indicate an invalid string.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public OptionType(String name, T defaultValue, Function<String, T> stringConverter) {
|
|
||||||
this(name, defaultValue, stringConverter, new Consumer<T>() {
|
|
||||||
public void accept(T t) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the default value of this type. Used if no value is available.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public T getDefaultValue() {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of this type.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a string value, validates it, and converts it to an object of this type.
|
|
||||||
*
|
|
||||||
* @throws IllegalArgumentException if the value is invalid or cannot be converted.
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public T convert(String value) {
|
|
||||||
T v = stringConverter.apply(value);
|
|
||||||
validate(v);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates an option value and throws an {@link IllegalArgumentException} if the value is
|
|
||||||
* invalid.
|
|
||||||
*
|
|
||||||
* @throws IllegalArgumentException if the value is invalid or cannot be converted.
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public void validate(T value) {
|
|
||||||
validator.accept(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "OptionType[name=" + name + ", defaultValue=" + defaultValue + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Class<?>, OptionType<?>> DEFAULTTYPES = new HashMap<>();
|
|
||||||
static {
|
|
||||||
DEFAULTTYPES.put(Boolean.class, new OptionType<>("Boolean", false, new Function<String, Boolean>() {
|
|
||||||
public Boolean apply(String t) {
|
|
||||||
if ("true".equals(t)) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else if ("false".equals(t)) {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException(String.format("Invalid boolean option value '%s'. The value of the option must be '%s' or '%s'.", t, "true", "false"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
DEFAULTTYPES.put(Byte.class, new OptionType<>("Byte", (byte) 0, new Function<String, Byte>() {
|
|
||||||
public Byte apply(String t) {
|
|
||||||
try {
|
|
||||||
return Byte.parseByte(t);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw new IllegalArgumentException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
DEFAULTTYPES.put(Integer.class, new OptionType<>("Integer", 0, new Function<String, Integer>() {
|
|
||||||
public Integer apply(String t) {
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(t);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw new IllegalArgumentException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
DEFAULTTYPES.put(Long.class, new OptionType<>("Long", 0L, new Function<String, Long>() {
|
|
||||||
public Long apply(String t) {
|
|
||||||
try {
|
|
||||||
return Long.parseLong(t);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw new IllegalArgumentException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
DEFAULTTYPES.put(Float.class, new OptionType<>("Float", 0.0f, new Function<String, Float>() {
|
|
||||||
public Float apply(String t) {
|
|
||||||
try {
|
|
||||||
return Float.parseFloat(t);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw new IllegalArgumentException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
DEFAULTTYPES.put(Double.class, new OptionType<>("Double", 0.0d, new Function<String, Double>() {
|
|
||||||
public Double apply(String t) {
|
|
||||||
try {
|
|
||||||
return Double.parseDouble(t);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw new IllegalArgumentException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
DEFAULTTYPES.put(String.class, new OptionType<>("String", "0", new Function<String, String>() {
|
|
||||||
public String apply(String t) {
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the default option type for a given value. Returns <code>null</code> if no default
|
|
||||||
* option type is available for the Java type of this value.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> OptionType<T> defaultType(T value) {
|
|
||||||
return defaultType((Class<T>) value.getClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the default option type for a class. Returns <code>null</code> if no default option
|
|
||||||
* type is available for this Java type.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> OptionType<T> defaultType(Class<T> clazz) {
|
|
||||||
return (OptionType<T>) DEFAULTTYPES.get(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2017, 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. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
package org.graalvm.options;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a set of option values based on an {@link OptionDescriptor}.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
public interface OptionValues {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all available options.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
OptionDescriptors getDescriptors();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of {@code optionKey} to {@code value}.
|
|
||||||
*
|
|
||||||
* @throws IllegalArgumentException if the given value is not {@link OptionType#validate(Object)
|
|
||||||
* validated} by the {@link OptionKey#getType() option type} of the key. Note that
|
|
||||||
* the operation succeeds if the option key is not described by any of the
|
|
||||||
* associated {@link #getDescriptors() descriptors}.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
<T> void set(OptionKey<T> optionKey, T value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of a given option. If no value is set or the key is not described by any
|
|
||||||
* {@link #getDescriptors() descriptors} the {@link OptionType#getDefaultValue() default value}
|
|
||||||
* of the given key is returned.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
<T> T get(OptionKey<T> optionKey);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if a value for {@code optionKey} has been {@link #set} in this set of option
|
|
||||||
* values.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
boolean hasBeenSet(OptionKey<?> optionKey);
|
|
||||||
|
|
||||||
}
|
|
|
@ -43,8 +43,6 @@ import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -231,7 +229,8 @@ public class JlinkTask {
|
||||||
try {
|
try {
|
||||||
List<String> remaining = optionsHelper.handleOptions(this, args);
|
List<String> remaining = optionsHelper.handleOptions(this, args);
|
||||||
if (remaining.size() > 0 && !options.suggestProviders) {
|
if (remaining.size() > 0 && !options.suggestProviders) {
|
||||||
throw taskHelper.newBadArgs("err.orphan.arguments", toString(remaining))
|
throw taskHelper.newBadArgs("err.orphan.arguments",
|
||||||
|
remaining.stream().collect(Collectors.joining(" ")))
|
||||||
.showUsage(true);
|
.showUsage(true);
|
||||||
}
|
}
|
||||||
if (options.help) {
|
if (options.help) {
|
||||||
|
@ -659,9 +658,12 @@ public class JlinkTask {
|
||||||
throws BadArgs
|
throws BadArgs
|
||||||
{
|
{
|
||||||
if (args.size() > 1) {
|
if (args.size() > 1) {
|
||||||
throw taskHelper.newBadArgs("err.orphan.argument",
|
List<String> arguments = args.get(0).startsWith("-")
|
||||||
toString(args.subList(1, args.size())))
|
? args
|
||||||
.showUsage(true);
|
: args.subList(1, args.size());
|
||||||
|
throw taskHelper.newBadArgs("err.invalid.arg.for.option",
|
||||||
|
"--suggest-providers",
|
||||||
|
arguments.stream().collect(Collectors.joining(" ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.bindServices) {
|
if (options.bindServices) {
|
||||||
|
@ -714,7 +716,7 @@ public class JlinkTask {
|
||||||
.forEach(names::remove);
|
.forEach(names::remove);
|
||||||
if (!names.isEmpty()) {
|
if (!names.isEmpty()) {
|
||||||
log.println(taskHelper.getMessage("warn.provider.notfound",
|
log.println(taskHelper.getMessage("warn.provider.notfound",
|
||||||
toString(names)));
|
names.stream().sorted().collect(Collectors.joining(","))));
|
||||||
}
|
}
|
||||||
|
|
||||||
String msg = String.format("%n%s:", taskHelper.getMessage("suggested.providers.header"));
|
String msg = String.format("%n%s:", taskHelper.getMessage("suggested.providers.header"));
|
||||||
|
@ -722,11 +724,6 @@ public class JlinkTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String toString(Collection<String> collection) {
|
|
||||||
return collection.stream().sorted()
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getSaveOpts() {
|
private String getSaveOpts() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append('#').append(new Date()).append("\n");
|
sb.append('#').append(new Date()).append("\n");
|
||||||
|
|
|
@ -128,7 +128,7 @@ err.badpattern=bad pattern {0}
|
||||||
err.unknown.option=unknown option: {0}
|
err.unknown.option=unknown option: {0}
|
||||||
err.missing.arg=no value given for {0}
|
err.missing.arg=no value given for {0}
|
||||||
err.internal.error=internal error: {0} {1} {2}
|
err.internal.error=internal error: {0} {1} {2}
|
||||||
err.invalid.arg.for.option=invalid argument for option: {0}
|
err.invalid.arg.for.option={0} does not accept \"{1}\" argument
|
||||||
err.option.after.class=option must be specified before classes: {0}
|
err.option.after.class=option must be specified before classes: {0}
|
||||||
err.option.unsupported={0} not supported: {1}
|
err.option.unsupported={0} not supported: {1}
|
||||||
err.orphan.arguments=invalid argument: {0}
|
err.orphan.arguments=invalid argument: {0}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -128,16 +128,6 @@ class CompletenessAnalyzer {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(DiagnosticPosition pos, String key, Object... args) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(DiagnosticFlag flag, DiagnosticPosition pos, String key, Object... args) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(int pos, Error errorKey) {
|
public void error(int pos, Error errorKey) {
|
||||||
die();
|
die();
|
||||||
|
@ -148,11 +138,6 @@ class CompletenessAnalyzer {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void error(DiagnosticFlag flag, int pos, String key, Object... args) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void report(JCDiagnostic diagnostic) {
|
public void report(JCDiagnostic diagnostic) {
|
||||||
// Ignore
|
// Ignore
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,6 +32,8 @@ import com.sun.tools.javac.parser.ParserFactory;
|
||||||
import com.sun.tools.javac.parser.Tokens.Comment;
|
import com.sun.tools.javac.parser.Tokens.Comment;
|
||||||
import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
|
import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
|
||||||
import com.sun.tools.javac.parser.Tokens.Token;
|
import com.sun.tools.javac.parser.Tokens.Token;
|
||||||
|
import com.sun.tools.javac.resources.CompilerProperties;
|
||||||
|
import com.sun.tools.javac.resources.CompilerProperties.Errors;
|
||||||
import static com.sun.tools.javac.parser.Tokens.TokenKind.CLASS;
|
import static com.sun.tools.javac.parser.Tokens.TokenKind.CLASS;
|
||||||
import static com.sun.tools.javac.parser.Tokens.TokenKind.COLON;
|
import static com.sun.tools.javac.parser.Tokens.TokenKind.COLON;
|
||||||
import static com.sun.tools.javac.parser.Tokens.TokenKind.ENUM;
|
import static com.sun.tools.javac.parser.Tokens.TokenKind.ENUM;
|
||||||
|
@ -244,11 +246,11 @@ class ReplParser extends JavacParser {
|
||||||
? List.of(toP(F.at(pos).MethodDef(mods, name, t, typarams,
|
? List.of(toP(F.at(pos).MethodDef(mods, name, t, typarams,
|
||||||
List.nil(), List.nil(), null, null)))
|
List.nil(), List.nil(), null, null)))
|
||||||
: null;
|
: null;
|
||||||
return List.<JCTree>of(syntaxError(token.pos, err, "expected", LPAREN));
|
return List.<JCTree>of(syntaxError(token.pos, err, Errors.Expected(LPAREN)));
|
||||||
}
|
}
|
||||||
} else if (!typarams.isEmpty()) {
|
} else if (!typarams.isEmpty()) {
|
||||||
// type parameters on non-variable non-method -- error
|
// type parameters on non-variable non-method -- error
|
||||||
return List.<JCTree>of(syntaxError(token.pos, "illegal.start.of.type"));
|
return List.<JCTree>of(syntaxError(token.pos, Errors.IllegalStartOfType));
|
||||||
} else {
|
} else {
|
||||||
// expression-statement or expression to evaluate
|
// expression-statement or expression to evaluate
|
||||||
JCExpressionStatement expr = toP(F.at(pos).Exec(t));
|
JCExpressionStatement expr = toP(F.at(pos).Exec(t));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_pt_BR extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -371,7 +371,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
|
||||||
{"Africa/Nouakchott", GMT},
|
{"Africa/Nouakchott", GMT},
|
||||||
{"Africa/Ouagadougou", GMT},
|
{"Africa/Ouagadougou", GMT},
|
||||||
{"Africa/Porto-Novo", WAT},
|
{"Africa/Porto-Novo", WAT},
|
||||||
{"Africa/Sao_Tome", GMT},
|
{"Africa/Sao_Tome", WAT},
|
||||||
{"Africa/Timbuktu", GMT},
|
{"Africa/Timbuktu", GMT},
|
||||||
{"Africa/Tripoli", EET},
|
{"Africa/Tripoli", EET},
|
||||||
{"Africa/Tunis", CET},
|
{"Africa/Tunis", CET},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -109,7 +109,9 @@ class JarFileSystem extends ZipFileSystem {
|
||||||
*/
|
*/
|
||||||
private Function<byte[],byte[]> createVersionedLinks(int version) {
|
private Function<byte[],byte[]> createVersionedLinks(int version) {
|
||||||
HashMap<IndexNode,byte[]> aliasMap = new HashMap<>();
|
HashMap<IndexNode,byte[]> aliasMap = new HashMap<>();
|
||||||
getVersionMap(version, getInode(getBytes("/META-INF/versions"))).values()
|
IndexNode verdir = getInode(getBytes("/META-INF/versions"));
|
||||||
|
if (verdir != null) {
|
||||||
|
getVersionMap(version, verdir).values()
|
||||||
.forEach(versionNode -> { // for each META-INF/versions/{n} directory
|
.forEach(versionNode -> { // for each META-INF/versions/{n} directory
|
||||||
// put all the leaf inodes, i.e. entries, into the alias map
|
// put all the leaf inodes, i.e. entries, into the alias map
|
||||||
// possibly shadowing lower versioned entries
|
// possibly shadowing lower versioned entries
|
||||||
|
@ -124,6 +126,7 @@ class JarFileSystem extends ZipFileSystem {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return path -> aliasMap.get(IndexNode.keyOf(path));
|
return path -> aliasMap.get(IndexNode.keyOf(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ ifndef CONCURRENCY_FACTOR
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR
|
# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR
|
||||||
CONCURRENCY := $(shell awk \
|
CONCURRENCY := $(shell $(AWK) \
|
||||||
'BEGIN { \
|
'BEGIN { \
|
||||||
c = $(NUM_CORES) / 2; \
|
c = $(NUM_CORES) / 2; \
|
||||||
if (c > 12) c = 12; \
|
if (c > 12) c = 12; \
|
||||||
|
@ -368,8 +368,10 @@ CONCURRENCY := $(shell awk \
|
||||||
}')
|
}')
|
||||||
JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
|
JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
|
||||||
|
|
||||||
# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
|
# Make sure MaxRAMPercentage is low enough to not cause OOM or swapping since
|
||||||
JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY))
|
# we may end up with a lot of JVM's
|
||||||
|
MAX_RAM_PERCENTAGE := $(shell expr 25 / $(CONCURRENCY))
|
||||||
|
JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(MAX_RAM_PERCENTAGE)
|
||||||
|
|
||||||
ifdef EXTRA_JTREG_OPTIONS
|
ifdef EXTRA_JTREG_OPTIONS
|
||||||
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
|
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
|
||||||
|
|
40
test/hotspot/gtest/opto/test_mathexact.cpp
Normal file
40
test/hotspot/gtest/opto/test_mathexact.cpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precompiled.hpp"
|
||||||
|
#include "opto/mulnode.hpp"
|
||||||
|
#include "opto/mathexactnode.hpp"
|
||||||
|
#include "unittest.hpp"
|
||||||
|
|
||||||
|
TEST_VM(opto, mathexact) {
|
||||||
|
ASSERT_FALSE(OverflowMulLNode::is_overflow(1, 1));
|
||||||
|
ASSERT_FALSE(OverflowMulLNode::is_overflow(1, min_jlong));
|
||||||
|
ASSERT_TRUE(OverflowMulLNode::is_overflow(-1, min_jlong));
|
||||||
|
ASSERT_FALSE(OverflowMulLNode::is_overflow(-1, max_jlong));
|
||||||
|
ASSERT_TRUE(OverflowMulLNode::is_overflow(max_jlong / 2 + 1, 2));
|
||||||
|
ASSERT_FALSE(OverflowMulLNode::is_overflow(min_jlong, 0));
|
||||||
|
ASSERT_FALSE(OverflowMulLNode::is_overflow(min_jlong + 1, -1));
|
||||||
|
ASSERT_TRUE(OverflowMulLNode::is_overflow(min_jlong + 1, 2));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8191915
|
||||||
|
* @summary Regression test for multiplyExact intrinsic
|
||||||
|
* @library /test/lib /
|
||||||
|
* @modules java.base/jdk.internal.misc
|
||||||
|
* java.management
|
||||||
|
*
|
||||||
|
* @run main/othervm -Xcomp -XX:-TieredCompilation compiler.intrinsics.mathexact.LongMulOverflowTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
package compiler.intrinsics.mathexact;
|
||||||
|
|
||||||
|
public class LongMulOverflowTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
LongMulOverflowTest test = new LongMulOverflowTest();
|
||||||
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
try {
|
||||||
|
test.runTest();
|
||||||
|
throw new RuntimeException("Error, runTest() did not overflow!");
|
||||||
|
} catch (ArithmeticException e) {
|
||||||
|
// success
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
test.runTestOverflow();
|
||||||
|
throw new RuntimeException("Error, runTestOverflow() did not overflow!");
|
||||||
|
} catch (ArithmeticException e) {
|
||||||
|
// success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runTest() {
|
||||||
|
java.lang.Math.multiplyExact(Long.MIN_VALUE, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runTestOverflow() {
|
||||||
|
java.lang.Math.multiplyExact((Long.MAX_VALUE / 2) + 1, 2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Red Hat, Inc. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact 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 8196296
|
||||||
|
* @summary Bad graph when unrolled loop bounds conflicts with range checks
|
||||||
|
*
|
||||||
|
* @run main/othervm -XX:-BackgroundCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=0 TestStripMinedBackToBackIfs
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class TestStripMinedBackToBackIfs {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
test(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double test(int limit) {
|
||||||
|
double v = 1;
|
||||||
|
for (int i = 0; i < limit; i++) {
|
||||||
|
v = v * 4;
|
||||||
|
// We don't want this test to be merged with identical
|
||||||
|
// loop end test
|
||||||
|
if (i+1 < limit) {
|
||||||
|
v = v * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -27,6 +27,11 @@ import jdk.test.lib.dcmd.JMXExecutor;
|
||||||
import jdk.test.lib.dcmd.PidJcmdExecutor;
|
import jdk.test.lib.dcmd.PidJcmdExecutor;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8054890
|
* @bug 8054890
|
||||||
|
@ -43,9 +48,19 @@ import org.testng.annotations.Test;
|
||||||
*/
|
*/
|
||||||
public class DataDumpDcmdTest {
|
public class DataDumpDcmdTest {
|
||||||
public void run(CommandExecutor executor) {
|
public void run(CommandExecutor executor) {
|
||||||
OutputAnalyzer output = executor.execute("JVMTI.data_dump");
|
OutputAnalyzer out = executor.execute("JVMTI.data_dump");
|
||||||
|
|
||||||
output.stderrShouldBeEmpty();
|
// stderr should be empty except for VM warnings.
|
||||||
|
if (!out.getStderr().isEmpty()) {
|
||||||
|
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
|
||||||
|
Pattern p = Pattern.compile(".*VM warning.*");
|
||||||
|
for (String line : lines) {
|
||||||
|
Matcher m = p.matcher(line);
|
||||||
|
if (!m.matches()) {
|
||||||
|
throw new RuntimeException("Stderr has output other than VM warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -22,10 +22,14 @@
|
||||||
*/
|
*/
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
import jdk.test.lib.dcmd.*;
|
import jdk.test.lib.dcmd.*;
|
||||||
|
@ -97,6 +101,20 @@ public class LoadAgentDcmdTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void checkWarningsOnly(OutputAnalyzer out) {
|
||||||
|
// stderr should be empty except for VM warnings.
|
||||||
|
if (!out.getStderr().isEmpty()) {
|
||||||
|
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
|
||||||
|
Pattern p = Pattern.compile(".*VM warning.*");
|
||||||
|
for (String line : lines) {
|
||||||
|
Matcher m = p.matcher(line);
|
||||||
|
if (!m.matches()) {
|
||||||
|
throw new RuntimeException("Stderr has output other than VM warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void run(CommandExecutor executor) {
|
public void run(CommandExecutor executor) {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
|
@ -108,22 +126,22 @@ public class LoadAgentDcmdTest {
|
||||||
// Test 1: Native agent, no arguments
|
// Test 1: Native agent, no arguments
|
||||||
output = executor.execute("JVMTI.agent_load " +
|
output = executor.execute("JVMTI.agent_load " +
|
||||||
libpath + " agent.jar");
|
libpath + " agent.jar");
|
||||||
output.stderrShouldBeEmpty();
|
checkWarningsOnly(output);
|
||||||
|
|
||||||
// Test 2: Native agent, with arguments
|
// Test 2: Native agent, with arguments
|
||||||
output = executor.execute("JVMTI.agent_load " +
|
output = executor.execute("JVMTI.agent_load " +
|
||||||
libpath + " \"agent.jar=foo=bar\"");
|
libpath + " \"agent.jar=foo=bar\"");
|
||||||
output.stderrShouldBeEmpty();
|
checkWarningsOnly(output);
|
||||||
|
|
||||||
// Test 3: Java agent, no arguments
|
// Test 3: Java agent, no arguments
|
||||||
output = executor.execute("JVMTI.agent_load " +
|
output = executor.execute("JVMTI.agent_load " +
|
||||||
"agent.jar");
|
"agent.jar");
|
||||||
output.stderrShouldBeEmpty();
|
checkWarningsOnly(output);
|
||||||
|
|
||||||
// Test 4: Java agent, with arguments
|
// Test 4: Java agent, with arguments
|
||||||
output = executor.execute("JVMTI.agent_load " +
|
output = executor.execute("JVMTI.agent_load " +
|
||||||
"\"agent.jar=foo=bar\"");
|
"\"agent.jar=foo=bar\"");
|
||||||
output.stderrShouldBeEmpty();
|
checkWarningsOnly(output);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
129
test/jaxp/javax/xml/jaxp/unittest/transform/sort/SortTest.java
Normal file
129
test/jaxp/javax/xml/jaxp/unittest/transform/sort/SortTest.java
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
package transform.sort;
|
||||||
|
|
||||||
|
import static jaxp.library.JAXPTestUtilities.getSystemProperty;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.transform.Result;
|
||||||
|
import javax.xml.transform.Source;
|
||||||
|
import javax.xml.transform.Templates;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
import javax.xml.transform.stream.StreamSource;
|
||||||
|
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.DataProvider;
|
||||||
|
import org.testng.annotations.Listeners;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8193830
|
||||||
|
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
||||||
|
* @run testng/othervm -DrunSecMngr=true transform.sort.SortTest
|
||||||
|
* @run testng/othervm transform.sort.SortTest
|
||||||
|
* @summary verify xsl:sort lang attribute
|
||||||
|
*/
|
||||||
|
@Listeners({jaxp.library.FilePolicy.class})
|
||||||
|
public class SortTest {
|
||||||
|
|
||||||
|
static final String LAND_EN = "en";
|
||||||
|
static final String LAND_PL = "pl";
|
||||||
|
static final String LAND_RU = "ru";
|
||||||
|
|
||||||
|
String filepath;
|
||||||
|
String slash = "";
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public void setUpClass() throws Exception {
|
||||||
|
String file1 = getClass().getResource("sort-alphabet-english.xml").getFile();
|
||||||
|
if (getSystemProperty("os.name").contains("Windows")) {
|
||||||
|
filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
|
||||||
|
slash = "/";
|
||||||
|
} else {
|
||||||
|
filepath = file1.substring(0, file1.lastIndexOf("/") + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DataProvider fields:
|
||||||
|
* lang, xml, xsl, gold file
|
||||||
|
*/
|
||||||
|
@DataProvider(name = "parameters")
|
||||||
|
public Object[][] getParameters() {
|
||||||
|
|
||||||
|
return new Object[][]{
|
||||||
|
{LAND_EN, "sort-alphabet-english.xml", "sort-alphabet-english.xsl", "sort-alphabet-english.out"},
|
||||||
|
{LAND_PL, "sort-alphabet-polish.xml", "sort-alphabet-polish.xsl", "sort-alphabet-polish.out"},
|
||||||
|
{LAND_RU, "sort-alphabet-russian.xml", "sort-alphabet-russian.xsl", "sort-alphabet-russian.out"},};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dataProvider = "parameters")
|
||||||
|
public final void testTransform(String lang, String xml, String xsl, String gold)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
// Create transformer factory
|
||||||
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
|
|
||||||
|
// Use the factory to create a template containing the xsl file
|
||||||
|
Templates template = factory.newTemplates(new StreamSource(getClass().getResourceAsStream(xsl)));
|
||||||
|
// Use the template to create a transformer
|
||||||
|
Transformer xformer = template.newTransformer();
|
||||||
|
xformer.setParameter("lang", lang);
|
||||||
|
// Prepare the input and output files
|
||||||
|
Source source = new StreamSource(getClass().getResourceAsStream(xml));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following may be used to produce gold files.
|
||||||
|
* Using however the original gold files, and compare without considering
|
||||||
|
* the format
|
||||||
|
*/
|
||||||
|
//String output = getClass().getResource(gold).getPath();
|
||||||
|
//Result result = new StreamResult(new FileOutputStream(output));
|
||||||
|
// use the following to verify the output against the pre-generated one
|
||||||
|
Result result = new StreamResult(sw);
|
||||||
|
|
||||||
|
// Apply the xsl file to the source file and write the result to the
|
||||||
|
// output file
|
||||||
|
xformer.transform(source, result);
|
||||||
|
|
||||||
|
String out = sw.toString();
|
||||||
|
|
||||||
|
List<String> lines = Files.readAllLines(Paths.get(filepath + gold));
|
||||||
|
String[] resultLines = out.split("\n");
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
// the purpose is to test sort, so ignore the format of the output
|
||||||
|
for (String line : lines) {
|
||||||
|
Assert.assertEquals(resultLines[i++].trim(), line.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><root>
|
||||||
|
<p>lang: en</p>
|
||||||
|
<ul>
|
||||||
|
<li>A</li>
|
||||||
|
<li>C</li>
|
||||||
|
<li>D</li>
|
||||||
|
<li>E</li>
|
||||||
|
<li>F</li>
|
||||||
|
<li>G</li>
|
||||||
|
<li>H</li>
|
||||||
|
<li>I</li>
|
||||||
|
<li>J</li>
|
||||||
|
<li>K</li>
|
||||||
|
<li>L</li>
|
||||||
|
<li>M</li>
|
||||||
|
<li>N</li>
|
||||||
|
<li>O</li>
|
||||||
|
<li>P</li>
|
||||||
|
<li>Q</li>
|
||||||
|
<li>R</li>
|
||||||
|
<li>S</li>
|
||||||
|
<li>T</li>
|
||||||
|
<li>U</li>
|
||||||
|
<li>V</li>
|
||||||
|
<li>W</li>
|
||||||
|
<li>X</li>
|
||||||
|
<li>Y</li>
|
||||||
|
<li>Z</li>
|
||||||
|
</ul>
|
||||||
|
</root>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<alphabet language="en">
|
||||||
|
<character>A</character>
|
||||||
|
<character>E</character>
|
||||||
|
<character>C</character>
|
||||||
|
<character>D</character>
|
||||||
|
<character>F</character>
|
||||||
|
<character>G</character>
|
||||||
|
<character>H</character>
|
||||||
|
<character>I</character>
|
||||||
|
<character>J</character>
|
||||||
|
<character>K</character>
|
||||||
|
<character>L</character>
|
||||||
|
<character>M</character>
|
||||||
|
<character>N</character>
|
||||||
|
<character>Y</character>
|
||||||
|
<character>O</character>
|
||||||
|
<character>P</character>
|
||||||
|
<character>Q</character>
|
||||||
|
<character>U</character>
|
||||||
|
<character>R</character>
|
||||||
|
<character>S</character>
|
||||||
|
<character>V</character>
|
||||||
|
<character>W</character>
|
||||||
|
<character>T</character>
|
||||||
|
<character>X</character>
|
||||||
|
<character>Z</character>
|
||||||
|
</alphabet>
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||||
|
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" encoding="UTF-8" indent="yes" xml:space="preserve" />
|
||||||
|
<!-- <xsl:output method="html" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML
|
||||||
|
4.01//EN" version="4.0" encoding="UTF-8" indent="yes" xml:lang="$lang" omit-xml-declaration="no"/> -->
|
||||||
|
<xsl:param name="lang" />
|
||||||
|
<xsl:template match="alphabet">
|
||||||
|
<root>
|
||||||
|
<p>lang: <xsl:value-of select="$lang" /></p>
|
||||||
|
<ul>
|
||||||
|
<xsl:apply-templates select="character">
|
||||||
|
<xsl:sort select="." lang="{$lang}" order="ascending" />
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</ul>
|
||||||
|
</root>
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template match="character">
|
||||||
|
<li>
|
||||||
|
<xsl:value-of select="text()" />
|
||||||
|
</li>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><root>
|
||||||
|
<p>lang: pl</p>
|
||||||
|
<ul>
|
||||||
|
<li>A</li>
|
||||||
|
<li>Ą</li>
|
||||||
|
<li>B</li>
|
||||||
|
<li>C</li>
|
||||||
|
<li>Ć</li>
|
||||||
|
<li>D</li>
|
||||||
|
<li>E</li>
|
||||||
|
<li>Ę</li>
|
||||||
|
<li>F</li>
|
||||||
|
<li>G</li>
|
||||||
|
<li>H</li>
|
||||||
|
<li>I</li>
|
||||||
|
<li>J</li>
|
||||||
|
<li>K</li>
|
||||||
|
<li>L</li>
|
||||||
|
<li>Ł</li>
|
||||||
|
<li>M</li>
|
||||||
|
<li>N</li>
|
||||||
|
<li>Ń</li>
|
||||||
|
<li>O</li>
|
||||||
|
<li>Ó</li>
|
||||||
|
<li>P</li>
|
||||||
|
<li>R</li>
|
||||||
|
<li>S</li>
|
||||||
|
<li>Ś</li>
|
||||||
|
<li>T</li>
|
||||||
|
<li>U</li>
|
||||||
|
<li>W</li>
|
||||||
|
<li>Y</li>
|
||||||
|
<li>Z</li>
|
||||||
|
<li>Ź</li>
|
||||||
|
<li>Ż</li>
|
||||||
|
</ul>
|
||||||
|
</root>
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<alphabet language="pl">
|
||||||
|
<character>A</character>
|
||||||
|
<character>Ż</character>
|
||||||
|
<character>B</character>
|
||||||
|
<character>C</character>
|
||||||
|
<character>Ć</character>
|
||||||
|
<character>D</character>
|
||||||
|
<character>Ł</character>
|
||||||
|
<character>E</character>
|
||||||
|
<character>Ę</character>
|
||||||
|
<character>F</character>
|
||||||
|
<character>G</character>
|
||||||
|
<character>H</character>
|
||||||
|
<character>I</character>
|
||||||
|
<character>J</character>
|
||||||
|
<character>K</character>
|
||||||
|
<character>L</character>
|
||||||
|
<character>Z</character>
|
||||||
|
<character>Ź</character>
|
||||||
|
<character>M</character>
|
||||||
|
<character>N</character>
|
||||||
|
<character>Ń</character>
|
||||||
|
<character>O</character>
|
||||||
|
<character>Ó</character>
|
||||||
|
<character>P</character>
|
||||||
|
<character>R</character>
|
||||||
|
<character>S</character>
|
||||||
|
<character>Ś</character>
|
||||||
|
<character>T</character>
|
||||||
|
<character>U</character>
|
||||||
|
<character>W</character>
|
||||||
|
<character>Ą</character>
|
||||||
|
<character>Y</character>
|
||||||
|
</alphabet>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||||
|
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" encoding="UTF-8" indent="yes" xml:space="preserve" />
|
||||||
|
<!-- <xsl:output method="html" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML
|
||||||
|
4.01//EN" version="4.0" encoding="UTF-8" indent="yes" xml:lang="$lang" omit-xml-declaration="no"/> -->
|
||||||
|
<xsl:param name="lang" />
|
||||||
|
<xsl:template match="alphabet">
|
||||||
|
<root>
|
||||||
|
<p>lang: <xsl:value-of select="$lang" /></p>
|
||||||
|
<ul>
|
||||||
|
<xsl:apply-templates select="character">
|
||||||
|
<xsl:sort select="." lang="{$lang}" order="ascending" />
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</ul>
|
||||||
|
</root>
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template match="character">
|
||||||
|
<li>
|
||||||
|
<xsl:value-of select="text()" />
|
||||||
|
</li>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><root>
|
||||||
|
<p>lang: ru</p>
|
||||||
|
<ul>
|
||||||
|
<li>А</li>
|
||||||
|
<li>Б</li>
|
||||||
|
<li>В</li>
|
||||||
|
<li>Г</li>
|
||||||
|
<li>Д</li>
|
||||||
|
<li>Е</li>
|
||||||
|
<li>Ё</li>
|
||||||
|
<li>Ж</li>
|
||||||
|
<li>З</li>
|
||||||
|
<li>И</li>
|
||||||
|
<li>Й</li>
|
||||||
|
<li>К</li>
|
||||||
|
<li>Л</li>
|
||||||
|
<li>М</li>
|
||||||
|
<li>Н</li>
|
||||||
|
<li>О</li>
|
||||||
|
<li>П</li>
|
||||||
|
<li>Р</li>
|
||||||
|
<li>С</li>
|
||||||
|
<li>Т</li>
|
||||||
|
<li>У</li>
|
||||||
|
<li>Ф</li>
|
||||||
|
<li>Х</li>
|
||||||
|
<li>Ц</li>
|
||||||
|
<li>Ч</li>
|
||||||
|
<li>Ш</li>
|
||||||
|
<li>Щ</li>
|
||||||
|
<li>Ъ</li>
|
||||||
|
<li>Ы</li>
|
||||||
|
<li>Ь</li>
|
||||||
|
<li>Э</li>
|
||||||
|
<li>Ю</li>
|
||||||
|
<li>Я</li>
|
||||||
|
</ul>
|
||||||
|
</root>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<alphabet language="ru">
|
||||||
|
<character>А</character>
|
||||||
|
<character>Б</character>
|
||||||
|
<character>В</character>
|
||||||
|
<character>Г</character>
|
||||||
|
<character>Д</character>
|
||||||
|
<character>Е</character>
|
||||||
|
<character>Ё</character>
|
||||||
|
<character>Ж</character>
|
||||||
|
<character>З</character>
|
||||||
|
<character>Й</character>
|
||||||
|
<character>П</character>
|
||||||
|
<character>Я</character>
|
||||||
|
<character>К</character>
|
||||||
|
<character>Л</character>
|
||||||
|
<character>С</character>
|
||||||
|
<character>М</character>
|
||||||
|
<character>Н</character>
|
||||||
|
<character>О</character>
|
||||||
|
<character>Р</character>
|
||||||
|
<character>И</character>
|
||||||
|
<character>Т</character>
|
||||||
|
<character>Ф</character>
|
||||||
|
<character>Х</character>
|
||||||
|
<character>Ц</character>
|
||||||
|
<character>У</character>
|
||||||
|
<character>Ш</character>
|
||||||
|
<character>Щ</character>
|
||||||
|
<character>Ъ</character>
|
||||||
|
<character>Ы</character>
|
||||||
|
<character>Ч</character>
|
||||||
|
<character>Ь</character>
|
||||||
|
<character>Э</character>
|
||||||
|
<character>Ю</character>
|
||||||
|
</alphabet>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
-->
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||||
|
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" encoding="UTF-8" indent="yes" xml:space="preserve" />
|
||||||
|
<!-- <xsl:output method="html" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML
|
||||||
|
4.01//EN" version="4.0" encoding="UTF-8" indent="yes" xml:lang="$lang" omit-xml-declaration="no"/> -->
|
||||||
|
<xsl:param name="lang" />
|
||||||
|
<xsl:template match="alphabet">
|
||||||
|
<root>
|
||||||
|
<p>lang: <xsl:value-of select="$lang" /></p>
|
||||||
|
<ul>
|
||||||
|
<xsl:apply-templates select="character">
|
||||||
|
<xsl:sort select="." lang="{$lang}" order="ascending" />
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</ul>
|
||||||
|
</root>
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template match="character">
|
||||||
|
<li>
|
||||||
|
<xsl:value-of select="text()" />
|
||||||
|
</li>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -31,7 +31,7 @@ import static org.testng.Assert.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4358774
|
* @bug 4358774 8139206
|
||||||
* @run testng NullInputStream
|
* @run testng NullInputStream
|
||||||
* @summary Check for expected behavior of InputStream.nullInputStream().
|
* @summary Check for expected behavior of InputStream.nullInputStream().
|
||||||
*/
|
*/
|
||||||
|
@ -107,7 +107,7 @@ public class NullInputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = "open")
|
@Test(groups = "open")
|
||||||
public static void testreadNBytes() {
|
public static void testReadNBytes() {
|
||||||
try {
|
try {
|
||||||
assertEquals(0, openStream.readNBytes(new byte[1], 0, 1),
|
assertEquals(0, openStream.readNBytes(new byte[1], 0, 1),
|
||||||
"readNBytes(byte[],int,int) != 0");
|
"readNBytes(byte[],int,int) != 0");
|
||||||
|
@ -116,6 +116,26 @@ public class NullInputStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(groups = "open")
|
||||||
|
public static void testReadNBytesWithLength() {
|
||||||
|
try {
|
||||||
|
assertEquals(0, openStream.readNBytes(-1).length,
|
||||||
|
"readNBytes(-1) != 0");
|
||||||
|
fail("Expected IllegalArgumentException not thrown");
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
fail("Unexpected IOException");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
assertEquals(0, openStream.readNBytes(0).length,
|
||||||
|
"readNBytes(0, false) != 0");
|
||||||
|
assertEquals(0, openStream.readNBytes(1).length,
|
||||||
|
"readNBytes(1, false) != 0");
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
fail("Unexpected IOException");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test(groups = "open")
|
@Test(groups = "open")
|
||||||
public static void testSkip() {
|
public static void testSkip() {
|
||||||
try {
|
try {
|
||||||
|
@ -180,6 +200,15 @@ public class NullInputStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(groups = "closed")
|
||||||
|
public static void testReadNBytesWithLengthClosed() {
|
||||||
|
try {
|
||||||
|
closedStream.readNBytes(1);
|
||||||
|
fail("Expected IOException not thrown");
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test(groups = "closed")
|
@Test(groups = "closed")
|
||||||
public static void testSkipClosed() {
|
public static void testSkipClosed() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,7 +31,7 @@ import jdk.test.lib.RandomFactory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8080835
|
* @bug 8080835 8139206
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @build jdk.test.lib.RandomFactory
|
* @build jdk.test.lib.RandomFactory
|
||||||
* @run main ReadNBytes
|
* @run main ReadNBytes
|
||||||
|
@ -46,15 +46,19 @@ public class ReadNBytes {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
test(new byte[]{1, 2, 3});
|
test(new byte[]{1, 2, 3});
|
||||||
test(createRandomBytes(1024));
|
test(createRandomBytes(1024));
|
||||||
test(createRandomBytes((1 << 13) - 1));
|
for (int shift : new int[] {13, 15, 17}) {
|
||||||
test(createRandomBytes((1 << 13)));
|
for (int offset : new int[] {-1, 0, 1}) {
|
||||||
test(createRandomBytes((1 << 13) + 1));
|
test(createRandomBytes((1 << shift) + offset));
|
||||||
test(createRandomBytes((1 << 15) - 1));
|
}
|
||||||
test(createRandomBytes((1 << 15)));
|
}
|
||||||
test(createRandomBytes((1 << 15) + 1));
|
|
||||||
test(createRandomBytes((1 << 17) - 1));
|
test(-1);
|
||||||
test(createRandomBytes((1 << 17)));
|
test(0);
|
||||||
test(createRandomBytes((1 << 17) + 1));
|
for (int shift : new int[] {13, 15, 17}) {
|
||||||
|
for (int offset : new int[] {-1, 0, 1}) {
|
||||||
|
test((1 << shift) + offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test(byte[] inputBytes) throws IOException {
|
static void test(byte[] inputBytes) throws IOException {
|
||||||
|
@ -91,6 +95,46 @@ public class ReadNBytes {
|
||||||
check(!in.isClosed(), "Stream unexpectedly closed");
|
check(!in.isClosed(), "Stream unexpectedly closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test(int max) throws IOException {
|
||||||
|
byte[] inputBytes = max <= 0 ? new byte[0] : createRandomBytes(max);
|
||||||
|
WrapperInputStream in =
|
||||||
|
new WrapperInputStream(new ByteArrayInputStream(inputBytes));
|
||||||
|
|
||||||
|
if (max < 0) {
|
||||||
|
try {
|
||||||
|
in.readNBytes(max);
|
||||||
|
check(false, "Expected IllegalArgumentException not thrown");
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (max == 0) {
|
||||||
|
int x;
|
||||||
|
check((x = in.readNBytes(max).length) == 0,
|
||||||
|
"Expected zero bytes, got " + x);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int off = Math.toIntExact(in.skip(generator.nextInt(max/2)));
|
||||||
|
int len = generator.nextInt(max - 1 - off);
|
||||||
|
byte[] readBytes = in.readNBytes(len);
|
||||||
|
check(readBytes.length == len,
|
||||||
|
"Expected " + len + " bytes, got " + readBytes.length);
|
||||||
|
check(Arrays.equals(inputBytes, off, off + len, readBytes, 0, len),
|
||||||
|
"Expected[" + Arrays.copyOfRange(inputBytes, off, off + len) +
|
||||||
|
"], got:[" + readBytes + "]");
|
||||||
|
|
||||||
|
int remaining = max - (off + len);
|
||||||
|
readBytes = in.readNBytes(remaining);
|
||||||
|
check(readBytes.length == remaining,
|
||||||
|
"Expected " + remaining + "bytes, got " + readBytes.length);
|
||||||
|
check(Arrays.equals(inputBytes, off + len, max,
|
||||||
|
readBytes, 0, remaining),
|
||||||
|
"Expected[" + Arrays.copyOfRange(inputBytes, off + len, max) +
|
||||||
|
"], got:[" + readBytes + "]");
|
||||||
|
|
||||||
|
check(!in.isClosed(), "Stream unexpectedly closed");
|
||||||
|
}
|
||||||
|
|
||||||
static byte[] createRandomBytes(int size) {
|
static byte[] createRandomBytes(int size) {
|
||||||
byte[] bytes = new byte[size];
|
byte[] bytes = new byte[size];
|
||||||
generator.nextBytes(bytes);
|
generator.nextBytes(bytes);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -138,6 +138,9 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||||
cases.add(new VarHandleSourceAccessTestCase(
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
"read write", bav, vh, h -> testArrayReadWrite(bas, h),
|
"read write", bav, vh, h -> testArrayReadWrite(bas, h),
|
||||||
true));
|
true));
|
||||||
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
|
"null array", bav, vh, h -> testArrayNPE(bas, h),
|
||||||
|
false));
|
||||||
cases.add(new VarHandleSourceAccessTestCase(
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
"unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
|
"unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
|
||||||
false));
|
false));
|
||||||
|
@ -162,6 +165,9 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||||
true));
|
true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
|
"null buffer", bav, vh, h -> testArrayNPE(bbs, h),
|
||||||
|
false));
|
||||||
cases.add(new VarHandleSourceAccessTestCase(
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
"unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
|
"unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
|
||||||
false));
|
false));
|
||||||
|
@ -192,6 +198,88 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
|
||||||
|
VarHandle vh = vhs.s;
|
||||||
|
byte[] array = null;
|
||||||
|
int ci = 1;
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.get(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.set(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.getVolatile(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.getAcquire(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.getOpaque(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setVolatile(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setRelease(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setOpaque(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
|
||||||
|
VarHandle vh = vhs.s;
|
||||||
|
ByteBuffer array = null;
|
||||||
|
int ci = 1;
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.get(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.set(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.getVolatile(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.getAcquire(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
char x = (char) vh.getOpaque(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setVolatile(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setRelease(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setOpaque(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
|
static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
|
||||||
VarHandle vh = vhs.s;
|
VarHandle vh = vhs.s;
|
||||||
byte[] array = bs.s;
|
byte[] array = bs.s;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -138,6 +138,9 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||||
cases.add(new VarHandleSourceAccessTestCase(
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
"read write", bav, vh, h -> testArrayReadWrite(bas, h),
|
"read write", bav, vh, h -> testArrayReadWrite(bas, h),
|
||||||
true));
|
true));
|
||||||
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
|
"null array", bav, vh, h -> testArrayNPE(bas, h),
|
||||||
|
false));
|
||||||
cases.add(new VarHandleSourceAccessTestCase(
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
"unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
|
"unsupported", bav, vh, h -> testArrayUnsupported(bas, h),
|
||||||
false));
|
false));
|
||||||
|
@ -162,6 +165,9 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||||
true));
|
true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
|
"null buffer", bav, vh, h -> testArrayNPE(bbs, h),
|
||||||
|
false));
|
||||||
cases.add(new VarHandleSourceAccessTestCase(
|
cases.add(new VarHandleSourceAccessTestCase(
|
||||||
"unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
|
"unsupported", bav, vh, h -> testArrayUnsupported(bbs, h),
|
||||||
false));
|
false));
|
||||||
|
@ -192,6 +198,174 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
|
||||||
|
VarHandle vh = vhs.s;
|
||||||
|
byte[] array = null;
|
||||||
|
int ci = 1;
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.get(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.set(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.getVolatile(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.getAcquire(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.getOpaque(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setVolatile(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setRelease(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setOpaque(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double r = (double) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double r = (double) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double r = (double) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
|
||||||
|
VarHandle vh = vhs.s;
|
||||||
|
ByteBuffer array = null;
|
||||||
|
int ci = 1;
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.get(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.set(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.getVolatile(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.getAcquire(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double x = (double) vh.getOpaque(array, ci);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setVolatile(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setRelease(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
vh.setOpaque(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double r = (double) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double r = (double) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double r = (double) vh.compareAndExchangeRelease(array, ci, VALUE_2, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSetAcquire(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
boolean r = vh.weakCompareAndSetRelease(array, ci, VALUE_1, VALUE_2);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double o = (double) vh.getAndSet(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
checkNPE(() -> {
|
||||||
|
double o = (double) vh.getAndSetRelease(array, ci, VALUE_1);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
|
static void testArrayUnsupported(ByteArraySource bs, VarHandleSource vhs) {
|
||||||
VarHandle vh = vhs.s;
|
VarHandle vh = vhs.s;
|
||||||
byte[] array = bs.s;
|
byte[] array = bs.s;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue