This commit is contained in:
Lana Steuck 2010-03-18 18:52:10 -07:00
commit 7268d4595b
119 changed files with 3213 additions and 410 deletions

View File

@ -59,3 +59,4 @@ dcc938ac40cc45f1ef454d76020b5db5d943001c jdk7-b81
a30062be6d9ca1d48579826f870f85974300004e jdk7-b82
34c8199936a1682aa8587857f44cfaf37c2b6381 jdk7-b83
b1e55627a6980b9508854ed0c0f21d4f981b4494 jdk7-b84
b6f633a93ae0ec4555ff4bf756f5e2150c9bdede jdk7-b85

View File

@ -59,3 +59,4 @@ a3242906c7747b5d9bcc3d118c7c3c69aa40f4b7 jdk7-b80
e1176f86805fe07fd9fb9da065dc51b47712ce76 jdk7-b82
6880a3af9addb41541e80ebe8cde6f79ec402a58 jdk7-b83
2f3ea057d1ad56cf3b269cdc4de2741411151982 jdk7-b84
cf26288a114be67c39f2758959ce50b60f5ae330 jdk7-b85

View File

@ -59,3 +59,4 @@ e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81
1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82
fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
68c8961a82e4a3ad2a67991e5d834192a81eb4cd jdk7-b84
c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85

View File

@ -81,3 +81,5 @@ ac59d4e6dae51ac5fc31a9a4940d1857f91161b1 hs16-b08
fafab5d5349c7c066d677538db67a1ee0fb33bd2 hs15-b05
3f370a32906eb5ba993fabd7b4279be7f31052b9 jdk7-b83
ffc8d176b84bcfb5ac21302b4feb3b0c0d69b97c jdk7-b84
6c9796468b91dcbb39e09dfa1baf9779ac45eb66 jdk7-b85
418bc80ce13995149eadc9eecbba21d7a9fa02ae hs17-b10

View File

@ -59,3 +59,4 @@ b1005c504358c18694c84e95fec16b28cdce7ae1 jdk7-b79
c876ad22e4bf9d3c6460080db7ace478e29a3ff9 jdk7-b82
309a0a7fc6ceb1c9fc3a85b3608e97ef8f7b0dfd jdk7-b83
32c0cf01d555747918529a6ff9e06b0090c7a474 jdk7-b84
6c0ccabb430dacdcd4479f8b197980d5da4eeb66 jdk7-b85

View File

@ -59,3 +59,4 @@ f051045fe94a48fae1097f90cbd9227e6aae6b7e jdk7-b81
31573ae8eed15a6c170f3f0d1abd0b9109c0e086 jdk7-b82
371e3ded591d09112a9f231e37cb072781c486ac jdk7-b83
8bc02839eee4ef02cd1b50e87638874368a26535 jdk7-b84
8424512588ff95362c1f1e5f11c6efd4e7f7db6e jdk7-b85

View File

@ -59,3 +59,4 @@ e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77
69ef657320ad5c35cfa12e4d8322d877e778f8b3 jdk7-b82
9027c6b9d7e2c9ca04a1add691b5b50d0f22b1aa jdk7-b83
7cb9388bb1a16365fa5118c5efa38b1cd58be40d jdk7-b84
b396584a3e64988839cca21ea1f7fbdcc9248783 jdk7-b85

View File

@ -21,4 +21,4 @@
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
tzdata2009r
tzdata2010b

View File

@ -128,7 +128,7 @@ Zone Antarctica/Casey 0 - zzz 1969
Zone Antarctica/Davis 0 - zzz 1957 Jan 13
7:00 - DAVT 1964 Nov # Davis Time
0 - zzz 1969 Feb
7:00 - DAVT 2009 Oct 18 2:0
7:00 - DAVT 2009 Oct 18 2:00
5:00 - DAVT
Zone Antarctica/Mawson 0 - zzz 1954 Feb 13
6:00 - MAWT 2009 Oct 18 2:00

View File

@ -218,6 +218,41 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # Al Manamah
# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
# </a>
# From Alexander Krivenyshev (2009-12-24):
# According to Bangladesh newspaper "The Daily Star,"
# Bangladesh will change its clock back to Standard Time on Dec 31, 2009.
#
# Clock goes back 1-hr on Dec 31 night.
# <a href="http://www.thedailystar.net/newDesign/news-details.php?nid=119228">
# http://www.thedailystar.net/newDesign/news-details.php?nid=119228
# </a>
# and
# <a href="http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html">
# http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html
# </a>
#
# "...The government yesterday decided to put the clock back by one hour
# on December 31 midnight and the new time will continue until March 31,
# 2010 midnight. The decision came at a cabinet meeting at the Prime
# Minister's Office last night..."
# From Danvin Ruangchan (2009-12-24):
# ...the news mentions DST will be turned off again 7 months after March
# 31st on Oct 31, 2010.
# From Arthur David Olson (2009-12-26):
# Indeed, "The government will advance again the Banglasdesh Standard
# Time by one one hour on March 31 next year by enforcing the Daylight
# Saving Time (DST) for seven months. It will continue till October 31
# until further notice." I take that last sentence as the
# establishment of a rule.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Dhaka 2009 only - Jun 19 23:00 1:00 S
Rule Dhaka 2010 only - Jan 1 0:00 0 -
Rule Dhaka 2010 max - Mar 31 23:00 1:00 S
Rule Dhaka 2010 max - Nov 1 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Dhaka 6:01:40 - LMT 1890
5:53:20 - HMT 1941 Oct # Howrah Mean Time?
@ -225,8 +260,8 @@ Zone Asia/Dhaka 6:01:40 - LMT 1890
5:30 - IST 1942 Sep
6:30 - BURT 1951 Sep 30
6:00 - DACT 1971 Mar 26 # Dacca Time
6:00 - BDT 2009 Jun 19 23:00 # Bangladesh Time
6:00 1:00 BDST
6:00 - BDT 2009
6:00 Dhaka BD%sT
# Bhutan
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -385,6 +420,69 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # or Urumchi
# West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
# Zhaosu, Tekesi, Gongliu, Chabuchaer, Huocheng, Bole, Pishan, Suiding,
# and Yarkand.
# From Luther Ma (2009-10-17):
# Almost all (>99.9%) ethnic Chinese (properly ethnic Han) living in
# Xinjiang use Chinese Standard Time. Some are aware of Xinjiang time,
# but have no need of it. All planes, trains, and schools function on
# what is called "Beijing time." When Han make an appointment in Chinese
# they implicitly use Beijing time.
#
# On the other hand, ethnic Uyghurs, who make up about half the
# population of Xinjiang, typically use "Xinjiang time" which is two
# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
# Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
# local governments such as the Urumqi city government use both times in
# publications, referring to what is popularly called Xinjiang time as
# "Urumqi time." When Uyghurs make an appointment in the Uyghur language
# they almost invariably use Xinjiang time.
#
# (Their ethnic Han compatriots would typically have no clue of its
# widespread use, however, because so extremely few of them are fluent in
# Uyghur, comparable to the number of Anglo-Americans fluent in Navajo.)
#
# (...As with the rest of China there was a brief interval ending in 1990
# or 1991 when summer time was in use. The confusion was severe, with
# the province not having dual times but four times in use at the same
# time. Some areas remained on standard Xinjiang time or Beijing time and
# others moving their clocks ahead.)
#
# ...an example of an official website using of Urumqi time.
#
# The first few lines of the Google translation of
# <a href="http://www.fjysgl.gov.cn/show.aspx?id=2379&cid=39">
# http://www.fjysgl.gov.cn/show.aspx?id=2379&cid=39
# </a>
# (retrieved 2009-10-13)
# > Urumqi fire seven people are missing the alleged losses of at least
# > 500 million yuan
# >
# > (Reporter Dong Liu) the day before 20:20 or so (Urumqi Time 18:20),
# > Urumqi City Department of International Plaza Luther Qiantang River
# > burst fire. As of yesterday, 18:30, Urumqi City Fire officers and men
# > have worked continuously for 22 hours...
# From Luther Ma (2009-11-19):
# With the risk of being redundant to previous answers these are the most common
# English "transliterations" (w/o using non-English symbols):
#
# 1. Wulumuqi...
# 2. Kashi...
# 3. Urumqi...
# 4. Kashgar...
# ...
# 5. It seems that Uyghurs in Urumqi has been using Xinjiang since at least the
# 1960's. I know of one Han, now over 50, who grew up in the surrounding
# countryside and used Xinjiang time as a child.
#
# 6. Likewise for Kashgar and the rest of south Xinjiang I don't know of any
# start date for Xinjiang time.
#
# Without having access to local historical records, nor the ability to legally
# publish them, I would go with October 1, 1949, when Xinjiang became the Uyghur
# Autonomous Region under the PRC. (Before that Uyghurs, of course, would also
# not be using Beijing time, but some local time.)
Zone Asia/Kashgar 5:03:56 - LMT 1928 # or Kashi or Kaxgar
5:30 - KAST 1940 # Kashgar Time
5:00 - KAST 1980 May
@ -392,8 +490,8 @@ Zone Asia/Kashgar 5:03:56 - LMT 1928 # or Kashi or Kaxgar
# From Lee Yiu Chung (2009-10-24):
# I found there are some mistakes for the historial DST rule for Hong
# Kong. Accoring to the DST record from Hong Kong Observatory (actually,
# I found there are some mistakes for the...DST rule for Hong
# Kong. [According] to the DST record from Hong Kong Observatory (actually,
# it is not [an] observatory, but the official meteorological agency of HK,
# and also serves as the official timing agency), there are some missing
# and incorrect rules. Although the exact switch over time is missing, I

View File

@ -270,9 +270,30 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
6:30 - CCT # Cocos Islands Time
# Fiji
# From Alexander Krivenyshev (2009-11-10):
# According to Fiji Broadcasting Corporation, Fiji plans to re-introduce DST
# from November 29th 2009 to April 25th 2010.
#
# "Daylight savings to commence this month"
# <a href="http://www.radiofiji.com.fj/fullstory.php?id=23719">
# http://www.radiofiji.com.fj/fullstory.php?id=23719
# </a>
# or
# <a href="http://www.worldtimezone.com/dst_news/dst_news_fiji01.html">
# http://www.worldtimezone.com/dst_news/dst_news_fiji01.html
# </a>
# From Steffen Thorsen (2009-11-10):
# The Fiji Government has posted some more details about the approved
# amendments:
# <a href="http://www.fiji.gov.fj/publish/page_16198.shtml">
# http://www.fiji.gov.fj/publish/page_16198.shtml
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
Rule Fiji 1999 2000 - Feb lastSun 3:00 0 -
Rule Fiji 2009 only - Nov 29 2:00 1:00 S
Rule Fiji 2010 only - Apr 25 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:53:40 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time

View File

@ -2152,12 +2152,20 @@ Zone Asia/Irkutsk 6:57:20 - LMT 1880
# From Oscar van Vlijmen (2003-10-18): [This region consists of]
# Aginskij Buryatskij avtonomnyj okrug, Amurskaya oblast',
# [parts of] Respublika Sakha (Yakutiya), Chitinskaya oblast'.
# From Oscar van Vlijmen (2009-11-29):
# ...some regions of RUssia were merged with others since 2005...
# Some names were changed, no big deal, except for one instance: a new name.
# YAK/YAKST: UTC+9 Zabajkal'skij kraj.
# From Oscar van Vlijmen (2009-11-29):
# The Sakha districts are: Aldanskij, Amginskij, Anabarskij,
# Bulunskij, Verkhnekolymskij, Verkhnevilyujskij, Vilyujskij, Gornyj,
# Verkhnevilyujskij, Vilyujskij, Gornyj,
# Zhiganskij, Kobyajskij, Lenskij, Megino-Kangalasskij, Mirninskij,
# Namskij, Nyurbinskij, Olenekskij, Olekminskij, Srednekolymskij,
# Namskij, Nyurbinskij, Olenyokskij, Olyokminskij,
# Suntarskij, Tattinskij, Ust'-Aldanskij, Khangalasskij,
# Churapchinskij, Eveno-Bytantajskij.
# Churapchinskij, Eveno-Bytantajskij Natsional'nij.
Zone Asia/Yakutsk 8:38:40 - LMT 1919 Dec 15
8:00 - YAKT 1930 Jun 21 # Yakutsk Time
9:00 Russia YAK%sT 1991 Mar 31 2:00s
@ -2167,7 +2175,9 @@ Zone Asia/Yakutsk 8:38:40 - LMT 1919 Dec 15
# From Oscar van Vlijmen (2003-10-18): [This region consists of]
# Evrejskaya avtonomnaya oblast', Khabarovskij kraj, Primorskij kraj,
# [parts of] Respublika Sakha (Yakutiya).
# The Sakha districts are: Verkhoyanskij, Tomponskij, Ust'-Majskij,
# From Oscar van Vlijmen (2009-11-29):
# The Sakha districts are: Bulunskij, Verkhoyanskij, Tomponskij, Ust'-Majskij,
# Ust'-Yanskij.
Zone Asia/Vladivostok 8:47:44 - LMT 1922 Nov 15
9:00 - VLAT 1930 Jun 21 # Vladivostok Time
@ -2188,8 +2198,10 @@ Zone Asia/Sakhalin 9:30:48 - LMT 1905 Aug 23
# From Oscar van Vlijmen (2003-10-18): [This region consists of]
# Magadanskaya oblast', Respublika Sakha (Yakutiya).
# Probably also: Kuril Islands.
# The Sakha districts are: Abyjskij, Allaikhovskij, Momskij,
# Nizhnekolymskij, Ojmyakonskij.
# From Oscar van Vlijmen (2009-11-29):
# The Sakha districts are: Abyjskij, Allaikhovskij, Verkhhhnekolymskij, Momskij,
# Nizhnekolymskij, Ojmyakonskij, Srednekolymskij.
Zone Asia/Magadan 10:03:12 - LMT 1924 May 2
10:00 - MAGT 1930 Jun 21 # Magadan Time
11:00 Russia MAG%sT 1991 Mar 31 2:00s

