This commit is contained in:
Lana Steuck 2018-02-02 02:55:00 +00:00
commit 94aa298a46
80 changed files with 2567 additions and 1104 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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 -

View File

@ -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

View File

@ -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

View File

@ -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.
# #

View File

@ -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

View File

@ -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) {

View File

@ -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

View File

@ -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) {

View File

@ -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();

View File

@ -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()) {

View File

@ -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 {

View File

@ -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

View File

@ -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),

View File

@ -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) {
if (hasPassword) {
dataStream.reset(); // prepare the stream for loading dataStream.reset(); // prepare the stream for loading
if (hasPassword) {
keystore.load(dataStream, password); keystore.load(dataStream, password);
} else { } else {
keystore.load(param); keystore.keyStoreSpi.engineLoad(dataStream, param);
} }
return keystore; return keystore;
} }

View File

@ -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;
} }

View File

@ -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",

View File

@ -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},

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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) {

View File

@ -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;
} }

View File

@ -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;
} }

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -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},

View File

@ -1,12 +1,10 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 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
* under the terms of the GNU General Public License version 2 only, as * under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this * published by the Free Software Foundation.
* 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 * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@ -21,35 +19,22 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 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 * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/
package org.graalvm.options;
/**
* Categorizes options according to user relevance.
* *
* @since 1.0
*/ */
public enum OptionCategory {
/** #include "precompiled.hpp"
* An option common for users to apply. #include "opto/mulnode.hpp"
* #include "opto/mathexactnode.hpp"
* @since 1.0 #include "unittest.hpp"
*/
USER,
/**
* An option only relevant in corner cases and for fine-tuning.
*
* @since 1.0
*/
EXPERT,
/**
* An option only relevant when debugging language or instrument implementations.
*
* @since 1.0
*/
DEBUG
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));
} }

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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 VarHandleTestByteArrayAsFloat 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 VarHandleTestByteArrayAsFloat 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 VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
} }
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
byte[] array = null;
int ci = 1;
checkNPE(() -> {
float x = (float) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
float x = (float) vh.getVolatile(array, ci);
});
checkNPE(() -> {
float x = (float) vh.getAcquire(array, ci);
});
checkNPE(() -> {
float x = (float) 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(() -> {
float r = (float) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
float r = (float) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
float r = (float) 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(() -> {
float o = (float) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
float o = (float) vh.getAndSetRelease(array, ci, VALUE_1);
});
}
static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
ByteBuffer array = null;
int ci = 1;
checkNPE(() -> {
float x = (float) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
float x = (float) vh.getVolatile(array, ci);
});
checkNPE(() -> {
float x = (float) vh.getAcquire(array, ci);
});
checkNPE(() -> {
float x = (float) 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(() -> {
float r = (float) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
float r = (float) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
float r = (float) 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(() -> {
float o = (float) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
float o = (float) 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;

View File

@ -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 VarHandleTestByteArrayAsInt 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 VarHandleTestByteArrayAsInt 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,266 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
} }
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
byte[] array = null;
int ci = 1;
checkNPE(() -> {
int x = (int) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
int x = (int) vh.getVolatile(array, ci);
});
checkNPE(() -> {
int x = (int) vh.getAcquire(array, ci);
});
checkNPE(() -> {
int x = (int) 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(() -> {
int r = (int) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
int r = (int) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
int r = (int) 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(() -> {
int o = (int) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
});
}
static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
ByteBuffer array = null;
int ci = 1;
checkNPE(() -> {
int x = (int) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
int x = (int) vh.getVolatile(array, ci);
});
checkNPE(() -> {
int x = (int) vh.getAcquire(array, ci);
});
checkNPE(() -> {
int x = (int) 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(() -> {
int r = (int) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
int r = (int) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
int r = (int) 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(() -> {
int o = (int) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndSetRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndAdd(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndAddRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
int o = (int) vh.getAndBitwiseXorRelease(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;

View File

@ -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 VarHandleTestByteArrayAsLong 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 VarHandleTestByteArrayAsLong 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,266 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
} }
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
byte[] array = null;
int ci = 1;
checkNPE(() -> {
long x = (long) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
long x = (long) vh.getVolatile(array, ci);
});
checkNPE(() -> {
long x = (long) vh.getAcquire(array, ci);
});
checkNPE(() -> {
long x = (long) 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(() -> {
long r = (long) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
long r = (long) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
long r = (long) 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(() -> {
long o = (long) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
});
}
static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
ByteBuffer array = null;
int ci = 1;
checkNPE(() -> {
long x = (long) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
long x = (long) vh.getVolatile(array, ci);
});
checkNPE(() -> {
long x = (long) vh.getAcquire(array, ci);
});
checkNPE(() -> {
long x = (long) 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(() -> {
long r = (long) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
long r = (long) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
long r = (long) 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(() -> {
long o = (long) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndSetRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndAdd(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndAddRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
long o = (long) vh.getAndBitwiseXorRelease(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;

View File

@ -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 VarHandleTestByteArrayAsShort 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 VarHandleTestByteArrayAsShort 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 VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
} }
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
byte[] array = null;
int ci = 1;
checkNPE(() -> {
short x = (short) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
short x = (short) vh.getVolatile(array, ci);
});
checkNPE(() -> {
short x = (short) vh.getAcquire(array, ci);
});
checkNPE(() -> {
short x = (short) 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(() -> {
short x = (short) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
short x = (short) vh.getVolatile(array, ci);
});
checkNPE(() -> {
short x = (short) vh.getAcquire(array, ci);
});
checkNPE(() -> {
short x = (short) 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;

View File

@ -2906,4 +2906,3 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
} }
} }
} }

View File

@ -3252,4 +3252,3 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
} }
} }
} }

View File

@ -3252,4 +3252,3 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
} }
} }
} }

View File

@ -2400,4 +2400,3 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
} }
} }

View File

@ -2400,4 +2400,3 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
} }
} }

View File

@ -3252,4 +3252,3 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
} }
} }
} }