View File

@ -1977,6 +1977,58 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20
# http://www.conae.gob.mx/ahorro/horaver2001_m1_2002.html (2002-02-20)
# confirms this. Sonora as usual is the only state where DST is not applied.
# From Steffen Thorsen (2009-12-28):
#
# Steffen Thorsen wrote:
# > Mexico's House of Representatives has approved a proposal for northern
# > Mexico's border cities to share the same daylight saving schedule as
# > the United States.
# Now this has passed both the Congress and the Senate, so starting from
# 2010, some border regions will be the same:
# <a href="http://www.signonsandiego.com/news/2009/dec/28/clocks-will-match-both-sides-border/">
# http://www.signonsandiego.com/news/2009/dec/28/clocks-will-match-both-sides-border/
# </a>
# <a href="http://www.elmananarey.com/diario/noticia/nacional/noticias/empatan_horario_de_frontera_con_eu/621939">
# http://www.elmananarey.com/diario/noticia/nacional/noticias/empatan_horario_de_frontera_con_eu/621939
# </a>
# (Spanish)
#
# Could not find the new law text, but the proposed law text changes are here:
# <a href="http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/20091210-V.pdf">
# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/20091210-V.pdf
# </a>
# (Gaceta Parlamentaria)
#
# There is also a list of the votes here:
# <a href="http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html">
# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html
# </a>
#
# Our page:
# <a href="http://www.timeanddate.com/news/time/north-mexico-dst-change.html">
# http://www.timeanddate.com/news/time/north-mexico-dst-change.html
# </a>
# From Arthur David Olson (2010-01-20):
# The page
# <a href="http://dof.gob.mx/nota_detalle.php?codigo=5127480&fecha=06/01/2010">
# http://dof.gob.mx/nota_detalle.php?codigo=5127480&fecha=06/01/2010
# </a>
# includes this text:
# En los municipios fronterizos de Tijuana y Mexicali en Baja California;
# Ju&aacute;rez y Ojinaga en Chihuahua; Acu&ntilde;a y Piedras Negras en Coahuila;
# An&aacute;huac en Nuevo Le&oacute;n; y Nuevo Laredo, Reynosa y Matamoros en
# Tamaulipas, la aplicaci&oacute;n de este horario estacional surtir&aacute; efecto
# desde las dos horas del segundo domingo de marzo y concluir&aacute; a las dos
# horas del primer domingo de noviembre.
# En los municipios fronterizos que se encuentren ubicados en la franja
# fronteriza norte en el territorio comprendido entre la l&iacute;nea
# internacional y la l&iacute;nea paralela ubicada a una distancia de veinte
# kil&oacute;metros, as&iacute; como la Ciudad de Ensenada, Baja California, hacia el
# interior del pa&iacute;s, la aplicaci&oacute;n de este horario estacional surtir&aacute;
# efecto desde las dos horas del segundo domingo de marzo y concluir&aacute; a
# las dos horas del primer domingo de noviembre.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Mexico 1939 only - Feb 5 0:00 1:00 D
Rule Mexico 1939 only - Jun 25 0:00 0 S
@ -2003,13 +2055,19 @@ Zone America/Merida -5:58:28 - LMT 1922 Jan 1 0:01:32
-6:00 - CST 1981 Dec 23
-5:00 - EST 1982 Dec 2
-6:00 Mexico C%sT
# Coahuila, Durango, Nuevo Leon, Tamaulipas
# Coahuila, Durango, Nuevo Leon, Tamaulipas (near US border)
Zone America/Matamoros -6:40:00 - LMT 1921 Dec 31 23:20:00
-6:00 - CST 1988
-6:00 US C%sT 1989
-6:00 Mexico C%sT 2010
-6:00 US C%sT
# Coahuila, Durango, Nuevo Leon, Tamaulipas (away from US border)
Zone America/Monterrey -6:41:16 - LMT 1921 Dec 31 23:18:44
-6:00 - CST 1988
-6:00 US C%sT 1989
-6:00 Mexico C%sT
# Central Mexico
Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 0:23:24
Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 0:23:24
-7:00 - MST 1927 Jun 10 23:00
-6:00 - CST 1930 Nov 15
-7:00 - MST 1931 May 1 23:00
@ -2018,7 +2076,19 @@ Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 0:23:24
-6:00 Mexico C%sT 2001 Sep 30 02:00
-6:00 - CST 2002 Feb 20
-6:00 Mexico C%sT
# Chihuahua
# Chihuahua (near US border)
Zone America/Ojinaga -6:57:40 - LMT 1922 Jan 1 0:02:20
-7:00 - MST 1927 Jun 10 23:00
-6:00 - CST 1930 Nov 15
-7:00 - MST 1931 May 1 23:00
-6:00 - CST 1931 Oct
-7:00 - MST 1932 Apr 1
-6:00 - CST 1996
-6:00 Mexico C%sT 1998
-6:00 - CST 1998 Apr Sun>=1 3:00
-7:00 Mexico M%sT 2010
-7:00 US M%sT
# Chihuahua (away from US border)
Zone America/Chihuahua -7:04:20 - LMT 1921 Dec 31 23:55:40
-7:00 - MST 1927 Jun 10 23:00
-6:00 - CST 1930 Nov 15
@ -2052,8 +2122,28 @@ Zone America/Mazatlan -7:05:40 - LMT 1921 Dec 31 23:54:20
-7:00 - MST 1949 Jan 14
-8:00 - PST 1970
-7:00 Mexico M%sT
# Baja California
# Baja California (near US border)
Zone America/Tijuana -7:48:04 - LMT 1922 Jan 1 0:11:56
-7:00 - MST 1924
-8:00 - PST 1927 Jun 10 23:00
-7:00 - MST 1930 Nov 15
-8:00 - PST 1931 Apr 1
-8:00 1:00 PDT 1931 Sep 30
-8:00 - PST 1942 Apr 24
-8:00 1:00 PWT 1945 Aug 14 23:00u
-8:00 1:00 PPT 1945 Nov 12 # Peace
-8:00 - PST 1948 Apr 5
-8:00 1:00 PDT 1949 Jan 14
-8:00 - PST 1954
-8:00 CA P%sT 1961
-8:00 - PST 1976
-8:00 US P%sT 1996
-8:00 Mexico P%sT 2001
-8:00 US P%sT 2002 Feb 20
-8:00 Mexico P%sT 2010
-8:00 US P%sT
# Baja California (away from US border)
Zone America/Santa_Isabel -7:39:28 - LMT 1922 Jan 1 0:20:32
-7:00 - MST 1924
-8:00 - PST 1927 Jun 10 23:00
-7:00 - MST 1930 Nov 15

View File

@ -301,11 +301,14 @@ MW -1547+03500 Africa/Blantyre
MX +1924-09909 America/Mexico_City Central Time - most locations
MX +2105-08646 America/Cancun Central Time - Quintana Roo
MX +2058-08937 America/Merida Central Time - Campeche, Yucatan
MX +2540-10019 America/Monterrey Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas
MX +2540-10019 America/Monterrey Mexican Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas away from US border
MX +2550-09730 America/Matamoros US Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas near US border
MX +2313-10625 America/Mazatlan Mountain Time - S Baja, Nayarit, Sinaloa
MX +2838-10605 America/Chihuahua Mountain Time - Chihuahua
MX +2838-10605 America/Chihuahua Mexican Mountain Time - Chihuahua away from US border
MX +2934-10425 America/Ojinaga US Mountain Time - Chihuahua near US border
MX +2904-11058 America/Hermosillo Mountain Standard Time - Sonora
MX +3232-11701 America/Tijuana Pacific Time
MX +3232-11701 America/Tijuana US Pacific Time - Baja California near US border
MX +3018-11452 America/Santa_Isabel Mexican Pacific Time - Baja California away from US border
MY +0310+10142 Asia/Kuala_Lumpur peninsular Malaysia
MY +0133+11020 Asia/Kuching Sabah & Sarawak
MZ -2558+03235 Africa/Maputo

View File