View File

@ -3252,4 +3252,3 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
} }
} }
} }

View File

@ -3252,4 +3252,3 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
} }
} }
} }

View File

@ -2054,4 +2054,3 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
} }
} }

View File

@ -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
@ -170,6 +170,9 @@ public class VarHandleTestByteArrayAs$Type$ 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));
@ -194,6 +197,9 @@ public class VarHandleTestByteArrayAs$Type$ 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));
@ -224,6 +230,278 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
} }
static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
byte[] array = null;
int ci = 1;
checkNPE(() -> {
$type$ x = ($type$) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ x = ($type$) vh.getVolatile(array, ci);
});
checkNPE(() -> {
$type$ x = ($type$) vh.getAcquire(array, ci);
});
checkNPE(() -> {
$type$ x = ($type$) 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);
});
#if[CAS]
checkNPE(() -> {
boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
});
checkNPE(() -> {
$type$ r = ($type$) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
$type$ r = ($type$) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
$type$ r = ($type$) 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(() -> {
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
});
#end[CAS]
#if[AtomicAdd]
checkNPE(() -> {
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
});
#end[AtomicAdd]
#if[Bitwise]
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
});
#end[Bitwise]
}
static void testArrayNPE(ByteBufferSource bs, VarHandleSource vhs) {
VarHandle vh = vhs.s;
ByteBuffer array = null;
int ci = 1;
checkNPE(() -> {
$type$ x = ($type$) vh.get(array, ci);
});
checkNPE(() -> {
vh.set(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ x = ($type$) vh.getVolatile(array, ci);
});
checkNPE(() -> {
$type$ x = ($type$) vh.getAcquire(array, ci);
});
checkNPE(() -> {
$type$ x = ($type$) 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);
});
#if[CAS]
checkNPE(() -> {
boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2);
});
checkNPE(() -> {
$type$ r = ($type$) vh.compareAndExchange(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
$type$ r = ($type$) vh.compareAndExchangeAcquire(array, ci, VALUE_2, VALUE_1);
});
checkNPE(() -> {
$type$ r = ($type$) 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(() -> {
$type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1);
});
#end[CAS]
#if[AtomicAdd]
checkNPE(() -> {
$type$ o = ($type$) vh.getAndAdd(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1);
});
#end[AtomicAdd]
#if[Bitwise]
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1);
});
checkNPE(() -> {
$type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1);
});
#end[Bitwise]
}
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;

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
javac -d . ../../../../../make/src/classes/build/tools/spp/Spp.java javac -d . ../../../../../../make/jdk/src/classes/build/tools/spp/Spp.java
SPP=build.tools.spp.Spp SPP=build.tools.spp.Spp