@ -614,14 +614,15 @@ public final class AlphaComposite implements Composite {
}
private AlphaComposite(int rule, float alpha) {
if (alpha < 0.0f || alpha > 1.0f) {
throw new IllegalArgumentException("alpha value out of range");
}
if (rule < MIN_RULE || rule > MAX_RULE) {
throw new IllegalArgumentException("unknown composite rule");
}
this.rule = rule;
this.extraAlpha = alpha;
if (alpha >= 0.0f && alpha <= 1.0f) {
this.rule = rule;
this.extraAlpha = alpha;
} else {
throw new IllegalArgumentException("alpha value out of range");
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -101,4 +101,9 @@ public class BeanDescriptor extends FeatureDescriptor {
beanClassRef = old.beanClassRef;
customizerClassRef = old.customizerClassRef;
}
void appendTo(StringBuilder sb) {
appendTo(sb, "beanClass", this.beanClassRef);
appendTo(sb, "customizerClass", this.customizerClassRef);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -26,7 +26,6 @@
package java.beans;
import java.lang.ref.Reference;
import java.lang.reflect.Method;
/**
@ -357,8 +356,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
* @return The method used to register a listener at the event source.
*/
public synchronized Method getAddListenerMethod() {
return (addMethodDescriptor != null ?
addMethodDescriptor.getMethod() : null);
return getMethod(this.addMethodDescriptor);
}
private synchronized void setAddListenerMethod(Method method) {
@ -378,8 +376,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
* @return The method used to remove a listener at the event source.
*/
public synchronized Method getRemoveListenerMethod() {
return (removeMethodDescriptor != null ?
removeMethodDescriptor.getMethod() : null);
return getMethod(this.removeMethodDescriptor);
}
private synchronized void setRemoveListenerMethod(Method method) {
@ -401,8 +398,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
* @since 1.4
*/
public synchronized Method getGetListenerMethod() {
return (getMethodDescriptor != null ?
getMethodDescriptor.getMethod() : null);
return getMethod(this.getMethodDescriptor);
}
private synchronized void setGetListenerMethod(Method method) {
@ -522,4 +518,19 @@ public class EventSetDescriptor extends FeatureDescriptor {
unicast = old.unicast;
inDefaultEventSet = old.inDefaultEventSet;
}
void appendTo(StringBuilder sb) {
appendTo(sb, "unicast", this.unicast);
appendTo(sb, "inDefaultEventSet", this.inDefaultEventSet);
appendTo(sb, "listenerType", this.listenerTypeRef);
appendTo(sb, "getListenerMethod", getMethod(this.getMethodDescriptor));
appendTo(sb, "addListenerMethod", getMethod(this.addMethodDescriptor));
appendTo(sb, "removeListenerMethod", getMethod(this.removeMethodDescriptor));
}
private static Method getMethod(MethodDescriptor descriptor) {
return (descriptor != null)
? descriptor.getMethod()
: null;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -35,6 +35,7 @@ import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Map.Entry;
/**
* The FeatureDescriptor class is the common baseclass for PropertyDescriptor,
@ -393,4 +394,52 @@ public class FeatureDescriptor {
private String name;
private String displayName;
private Hashtable<String, Object> table;
/**
* Returns a string representation of the object.
*
* @return a string representation of the object
*
* @since 1.7
*/
public String toString() {
StringBuilder sb = new StringBuilder(getClass().getName());
sb.append("[name=").append(this.name);
appendTo(sb, "displayName", this.displayName);
appendTo(sb, "shortDescription", this.shortDescription);
appendTo(sb, "preferred", this.preferred);
appendTo(sb, "hidden", this.hidden);
appendTo(sb, "expert", this.expert);
if ((this.table != null) && !this.table.isEmpty()) {
sb.append("; values={");
for (Entry<String, Object> entry : this.table.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("; ");
}
sb.setLength(sb.length() - 2);
sb.append("}");
}
appendTo(sb);
return sb.append("]").toString();
}
void appendTo(StringBuilder sb) {
}
static void appendTo(StringBuilder sb, String name, Reference reference) {
if (reference != null) {
appendTo(sb, name, reference.get());
}
}
static void appendTo(StringBuilder sb, String name, Object value) {
if (value != null) {
sb.append("; ").append(name).append("=").append(value);
}
}
static void appendTo(StringBuilder sb, String name, boolean value) {
if (value) {
sb.append("; ").append(name);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-2010 Sun Microsystems, 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
@ -62,7 +62,6 @@ public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
this.index = index;
}
/**
* Gets the index of the property that was changed.
*
@ -72,4 +71,8 @@ public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
public int getIndex() {
return index;
}
void appendTo(StringBuilder sb) {
sb.append("; index=").append(getIndex());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -26,7 +26,6 @@
package java.beans;
import java.lang.ref.Reference;
import java.lang.reflect.Method;
/**
@ -117,8 +116,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
* This constructor takes the name of a simple property, and Method
* objects for reading and writing the property.
*
* @param propertyName The programmatic name of the pro
perty.
* @param propertyName The programmatic name of the property.
* @param readMethod The method used for reading the property values as an array.
* May be null if the property is write-only or must be indexed.
* @param writeMethod The method used for writing the property values as an array.
@ -518,20 +516,10 @@ perty.
return result;
}
/*
public String toString() {
String message = super.toString();
message += ", indexedType=";
message += getIndexedPropertyType();
message += ", indexedWriteMethod=";
message += indexedWriteMethodName;
message += ", indexedReadMethod=";
message += indexedReadMethodName;
return message;
void appendTo(StringBuilder sb) {
super.appendTo(sb);
appendTo(sb, "indexedPropertyType", this.indexedPropertyTypeRef);
appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef);
appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef);
}
*/
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -27,9 +27,7 @@ package java.beans;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.List;
import java.util.ArrayList;
@ -166,23 +164,6 @@ public class MethodDescriptor extends FeatureDescriptor {
return parameterDescriptors;
}
/*
public String toString() {
String message = "name=" + getName();
Class cls = getClass0();
if (cls != null) {
message += ", class=";
message += cls.getName();
}
String[] names = getParamNames();
if (names != null) {
for (int i = 0; i < names.length; i++) {
message += ", param=" + names[i];
}
}
return message;
} */
/*
* Package-private constructor
* Merge two method descriptors. Where they conflict, give the
@ -233,4 +214,15 @@ public class MethodDescriptor extends FeatureDescriptor {
}
}
void appendTo(StringBuilder sb) {
appendTo(sb, "method", this.methodRef);
if (this.parameterDescriptors != null) {
sb.append("; parameterDescriptors={");
for (ParameterDescriptor pd : this.parameterDescriptors) {
sb.append(pd).append(", ");
}
sb.setLength(sb.length() - 2);
sb.append("}");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -140,4 +140,25 @@ public class PropertyChangeEvent extends java.util.EventObject {
* @see #getPropagationId
*/
private Object propagationId;
/**
* Returns a string representation of the object.
*
* @return a string representation of the object
*
* @since 1.7
*/
public String toString() {
StringBuilder sb = new StringBuilder(getClass().getName());
sb.append("[propertyName=").append(getPropertyName());
appendTo(sb);
sb.append("; oldValue=").append(getOldValue());
sb.append("; newValue=").append(getNewValue());
sb.append("; propagationId=").append(getPropagationId());
sb.append("; source=").append(getSource());
return sb.append("]").toString();
}
void appendTo(StringBuilder sb) {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-2010 Sun Microsystems, 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
@ -26,7 +26,6 @@
package java.beans;
import java.lang.ref.Reference;
import java.lang.reflect.Method;
import java.lang.reflect.Constructor;
@ -710,22 +709,12 @@ public class PropertyDescriptor extends FeatureDescriptor {
return baseName;
}
/*
public String toString() {
String message = "name=" + getName();
message += ", class=" + getClass0();
message += ", type=" + getPropertyType();
message += ", writeMethod=";
message += writeMethodName;
message += ", readMethod=";
message += readMethodName;
message += ", bound=" + bound;
message += ", constrained=" + constrained;
return message;
void appendTo(StringBuilder sb) {
appendTo(sb, "bound", this.bound);
appendTo(sb, "constrained", this.constrained);
appendTo(sb, "propertyEditorClass", this.propertyEditorClassRef);
appendTo(sb, "propertyType", this.propertyTypeRef);
appendTo(sb, "readMethod", this.readMethodRef);
appendTo(sb, "writeMethod", this.writeMethodRef);
}
*/
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-2010 Sun Microsystems, 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
@ -214,8 +214,8 @@ public class XMLEncoder extends Encoder {
private Object owner;
private int indentation = 0;
private boolean internal = false;
private Map valueToExpression;
private Map targetToStatementList;
private Map<Object, ValueData> valueToExpression;
private Map<Object, List<Statement>> targetToStatementList;
private boolean preambleWritten = false;
private NameGenerator nameGenerator;
@ -287,8 +287,8 @@ public class XMLEncoder extends Encoder {
this.declaration = declaration;
this.indentation = indentation;
this.out = new OutputStreamWriter(out, cs.newEncoder());
valueToExpression = new IdentityHashMap();
targetToStatementList = new IdentityHashMap();
valueToExpression = new IdentityHashMap<Object, ValueData>();
targetToStatementList = new IdentityHashMap<Object, List<Statement>>();
nameGenerator = new NameGenerator();
}
@ -331,13 +331,12 @@ public class XMLEncoder extends Encoder {
}
}
private Vector statementList(Object target) {
Vector list = (Vector)targetToStatementList.get(target);
if (list != null) {
return list;
private List<Statement> statementList(Object target) {
List<Statement> list = targetToStatementList.get(target);
if (list == null) {
list = new ArrayList<Statement>();
targetToStatementList.put(target, list);
}
list = new Vector();
targetToStatementList.put(target, list);
return list;
}
@ -363,13 +362,13 @@ public class XMLEncoder extends Encoder {
}
d.marked = true;
Object target = exp.getTarget();
mark(exp);
if (!(target instanceof Class)) {
statementList(target).add(exp);
// Pending: Why does the reference count need to
// be incremented here?
d.refs++;
}
mark(exp);
}
private void mark(Statement stm) {
@ -463,9 +462,9 @@ public class XMLEncoder extends Encoder {
preambleWritten = true;
}
indentation++;
Vector roots = statementList(this);
for(int i = 0; i < roots.size(); i++) {
Statement s = (Statement)roots.get(i);
List<Statement> statements = statementList(this);
while (!statements.isEmpty()) {
Statement s = statements.remove(0);
if ("writeObject".equals(s.getMethodName())) {
outputValue(s.getArguments()[0], this, true);
}
@ -513,7 +512,7 @@ public class XMLEncoder extends Encoder {
}
private ValueData getValueData(Object o) {
ValueData d = (ValueData)valueToExpression.get(o);
ValueData d = valueToExpression.get(o);
if (d == null) {
d = new ValueData();
valueToExpression.put(o, d);
@ -619,11 +618,11 @@ public class XMLEncoder extends Encoder {
}
if (d.name != null) {
writeln("<object idref=" + quote(d.name) + "/>");
return;
outputXML(isArgument ? "object" : "void", " idref=" + quote(d.name), value);
}
else if (d.exp != null) {
outputStatement(d.exp, outer, isArgument);
}
outputStatement(d.exp, outer, isArgument);
}
private static String quoteCharCode(int code) {
@ -683,13 +682,6 @@ public class XMLEncoder extends Encoder {
String tag = (expression && isArgument) ? "object" : "void";
String attributes = "";
ValueData d = getValueData(value);
if (expression) {
if (d.refs > 1) {
String instanceName = nameGenerator.instanceName(value);
d.name = instanceName;
attributes = attributes + " id=" + quote(instanceName);
}
}
// Special cases for targets.
if (target == outer) {
@ -706,13 +698,19 @@ public class XMLEncoder extends Encoder {
else {
d.refs = 2;
getValueData(target).refs++;
outputValue(target, outer, false);
if (isArgument) {
outputValue(value, outer, false);
List<Statement> statements = statementList(target);
if (!statements.contains(exp)) {
statements.add(exp);
}
outputValue(target, outer, false);
outputValue(value, outer, isArgument);
return;
}
if (expression && (d.refs > 1)) {
String instanceName = nameGenerator.instanceName(value);
d.name = instanceName;
attributes = attributes + " id=" + quote(instanceName);
}
// Special cases for methods.
if ((!expression && methodName.equals("set") && args.length == 2 &&
@ -730,8 +728,11 @@ public class XMLEncoder extends Encoder {
else if (!methodName.equals("new") && !methodName.equals("newInstance")) {
attributes = attributes + " method=" + quote(methodName);
}
outputXML(tag, attributes, value, args);
}
Vector statements = statementList(value);
private void outputXML(String tag, String attributes, Object value, Object... args) {
List<Statement> statements = statementList(value);
// Use XML's short form when there is no body.
if (args.length == 0 && statements.size() == 0) {
writeln("<" + tag + attributes + "/>");
@ -745,8 +746,8 @@ public class XMLEncoder extends Encoder {
outputValue(args[i], null, true);
}
for(int i = 0; i < statements.size(); i++) {
Statement s = (Statement)statements.get(i);
while (!statements.isEmpty()) {
Statement s = statements.remove(0);
outputStatement(s, value, false);
}

View File

@ -2506,10 +2506,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
Color old = this.selectionForeground;
this.selectionForeground = selectionForeground;
firePropertyChange("selectionForeground", old, selectionForeground);
if ( !selectionForeground.equals(old) )
{
repaint();
}
repaint();
}
/**
@ -2547,10 +2544,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
Color old = this.selectionBackground;
this.selectionBackground = selectionBackground;
firePropertyChange("selectionBackground", old, selectionBackground);
if ( !selectionBackground.equals(old) )
{
repaint();
}
repaint();
}
/**

View File

@ -169,15 +169,13 @@ public class BasicSliderUI extends SliderUI{
+ c + " when it only knows about "
+ slider + ".");
LookAndFeel.uninstallBorder(slider);
scrollTimer.stop();
scrollTimer = null;
uninstallDefaults(slider);
uninstallListeners( slider );
uninstallKeyboardActions(slider);
focusInsets = null;
insetCache = null;
leftToRightCache = true;
focusRect = null;
@ -210,6 +208,12 @@ public class BasicSliderUI extends SliderUI{
if (focusInsets == null) focusInsets = new InsetsUIResource(2,2,2,2);
}
protected void uninstallDefaults(JSlider slider) {
LookAndFeel.uninstallBorder(slider);
focusInsets = null;
}
protected TrackListener createTrackListener(JSlider slider) {
return new TrackListener();
}
@ -1571,20 +1575,8 @@ public class BasicSliderUI extends SliderUI{
offset = 0;
scrollTimer.stop();
// This is the way we have to determine snap-to-ticks. It's
// hard to explain but since ChangeEvents don't give us any
// idea what has changed we don't have a way to stop the thumb
// bounds from being recalculated. Recalculating the thumb
// bounds moves the thumb over the current value (i.e., snapping
// to the ticks).
if (slider.getSnapToTicks() /*|| slider.getSnapToValue()*/ ) {
isDragging = false;
slider.setValueIsAdjusting(false);
}
else {
slider.setValueIsAdjusting(false);
isDragging = false;
}
isDragging = false;
slider.setValueIsAdjusting(false);
slider.repaint();
}

View File

@ -62,6 +62,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI
(scrollbar.getLayout() instanceof UIResource)) {
scrollbar.setLayout(this);
}
configureScrollBarColors();
updateStyle(scrollbar);
}

View File

@ -43,7 +43,7 @@ import sun.swing.SwingUtilities2;
/**
* Provides the Synth L&F UI delegate for
* {@link javax.swing.JSlider}.
* {@link JSlider}.
*
* @author Joshua Outwater
* @since 1.7
@ -65,7 +65,7 @@ public class SynthSliderUI extends BasicSliderUI
* the slider has not changed sizes since being last layed out. If necessary
* we recompute the layout.
*/
private Dimension lastSize = null;
private Dimension lastSize;
private int trackHeight;
private int trackBorder;
@ -109,7 +109,7 @@ public class SynthSliderUI extends BasicSliderUI
* Uninstalls default setting. This method is called when a
* {@code LookAndFeel} is uninstalled.
*/
protected void uninstallDefaults() {
protected void uninstallDefaults(JSlider slider) {
SynthContext context = getContext(slider, ENABLED);
style.uninstallDefaults(context);
context.dispose();
@ -339,6 +339,7 @@ public class SynthSliderUI extends BasicSliderUI
*/
@Override
protected void calculateGeometry() {
calculateThumbSize();
layout();
calculateThumbLocation();
}
@ -350,10 +351,6 @@ public class SynthSliderUI extends BasicSliderUI
SynthContext context = getContext(slider);
SynthGraphicsUtils synthGraphics = style.getGraphicsUtils(context);
// Set the thumb size.
Dimension size = getThumbSize();
thumbRect.setSize(size.width, size.height);
// Get the insets for the track.
Insets trackInsets = new Insets(0, 0, 0, 0);
SynthContext trackContext = getContext(slider, Region.SLIDER_TRACK);
@ -553,39 +550,6 @@ public class SynthSliderUI extends BasicSliderUI
}
}
/**
* @inheritDoc
*/
@Override
protected void calculateTickRect() {
if (slider.getOrientation() == JSlider.HORIZONTAL) {
tickRect.x = trackRect.x;
tickRect.y = trackRect.y + trackRect.height + 2 + getTickLength();
tickRect.width = trackRect.width;
tickRect.height = getTickLength();
if (!slider.getPaintTicks()) {
--tickRect.y;
tickRect.height = 0;
}
} else {
if (SynthLookAndFeel.isLeftToRight(slider)) {
tickRect.x = trackRect.x + trackRect.width;
tickRect.width = getTickLength();
} else {
tickRect.width = getTickLength();
tickRect.x = trackRect.x - tickRect.width;
}
tickRect.y = trackRect.y;
tickRect.height = trackRect.height;
if (!slider.getPaintTicks()) {
--tickRect.x;
tickRect.width = 0;
}
}
}
/**
* @inheritDoc
*/
@ -865,13 +829,17 @@ public class SynthSliderUI extends BasicSliderUI
valueRect.y, -1);
}
SynthContext subcontext = getContext(slider, Region.SLIDER_TRACK);
paintTrack(subcontext, g, trackRect);
subcontext.dispose();
if (slider.getPaintTrack() && clip.intersects(trackRect)) {
SynthContext subcontext = getContext(slider, Region.SLIDER_TRACK);
paintTrack(subcontext, g, trackRect);
subcontext.dispose();
}
subcontext = getContext(slider, Region.SLIDER_THUMB);
paintThumb(subcontext, g, thumbRect);
subcontext.dispose();
if (clip.intersects(thumbRect)) {
SynthContext subcontext = getContext(slider, Region.SLIDER_THUMB);
paintThumb(subcontext, g, thumbRect);
subcontext.dispose();
}
if (slider.getPaintTicks() && clip.intersects(tickRect)) {
paintTicks(g);

View File

@ -45,8 +45,7 @@ import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicTableUI;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
@ -158,7 +157,7 @@ public class SynthTableUI extends BasicTableUI
if (gridColor == null) {
gridColor = style.getColor(context, ColorType.FOREGROUND);
}
table.setGridColor(gridColor);
table.setGridColor(gridColor == null ? new ColorUIResource(Color.GRAY) : gridColor);
}
useTableColors = style.getBoolean(context,

View File

@ -248,23 +248,26 @@ public class SynthToolBarUI extends BasicToolBarUI
toolBar.getOrientation());
}
// Overloaded to do nothing so we can share listeners.
/**
* @inheritDoc
* This implementation does nothing, because the {@code rollover}
* property of the {@code JToolBar} class is not used
* in the Synth Look and Feel.
*/
@Override
protected void setBorderToNonRollover(Component c) {}
// Overloaded to do nothing so we can share listeners.
/**
* @inheritDoc
* This implementation does nothing, because the {@code rollover}
* property of the {@code JToolBar} class is not used
* in the Synth Look and Feel.
*/
@Override
protected void setBorderToRollover(Component c) {}
// Overloaded to do nothing so we can share listeners.
/**
* @inheritDoc
* This implementation does nothing, because the {@code rollover}
* property of the {@code JToolBar} class is not used
* in the Synth Look and Feel.
*/
@Override
protected void setBorderToNormal(Component c) {}

View File

@ -173,13 +173,20 @@ public class SynthViewportUI extends ViewportUI
}
/**
* @inheritDoc
* Paints the border. The method is never called,
* because the {@code JViewport} class does not support a border.
* This implementation does nothing.
*
* @param context a component context
* @param g the {@code Graphics} to paint on
* @param x the X coordinate
* @param y the Y coordinate
* @param w width of the border
* @param h height of the border
*/
@Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
// This does nothing on purpose, JViewport doesn't allow a border
// and therefor this will NEVER be called.
}
/**

View File

@ -1461,13 +1461,17 @@ public class DefaultEditorKit extends EditorKit {
// Make sure the new visible location contains
// the location of dot, otherwise Caret will
// cause an additional scroll.
adjustScrollIfNecessary(target, newVis, initialY,
newIndex);
if (select) {
target.moveCaretPosition(newIndex);
}
else {
target.setCaretPosition(newIndex);
int newY = getAdjustedY(target, newVis, newIndex);
if (direction == -1 && newY <= initialY || direction == 1 && newY >= initialY) {
// Change index and correct newVis.y only if won't cause scrolling upward
newVis.y = newY;
if (select) {
target.moveCaretPosition(newIndex);
} else {
target.setCaretPosition(newIndex);
}
}
}
} catch (BadLocationException ble) { }
@ -1513,34 +1517,27 @@ public class DefaultEditorKit extends EditorKit {
}
/**
* Adjusts the rectangle that indicates the location to scroll to
* Returns adjustsed {@code y} position that indicates the location to scroll to
* after selecting <code>index</code>.
*/
private void adjustScrollIfNecessary(JTextComponent text,
Rectangle visible, int initialY,
int index) {
private int getAdjustedY(JTextComponent text, Rectangle visible, int index) {
int result = visible.y;
try {
Rectangle dotBounds = text.modelToView(index);
if (dotBounds.y < visible.y ||
(dotBounds.y > (visible.y + visible.height)) ||
(dotBounds.y + dotBounds.height) >
(visible.y + visible.height)) {
int y;
if (dotBounds.y < visible.y) {
y = dotBounds.y;
}
else {
y = dotBounds.y + dotBounds.height - visible.height;
}
if ((direction == -1 && y < initialY) ||
(direction == 1 && y > initialY)) {
// Only adjust if won't cause scrolling upward.
visible.y = y;
if (dotBounds.y < visible.y) {
result = dotBounds.y;
} else {
if ((dotBounds.y > visible.y + visible.height) ||
(dotBounds.y + dotBounds.height > visible.y + visible.height)) {
result = dotBounds.y + dotBounds.height - visible.height;
}
}
} catch (BadLocationException ble) {}
} catch (BadLocationException ble) {
}
return result;
}
/**

View File

@ -3058,7 +3058,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return;
}
/* Use lock specific to the font system */
synchronized (lucidaFontName) {
synchronized (this) {
if (FontUtilities.debugFonts()) {
Thread.dumpStack();
FontUtilities.getLogger()
@ -3194,7 +3194,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return;
}
/* Use lock specific to the font system */
synchronized (lucidaFontName) {
synchronized (this) {
if (FontUtilities.debugFonts()) {
Thread.dumpStack();
FontUtilities.getLogger().info("loadAllFontFiles() called");

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"Suriname Time", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"Suriname Zeit", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_de extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"Hora de Surinam", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_es extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"Heure du Surinam", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_fr extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"Ora di Suriname", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_it extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"\u30b9\u30ea\u30ca\u30e0\u6642\u9593", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_ja extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"\uc218\ub9ac\ub0a8 \uc2dc\uac04", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_ko extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"Surinam, normaltid", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_sv extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"\u82cf\u5229\u5357\u65f6\u95f4", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_zh_CN extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -384,6 +384,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"America/Manaus", AMT},
{"America/Marigot", AST},
{"America/Martinique", AST},
{"America/Matamoros", CST},
{"America/Mazatlan", MST},
{"America/Mendoza", AGT},
{"America/Menominee", CST},
@ -403,6 +404,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"America/Noronha", NORONHA},
{"America/North_Dakota/Center", CST},
{"America/North_Dakota/New_Salem", CST},
{"America/Ojinaga", MST},
{"America/Panama", EST},
{"America/Pangnirtung", EST},
{"America/Paramaribo", new String[] {"\u8607\u5229\u5357\u6642\u9593", "SRT",
@ -419,6 +421,7 @@ public final class TimeZoneNames_zh_TW extends TimeZoneNamesBundle {
{"America/Resolute", RST},
{"America/Rio_Branco", AMT},
{"America/Rosario", AGT},
{"America/Santa_Isabel", PST},
{"America/Santarem", BRT},
{"America/Santiago", CLT},
{"America/Santo_Domingo", AST},

View File

@ -0,0 +1,22 @@
/*
* @test
* @bug 6918065
* @summary Test for passing NaN as alpha
* should throw IllegalArgumentException
*/
import java.awt.*;
public class TestAlphaCompositeForNaN {
public static void main(String[] args) {
try {
AlphaComposite a = AlphaComposite.getInstance(AlphaComposite.DST, Float.NaN);
System.out.println("Failed");
throw new RuntimeException(a + " failed to throw IllegalArgumentException for alpha = " + Float.NaN);
}
catch (IllegalArgumentException ie) {
System.out.println("Passed");
System.out.println("Caught " + ie);
}
}
}

View File

@ -0,0 +1,188 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4498236
* @summary Tests toString methods
* @author Sergey Malenkov
*/
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.beans.BeanDescriptor;
import java.beans.EventSetDescriptor;
import java.beans.FeatureDescriptor;
import java.beans.IndexedPropertyChangeEvent;
import java.beans.IndexedPropertyDescriptor;
import java.beans.MethodDescriptor;
import java.beans.ParameterDescriptor;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
public class Test4498236 {
public static void main(String[] args) throws Exception {
PropertyChangeEvent event = new PropertyChangeEvent("source", null, null, null);
event.setPropagationId("id");
test("[propertyName=null; oldValue=null; newValue=null; propagationId=id; source=source]", event);
test("[propertyName=name; oldValue=old; newValue=new; propagationId=null; source=source]",
new PropertyChangeEvent("source", "name", "old", "new")
);
test("[propertyName=array; index=5; oldValue=old; newValue=new; propagationId=null; source=source]",
new IndexedPropertyChangeEvent("source", "array", "old", "new", 5)
);
FeatureDescriptor fd = new FeatureDescriptor();
fd.setName("n");
fd.setDisplayName("dn");
fd.setShortDescription("sd");
fd.setPreferred(true);
fd.setHidden(true);
fd.setExpert(true);
fd.setValue("first", "value");
test("[name=n; displayName=dn; shortDescription=sd; preferred; hidden; expert; values={first=value}]", fd);
test("[name=String; beanClass=class java.lang.String]",
new BeanDescriptor(String.class)
);
test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
new BeanDescriptor(Object.class, String.class)
);
test("[name=Object; beanClass=class java.lang.Object; customizerClass=class java.lang.String]",
new BeanDescriptor(Object.class, String.class)
);
test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object)]",
new MethodDescriptor(Object.class.getMethod("equals", Object.class))
);
test("[name=equals; method=public boolean java.lang.Object.equals(java.lang.Object); parameterDescriptors={java.beans.ParameterDescriptor[name=null]}]",
new MethodDescriptor(Object.class.getMethod("equals", Object.class), new ParameterDescriptor[] {
new ParameterDescriptor()
})
);
Class type = KeyListener.class;
String[] names = { "keyTyped", "keyPressed", "keyReleased" };
Method[] methods = new Method[names.length];
for (int i = 0; i < names.length; i++) {
methods[i] = type.getMethod(names[i], KeyEvent.class);
}
test("[name=key; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.getKeyListeners(); addListenerMethod=public void Test4498236.addKeyListener(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.removeKeyListener(java.awt.event.KeyListener)]",
new EventSetDescriptor(Test4498236.class, "key", type, names[0])
);
test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove")
);
test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
new EventSetDescriptor(Test4498236.class, "$$$", type, names, "add", "remove", "get")
);
test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type))
);
test("[name=$$$; inDefaultEventSet; listenerType=interface java.awt.event.KeyListener; getListenerMethod=public java.awt.event.KeyListener Test4498236.get(); addListenerMethod=public void Test4498236.add(java.awt.event.KeyListener); removeListenerMethod=public void Test4498236.remove(java.awt.event.KeyListener)]",
new EventSetDescriptor("$$$", type, methods, Test4498236.class.getMethod("add", type), Test4498236.class.getMethod("remove", type), Test4498236.class.getMethod("get"))
);
test("[name=value; propertyType=boolean; readMethod=public boolean Test4498236.isValue(); writeMethod=public void Test4498236.setValue(boolean)]",
new PropertyDescriptor("value", Test4498236.class)
);
test("[name=$$$]",
new PropertyDescriptor("$$$", Test4498236.class, null, null)
);
test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
new PropertyDescriptor("$$$", Test4498236.class, "getValue", null)
);
test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
new PropertyDescriptor("$$$", Test4498236.class, "getValue", "setValue")
);
test("[name=$$$]",
new PropertyDescriptor("$$$", null, null)
);
test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue()]",
new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), null)
);
test("[name=$$$; propertyType=boolean; readMethod=public boolean Test4498236.getValue(); writeMethod=public void Test4498236.setValue(boolean)]",
new PropertyDescriptor("$$$", Test4498236.class.getMethod("getValue"), Test4498236.class.getMethod("setValue", boolean.class))
);
test("[name=index; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
new IndexedPropertyDescriptor("index", Test4498236.class)
);
test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
new IndexedPropertyDescriptor("$$$", Test4498236.class, "getIndex", "setIndex", "getIndex", "setIndex")
);
test("[name=$$$; propertyType=class [I; readMethod=public int[] Test4498236.getIndex(); writeMethod=public void Test4498236.setIndex(int[]); indexedPropertyType=int; indexedReadMethod=public int Test4498236.getIndex(int); indexedWriteMethod=public void Test4498236.setIndex(int,int)]",
new IndexedPropertyDescriptor("$$$", Test4498236.class.getMethod("getIndex"), Test4498236.class.getMethod("setIndex", new int[0].getClass()), Test4498236.class.getMethod("getIndex", int.class), Test4498236.class.getMethod("setIndex", int.class, int.class) )
);
}
public void addKeyListener(KeyListener listener) {
add(listener);
}
public void removeKeyListener(KeyListener listener) {
remove(listener);
}
public KeyListener getKeyListeners() {
return null;
}
public void add(KeyListener listener) {
}
public void remove(KeyListener listener) {
}
public KeyListener get() {
return null;
}
public boolean isValue() {
return true;
}
public boolean getValue() {
return true;
}
public void setValue(boolean value) {
}
public int[] getIndex() {
return null;
}
public int getIndex(int index) {
return 0;
}
public void setIndex(int index, int value) {
}
public void setIndex(int[] value) {
}
private static void test(String expected, Object object) {
String actual = object.toString();
if (!actual.equals(object.getClass().getName() + expected)) {
throw new Error(actual);
}
}
}

View File

@ -0,0 +1,122 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 5023550
* @summary Tests complex references to owner
* @author Sergey Malenkov
*/
import java.beans.DefaultPersistenceDelegate;
import java.beans.Encoder;
import java.beans.Expression;
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
public class Test5023550 extends AbstractTest {
public static void main(String[] args) {
new Test5023550().test(true);
}
private final Owner owner = new Owner();
@Override
protected void initialize(XMLEncoder encoder) {
encoder.setOwner(this.owner);
encoder.setPersistenceDelegate(A.class, new ADelegate());
encoder.setPersistenceDelegate(B.class, new BDelegate());
encoder.setPersistenceDelegate(C.class, new CDelegate());
}
@Override
protected void initialize(XMLDecoder decoder) {
decoder.setOwner(this.owner);
}
protected Object getObject() {
return this.owner.newA(this.owner.newB().newC());
}
public static class Owner {
public A newA(C c) {
return new A(c);
}
public B newB() {
return new B();
}
}
public static class A {
private final C c;
private A(C c) {
this.c = c;
}
public C getC() {
return this.c;
}
}
public static class B {
public C newC() {
return new C(this);
}
}
public static class C {
private final B b;
private C(B b) {
this.b = b;
}
public B getB() {
return this.b;
}
}
public static class ADelegate extends DefaultPersistenceDelegate {
protected Expression instantiate(Object old, Encoder out) {
XMLEncoder encoder = (XMLEncoder) out;
A a = (A) old;
return new Expression(old, encoder.getOwner(), "newA", new Object[] { a.getC() });
}
}
public static class BDelegate extends DefaultPersistenceDelegate {
protected Expression instantiate(Object old, Encoder out) {
XMLEncoder encoder = (XMLEncoder) out;
return new Expression(old, encoder.getOwner(), "newB", new Object[0]);
}
}
public static class CDelegate extends DefaultPersistenceDelegate {
protected Expression instantiate(Object old, Encoder out) {
C c = (C) old;
return new Expression(c, c.getB(), "newC", new Object[0]);
}
}
}

View File

@ -0,0 +1,99 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 5023557
* @summary Tests complex references
* @author Sergey Malenkov
*/
import java.beans.DefaultPersistenceDelegate;
import java.beans.Encoder;
import java.beans.Expression;
import java.beans.XMLEncoder;
public class Test5023557 extends AbstractTest {
public static void main(String[] args) {
new Test5023557().test(true);
}
@Override
protected void initialize(XMLEncoder encoder) {
encoder.setPersistenceDelegate(B.class, new BDelegate());
encoder.setPersistenceDelegate(C.class, new CDelegate());
}
protected Object getObject() {
A a = new A();
return a.newC(a.newB());
}
public static class A {
public B newB() {
return new B(this);
}
public C newC(B b) {
return new C(b);
}
}
public static class B {
private final A a;
private B(A a) {
this.a = a;
}
public A getA() {
return this.a;
}
}
public static class C {
private final B b;
private C(B b) {
this.b = b;
}
public B getB() {
return this.b;
}
}
public static class BDelegate extends DefaultPersistenceDelegate {
protected Expression instantiate(Object old, Encoder out) {
B b = (B) old;
return new Expression(b, b.getA(), "newB", new Object[0]);
}
}
public static class CDelegate extends DefaultPersistenceDelegate {
protected Expression instantiate(Object old, Encoder out) {
C c = (C) old;
return new Expression(c, c.getB().getA(), "newC", new Object[] { c.getB() });
}
}
}

View File

@ -0,0 +1,197 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6921644
* @summary Tests references to cached integer
* @author Sergey Malenkov
*/
import java.beans.ConstructorProperties;
import java.util.ArrayList;
import java.util.List;
public final class Test6921644 extends AbstractTest {
public static void main(String[] args) {
new Test6921644().test(true);
}
protected Object getObject() {
Owner<Author> o = new Owner<Author>(100); // it works if ID >= 128
Category c = new Category(o);
Document d1 = new Document(o);
Document d2 = new Document(o);
Document d3 = new Document(o);
Author a1 = new Author(o);
Author a2 = new Author(o);
Author a3 = new Author(o);
o.getList().add(a1);
o.getList().add(a2);
o.getList().add(a3);
a3.setRef(o.getId());
d2.setCategory(c);
d3.setCategory(c);
a1.addDocument(d1);
a1.addDocument(d2);
a3.addDocument(d3);
c.addDocument(d2);
c.addDocument(d3);
return o;
}
public static class Owner<T> {
private int id;
private List<T> list = new ArrayList<T>();
@ConstructorProperties("id")
public Owner(int id) {
this.id = id;
}
public int getId() {
return this.id;
}
public List<T> getList() {
return this.list;
}
public void setList(List<T> list) {
this.list = list;
}
}
public static class Author {
private int id;
private int ref;
private Owner owner;
private List<Document> list = new ArrayList<Document>();
@ConstructorProperties("owner")
public Author(Owner<Author> owner) {
this.owner = owner;
this.id = owner.getId();
}
public Owner getOwner() {
return this.owner;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getRef() {
return this.ref;
}
public void setRef(Integer ref) {
this.ref = ref;
}
public List<Document> getList() {
return this.list;
}
public void setList(List<Document> list) {
this.list = list;
}
public void addDocument(Document document) {
this.list.add(document);
document.setAuthor(this);
}
}
public static class Category {
private Owner owner;
private List<Document> list = new ArrayList<Document>();
@ConstructorProperties("owner")
public Category(Owner owner) {
this.owner = owner;
}
public Owner getOwner() {
return this.owner;
}
public List<Document> getList() {
return this.list;
}
public void setList(List<Document> list) {
this.list = list;
}
public void addDocument(Document document) {
this.list.add(document);
document.setCategory(this);
}
}
public static class Document {
private Owner owner;
private Author author;
private Category category;
@ConstructorProperties("owner")
public Document(Owner owner) {
this.owner = owner;
}
public Owner getOwner() {
return this.owner;
}
public Author getAuthor() {
return this.author;
}
public void setAuthor(Author author) {
this.author = author;
}
public Category getCategory() {
return this.category;
}
public void setCategory(Category category) {
this.category = category;
}
}
}

View File

@ -0,0 +1,113 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6917744
* @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
* @author Pavel Porvatov
* @run main bug6917744
*/
import java.awt.*;
import java.awt.event.KeyEvent;
import java.io.IOException;
import javax.swing.*;
import sun.awt.SunToolkit;
public class bug6917744 {
private static JFrame frame;
private static JEditorPane editorPane;
private static JScrollPane scrollPane;
private static Robot robot;
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
robot = new Robot();
robot.setAutoDelay(100);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame = new JFrame();
editorPane = new JEditorPane();
try {
editorPane.setPage(bug6917744.class.getResource("/test.html"));
} catch (IOException e) {
throw new RuntimeException("HTML resource not found", e);
}
scrollPane = new JScrollPane(editorPane);
frame.getContentPane().add(scrollPane);
frame.setSize(400, 300);
frame.setVisible(true);
}
});
toolkit.realSync();
for (int i = 0; i < 50; i++) {
robot.keyPress(KeyEvent.VK_PAGE_DOWN);
}
toolkit.realSync();
// Check that we at the end of document
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
if (model.getValue() + model.getExtent() != model.getMaximum()) {
throw new RuntimeException("Invalid HTML position");
}
}
});
toolkit.realSync();
for (int i = 0; i < 50; i++) {
robot.keyPress(KeyEvent.VK_PAGE_UP);
}
toolkit.realSync();
// Check that we at the begin of document
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
if (model.getValue() != model.getMinimum()) {
throw new RuntimeException("Invalid HTML position");
}
frame.dispose();
}
});
}
}

View File

@ -0,0 +1,494 @@
<html>
<body bgcolor="#ffffff">
<table border="0">
<tr>
<td>&nbsp;</td>
<td valign="top">
<font size="+1" face="Arial, Helvetica, sans-serif">
<b>TEST FOR JScrollPane BUG</b> <br>
</font>
<font face="Arial, Helvetica, sans-serif" size="-1">
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
This is a test html file.
<br>
<font size="+1" face="Arial, Helvetica, sans-serif">
<b>END OF TEST FOR JScrollPane BUG</b> <br>
</font>
</font>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,56 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6924059
* @summary SynthScrollBarUI.configureScrollBarColors() should have spec different from the overridden method
* @author Pavel Porvatov
* @run main bug6924059
*/
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
import javax.swing.plaf.synth.SynthScrollBarUI;
public class bug6924059 {
private static boolean isMethodCalled;
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
new JScrollBar().setUI(new SynthScrollBarUI() {
protected void configureScrollBarColors() {
super.configureScrollBarColors();
isMethodCalled = true;
}
});
if (!isMethodCalled) {
throw new RuntimeException("The configureScrollBarColors was not called");
}
}
});
}
}

View File

@ -0,0 +1,126 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6848475
* @summary JSlider does not display the correct value of its BoundedRangeModel
* @author Pavel Porvatov
* @run main bug6848475
*/
import sun.awt.SunToolkit;
import javax.swing.*;
import javax.swing.plaf.SliderUI;
import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*;
import java.awt.event.InputEvent;
import java.lang.reflect.Field;
public class bug6848475 {
private static JFrame frame;
private static JSlider slider;
private static Robot robot;
private static int thumbRectX;
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
robot = new Robot();
robot.setAutoDelay(100);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame = new JFrame();
DefaultBoundedRangeModel sliderModel = new DefaultBoundedRangeModel() {
public void setValue(int n) {
// Don't allow value to be changed
}
};
slider = new JSlider(sliderModel);
frame.getContentPane().add(slider);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Point p = slider.getLocationOnScreen();
robot.mouseMove(p.x, p.y);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
thumbRectX = getThumbRectField().x;
Point p = slider.getLocationOnScreen();
robot.mouseMove(p.x, p.y);
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.mouseMove(p.x + 20, p.y);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Rectangle newThumbRect = getThumbRectField();
if (newThumbRect.x != thumbRectX) {
throw new RuntimeException("Test failed: the thumb was moved");
}
frame.dispose();
}
});
}
private static Rectangle getThumbRectField() {
try {
SliderUI ui = slider.getUI();
Field field = BasicSliderUI.class.getDeclaredField("thumbRect");
field.setAccessible(true);
return (Rectangle) field.get(ui);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,103 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6918861
* @summary SynthSliderUI.uninstallDefaults() is not called when UI is uninstalled
* @author Pavel Porvatov
* @run main bug6918861
*/
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
import javax.swing.plaf.synth.SynthSliderUI;
public class bug6918861 {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JSlider slider = new JSlider();
HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);
slider.setUI(ui);
if (ui.counter != 111) {
throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
}
slider.setUI(null);
if (ui.counter != 0) {
throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
}
}
});
}
private static class HackedSynthSliderUI extends SynthSliderUI {
private int counter;
protected HackedSynthSliderUI(JSlider c) {
super(c);
}
protected void installDefaults(JSlider slider) {
super.installDefaults(slider);
counter += 1;
}
protected void uninstallDefaults(JSlider slider) {
super.uninstallDefaults(slider);
counter -= 1;
}
protected void installListeners(JSlider slider) {
super.installListeners(slider);
counter += 10;
}
protected void uninstallListeners(JSlider slider) {
super.uninstallListeners(slider);
counter -= 10;
}
protected void installKeyboardActions(JSlider slider) {
super.installKeyboardActions(slider);
counter += 100;
}
protected void uninstallKeyboardActions(JSlider slider) {
super.uninstallKeyboardActions(slider);
counter -= 100;
}
}
}