View File

@ -0,0 +1,377 @@
/*
* 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 8195823
* @summary Buffers given to response body subscribers should not contain
* unprocessed HTTP data
* @modules java.base/sun.net.www.http
* jdk.incubator.httpclient/jdk.incubator.http.internal.common
* jdk.incubator.httpclient/jdk.incubator.http.internal.frame
* jdk.incubator.httpclient/jdk.incubator.http.internal.hpack
* java.logging
* jdk.httpserver
* @library /lib/testlibrary http2/server
* @build Http2TestServer
* @build jdk.testlibrary.SimpleSSLContext
* @run testng/othervm -Djdk.internal.httpclient.debug=true ConcurrentResponses
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Flow;
import java.util.stream.IntStream;
import javax.net.ssl.SSLContext;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
import jdk.incubator.http.HttpClient;
import jdk.incubator.http.HttpRequest;
import jdk.incubator.http.HttpResponse;
import jdk.incubator.http.HttpResponse.BodyHandler;
import jdk.incubator.http.HttpResponse.BodySubscriber;
import jdk.testlibrary.SimpleSSLContext;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static java.nio.charset.StandardCharsets.UTF_8;
import static jdk.incubator.http.HttpResponse.BodyHandler.asString;
import static jdk.incubator.http.HttpResponse.BodyHandler.discard;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.fail;
public class ConcurrentResponses {
SSLContext sslContext;
HttpServer httpTestServer; // HTTP/1.1 [ 4 servers ]
HttpsServer httpsTestServer; // HTTPS/1.1
Http2TestServer http2TestServer; // HTTP/2 ( h2c )
Http2TestServer https2TestServer; // HTTP/2 ( h2 )
String httpFixedURI, httpsFixedURI, httpChunkedURI, httpsChunkedURI;
String http2FixedURI, https2FixedURI, http2VariableURI, https2VariableURI;
static final int CONCURRENT_REQUESTS = 13;
static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static final int ALPHABET_LENGTH = ALPHABET.length();
static final String stringOfLength(int requiredLength) {
StringBuilder sb = new StringBuilder(requiredLength);
IntStream.range(0, requiredLength)
.mapToObj(i -> ALPHABET.charAt(i % ALPHABET_LENGTH))
.forEach(c -> sb.append(c));
return sb.toString();
}
/** An array of different Strings, to be used as bodies. */
static final String[] BODIES = bodies();
static String[] bodies() {
String[] bodies = new String[CONCURRENT_REQUESTS];
for (int i=0;i<CONCURRENT_REQUESTS; i++) {
// slightly, but still, different bodies
bodies[i] = "Request-" + i + "-body-" + stringOfLength((1024) + i);
}
return bodies;
}
/**
* Asserts the given response's status code is 200.
* Returns a CF that completes with the given response.
*/
static final <T> CompletionStage<HttpResponse<T>>
assert200ResponseCode(HttpResponse<T> response) {
assertEquals(response.statusCode(), 200);
return CompletableFuture.completedFuture(response);
}
/**
* Asserts that the given response's body is equal to the given body.
* Returns a CF that completes with the given response.
*/
static final <T> CompletionStage<HttpResponse<T>>
assertbody(HttpResponse<T> response, T body) {
assertEquals(response.body(), body);
return CompletableFuture.completedFuture(response);
}
@DataProvider(name = "uris")
public Object[][] variants() {
return new Object[][]{
{ httpFixedURI },
{ httpsFixedURI },
{ httpChunkedURI },
{ httpsChunkedURI },
{ http2FixedURI },
{ https2FixedURI },
{ http2VariableURI },
{ https2VariableURI }
};
}
// The asString implementation accumulates data, below a certain threshold
// into the byte buffers it is given.
@Test(dataProvider = "uris")
void testAsString(String uri) throws Exception {
HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build();
Map<HttpRequest, String> requests = new HashMap<>();
for (int i=0;i<CONCURRENT_REQUESTS; i++) {
HttpRequest request = HttpRequest.newBuilder(URI.create(uri + "?" + i))
.build();
requests.put(request, BODIES[i]);
}
// initial connection to seed the cache so next parallel connections reuse it
client.sendAsync(HttpRequest.newBuilder(URI.create(uri)).build(), discard(null)).join();
// will reuse connection cached from the previous request ( when HTTP/2 )
CompletableFuture.allOf(requests.keySet().parallelStream()
.map(request -> client.sendAsync(request, asString()))
.map(cf -> cf.thenCompose(ConcurrentResponses::assert200ResponseCode))
.map(cf -> cf.thenCompose(response -> assertbody(response, requests.get(response.request()))))
.toArray(CompletableFuture<?>[]::new))
.join();
}
// The custom subscriber aggressively attacks any area, between the limit
// and the capacity, in the byte buffers it is given, by writing 'X' into it.
@Test(dataProvider = "uris")
void testWithCustomSubscriber(String uri) throws Exception {
HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build();
Map<HttpRequest, String> requests = new HashMap<>();
for (int i=0;i<CONCURRENT_REQUESTS; i++) {
HttpRequest request = HttpRequest.newBuilder(URI.create(uri + "?" + i))
.build();
requests.put(request, BODIES[i]);
}
// initial connection to seed the cache so next parallel connections reuse it
client.sendAsync(HttpRequest.newBuilder(URI.create(uri)).build(), discard(null)).join();
// will reuse connection cached from the previous request ( when HTTP/2 )
CompletableFuture.allOf(requests.keySet().parallelStream()
.map(request -> client.sendAsync(request, CustomSubscriber.handler))
.map(cf -> cf.thenCompose(ConcurrentResponses::assert200ResponseCode))
.map(cf -> cf.thenCompose(response -> assertbody(response, requests.get(response.request()))))
.toArray(CompletableFuture<?>[]::new))
.join();
}
/**
* A subscriber that wraps asString, but mucks with any data between limit
* and capacity, if the client mistakenly passes it any that is should not.
*/
static class CustomSubscriber implements BodySubscriber<String> {
static final BodyHandler<String> handler = (r,h) -> new CustomSubscriber();
private final BodySubscriber<String> asString = BodySubscriber.asString(UTF_8);
@Override
public CompletionStage<String> getBody() {
return asString.getBody();
}
@Override
public void onSubscribe(Flow.Subscription subscription) {
asString.onSubscribe(subscription);
}
@Override
public void onNext(List<ByteBuffer> buffers) {
// Muck any data beyond the give limit, since there shouldn't
// be any of interest to the HTTP Client.
for (ByteBuffer buffer : buffers) {
if (buffer.limit() != buffer.capacity()) {
final int limit = buffer.limit();
final int position = buffer.position();
buffer.position(buffer.limit());
buffer.limit(buffer.capacity());
while (buffer.hasRemaining())
buffer.put((byte)'X');
buffer.position(position); // restore original position
buffer.limit(limit); // restore original limit
}
}
asString.onNext(buffers);
}
@Override
public void onError(Throwable throwable) {
asString.onError(throwable);
throwable.printStackTrace();
fail("UNEXPECTED:" + throwable);
}
@Override
public void onComplete() {
asString.onComplete();
}
}
@BeforeTest
public void setup() throws Exception {
sslContext = new SimpleSSLContext().get();
if (sslContext == null)
throw new AssertionError("Unexpected null sslContext");
InetSocketAddress sa = new InetSocketAddress("localhost", 0);
httpTestServer = HttpServer.create(sa, 0);
httpTestServer.createContext("/http1/fixed", new Http1FixedHandler());
httpFixedURI = "http://127.0.0.1:" + httpTestServer.getAddress().getPort() + "/http1/fixed";
httpTestServer.createContext("/http1/chunked", new Http1ChunkedHandler());
httpChunkedURI = "http://127.0.0.1:" + httpTestServer.getAddress().getPort() + "/http1/chunked";
httpsTestServer = HttpsServer.create(sa, 0);
httpsTestServer.setHttpsConfigurator(new HttpsConfigurator(sslContext));
httpsTestServer.createContext("/https1/fixed", new Http1FixedHandler());
httpsFixedURI = "https://127.0.0.1:" + httpsTestServer.getAddress().getPort() + "/https1/fixed";
httpsTestServer.createContext("/https1/chunked", new Http1ChunkedHandler());
httpsChunkedURI = "https://127.0.0.1:" + httpsTestServer.getAddress().getPort() + "/https1/chunked";
http2TestServer = new Http2TestServer("127.0.0.1", false, 0);
http2TestServer.addHandler(new Http2FixedHandler(), "/http2/fixed");
http2FixedURI = "http://127.0.0.1:" + http2TestServer.getAddress().getPort() + "/http2/fixed";
http2TestServer.addHandler(new Http2VariableHandler(), "/http2/variable");
http2VariableURI = "http://127.0.0.1:" + http2TestServer.getAddress().getPort() + "/http2/variable";
https2TestServer = new Http2TestServer("127.0.0.1", true, 0);
https2TestServer.addHandler(new Http2FixedHandler(), "/https2/fixed");
https2FixedURI = "https://127.0.0.1:" + https2TestServer.getAddress().getPort() + "/https2/fixed";
https2TestServer.addHandler(new Http2VariableHandler(), "/https2/variable");
https2VariableURI = "https://127.0.0.1:" + https2TestServer.getAddress().getPort() + "/https2/variable";
httpTestServer.start();
httpsTestServer.start();
http2TestServer.start();
https2TestServer.start();
}
@AfterTest
public void teardown() throws Exception {
httpTestServer.stop(0);
httpsTestServer.stop(0);
http2TestServer.stop();
https2TestServer.stop();
}
interface SendResponseHeadersFunction {
void apply(int responseCode, long responseLength) throws IOException;
}
// A handler implementation that replies with 200 OK. If the exchange's uri
// has a query, then it must be an integer, which is used as an index to
// select the particular response body, e.g. /http2/x?5 -> BODIES[5]
static void serverHandlerImpl(InputStream inputStream,
OutputStream outputStream,
URI uri,
SendResponseHeadersFunction sendResponseHeadersFunction)
throws IOException
{
try (InputStream is = inputStream;
OutputStream os = outputStream) {
is.readAllBytes();
String magicQuery = uri.getQuery();
if (magicQuery != null) {
int bodyIndex = Integer.valueOf(magicQuery);
String body = BODIES[bodyIndex];
byte[] bytes = body.getBytes(UTF_8);
sendResponseHeadersFunction.apply(200, bytes.length);
int offset = 0;
// Deliberately attempt to reply with several relatively
// small data frames ( each write corresponds to its own
// data frame ). Additionally, yield, to encourage other
// handlers to execute, therefore increasing the likelihood
// of multiple different-stream related frames in the
// client's read buffer.
while (offset < bytes.length) {
int length = Math.min(bytes.length - offset, 64);
os.write(bytes, offset, length);
os.flush();
offset += length;
Thread.yield();
}
} else {
sendResponseHeadersFunction.apply(200, 1);
os.write('A');
}
}
}
static class Http1FixedHandler implements HttpHandler {
@Override
public void handle(HttpExchange t) throws IOException {
serverHandlerImpl(t.getRequestBody(),
t.getResponseBody(),
t.getRequestURI(),
(rcode, length) -> t.sendResponseHeaders(rcode, length));
}
}
static class Http1ChunkedHandler implements HttpHandler {
@Override
public void handle(HttpExchange t) throws IOException {
serverHandlerImpl(t.getRequestBody(),
t.getResponseBody(),
t.getRequestURI(),
(rcode, ignored) -> t.sendResponseHeaders(rcode, 0 /*chunked*/));
}
}
static class Http2FixedHandler implements Http2Handler {
@Override
public void handle(Http2TestExchange t) throws IOException {
serverHandlerImpl(t.getRequestBody(),
t.getResponseBody(),
t.getRequestURI(),
(rcode, length) -> t.sendResponseHeaders(rcode, length));
}
}
static class Http2VariableHandler implements Http2Handler {
@Override
public void handle(Http2TestExchange t) throws IOException {
serverHandlerImpl(t.getRequestBody(),
t.getResponseBody(),
t.getRequestURI(),
(rcode, ignored) -> t.sendResponseHeaders(rcode, 0 /* no Content-Length */));
}
}
}