View File

@ -0,0 +1,63 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6923305
* @summary SynthSliderUI paints the slider track when the slider's "paintTrack" property is set to false
* @author Pavel Porvatov
* @run main bug6923305
*/
import javax.swing.*;
import javax.swing.plaf.synth.SynthContext;
import javax.swing.plaf.synth.SynthLookAndFeel;
import javax.swing.plaf.synth.SynthSliderUI;
import java.awt.*;
import java.awt.image.BufferedImage;
public class bug6923305 {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JSlider slider = new JSlider();
slider.setUI(new SynthSliderUI(slider) {
@Override
protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
}
});
slider.setPaintTrack(false);
slider.setSize(slider.getPreferredSize());
BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
BufferedImage.TYPE_INT_ARGB);
slider.paint(bufferedImage.getGraphics());
}
});
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6913768
* @summary With default SynthLookAndFeel instance installed new JTable creation leads to throwing NPE
* @author Pavel Porvatov
* @run main bug6913768
*/
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
public class bug6913768 {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame();
JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}},
new Object[]{"col1", "col2"});
frame.getContentPane().add(new JScrollPane(table));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
}

View File

@ -59,3 +59,4 @@ cfabfcf9f110ef896cbdd382903d20eefbceefe0 jdk7-b81
47003a3622f6a17756ab0338bfa8a43e36549e99 jdk7-b82
c9f4ae1f1480e89aaf7e72173184089d9cea397a jdk7-b83
d9cd5b8286e44f3baf90da290cd295433e21c05a jdk7-b84
136bfc67946219fb02ee223984540a4a9c5b209f jdk7-b85

View File

@ -457,8 +457,10 @@ public class Apt extends ListBuffer<Env<AttrContext>> {
throw new UsageMessageNeededException();
try {
for(AnnotationProcessorFactory apFactory: factoryToAnnotation.keySet()) {
AnnotationProcessor processor = apFactory.getProcessorFor(factoryToAnnotation.get(apFactory),
for(Map.Entry<AnnotationProcessorFactory, Set<AnnotationTypeDeclaration>> entry :
factoryToAnnotation.entrySet()) {
AnnotationProcessorFactory apFactory = entry.getKey();
AnnotationProcessor processor = apFactory.getProcessorFor(entry.getValue(),
trivAPE);
if (processor != null)
processors.add(processor);

View File

@ -82,7 +82,7 @@ public class CommandLine {
st.commentChar('#');
st.quoteChar('"');
st.quoteChar('\'');
while (st.nextToken() != st.TT_EOF) {
while (st.nextToken() != StreamTokenizer.TT_EOF) {
args.append(st.sval);
}
r.close();

View File

@ -270,7 +270,7 @@ class AnnotationProxyMaker {
* The toString, hashCode, and equals methods foward to the underlying
* type.
*/
private static class MirroredTypeExceptionProxy extends ExceptionProxy {
private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
private static final long serialVersionUID = 6662035281599933545L;
private MirroredTypeException ex;
@ -312,7 +312,7 @@ class AnnotationProxyMaker {
* The toString, hashCode, and equals methods foward to the underlying
* types.
*/
private static class MirroredTypesExceptionProxy extends ExceptionProxy {
private static final class MirroredTypesExceptionProxy extends ExceptionProxy {
private static final long serialVersionUID = -6670822532616693951L;
private MirroredTypesException ex;

View File

@ -58,7 +58,7 @@ public abstract class DeclarationImpl implements Declaration {
protected final AptEnv env;
public final Symbol sym;
protected static DeclarationFilter identityFilter =
protected static final DeclarationFilter identityFilter =
new DeclarationFilter();

View File

@ -71,6 +71,6 @@ public abstract class TypeMirrorImpl implements TypeMirror {
* {@inheritDoc}
*/
public int hashCode() {
return env.jctypes.hashCode(type);
return Types.hashCode(type);
}
}

View File

@ -40,7 +40,7 @@ import java.util.Iterator;
*/
public class ConstantPool {
public class InvalidIndex extends ConstantPoolException {
public static class InvalidIndex extends ConstantPoolException {
private static final long serialVersionUID = -4350294289300939730L;
InvalidIndex(int index) {
super(index);
@ -53,7 +53,7 @@ public class ConstantPool {
}
}
public class UnexpectedEntry extends ConstantPoolException {
public static class UnexpectedEntry extends ConstantPoolException {
private static final long serialVersionUID = 6986335935377933211L;
UnexpectedEntry(int index, int expected_tag, int found_tag) {
super(index);
@ -71,7 +71,7 @@ public class ConstantPool {
public final int found_tag;
}
public class InvalidEntry extends ConstantPoolException {
public static class InvalidEntry extends ConstantPoolException {
private static final long serialVersionUID = 1000087545585204447L;
InvalidEntry(int index, int tag) {
super(index);
@ -87,7 +87,7 @@ public class ConstantPool {
public final int tag;
}
public class EntryNotFound extends ConstantPoolException {
public static class EntryNotFound extends ConstantPoolException {
private static final long serialVersionUID = 2885537606468581850L;
EntryNotFound(Object value) {
super(-1);
@ -694,7 +694,7 @@ public class ConstantPool {
public int byteLength() {
class SizeOutputStream extends OutputStream {
@Override
public void write(int b) throws IOException {
public void write(int b) {
size++;
}
int size;

View File

@ -31,23 +31,21 @@ import com.sun.tools.doclets.formats.html.*;
public class Standard {
public static final HtmlDoclet htmlDoclet = new HtmlDoclet();
public static int optionLength(String option) {
return htmlDoclet.optionLength(option);
return HtmlDoclet.optionLength(option);
}
public static boolean start(RootDoc root) {
return htmlDoclet.start(root);
return HtmlDoclet.start(root);
}
public static boolean validOptions(String[][] options,
DocErrorReporter reporter) {
return htmlDoclet.validOptions(options, reporter);
return HtmlDoclet.validOptions(options, reporter);
}
public static LanguageVersion languageVersion() {
return htmlDoclet.languageVersion();
return HtmlDoclet.languageVersion();
}
}

View File

@ -64,7 +64,7 @@ class Launcher {
fileChooser.setSelectedFile(new File(fileName));
}
}
if (fileChooser.showOpenDialog(null) == fileChooser.APPROVE_OPTION) {
if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
String fileName = fileChooser.getSelectedFile().getPath();
prefs.put("recent.file", fileName);
javac.run(System.in, null, null, "-d", "/tmp", fileName);

View File

@ -137,7 +137,7 @@ public final class JavacTool implements JavaCompiler {
}
private static boolean match(OptionKind clientKind, OptionKind optionKind) {
return (clientKind == (optionKind == OptionKind.HIDDEN ? optionKind.EXTENDED : optionKind));
return (clientKind == (optionKind == OptionKind.HIDDEN ? OptionKind.EXTENDED : optionKind));
}
public JavacFileManager getStandardFileManager(

View File

@ -198,7 +198,12 @@ public class Lint
/**
* Warn about Sun proprietary API that may be removed in a future release.
*/
SUNAPI("sunapi", true);
SUNAPI("sunapi", true),
/**
* Warn about issues relating to use of statics
*/
STATIC("static");
LintCategory(String option) {
this(option, false);

View File

@ -162,7 +162,7 @@ public abstract class Symbol implements Element {
* the default package; otherwise, the owner symbol is returned
*/
public Symbol location() {
if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK)) {
if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK && owner.kind != TYP)) {
return null;
}
return owner;

View File

@ -2504,7 +2504,7 @@ public class Types {
}
@Override
public int hashCode() {
return 127 * Types.this.hashCode(t1) + Types.this.hashCode(t2);
return 127 * Types.hashCode(t1) + Types.hashCode(t2);
}
@Override
public boolean equals(Object obj) {
@ -3375,7 +3375,7 @@ public class Types {
this.t = t;
}
public int hashCode() {
return Types.this.hashCode(t);
return Types.hashCode(t);
}
public boolean equals(Object obj) {
return (obj instanceof SingletonType) &&

View File

@ -2020,6 +2020,10 @@ public class Attr extends JCTree.Visitor {
tree.pos(), site, sym.name, true);
}
}
} else if (sym.kind != ERR && (sym.flags() & STATIC) != 0 && sym.name != names._class) {
// If the qualified item is not a type and the selected item is static, report
// a warning. Make allowance for the class of an array type e.g. Object[].class)
chk.warnStatic(tree, "static.not.qualified.by.type", Kinds.kindName(sym.kind), sym.owner);
}
// If we are selecting an instance member via a `super', ...
@ -2636,6 +2640,7 @@ public class Attr extends JCTree.Visitor {
if (tree.bounds.tail.nonEmpty()) {
log.error(tree.bounds.tail.head.pos(),
"type.var.may.not.be.followed.by.other.bounds");
log.unrecoverableError = true;
tree.bounds = List.of(tree.bounds.head);
a.bound = bs.head;
}

View File

@ -189,6 +189,11 @@ public class Check {
sunApiHandler.report(pos, msg, args);
}
public void warnStatic(DiagnosticPosition pos, String msg, Object... args) {
if (lint.isEnabled(LintCategory.STATIC))
log.warning(pos, msg, args);
}
/**
* Report any deferred diagnostics.
*/

View File

@ -270,6 +270,7 @@ public class Enter extends JCTree.Visitor {
return ts.toList();
}
@Override
public void visitTopLevel(JCCompilationUnit tree) {
JavaFileObject prev = log.useSource(tree.sourcefile);
boolean addEnv = false;
@ -289,13 +290,13 @@ public class Enter extends JCTree.Visitor {
tree.packge = syms.unnamedPackage;
}
tree.packge.complete(); // Find all classes in package.
Env<AttrContext> env = topLevelEnv(tree);
Env<AttrContext> topEnv = topLevelEnv(tree);
// Save environment of package-info.java file.
if (isPkgInfo) {
Env<AttrContext> env0 = typeEnvs.get(tree.packge);
if (env0 == null) {
typeEnvs.put(tree.packge, env);
typeEnvs.put(tree.packge, topEnv);
} else {
JCCompilationUnit tree0 = env0.toplevel;
if (!fileManager.isSameFile(tree.sourcefile, tree0.sourcefile)) {
@ -306,7 +307,7 @@ public class Enter extends JCTree.Visitor {
if (addEnv || (tree0.packageAnnotations.isEmpty() &&
tree.docComments != null &&
tree.docComments.get(tree) != null)) {
typeEnvs.put(tree.packge, env);
typeEnvs.put(tree.packge, topEnv);
}
}
}
@ -322,14 +323,15 @@ public class Enter extends JCTree.Visitor {
c.members_field = new Scope(c);
tree.packge.package_info = c;
}
classEnter(tree.defs, env);
classEnter(tree.defs, topEnv);
if (addEnv) {
todo.append(env);
todo.append(topEnv);
}
log.useSource(prev);
result = null;
}
@Override
public void visitClassDef(JCClassDecl tree) {
Symbol owner = env.info.scope.owner;
Scope enclScope = enterScope(env);
@ -435,6 +437,7 @@ public class Enter extends JCTree.Visitor {
* Enter a symbol for type parameter in local scope, after checking that it
* is unique.
*/
@Override
public void visitTypeParameter(JCTypeParameter tree) {
TypeVar a = (tree.type != null)
? (TypeVar)tree.type
@ -448,6 +451,7 @@ public class Enter extends JCTree.Visitor {
/** Default class enter visitor method: do nothing.
*/
@Override
public void visitTree(JCTree tree) {
result = null;
}
@ -489,10 +493,8 @@ public class Enter extends JCTree.Visitor {
for (JCCompilationUnit tree : trees) {
if (tree.starImportScope.elems == null) {
JavaFileObject prev = log.useSource(tree.sourcefile);
Env<AttrContext> env = typeEnvs.get(tree);
if (env == null)
env = topLevelEnv(tree);
memberEnter.memberEnter(tree, env);
Env<AttrContext> topEnv = topLevelEnv(tree);
memberEnter.memberEnter(tree, topEnv);
log.useSource(prev);
}
}

View File

@ -607,10 +607,12 @@ public class TransTypes extends TreeTranslator {
public void visitNewArray(JCNewArray tree) {
tree.elemtype = translate(tree.elemtype, null);
translate(tree.dims, syms.intType);
tree.elems = translate(tree.elems,
(tree.type == null) ? null
: erasure(types.elemtype(tree.type)));
tree.type = erasure(tree.type);
if (tree.type != null) {
tree.elems = translate(tree.elems, erasure(types.elemtype(tree.type)));
tree.type = erasure(tree.type);
} else {
tree.elems = translate(tree.elems, null);
}
result = tree;
}

View File

@ -260,7 +260,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
archive = openArchive(directory);
} catch (IOException ex) {
log.error("error.reading.file",
directory, ex.getLocalizedMessage());
directory, getMessage(ex));
return;
}
}
@ -489,7 +489,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
archive = new MissingArchive(zipFileName);
} catch (IOException ex) {
if (zipFileName.exists())
log.error("error.reading.file", zipFileName, ex.getLocalizedMessage());
log.error("error.reading.file", zipFileName, getMessage(ex));
archive = new MissingArchive(zipFileName);
}
@ -838,4 +838,23 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
}
throw new IllegalArgumentException("Invalid relative path: " + file);
}
/**
* Get a detail message from an IOException.
* Most, but not all, instances of IOException provide a non-null result
* for getLocalizedMessage(). But some instances return null: in these
* cases, fallover to getMessage(), and if even that is null, return the
* name of the exception itself.
* @param e an IOException
* @return a string to include in a compiler diagnostic
*/
public static String getMessage(IOException e) {
String s = e.getLocalizedMessage();
if (s != null)
return s;
s = e.getMessage();
if (s != null)
return s;
return e.toString();
}
}

View File

@ -320,7 +320,7 @@ public class Paths {
addFile(f, warn);
}
} catch (IOException e) {
log.error("error.reading.file", jarFile, e.getLocalizedMessage());
log.error("error.reading.file", jarFile, JavacFileManager.getMessage(e));
}
}
}

View File

@ -1135,7 +1135,7 @@ public class ClassReader implements Completer {
self.name = simpleBinaryName(self.flatname, c.flatname) ;
self.owner = m != null ? m : c;
if (self.name.isEmpty())
self.fullname = null;
self.fullname = names.empty;
else
self.fullname = ClassSymbol.formFullName(self.name, self.owner);

View File

@ -808,8 +808,8 @@ public class Gen extends JCTree.Visitor {
code.resolve(secondJumps);
CondItem second = genCond(tree.falsepart, CRT_FLOW_TARGET);
CondItem result = items.makeCondItem(second.opcode,
code.mergeChains(trueJumps, second.trueJumps),
code.mergeChains(falseJumps, second.falseJumps));
Code.mergeChains(trueJumps, second.trueJumps),
Code.mergeChains(falseJumps, second.falseJumps));
if (markBranches) result.tree = tree.falsepart;
return result;
} else {
@ -1322,7 +1322,7 @@ public class Gen extends JCTree.Visitor {
if (useJsrLocally) {
if (tree.finalizer != null) {
Code.State jsrState = code.state.dup();
jsrState.push(code.jsrReturnValue);
jsrState.push(Code.jsrReturnValue);
tryEnv.info.cont =
new Chain(code.emitJump(jsr),
tryEnv.info.cont,
@ -1375,7 +1375,7 @@ public class Gen extends JCTree.Visitor {
genFinalizer(env);
if (hasFinalizer || l.tail.nonEmpty()) {
code.statBegin(TreeInfo.endPos(env.tree));
exitChain = code.mergeChains(exitChain,
exitChain = Code.mergeChains(exitChain,
code.branch(goto_));
}
endFinalizerGap(env);
@ -1963,7 +1963,7 @@ public class Gen extends JCTree.Visitor {
result = items.
makeCondItem(rcond.opcode,
rcond.trueJumps,
code.mergeChains(falseJumps,
Code.mergeChains(falseJumps,
rcond.falseJumps));
} else {
result = lcond;
@ -1976,7 +1976,7 @@ public class Gen extends JCTree.Visitor {
CondItem rcond = genCond(tree.rhs, CRT_FLOW_TARGET);
result = items.
makeCondItem(rcond.opcode,
code.mergeChains(trueJumps, rcond.trueJumps),
Code.mergeChains(trueJumps, rcond.trueJumps),
rcond.falseJumps);
} else {
result = lcond;

View File

@ -792,25 +792,25 @@ public class Items {
}
Chain jumpTrue() {
if (tree == null) return code.mergeChains(trueJumps, code.branch(opcode));
if (tree == null) return Code.mergeChains(trueJumps, code.branch(opcode));
// we should proceed further in -Xjcov mode only
int startpc = code.curPc();
Chain c = code.mergeChains(trueJumps, code.branch(opcode));
Chain c = Code.mergeChains(trueJumps, code.branch(opcode));
code.crt.put(tree, CRTable.CRT_BRANCH_TRUE, startpc, code.curPc());
return c;
}
Chain jumpFalse() {
if (tree == null) return code.mergeChains(falseJumps, code.branch(code.negate(opcode)));
if (tree == null) return Code.mergeChains(falseJumps, code.branch(Code.negate(opcode)));
// we should proceed further in -Xjcov mode only
int startpc = code.curPc();
Chain c = code.mergeChains(falseJumps, code.branch(code.negate(opcode)));
Chain c = Code.mergeChains(falseJumps, code.branch(Code.negate(opcode)));
code.crt.put(tree, CRTable.CRT_BRANCH_FALSE, startpc, code.curPc());
return c;
}
CondItem negate() {
CondItem c = new CondItem(code.negate(opcode), falseJumps, trueJumps);
CondItem c = new CondItem(Code.negate(opcode), falseJumps, trueJumps);
c.tree = tree;
return c;
}

View File

@ -82,7 +82,7 @@ public class CommandLine {
st.commentChar('#');
st.quoteChar('"');
st.quoteChar('\'');
while (st.nextToken() != st.TT_EOF) {
while (st.nextToken() != StreamTokenizer.TT_EOF) {
args.append(st.sval);
}
r.close();

View File

@ -549,12 +549,6 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
return log.nwarnings;
}
/** Whether or not any parse errors have occurred.
*/
public boolean parseErrors() {
return parseErrors;
}
/** Try to open input stream with given name.
* Report an error if this fails.
* @param filename The file name of the input stream to be opened.
@ -564,7 +558,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
inputFiles.add(filename);
return filename.getCharContent(false);
} catch (IOException e) {
log.error("error.reading.file", filename, e.getLocalizedMessage());
log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
return null;
}
}
@ -588,7 +582,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
int initialErrorCount = log.nerrors;
Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
tree = parser.parseCompilationUnit();
parseErrors |= (log.nerrors > initialErrorCount);
log.unrecoverableError |= (log.nerrors > initialErrorCount);
if (verbose) {
printVerbose("parsing.done", Long.toString(elapsed(msec)));
}
@ -723,7 +717,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
try {
tree = parse(filename, filename.getCharContent(false));
} catch (IOException e) {
log.error("error.reading.file", filename, e);
log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
tree = make.TopLevel(List.<JCTree.JCAnnotation>nil(), null, List.<JCTree>nil());
} finally {
log.useSource(prev);
@ -768,9 +762,6 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
private long start_msec = 0;
public long elapsed_msec = 0;
/** Track whether any errors occurred while parsing source text. */
private boolean parseErrors = false;
public void compile(List<JavaFileObject> sourceFileObject)
throws Throwable {
compile(sourceFileObject, List.<String>nil(), null);
@ -1114,7 +1105,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
return env;
if (verboseCompilePolicy)
log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]");
Log.printLines(log.noticeWriter, "[attribute " + env.enclClass.sym + "]");
if (verbose)
printVerbose("checking.attribution", env.enclClass.sym);

View File

@ -26,6 +26,8 @@
package com.sun.tools.javac.model;
import com.sun.tools.javac.util.*;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.lang.annotation.*;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
@ -268,10 +270,10 @@ public class AnnotationProxyMaker {
* The toString, hashCode, and equals methods foward to the underlying
* type.
*/
private static class MirroredTypeExceptionProxy extends ExceptionProxy {
private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
static final long serialVersionUID = 269;
private transient final TypeMirror type;
private transient TypeMirror type;
private final String typeString;
MirroredTypeExceptionProxy(TypeMirror t) {
@ -296,6 +298,13 @@ public class AnnotationProxyMaker {
protected RuntimeException generateException() {
return new MirroredTypeException(type);
}
// Explicitly set all transient fields.
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
type = null;
}
}
@ -304,10 +313,10 @@ public class AnnotationProxyMaker {
* The toString, hashCode, and equals methods foward to the underlying
* types.
*/
private static class MirroredTypesExceptionProxy extends ExceptionProxy {
private static final class MirroredTypesExceptionProxy extends ExceptionProxy {
static final long serialVersionUID = 269;
private transient final List<TypeMirror> types;
private transient List<TypeMirror> types;
private final String typeStrings;
MirroredTypesExceptionProxy(List<TypeMirror> ts) {
@ -333,5 +342,12 @@ public class AnnotationProxyMaker {
protected RuntimeException generateException() {
return new MirroredTypesException(types);
}
// Explicitly set all transient fields.
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
types = null;
}
}
}

View File

@ -1561,7 +1561,10 @@ public class JavacParser implements Parser {
JCNewClass newClass = classCreatorRest(newpos, null, typeArgs, t);
if (newClass.def != null) {
assert newClass.def.mods.annotations.isEmpty();
newClass.def.mods.annotations = List.convert(JCAnnotation.class, newAnnotations);
if (newAnnotations.nonEmpty()) {
newClass.def.mods.pos = earlier(newClass.def.mods.pos, newAnnotations.head.pos);
newClass.def.mods.annotations = List.convert(JCAnnotation.class, newAnnotations);
}
}
return newClass;
} else {
@ -3016,6 +3019,18 @@ public class JavacParser implements Parser {
return (oc >= 0) ? TreeInfo.opPrec(oc) : -1;
}
/**
* Return the lesser of two positions, making allowance for either one
* being unset.
*/
static int earlier(int pos1, int pos2) {
if (pos1 == Position.NOPOS)
return pos2;
if (pos2 == Position.NOPOS)
return pos1;
return (pos1 < pos2 ? pos1 : pos2);
}
/** Return operation tag of binary operator represented by token,
* -1 if token is not a binary operator.
*/

View File

@ -690,10 +690,12 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
ProcessorState ps = psi.next();
Set<String> matchedNames = new HashSet<String>();
Set<TypeElement> typeElements = new LinkedHashSet<TypeElement>();
for (String unmatchedAnnotationName : unmatchedAnnotations.keySet()) {
for (Map.Entry<String, TypeElement> entry: unmatchedAnnotations.entrySet()) {
String unmatchedAnnotationName = entry.getKey();
if (ps.annotationSupported(unmatchedAnnotationName) ) {
matchedNames.add(unmatchedAnnotationName);
TypeElement te = unmatchedAnnotations.get(unmatchedAnnotationName);
TypeElement te = entry.getValue();
if (te != null)
typeElements.add(te);
}
@ -790,16 +792,13 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
List<JCCompilationUnit> roots,
List<ClassSymbol> classSymbols,
Iterable<? extends PackageSymbol> pckSymbols)
throws IOException {
throws IOException {
log = Log.instance(context);
// Writer for -XprintRounds and -XprintProcessorInfo data
PrintWriter xout = context.get(Log.outKey);
TaskListener taskListener = context.get(TaskListener.class);
AnnotationCollector collector = new AnnotationCollector();
JavaCompiler compiler = JavaCompiler.instance(context);
compiler.todo.clear(); // free the compiler's resources
@ -878,7 +877,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
roots = cleanTrees(roots).appendList(parsedFiles);
// Check for errors after parsing
if (compiler.parseErrors()) {
if (log.unrecoverableError) {
errorStatus = true;
break runAround;
} else {
@ -912,7 +911,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
roots = runLastRound(xout, roundNumber, errorStatus, compiler, roots, taskListener);
// Set error status for any files compiled and generated in
// the last round
if (compiler.parseErrors())
if (log.unrecoverableError)
errorStatus = true;
compiler.close(false);
@ -1218,45 +1217,6 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
return false;
}
private class AnnotationCollector extends TreeScanner {
List<JCTree> path = List.nil();
static final boolean verbose = false;
List<JCAnnotation> annotations = List.nil();
public List<JCAnnotation> findAnnotations(List<? extends JCTree> nodes) {
annotations = List.nil();
scan(nodes);
List<JCAnnotation> found = annotations;
annotations = List.nil();
return found.reverse();
}
public void scan(JCTree node) {
if (node == null)
return;
Symbol sym = TreeInfo.symbolFor(node);
if (sym != null)
path = path.prepend(node);
super.scan(node);
if (sym != null)
path = path.tail;
}
public void visitAnnotation(JCAnnotation node) {
annotations = annotations.prepend(node);
if (verbose) {
StringBuilder sb = new StringBuilder();
for (JCTree tree : path.reverse()) {
System.err.print(sb);
System.err.println(TreeInfo.symbolFor(tree));
sb.append(" ");
}
System.err.print(sb);
System.err.println(node);
}
}
}
private static <T extends JCTree> List<T> cleanTrees(List<T> nodes) {
for (T node : nodes)
treeCleaner.scan(node);

View File

@ -720,6 +720,9 @@ compiler.warn.big.major.version=\
{0}: major version {1} is newer than {2}, the highest major version supported by this compiler.\n\
It is recommended that the compiler be upgraded.
compiler.warn.static.not.qualified.by.type=\
[static] static {0} should be qualified by type name, {1}, instead of by an expression
# Warnings related to annotation processing
compiler.warn.proc.package.does.not.exist=\
package {0} does not exist

View File

@ -201,7 +201,7 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
private String selectFormat(JCDiagnostic d) {
DiagnosticSource source = d.getDiagnosticSource();
String format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_NO_POS_FORMAT);
if (source != null) {
if (source != null && source != DiagnosticSource.NO_SOURCE) {
if (d.getIntPosition() != Position.NOPOS) {
format = getConfiguration().getFormat(BasicFormatKind.DEFAULT_POS_FORMAT);
} else if (source.getFile() != null &&

View File

@ -192,6 +192,12 @@ public class Log extends AbstractLog {
*/
public int nwarnings = 0;
/**
* Whether or not an unrecoverable error has been seen.
* Unrecoverable errors prevent subsequent annotation processing.
*/
public boolean unrecoverableError;
/** A set of all errors generated so far. This is used to avoid printing an
* error message more than once. For each error, a pair consisting of the
* source file name and source code position of the error is added to the set.

View File

@ -34,7 +34,6 @@ import com.sun.javadoc.*;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.ClassType;
import com.sun.tools.javac.comp.Attr;
import com.sun.tools.javac.comp.Check;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.Context;
@ -73,10 +72,6 @@ public class DocEnv {
/** Referenced directly in RootDocImpl. */
JavadocClassReader reader;
/** The compiler's attribution phase (needed to evaluate
* constant initializers). */
Attr attr;
/** Javadoc's own version of the compiler's enter phase. */
JavadocEnter enter;
@ -91,8 +86,6 @@ public class DocEnv {
/** Access filter (public, protected, ...). */
ModifierFilter showAccess;
private ClassDocImpl runtimeException;
/** True if we are using a sentence BreakIterator. */
boolean breakiterator;
@ -129,7 +122,6 @@ public class DocEnv {
syms = Symtab.instance(context);
reader = JavadocClassReader.instance0(context);
enter = JavadocEnter.instance0(context);
attr = Attr.instance(context);
names = Names.instance(context);
externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
chk = Check.instance(context);

View File

@ -349,12 +349,12 @@ class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
// (int i, String s) ==> [0] = "int", [1] = String
// (int[][], String[]) ==> [0] = "int[][]" // [1] = "String[]"
class ParameterParseMachine {
final int START = 0;
final int TYPE = 1;
final int NAME = 2;
final int TNSPACE = 3; // space between type and name
final int ARRAYDECORATION = 4;
final int ARRAYSPACE = 5;
static final int START = 0;
static final int TYPE = 1;
static final int NAME = 2;
static final int TNSPACE = 3; // space between type and name
static final int ARRAYDECORATION = 4;
static final int ARRAYSPACE = 5;
String parameters;

View File

@ -255,9 +255,11 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
}
this.classes = new ArrayList<String>();
for (String classname: classes) {
classname.getClass(); // null-check
this.classes.add(classname);
if (classes != null) {
for (String classname: classes) {
classname.getClass(); // null-check
this.classes.add(classname);
}
}
}
@ -316,6 +318,12 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
int run(String[] args) {
try {
handleOptions(args);
if (classes == null || classes.size() == 0) {
if (help || version || fullVersion)
return 0;
else
return 1;
}
boolean ok = run();
return ok ? 0 : 1;
} catch (BadArgs e) {
@ -347,8 +355,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
fileManager = getDefaultFileManager(diagnosticListener, log);
Iterator<String> iter = args.iterator();
if (!iter.hasNext())
help = true;
boolean noArgs = !iter.hasNext();
while (iter.hasNext()) {
String arg = iter.next();
@ -365,7 +372,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
}
if ((classes == null || classes.size() == 0) &&
!(help || version || fullVersion)) {
!(noArgs || help || version || fullVersion)) {
throw new BadArgs("err.no.classes.specified");
}

View File

@ -0,0 +1,9 @@
T4880220.java:20:27: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
T4880220.java:21:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
T4880220.java:22:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
T4880220.java:24:29: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
T4880220.java:25:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
T4880220.java:26:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
- compiler.err.warnings.and.werror
1 error
6 warnings

View File

@ -0,0 +1,43 @@
/*
* @test /nodynamiccopyright/
* @bug 4880220
* @summary Add a warning when accessing a static method via an reference
*
* @compile/ref=T4880220.empty.out T4880220.java
* @compile/ref=T4880220.warn.out -XDrawDiagnostics -Xlint:static T4880220.java
* @compile/ref=T4880220.warn.out -XDrawDiagnostics -Xlint:all T4880220.java
* @compile/ref=T4880220.empty.out -XDrawDiagnostics -Xlint:all,-static T4880220.java
* @compile/ref=T4880220.error.out/fail -XDrawDiagnostics -Werror -Xlint:all T4880220.java
*/
public class T4880220 {
void m1() {
int good_1 = C.m();
int good_2 = C.f;
int good_3 = C.x;
C c = new C();
int bad_inst_1 = c.m();
int bad_inst_2 = c.f;
int bad_inst_3 = c.x;
int bad_expr_1 = c().m();
int bad_expr_2 = c().f;
int bad_expr_3 = c().x;
}
void m2() {
Class<?> good_1 = C.class;
Class<?> good_2 = C[].class;
}
C c() {
return new C();
}
static class C {
static int m() { return 0; }
static int f;
static final int x = 3;
}
}

View File

@ -0,0 +1,7 @@
T4880220.java:20:27: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
T4880220.java:21:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
T4880220.java:22:27: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
T4880220.java:24:29: compiler.warn.static.not.qualified.by.type: kindname.method, T4880220.C
T4880220.java:25:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
T4880220.java:26:29: compiler.warn.static.not.qualified.by.type: kindname.variable, T4880220.C
6 warnings

View File

@ -0,0 +1,38 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @summary Unchecked method call on a method declared inside anonymous inner causes javac to crash
* @compile -Xlint:unchecked T6881645.java
*/
class T6881645 {
Object o = new Object() {
<Z> void m (Class<Z> x) {}
void test() {
m((Class)null);
}
};
}

View File

@ -30,6 +30,8 @@
* @compile ThrowsIntersection_1.java
*/
package ThrowsIntersection_1;
class Ex1 extends Exception {}
class Ex2 extends Exception {}

View File

@ -30,6 +30,8 @@
* @compile ThrowsIntersection_2.java
*/
package ThrowsIntersection_2;
class Ex1 extends Exception {}
class Ex2 extends Exception {}
class Ex3 extends Exception {}

View File

@ -30,6 +30,8 @@
* @run compile/fail ThrowsIntersection_3.java
*/
package ThrowsIntersection_3;
class Ex1 extends Exception {}
class Ex2 extends Exception {}

View File

@ -30,6 +30,8 @@
* @run compile/fail ThrowsIntersection_4.java
*/
package ThrowsIntersection_4;
// Note: This is the test that actually failed for 4042259. The others are for completeness.
class Ex1 extends Exception {}

View File

@ -30,7 +30,7 @@
* @compile/fail Constant.java
*/
package test.tools.javac.annotation.Constant;
package Constant;
@T(a = X.x)
@interface T {

View File

@ -34,7 +34,10 @@ import com.sun.tools.javac.api.JavacTaskImpl;
import com.sun.tools.javac.parser.*; // XXX
import com.sun.tools.javac.util.*; // XXX
import java.io.*;
import java.net.*;
import java.nio.*;
import java.nio.charset.Charset;
import java.util.Arrays;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
@ -43,6 +46,10 @@ import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.*;
import static javax.tools.StandardLocation.CLASS_PATH;
import static javax.tools.StandardLocation.SOURCE_PATH;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
public class TestJavacTaskScanner extends ToolTester {
final JavacTaskImpl task;
@ -56,6 +63,7 @@ public class TestJavacTaskScanner extends ToolTester {
TestJavacTaskScanner(File file) {
final Iterable<? extends JavaFileObject> compilationUnits =
fm.getJavaFileObjects(new File[] {file});
StandardJavaFileManager fm = getLocalFileManager(tool, null, null);
task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, compilationUnits);
task.getContext().put(Scanner.Factory.scannerFactoryKey,
new MyScanner.Factory(task.getContext(), this));
@ -83,7 +91,7 @@ public class TestJavacTaskScanner extends ToolTester {
System.out.println("#parseTypeElements: " + numParseTypeElements);
System.out.println("#allMembers: " + numAllMembers);
check(numTokens, "#Tokens", 891);
check(numTokens, "#Tokens", 1222);
check(numParseTypeElements, "#parseTypeElements", 136);
check(numAllMembers, "#allMembers", 67);
}
@ -117,6 +125,47 @@ public class TestJavacTaskScanner extends ToolTester {
numAllMembers++;
}
}
/* Similar to ToolTester.getFileManager, except that this version also ensures
* javac classes will be available on the classpath. The javac classes are assumed
* to be on the classpath used to run this test (this is true when using jtreg).
* The classes are found by obtaining the URL for a sample javac class, using
* getClassLoader().getResource(), and then deconstructing the URL to find the
* underlying directory or jar file to place on the classpath.
*/
public StandardJavaFileManager getLocalFileManager(JavaCompiler tool,
DiagnosticListener<JavaFileObject> dl,
Charset encoding) {
File javac_classes;
try {
final String javacMainClass = "com/sun/tools/javac/Main.class";
URL url = getClass().getClassLoader().getResource(javacMainClass);
if (url == null)
throw new Error("can't locate javac classes");
URI uri = url.toURI();
String scheme = uri.getScheme();
String ssp = uri.getSchemeSpecificPart();
if (scheme.equals("jar")) {
javac_classes = new File(new URI(ssp.substring(0, ssp.indexOf("!/"))));
} else if (scheme.equals("file")) {
javac_classes = new File(ssp.substring(0, ssp.indexOf(javacMainClass)));
} else
throw new Error("unknown URL: " + url);
} catch (URISyntaxException e) {
throw new Error(e);
}
System.err.println("javac_classes: " + javac_classes);
StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, encoding);
try {
fm.setLocation(SOURCE_PATH, Arrays.asList(test_src));
fm.setLocation(CLASS_PATH, Arrays.asList(test_classes, javac_classes));
fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
} catch (IOException e) {
throw new AssertionError(e);
}
return fm;
}
}
class MyScanner extends Scanner {

View File

@ -0,0 +1,101 @@
/*
* Copyright 2010 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 6930108
* @summary IllegalArgumentException in AbstractDiagnosticFormatter for tools/javac/api/TestJavacTaskScanner.java
* @library ./lib
* @build ToolTester
* @run main TestResolveError
*/
import java.io.*;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.*;
import com.sun.tools.javac.api.JavacTaskImpl;
/*
* This is a cut down version of TestJavacTaskScanner, which as originally written
* caused an IllegalArgumentException in AbstractDiagnosticFormatter as a result
* of calling task.parseType with a name whose resolution depended on the setting
* of the bootclasspath.
* This test has the same call, task.parseType("List<String>", clazz), but checks
* that the error is handled in a reasonable way by javac.
*/
public class TestResolveError extends ToolTester {
public static void main(String... args) throws Exception {
new TestResolveError().run();
}
void run() throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
File file = new File(test_src, "TestResolveError.java");
final Iterable<? extends JavaFileObject> compilationUnits =
fm.getJavaFileObjects(new File[] {file});
task = (JavacTaskImpl)tool.getTask(pw, fm, null, null, null, compilationUnits);
elements = task.getElements();
types = task.getTypes();
Iterable<? extends TypeElement> toplevels;
try {
toplevels = task.enter(task.parse());
} catch (IOException ex) {
throw new AssertionError(ex);
}
for (TypeElement clazz : toplevels) {
System.out.format("Testing %s:%n%n", clazz.getSimpleName());
// this should not cause any exception from the compiler,
// such as IllegalArgumentException
testParseType(clazz);
}
pw.close();
String out = sw.toString();
System.out.println(out);
if (out.contains("com.sun.tools.javac.util"))
throw new Exception("Unexpected output from compiler");
}
void testParseType(TypeElement clazz) {
DeclaredType type = (DeclaredType)task.parseType("List<String>", clazz);
for (Element member : elements.getAllMembers((TypeElement)type.asElement())) {
TypeMirror mt = types.asMemberOf(type, member);
System.out.format("%s : %s -> %s%n", member.getSimpleName(), member.asType(), mt);
}
}
JavacTaskImpl task;
Elements elements;
Types types;
}

Some files were not shown because too many files have changed in this diff Show More