View File

@ -1,12 +1,10 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 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
* under the terms of the GNU General Public License version 2 only, as * under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this * published by the Free Software Foundation.
* 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 * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@ -22,12 +20,11 @@
* 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.
*/ */
/**
* The Graal-SDK options package contains reusable collection classes for options. /*
* * @test
* @see org.graalvm.options.OptionDescriptor * @bug 8195823
* @see org.graalvm.options.OptionValues * @modules jdk.incubator.httpclient/jdk.incubator.http.internal.frame
* * @run testng/othervm -Djdk.internal.httpclient.debug=true jdk.incubator.httpclient/jdk.incubator.http.internal.frame.FramesDecoderTest
* @since 1.0
*/ */
package org.graalvm.options;

View File

@ -0,0 +1,140 @@
/*
* 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 jdk.incubator.http.internal.frame;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import org.testng.Assert;
import org.testng.annotations.Test;
import static java.lang.System.out;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.testng.Assert.*;
public class FramesDecoderTest {
abstract class TestFrameProcessor implements FramesDecoder.FrameProcessor {
protected volatile int count;
public int numberOfFramesDecoded() { return count; }
}
/**
* Verifies that a ByteBuffer containing more that one frame, destined
* to be returned to the user's subscriber, i.e. a data frame, does not
* inadvertently expose the following frame ( between its limit and
* capacity ).
*/
@Test
public void decodeDataFrameFollowedByAnother() throws Exception {
// input frames for to the decoder
List<ByteBuffer> data1 = List.of(ByteBuffer.wrap("XXXX".getBytes(UTF_8)));
DataFrame dataFrame1 = new DataFrame(1, 0, data1);
List<ByteBuffer> data2 = List.of(ByteBuffer.wrap("YYYY".getBytes(UTF_8)));
DataFrame dataFrame2 = new DataFrame(1, 0, data2);
List<ByteBuffer> buffers = new ArrayList<>();
FramesEncoder encoder = new FramesEncoder();
buffers.addAll(encoder.encodeFrame(dataFrame1));
buffers.addAll(encoder.encodeFrame(dataFrame2));
ByteBuffer combined = ByteBuffer.allocate(1024);
buffers.stream().forEach(combined::put);
combined.flip();
TestFrameProcessor testFrameProcessor = new TestFrameProcessor() {
@Override
public void processFrame(Http2Frame frame) throws IOException {
assertTrue(frame instanceof DataFrame);
DataFrame dataFrame = (DataFrame) frame;
List<ByteBuffer> list = dataFrame.getData();
assertEquals(list.size(), 1);
ByteBuffer data = list.get(0);
byte[] bytes = new byte[data.remaining()];
data.get(bytes);
if (count == 0) {
assertEquals(new String(bytes, UTF_8), "XXXX");
out.println("First data received:" + data);
assertEquals(data.position(), data.limit()); // since bytes read
assertEquals(data.limit(), data.capacity());
} else {
assertEquals(new String(bytes, UTF_8), "YYYY");
out.println("Second data received:" + data);
}
count++;
}
};
FramesDecoder decoder = new FramesDecoder(testFrameProcessor);
out.println("Sending " + combined + " to decoder: ");
decoder.decode(combined);
Assert.assertEquals(testFrameProcessor.numberOfFramesDecoded(), 2);
}
/**
* Verifies that a ByteBuffer containing ONLY data one frame, destined
* to be returned to the user's subscriber, does not restrict the capacity.
* The complete buffer ( all its capacity ), since no longer used by the
* HTTP Client, should be returned to the user.
*/
@Test
public void decodeDataFrameEnsureNotCapped() throws Exception {
// input frames for to the decoder
List<ByteBuffer> data1 = List.of(ByteBuffer.wrap("XXXX".getBytes(UTF_8)));
DataFrame dataFrame1 = new DataFrame(1, 0, data1);
List<ByteBuffer> buffers = new ArrayList<>();
FramesEncoder encoder = new FramesEncoder();
buffers.addAll(encoder.encodeFrame(dataFrame1));
ByteBuffer combined = ByteBuffer.allocate(1024);
buffers.stream().forEach(combined::put);
combined.flip();
TestFrameProcessor testFrameProcessor = new TestFrameProcessor() {
@Override
public void processFrame(Http2Frame frame) throws IOException {
assertTrue(frame instanceof DataFrame);
DataFrame dataFrame = (DataFrame) frame;
List<ByteBuffer> list = dataFrame.getData();
assertEquals(list.size(), 1);
ByteBuffer data = list.get(0);
byte[] bytes = new byte[data.remaining()];
data.get(bytes);
assertEquals(new String(bytes, UTF_8), "XXXX");
out.println("First data received:" + data);
assertEquals(data.position(), data.limit()); // since bytes read
//assertNotEquals(data.limit(), data.capacity());
assertEquals(data.capacity(), 1024 - 9 /*frame header*/);
count++;
}
};
FramesDecoder decoder = new FramesDecoder(testFrameProcessor);
out.println("Sending " + combined + " to decoder: ");
decoder.decode(combined);
Assert.assertEquals(testFrameProcessor.numberOfFramesDecoded(), 1);
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, 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
@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 8044445 * @bug 8044445 8194307
* @summary test new methods from JEP-229: Create PKCS12 Keystores by Default * @summary test new methods from JEP-229: Create PKCS12 Keystores by Default
*/ */
@ -37,9 +37,26 @@ import javax.security.auth.callback.*;
public class ProbeKeystores { public class ProbeKeystores {
private static final char[] PASSWORD = "changeit".toCharArray(); private static final char[] PASSWORD = "changeit".toCharArray();
private static final char[] BAD_PASSWORD = "badpasword".toCharArray(); private static final char[] BAD_PASSWORD = "badpasword".toCharArray();
private static final LoadStoreParameter LOAD_STORE_PARAM =
new MyLoadStoreParameter(new PasswordProtection(PASSWORD));
private static final LoadStoreParameter BAD_LOAD_STORE_PARAM =
new MyLoadStoreParameter(new PasswordProtection(BAD_PASSWORD));
private static final String DIR = System.getProperty("test.src", "."); private static final String DIR = System.getProperty("test.src", ".");
private static final String CERT_FILE = "trusted.pem"; private static final String CERT_FILE = "trusted.pem";
private static class MyLoadStoreParameter implements LoadStoreParameter {
private ProtectionParameter protection;
MyLoadStoreParameter(ProtectionParameter protection) {
this.protection = protection;
}
public ProtectionParameter getProtectionParameter() {
return protection;
}
}
public static final void main(String[] args) throws Exception { public static final void main(String[] args) throws Exception {
// Testing empty keystores // Testing empty keystores
@ -173,6 +190,23 @@ public class ProbeKeystores {
} catch (IOException e) { } catch (IOException e) {
System.out.println("Failed to load a " + type + " keystore named '" + file + "' (as expected)"); System.out.println("Failed to load a " + type + " keystore named '" + file + "' (as expected)");
} }
// Now try with the correct password within a LoadStoreParameter
ks = KeyStore.getInstance(new File(file), LOAD_STORE_PARAM);
if (!type.equalsIgnoreCase(ks.getType())) {
throw new Exception("ERROR: expected a " + type + " keystore, " +
"got a " + ks.getType() + " keystore instead");
} else {
System.out.println("Probed a " + type + " keystore named '" + file + "'");
}
// Next try with an incorrect password within a LoadStoreParameter
try {
ks = KeyStore.getInstance(new File(file), BAD_LOAD_STORE_PARAM);
throw new Exception("ERROR: expected an exception but got success");
} catch (IOException e) {
System.out.println("Failed to load a " + type + " keystore named '" + file + "' (as expected)");
}
} }
// Instantiate a keystore by probing the supplied file for the keystore type // Instantiate a keystore by probing the supplied file for the keystore type

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2016, 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
@ -194,7 +194,7 @@ class ZoneName {
"Pacific/Rarotonga", "Cook", "Pacific/Rarotonga", "Pacific/Rarotonga", "Cook", "Pacific/Rarotonga",
"America/Louisville", "America_Eastern", "America/New_York", "America/Louisville", "America_Eastern", "America/New_York",
"Africa/El_Aaiun", "Europe_Western", "Atlantic/Canary", "Africa/El_Aaiun", "Europe_Western", "Atlantic/Canary",
"Africa/Sao_Tome", "GMT", "Atlantic/Reykjavik", "Africa/Sao_Tome", "Africa_Western", "Africa/Lagos",
"Pacific/Fiji", "Fiji", "Pacific/Fiji", "Pacific/Fiji", "Fiji", "Pacific/Fiji",
"Asia/Damascus", "Europe_Eastern", "Europe/Bucharest", "Asia/Damascus", "Europe_Eastern", "Europe/Bucharest",
"Asia/Ulaanbaatar", "Mongolia", "Asia/Ulaanbaatar", "Asia/Ulaanbaatar", "Mongolia", "Asia/Ulaanbaatar",
@ -508,6 +508,7 @@ class ZoneName {
"Africa_Central", "CD", "Africa/Lubumbashi", "Africa_Central", "CD", "Africa/Lubumbashi",
"Africa_Central", "BI", "Africa/Bujumbura", "Africa_Central", "BI", "Africa/Bujumbura",
"Africa_Central", "RW", "Africa/Kigali", "Africa_Central", "RW", "Africa/Kigali",
"Africa_Western", "ST", "Africa/Sao_Tome",
"Africa_Western", "CF", "Africa/Bangui", "Africa_Western", "CF", "Africa/Bangui",
"Africa_Western", "AO", "Africa/Luanda", "Africa_Western", "AO", "Africa/Luanda",
"Africa_Western", "NE", "Africa/Niamey", "Africa_Western", "NE", "Africa/Niamey",
@ -549,7 +550,6 @@ class ZoneName {
"GMT", "GN", "Africa/Conakry", "GMT", "GN", "Africa/Conakry",
"GMT", "SL", "Africa/Freetown", "GMT", "SL", "Africa/Freetown",
"GMT", "BF", "Africa/Ouagadougou", "GMT", "BF", "Africa/Ouagadougou",
"GMT", "ST", "Africa/Sao_Tome",
"GMT", "SN", "Africa/Dakar", "GMT", "SN", "Africa/Dakar",
"GMT", "CI", "Africa/Abidjan", "GMT", "CI", "Africa/Abidjan",
"GMT", "IE", "Europe/Dublin", "GMT", "IE", "Europe/Dublin",

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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 -

View File

@ -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

View File

@ -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

View File

@ -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.
# #

View File

@ -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

View File

@ -124,18 +124,21 @@ public class JImageExtractTest extends JImageCliTest {
public void testExtractToDirBySymlink() throws IOException { public void testExtractToDirBySymlink() throws IOException {
Path tmp = Files.createTempDirectory(Paths.get("."), getClass().getName()); Path tmp = Files.createTempDirectory(Paths.get("."), getClass().getName());
Path symlink;
try { try {
Path symlink = Files.createSymbolicLink(Paths.get(".", "symlink"), tmp); symlink = Files.createSymbolicLink(Paths.get(".", "symlink"), tmp);
} catch (IOException|UnsupportedOperationException e) {
// symlinks are not supported
// nothing to test
return;
}
jimage("extract", "--dir", symlink.toString(), getImagePath()) jimage("extract", "--dir", symlink.toString(), getImagePath())
.assertSuccess() .assertSuccess()
.resultChecker(r -> { .resultChecker(r -> {
assertTrue(r.output.isEmpty(), "Output is not expected"); assertTrue(r.output.isEmpty(), "Output is not expected");
}); });
verifyExplodedImage(tmp); verifyExplodedImage(tmp);
} catch (UnsupportedOperationException e) {
// symlinks are not supported
// nothing to test
}
} }
public void testExtractToReadOnlyDir() throws IOException { public void testExtractToReadOnlyDir() throws IOException {

View File

@ -104,7 +104,7 @@ public class JmodTest {
Path link = Files.createSymbolicLink( Path link = Files.createSymbolicLink(
libDir.resolve("baz"), libDir.resolve("foo").toAbsolutePath()); libDir.resolve("baz"), libDir.resolve("foo").toAbsolutePath());
assertTrue(Files.exists(link)); assertTrue(Files.exists(link));
} catch (UnsupportedOperationException uoe) { } catch (IOException|UnsupportedOperationException uoe) {
// OS does not support symlinks. Nothing to test! // OS does not support symlinks. Nothing to test!
return; return;
} }