Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
28ea77aa
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
28ea77aa
编写于
3月 24, 2014
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
18135a0e
7b87c56a
变更
95
展开全部
显示空白变更内容
内联
并排
Showing
95 changed file
with
2771 addition
and
844 deletion
+2771
-844
.hgtags
.hgtags
+3
-0
make/Import.gmk
make/Import.gmk
+1
-1
make/data/tzdata/VERSION
make/data/tzdata/VERSION
+1
-1
make/data/tzdata/asia
make/data/tzdata/asia
+7
-2
make/data/tzdata/australasia
make/data/tzdata/australasia
+12
-9
make/data/tzdata/europe
make/data/tzdata/europe
+40
-20
make/data/tzdata/northamerica
make/data/tzdata/northamerica
+4
-3
make/data/tzdata/southamerica
make/data/tzdata/southamerica
+15
-4
src/macosx/classes/sun/lwawt/LWChoicePeer.java
src/macosx/classes/sun/lwawt/LWChoicePeer.java
+10
-10
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+20
-4
src/macosx/classes/sun/lwawt/macosx/CClipboard.java
src/macosx/classes/sun/lwawt/macosx/CClipboard.java
+25
-17
src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
+26
-304
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+0
-1
src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
+5
-6
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+2
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+1
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+9
-7
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+22
-3
src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
+3
-2
src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
+3
-2
src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
+3
-3
src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
+13
-4
src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
+1
-4
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+39
-47
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+15
-22
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
+28
-27
src/macosx/lib/flavormap.properties
src/macosx/lib/flavormap.properties
+2
-0
src/macosx/native/sun/awt/AWTEvent.m
src/macosx/native/sun/awt/AWTEvent.m
+11
-11
src/macosx/native/sun/awt/AWTView.h
src/macosx/native/sun/awt/AWTView.h
+2
-8
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+9
-5
src/macosx/native/sun/awt/CDragSource.h
src/macosx/native/sun/awt/CDragSource.h
+8
-11
src/macosx/native/sun/awt/CDragSource.m
src/macosx/native/sun/awt/CDragSource.m
+9
-10
src/macosx/native/sun/awt/CDropTarget.h
src/macosx/native/sun/awt/CDropTarget.h
+8
-2
src/macosx/native/sun/awt/CTrayIcon.m
src/macosx/native/sun/awt/CTrayIcon.m
+3
-3
src/macosx/native/sun/awt/CWrapper.m
src/macosx/native/sun/awt/CWrapper.m
+8
-80
src/share/classes/java/awt/DefaultKeyboardFocusManager.java
src/share/classes/java/awt/DefaultKeyboardFocusManager.java
+1
-1
src/share/classes/java/awt/SystemColor.java
src/share/classes/java/awt/SystemColor.java
+5
-2
src/share/classes/java/awt/datatransfer/DataFlavor.java
src/share/classes/java/awt/datatransfer/DataFlavor.java
+4
-5
src/share/classes/java/awt/dnd/DragGestureEvent.java
src/share/classes/java/awt/dnd/DragGestureEvent.java
+37
-8
src/share/classes/java/awt/dnd/DragGestureRecognizer.java
src/share/classes/java/awt/dnd/DragGestureRecognizer.java
+14
-1
src/share/classes/java/awt/dnd/DragSourceContext.java
src/share/classes/java/awt/dnd/DragSourceContext.java
+32
-2
src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
...java/lang/invoke/AbstractValidatingLambdaMetafactory.java
+20
-2
src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java
...classes/java/lang/invoke/TypeConvertingMethodAdapter.java
+1
-1
src/share/classes/sun/awt/AWTAccessor.java
src/share/classes/sun/awt/AWTAccessor.java
+27
-1
src/share/classes/sun/awt/HToolkit.java
src/share/classes/sun/awt/HToolkit.java
+8
-1
src/share/classes/sun/awt/SunToolkit.java
src/share/classes/sun/awt/SunToolkit.java
+4
-14
src/share/classes/sun/awt/datatransfer/DataTransferer.java
src/share/classes/sun/awt/datatransfer/DataTransferer.java
+15
-90
src/solaris/classes/sun/awt/X11/XDataTransferer.java
src/solaris/classes/sun/awt/X11/XDataTransferer.java
+5
-7
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XToolkit.java
+7
-4
src/windows/classes/sun/awt/windows/WDataTransferer.java
src/windows/classes/sun/awt/windows/WDataTransferer.java
+3
-7
src/windows/classes/sun/awt/windows/WToolkit.java
src/windows/classes/sun/awt/windows/WToolkit.java
+7
-5
src/windows/native/sun/windows/ShellFolder2.cpp
src/windows/native/sun/windows/ShellFolder2.cpp
+24
-3
src/windows/native/sun/windows/awt_Object.cpp
src/windows/native/sun/windows/awt_Object.cpp
+14
-5
src/windows/native/sun/windows/awt_PrintDialog.cpp
src/windows/native/sun/windows/awt_PrintDialog.cpp
+4
-2
test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
...ava/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
+96
-0
test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html
...leDialog/FileDialogForPackages/FileDialogForPackages.html
+45
-0
test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java
...leDialog/FileDialogForPackages/FileDialogForPackages.java
+84
-0
test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java
test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java
+138
-0
test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html
...TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html
+45
-0
test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java
...TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java
+106
-0
test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
...ava/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
+149
-0
test/java/awt/Window/Grab/GrabTest.java
test/java/awt/Window/Grab/GrabTest.java
+31
-1
test/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java
...ava/awt/dnd/BadSerializaionTest/BadSerializationTest.java
+75
-0
test/java/awt/dnd/BadSerializaionTest/badAction
test/java/awt/dnd/BadSerializaionTest/badAction
+0
-0
test/java/awt/dnd/BadSerializaionTest/good
test/java/awt/dnd/BadSerializaionTest/good
+0
-0
test/java/awt/dnd/BadSerializaionTest/noEvents
test/java/awt/dnd/BadSerializaionTest/noEvents
+0
-0
test/java/awt/dnd/BadSerializaionTest/nullComponent
test/java/awt/dnd/BadSerializaionTest/nullComponent
+0
-0
test/java/awt/dnd/BadSerializaionTest/nullDragSource
test/java/awt/dnd/BadSerializaionTest/nullDragSource
+0
-0
test/java/awt/dnd/BadSerializaionTest/nullOrigin
test/java/awt/dnd/BadSerializaionTest/nullOrigin
+0
-0
test/java/awt/dnd/Button2DragTest/Button2DragTest.java
test/java/awt/dnd/Button2DragTest/Button2DragTest.java
+2
-1
test/java/awt/dnd/URLDragTest/URLDragTest.html
test/java/awt/dnd/URLDragTest/URLDragTest.html
+45
-0
test/java/awt/dnd/URLDragTest/URLDragTest.java
test/java/awt/dnd/URLDragTest/URLDragTest.java
+88
-0
test/java/lang/invoke/lambda/LambdaReceiver.java
test/java/lang/invoke/lambda/LambdaReceiver.java
+70
-0
test/java/lang/invoke/lambda/LambdaReceiverBridge.java
test/java/lang/invoke/lambda/LambdaReceiverBridge.java
+71
-0
test/java/lang/invoke/lambda/LambdaReceiver_anotherpkg/LambdaReceiver_A.java
...ke/lambda/LambdaReceiver_anotherpkg/LambdaReceiver_A.java
+8
-4
test/java/lang/invoke/lambda/LambdaReturn.java
test/java/lang/invoke/lambda/LambdaReturn.java
+92
-0
test/java/lang/invoke/lambda/MetafactoryArityTest.java
test/java/lang/invoke/lambda/MetafactoryArityTest.java
+169
-0
test/java/lang/invoke/lambda/MetafactoryParameterCastTest.java
...java/lang/invoke/lambda/MetafactoryParameterCastTest.java
+211
-0
test/java/lang/invoke/lambda/MetafactorySamReturnTest.java
test/java/lang/invoke/lambda/MetafactorySamReturnTest.java
+167
-0
test/javax/swing/JPopupMenu/7154841/bug7154841.java
test/javax/swing/JPopupMenu/7154841/bug7154841.java
+121
-0
test/javax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java
...avax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java
+184
-0
test/javax/xml/jaxp/parsers/8032909/XSLT.java
test/javax/xml/jaxp/parsers/8032909/XSLT.java
+54
-0
test/javax/xml/jaxp/parsers/8032909/a_utf16.xml
test/javax/xml/jaxp/parsers/8032909/a_utf16.xml
+0
-0
test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl
test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl
+0
-0
test/javax/xml/jaxp/parsers/8032909/a_utf8.xml
test/javax/xml/jaxp/parsers/8032909/a_utf8.xml
+5
-0
test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl
test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl
+13
-0
test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml
test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml
+5
-0
test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl
test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl
+13
-0
test/sun/util/calendar/zi/Zoneinfo.java
test/sun/util/calendar/zi/Zoneinfo.java
+5
-1
test/sun/util/calendar/zi/tzdata/VERSION
test/sun/util/calendar/zi/tzdata/VERSION
+1
-1
test/sun/util/calendar/zi/tzdata/asia
test/sun/util/calendar/zi/tzdata/asia
+7
-2
test/sun/util/calendar/zi/tzdata/australasia
test/sun/util/calendar/zi/tzdata/australasia
+12
-9
test/sun/util/calendar/zi/tzdata/europe
test/sun/util/calendar/zi/tzdata/europe
+40
-20
test/sun/util/calendar/zi/tzdata/northamerica
test/sun/util/calendar/zi/tzdata/northamerica
+4
-3
test/sun/util/calendar/zi/tzdata/southamerica
test/sun/util/calendar/zi/tzdata/southamerica
+15
-4
未找到文件。
.hgtags
浏览文件 @
28ea77aa
...
...
@@ -257,4 +257,7 @@ f644211c59fd7c1d0c81239c55b31e1d377d7650 jdk8-b128
5a9f04957f826ce23639479c9791c7d8fd282b01 jdk8u20-b03
c347889445c1153f11aaa56092d44a911e497454 jdk8u20-b04
c9117a5defe912b1f7ae92bb0730d6e7a5a045df jdk8u20-b05
43386cc9a017a9f9e704760050086bb18b778ae0 jdk8-b130
e291ac47c9a90366c3c0787a6f7ce547a2bda308 jdk8-b131
43cb25339b5500871f41388a5197f1b01c4b57b8 jdk8-b132
1ecfc0fac3e7b931f09728b7594384ea5b5f9f0f jdk8u20-b06
make/Import.gmk
浏览文件 @
28ea77aa
...
...
@@ -252,7 +252,7 @@ define unzip-sec-file
$(ECHO) Unzipping $(<F)
$(MKDIR) -p $(@D)
$(RM) $@
($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) $< > $@.tmp)
($(CD) $(JDK_OUTPUTDIR) && $(UNZIP)
-q -o
$< > $@.tmp)
$(MV) $@.tmp $@
endef
...
...
make/data/tzdata/VERSION
浏览文件 @
28ea77aa
...
...
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata201
3i
tzdata201
4a
make/data/tzdata/asia
浏览文件 @
28ea77aa
...
...
@@ -1113,8 +1113,13 @@ Rule Zion 1986 only - May 18 0:00 1:00 D
Rule Zion 1986 only - Sep 7 0:00 0 S
Rule Zion 1987 only - Apr 15 0:00 1:00 D
Rule Zion 1987 only - Sep 13 0:00 0 S
Rule Zion 1988 only - Apr 9 0:00 1:00 D
Rule Zion 1988 only - Sep 3 0:00 0 S
# From Avigdor Finkelstein (2014-03-05):
# I check the Parliament (Knesset) records and there it's stated that the
# [1988] transition should take place on Saturday night, when the Sabbath
# ends and changes to Sunday.
Rule Zion 1988 only - Apr 10 0:00 1:00 D
Rule Zion 1988 only - Sep 4 0:00 0 S
# From Ephraim Silverberg
# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
...
...
make/data/tzdata/australasia
浏览文件 @
28ea77aa
...
...
@@ -377,16 +377,18 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
# From the Fijian Government Media Center (2013-08-30) via David Wheeler:
# Fiji will start daylight savings on Sunday 27th October, 2013
and end at 3am
#
on Sunday 19th January, 2014....
move clocks forward by one hour from 2am
# Fiji will start daylight savings on Sunday 27th October, 2013
...
# move clocks forward by one hour from 2am
# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
#
# From Paul Eggert (2013-09-09):
# From Steffen Thorsen (2013-01-10):
# Fiji will end DST on 2014-01-19 02:00:
# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
# From Paul Eggert (2014-01-10):
# For now, guess that Fiji springs forward the Sunday before the fourth
# Monday in October. This matches both recent practice and
# timeanddate.com's current spring-forward prediction.
# For the January 2014 transition we guessed right while timeanddate.com
# guessed wrong, so leave the fall-back prediction alone.
# Monday in October, and springs back the penultimate Sunday in January.
# This is ad hoc, but matches recent practice.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 S
...
...
@@ -395,7 +397,8 @@ Rule Fiji 2009 only - Nov 29 2:00 1:00 S
Rule Fiji 2010 only - Mar lastSun 3:00 0 -
Rule Fiji 2010 max - Oct Sun>=21 2:00 1:00 S
Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2012 max - Jan Sun>=18 3:00 0 -
Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 -
Rule Fiji 2014 max - Jan Sun>=18 2:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva
12:00 Fiji FJ%sT # Fiji Time
...
...
make/data/tzdata/europe
浏览文件 @
28ea77aa
...
...
@@ -2768,14 +2768,18 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
# According to the articles linked below, Turkey will change into summer
# time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
# This change is due to a nationwide exam on 27th.
#
# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
# </a>
# Turkish:
# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
# http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
# </a>
# From Faruk Pasin (2014-02-14):
# The DST for Turkey has been changed for this year because of the
# Turkish Local election....
# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
# From Paul Eggert (2014-02-17):
# Here is an English-language source:
# http://www.worldbulletin.net/turkey/129016/turkey-switches-to-daylight-saving-time-march-31
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Turkey 1916 only - May 1 0:00 1:00 S
...
...
@@ -2844,6 +2848,8 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880
2:00 Turkey EE%sT 2007
2:00 EU EE%sT 2011 Mar 27 1:00u
2:00 - EET 2011 Mar 28 1:00u
2:00 EU EE%sT 2014 Mar 30 1:00u
2:00 - EET 2014 Mar 31 1:00u
2:00 EU EE%sT
Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
...
...
@@ -2865,19 +2871,13 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# approval from 266 deputies.
#
# Ukraine abolishes transter back to the winter time (in Russian)
# <a href="http://news.mail.ru/politics/6861560/">
# http://news.mail.ru/politics/6861560/
# </a>
#
# The Ukrainians will no longer change the clock (in Russian)
# <a href="http://www.segodnya.ua/news/14290482.html">
# http://www.segodnya.ua/news/14290482.html
# </a>
#
# Deputies cancelled the winter time (in Russian)
# <a href="http://www.pravda.com.ua/rus/news/2011/09/20/6600616/">
# http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
# </a>
#
# From Philip Pizzey (2011-10-18):
# Today my Ukrainian colleagues have informed me that the
...
...
@@ -2888,18 +2888,39 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# As far as I understand, the recent change to the Ukrainian time zone
# (Europe/Kiev) to introduce permanent daylight saving time (similar
# to Russia) was reverted today:
#
# <a href="http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995">
# http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
# </a>
#
# Also reported by Alexander Bokovoy (2011-10-18) who also noted:
# The law documents themselves are at
#
# <a href="http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484">
# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
# </a>
# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
# 03 25 1990 02:00 -03.00 1 Time Zone 3 with DST
# 07 01 1990 02:00 -02.00 1 Time Zone 2 with DST
# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
#
# They did not end DST in September, 1990 (according to the law,
# "summer time" was still in action):
# 09 30 1990 03:00 -02.00 1 Time Zone 2 with DST
# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
#
# Again no change in March, 1991 ("summer time" in action):
# 03 31 1991 02:00 -02.00 1 Time Zone 2 with DST
#
# DST ended in September 1991 ("summer time" ended):
# 09 29 1991 03:00 -02.00 0 Time Zone 2, no DST
# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
# This is an answer.
#
# Since 1992 they had normal DST procedure:
# 03 29 1992 02:00 -02.00 1 DST started
# 09 27 1992 03:00 -02.00 0 DST ended
# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Most of Ukraine since 1970 has been like Kiev.
...
...
@@ -2910,9 +2931,8 @@ Zone Europe/Kiev 2:02:04 - LMT 1880
2:00 - EET 1930 Jun 21
3:00 - MSK 1941 Sep 20
1:00 C-Eur CE%sT 1943 Nov 6
3:00 Russia MSK/MSD 1990
3:00 - MSK 1990 Jul 1 2:00
2:00 - EET 1992
3:00 Russia MSK/MSD 1990 Jul 1 2:00
2:00 1:00 EEST 1991 Sep 29 3:00
2:00 E-Eur EE%sT 1995
2:00 EU EE%sT
# Ruthenia used CET 1990/1991.
...
...
make/data/tzdata/northamerica
浏览文件 @
28ea77aa
...
...
@@ -414,9 +414,10 @@ Zone America/Denver -6:59:56 - LMT 1883 Nov 18 12:00:04
# US Pacific time, represented by Los Angeles
#
# California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
# and the northern three-quarters of Idaho county),
# most of Nevada, most of Oregon, and Washington
# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
# north of the Salmon River, and the towns of Burgdorf and Warren),
# Nevada (except West Wendover), Oregon (except the northern 3/4 of
# Malheur county), and Washington
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER
Rule CA 1948 only - Mar 14 2:00 1:00 D
...
...
make/data/tzdata/southamerica
浏览文件 @
28ea77aa
...
...
@@ -1298,6 +1298,13 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# start date is 2013-09-08 00:00....
# http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
# From Jose Miguel Garrido (2014-02-19):
# Today appeared in the Diario Oficial a decree amending the time change
# dates to 2014.
# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
# NOTE: ChileAQ rules for Antarctic bases are stored separately in the
# 'antarctica' file.
...
...
@@ -1631,6 +1638,9 @@ Rule Para 2010 2012 - Apr Sun>=8 0:00 0 -
# From Carlos Raul Perasso (2013-03-15):
# The change in Paraguay is now final. Decree number 10780
# http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
# From Carlos Raul Perasso (2014-02-28):
# Decree 1264 can be found at:
# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
Rule Para 2013 max - Mar Sun>=22 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
...
...
@@ -1689,18 +1699,19 @@ Zone America/Paramaribo -3:40:40 - LMT 1911
Zone America/Port_of_Spain -4:06:04 - LMT 1912 Mar 2
-4:00 - AST
# These all agree with Trinidad and Tobago since 1970.
Link America/Port_of_Spain America/Anguilla
Link America/Port_of_Spain America/Dominica
Link America/Port_of_Spain America/Grenada
Link America/Port_of_Spain America/Guadeloupe
Link America/Port_of_Spain America/Marigot
Link America/Port_of_Spain America/Marigot
# St Martin (French part)
Link America/Port_of_Spain America/Montserrat
Link America/Port_of_Spain America/St_Barthelemy
Link America/Port_of_Spain America/St_Kitts
Link America/Port_of_Spain America/St_Kitts
# St Kitts & Nevis
Link America/Port_of_Spain America/St_Lucia
Link America/Port_of_Spain America/St_Thomas
Link America/Port_of_Spain America/St_Thomas
# Virgin Islands (US)
Link America/Port_of_Spain America/St_Vincent
Link America/Port_of_Spain America/Tortola
Link America/Port_of_Spain America/Tortola
# Virgin Islands (UK)
# Uruguay
# From Paul Eggert (1993-11-18):
...
...
src/macosx/classes/sun/lwawt/LWChoicePeer.java
浏览文件 @
28ea77aa
...
...
@@ -168,16 +168,16 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
@Override
public
void
firePopupMenuWillBecomeVisible
()
{
super
.
firePopupMenuWillBecomeVisible
();
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
SwingUtilities
.
invokeLater
(()
->
{
JPopupMenu
popupMenu
=
getPopupMenu
();
if
(
popupMenu
!=
null
)
{
if
(
popupMenu
.
getInvoker
()
!=
LWChoicePeer
.
this
.
getTarget
())
{
// Need to override the invoker for proper grab handling
if
(
popupMenu
!=
null
&&
popupMenu
.
getInvoker
()
!=
getTarget
())
{
// The popup is now visible with correct location
// Save it and restore after toggling visibility and changing invoker
Point
loc
=
popupMenu
.
getLocationOnScreen
();
SwingUtilities
.
convertPointFromScreen
(
loc
,
this
);
popupMenu
.
setVisible
(
false
);
popupMenu
.
show
(
LWChoicePeer
.
this
.
getTarget
(),
0
,
0
);
}
}
popupMenu
.
show
(
getTarget
(),
loc
.
x
,
loc
.
y
);
}
});
}
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -684,7 +684,7 @@ public class LWWindowPeer
public
void
notifyNCMouseDown
()
{
// Ungrab except for a click on a Dialog with the grabbing owner
if
(
grabbingWindow
!=
null
&&
grabbingWindow
!=
getOwnerFrameDialog
(
this
))
!
grabbingWindow
.
isOneOfOwnersOf
(
this
))
{
grabbingWindow
.
ungrab
();
}
...
...
@@ -779,7 +779,7 @@ public class LWWindowPeer
// Ungrab only if this window is not an owned window of the grabbing one.
if
(!
isGrabbing
()
&&
grabbingWindow
!=
null
&&
grabbingWindow
!=
getOwnerFrameDialog
(
this
))
!
grabbingWindow
.
isOneOfOwnersOf
(
this
))
{
grabbingWindow
.
ungrab
();
}
...
...
@@ -1232,6 +1232,17 @@ public class LWWindowPeer
changeFocusedWindow
(
activate
,
null
);
}
private
boolean
isOneOfOwnersOf
(
LWWindowPeer
peer
)
{
Window
owner
=
(
peer
!=
null
?
peer
.
getTarget
().
getOwner
()
:
null
);
while
(
owner
!=
null
)
{
if
((
LWWindowPeer
)
owner
.
getPeer
()
==
this
)
{
return
true
;
}
owner
=
owner
.
getOwner
();
}
return
false
;
}
/*
* Changes focused window on java level.
*/
...
...
@@ -1263,7 +1274,7 @@ public class LWWindowPeer
// - when the opposite (gaining focus) window is an owned/owner window.
// - for a simple window in any case.
if
(!
becomesFocused
&&
(
isGrabbing
()
||
getOwnerFrameDialog
(
grabbingWindow
)
==
this
))
(
isGrabbing
()
||
this
.
isOneOfOwnersOf
(
grabbingWindow
)
))
{
if
(
focusLog
.
isLoggable
(
PlatformLogger
.
Level
.
FINE
))
{
focusLog
.
fine
(
"ungrabbing on "
+
grabbingWindow
);
...
...
@@ -1282,6 +1293,11 @@ public class LWWindowPeer
postEvent
(
windowEvent
);
}
/*
* Retrieves the owner of the peer.
* Note: this method returns the owner which can be activated, (i.e. the instance
* of Frame or Dialog may be returned).
*/
static
LWWindowPeer
getOwnerFrameDialog
(
LWWindowPeer
peer
)
{
Window
owner
=
(
peer
!=
null
?
peer
.
getTarget
().
getOwner
()
:
null
);
while
(
owner
!=
null
&&
!(
owner
instanceof
Frame
||
owner
instanceof
Dialog
))
{
...
...
src/macosx/classes/sun/lwawt/macosx/CClipboard.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -40,20 +40,23 @@ import sun.awt.datatransfer.*;
* sun.awt.datatransfer.DataTransferer.
*/
public
class
CClipboard
extends
SunClipboard
{
final
class
CClipboard
extends
SunClipboard
{
public
CClipboard
(
String
name
)
{
super
(
name
);
}
@Override
public
long
getID
()
{
return
0
;
}
@Override
protected
void
clearNativeContext
()
{
// Leaving Empty, as WClipboard.clearNativeContext is empty as well.
}
@Override
protected
void
setContentsNative
(
Transferable
contents
)
{
// Don't use delayed Clipboard rendering for the Transferable's data.
...
...
@@ -89,27 +92,19 @@ public class CClipboard extends SunClipboard {
notifyChanged
();
}
private
void
notifyLostOwnership
()
{
lostOwnershipImpl
();
}
private
static
void
notifyChanged
()
{
CClipboard
clipboard
=
(
CClipboard
)
Toolkit
.
getDefaultToolkit
().
getSystemClipboard
();
if
(!
clipboard
.
areFlavorListenersRegistered
())
{
return
;
}
clipboard
.
checkChange
(
clipboard
.
getClipboardFormats
());
}
@Override
protected
native
long
[]
getClipboardFormats
();
@Override
protected
native
byte
[]
getClipboardData
(
long
format
)
throws
IOException
;
// 1.5 peer method
@Override
protected
void
unregisterClipboardViewerChecked
()
{
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
// 1.5 peer method
@Override
protected
void
registerClipboardViewerChecked
()
{
// no-op because we lack OS support. This requires 4048791, which requires 4048792
}
...
...
@@ -118,8 +113,8 @@ public class CClipboard extends SunClipboard {
// no-op. This appears to be win32 specific. Filed 4048790 for investigation
//protected Transferable createLocaleTransferable(long[] formats) throws IOException;
p
ublic
native
void
declareTypes
(
long
[]
formats
,
SunClipboard
newOwner
);
p
ublic
native
void
setData
(
byte
[]
data
,
long
format
);
p
rivate
native
void
declareTypes
(
long
[]
formats
,
SunClipboard
newOwner
);
p
rivate
native
void
setData
(
byte
[]
data
,
long
format
);
/**
* Invokes native check whether a change count on the general pasteboard is different
...
...
@@ -127,5 +122,18 @@ public class CClipboard extends SunClipboard {
* pasteboard ownership and someone else put data on the clipboard.
* @since 1.7
*/
public
native
void
checkPasteboard
();
native
void
checkPasteboard
();
/*** Native Callbacks ***/
private
void
notifyLostOwnership
()
{
lostOwnershipImpl
();
}
private
static
void
notifyChanged
()
{
CClipboard
clipboard
=
(
CClipboard
)
Toolkit
.
getDefaultToolkit
().
getSystemClipboard
();
if
(!
clipboard
.
areFlavorListenersRegistered
())
{
return
;
}
clipboard
.
checkChange
(
clipboard
.
getClipboardFormats
());
}
}
src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -56,11 +56,11 @@ public class CDataTransferer extends DataTransferer {
};
static
{
Map
<
String
,
Long
>
nameMap
=
new
HashMap
<
String
,
Long
>(
predefinedClipboardNames
.
length
,
1.0f
);
Map
<
Long
,
String
>
formatMap
=
new
HashMap
<
Long
,
String
>(
predefinedClipboardNames
.
length
,
1.0f
);
Map
<
String
,
Long
>
nameMap
=
new
HashMap
<>(
predefinedClipboardNames
.
length
,
1.0f
);
Map
<
Long
,
String
>
formatMap
=
new
HashMap
<>(
predefinedClipboardNames
.
length
,
1.0f
);
for
(
int
i
=
1
;
i
<
predefinedClipboardNames
.
length
;
i
++)
{
nameMap
.
put
(
predefinedClipboardNames
[
i
],
new
Long
(
i
)
);
formatMap
.
put
(
new
Long
(
i
)
,
predefinedClipboardNames
[
i
]);
nameMap
.
put
(
predefinedClipboardNames
[
i
],
(
long
)
i
);
formatMap
.
put
(
(
long
)
i
,
predefinedClipboardNames
[
i
]);
}
predefinedClipboardNameMap
=
Collections
.
synchronizedMap
(
nameMap
);
predefinedClipboardFormatMap
=
Collections
.
synchronizedMap
(
formatMap
);
...
...
@@ -77,19 +77,11 @@ public class CDataTransferer extends DataTransferer {
public
static
final
int
CF_PNG
=
10
;
public
static
final
int
CF_JPEG
=
11
;
public
static
final
Long
L_CF_TIFF
=
predefinedClipboardNameMap
.
get
(
predefinedClipboardNames
[
CF_TIFF
]);
// Image file formats with java.awt.Image representation:
private
static
final
Long
[]
imageFormats
=
new
Long
[]
{
L_CF_TIFF
};
private
CDataTransferer
()
{}
private
static
CDataTransferer
fTransferer
;
public
static
synchronized
CDataTransferer
getInstanceImpl
()
{
static
synchronized
CDataTransferer
getInstanceImpl
()
{
if
(
fTransferer
==
null
)
{
fTransferer
=
new
CDataTransferer
();
}
...
...
@@ -97,18 +89,22 @@ public class CDataTransferer extends DataTransferer {
return
fTransferer
;
}
@Override
public
String
getDefaultUnicodeEncoding
()
{
return
"utf-16le"
;
}
@Override
public
boolean
isLocaleDependentTextFormat
(
long
format
)
{
return
format
==
CF_STRING
;
}
@Override
public
boolean
isFileFormat
(
long
format
)
{
return
format
==
CF_FILE
;
}
@Override
public
boolean
isImageFormat
(
long
format
)
{
int
ifmt
=
(
int
)
format
;
switch
(
ifmt
)
{
...
...
@@ -122,43 +118,12 @@ public class CDataTransferer extends DataTransferer {
}
}
protected
Long
[]
getImageFormatsAsLongArray
()
{
return
imageFormats
;
}
public
byte
[]
translateTransferable
(
Transferable
contents
,
DataFlavor
flavor
,
long
format
)
throws
IOException
{
byte
[]
bytes
=
super
.
translateTransferable
(
contents
,
flavor
,
format
);
// 9-12-02 VL: we may need to do something like Windows here.
//if (format == CF_HTML) {
// bytes = HTMLSupport.convertToHTMLFormat(bytes);
//}
return
bytes
;
}
protected
Object
translateBytesOrStream
(
InputStream
stream
,
byte
[]
bytes
,
DataFlavor
flavor
,
long
format
,
Transferable
transferable
)
throws
IOException
{
// 5-28-03 VL: [Radar 3266030]
// We need to do like Windows does here.
if
(
format
==
CF_HTML
&&
flavor
.
isFlavorTextType
())
{
if
(
stream
==
null
)
{
stream
=
new
ByteArrayInputStream
(
bytes
);
bytes
=
null
;
}
stream
=
new
HTMLDecodingInputStream
(
stream
);
}
@Override
public
Object
translateBytes
(
byte
[]
bytes
,
DataFlavor
flavor
,
long
format
,
Transferable
transferable
)
throws
IOException
{
if
(
format
==
CF_URL
&&
URL
.
class
.
equals
(
flavor
.
getRepresentationClass
()))
{
if
(
bytes
==
null
)
{
bytes
=
inputStreamToByteArray
(
stream
);
stream
=
null
;
}
String
charset
=
getDefaultTextCharset
();
if
(
transferable
!=
null
&&
transferable
.
isDataFlavorSupported
(
javaTextEncodingFlavor
))
{
try
{
...
...
@@ -177,7 +142,7 @@ public class CDataTransferer extends DataTransferer {
return
super
.
translateBytes
(
bytes
,
flavor
,
format
,
transferable
);
}
@Override
synchronized
protected
Long
getFormatForNativeAsLong
(
String
str
)
{
Long
format
=
predefinedClipboardNameMap
.
get
(
str
);
...
...
@@ -202,6 +167,7 @@ public class CDataTransferer extends DataTransferer {
// Get registered native format string for an index, return null if unknown:
private
native
String
formatForIndex
(
long
index
);
@Override
protected
String
getNativeForFormat
(
long
format
)
{
String
returnValue
=
null
;
...
...
@@ -209,7 +175,7 @@ public class CDataTransferer extends DataTransferer {
if
(
format
>=
0
&&
format
<
predefinedClipboardNames
.
length
)
{
returnValue
=
predefinedClipboardNames
[(
int
)
format
];
}
else
{
Long
formatObj
=
new
Long
(
format
)
;
Long
formatObj
=
format
;
returnValue
=
predefinedClipboardFormatMap
.
get
(
formatObj
);
// predefinedClipboardFormatMap may not know this format:
...
...
@@ -233,10 +199,13 @@ public class CDataTransferer extends DataTransferer {
private
final
ToolkitThreadBlockedHandler
handler
=
new
CToolkitThreadBlockedHandler
();
@Override
public
ToolkitThreadBlockedHandler
getToolkitThreadBlockedHandler
()
{
return
handler
;
}
private
native
byte
[]
imageDataToPlatformImageBytes
(
int
[]
rData
,
int
nW
,
int
nH
);
@Override
protected
byte
[]
imageToPlatformBytes
(
Image
image
,
long
format
)
{
int
w
=
image
.
getWidth
(
null
);
int
h
=
image
.
getHeight
(
null
);
...
...
@@ -252,32 +221,28 @@ public class CDataTransferer extends DataTransferer {
}
private
static
native
String
[]
nativeDragQueryFile
(
final
byte
[]
bytes
);
@Override
protected
String
[]
dragQueryFile
(
final
byte
[]
bytes
)
{
if
(
bytes
==
null
)
return
null
;
if
(
new
String
(
bytes
).
startsWith
(
"Unsupported type"
))
return
null
;
return
nativeDragQueryFile
(
bytes
);
}
private
native
byte
[]
imageDataToPlatformImageBytes
(
int
[]
rData
,
int
nW
,
int
nH
);
private
native
Image
getImageForByteStream
(
byte
[]
bytes
);
/**
* Translates a byte array which contains
* platform-specific image data in the given format into an Image.
*/
protected
Image
platformImageBytesToImage
(
byte
[]
bytes
,
long
format
)
throws
IOException
{
@Override
protected
Image
platformImageBytesToImage
(
byte
[]
bytes
,
long
format
)
throws
IOException
{
return
getImageForByteStream
(
bytes
);
}
private
native
Image
getImageForByteStream
(
byte
[]
bytes
);
@Override
protected
ByteArrayOutputStream
convertFileListToBytes
(
ArrayList
<
String
>
fileList
)
throws
IOException
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
for
(
int
i
=
0
;
i
<
fileList
.
size
();
i
++)
{
byte
[]
bytes
=
fileList
.
get
(
i
).
getBytes
();
for
(
String
file
:
fileList
)
{
byte
[]
bytes
=
file
.
getBytes
();
bos
.
write
(
bytes
,
0
,
bytes
.
length
);
bos
.
write
(
0
);
}
...
...
@@ -303,246 +268,3 @@ public class CDataTransferer extends DataTransferer {
}
// ---- Code borrowed from WDataTransferer: ----
// This will come handy for supporting HTML data.
final
class
HTMLSupport
{
public
static
final
String
ENCODING
=
"UTF-8"
;
public
static
final
String
VERSION
=
"Version:"
;
public
static
final
String
START_HTML
=
"StartHTML:"
;
public
static
final
String
END_HTML
=
"EndHTML:"
;
public
static
final
String
START_FRAGMENT
=
"StartFragment:"
;
public
static
final
String
END_FRAGMENT
=
"EndFragment:"
;
public
static
final
String
START_FRAGMENT_CMT
=
"<!--StartFragment-->"
;
public
static
final
String
END_FRAGMENT_CMT
=
"<!--EndFragment-->"
;
public
static
final
String
EOLN
=
"\r\n"
;
private
static
final
String
VERSION_NUM
=
"0.9"
;
private
static
final
String
HTML_START_END
=
"-1"
;
private
static
final
int
PADDED_WIDTH
=
10
;
private
static
final
int
HEADER_LEN
=
VERSION
.
length
()
+
VERSION_NUM
.
length
()
+
EOLN
.
length
()
+
START_HTML
.
length
()
+
HTML_START_END
.
length
()
+
EOLN
.
length
()
+
END_HTML
.
length
()
+
HTML_START_END
.
length
()
+
EOLN
.
length
()
+
START_FRAGMENT
.
length
()
+
PADDED_WIDTH
+
EOLN
.
length
()
+
END_FRAGMENT
.
length
()
+
PADDED_WIDTH
+
EOLN
.
length
()
+
START_FRAGMENT_CMT
.
length
()
+
EOLN
.
length
();
private
static
final
String
HEADER_LEN_STR
=
toPaddedString
(
HEADER_LEN
,
PADDED_WIDTH
);
private
static
final
String
TRAILER
=
END_FRAGMENT_CMT
+
EOLN
+
'\0'
;
private
static
String
toPaddedString
(
int
n
,
int
width
)
{
String
string
=
""
+
n
;
int
len
=
string
.
length
();
if
(
n
>=
0
&&
len
<
width
)
{
char
[]
array
=
new
char
[
width
-
len
];
Arrays
.
fill
(
array
,
'0'
);
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
array
);
buffer
.
append
(
string
);
string
=
buffer
.
toString
();
}
return
string
;
}
public
static
byte
[]
convertToHTMLFormat
(
byte
[]
bytes
)
{
StringBuffer
header
=
new
StringBuffer
(
HEADER_LEN
);
header
.
append
(
VERSION
);
header
.
append
(
VERSION_NUM
);
header
.
append
(
EOLN
);
header
.
append
(
START_HTML
);
header
.
append
(
HTML_START_END
);
header
.
append
(
EOLN
);
header
.
append
(
END_HTML
);
header
.
append
(
HTML_START_END
);
header
.
append
(
EOLN
);
header
.
append
(
START_FRAGMENT
);
header
.
append
(
HEADER_LEN_STR
);
header
.
append
(
EOLN
);
header
.
append
(
END_FRAGMENT
);
// Strip terminating NUL byte from array
header
.
append
(
toPaddedString
(
HEADER_LEN
+
bytes
.
length
-
1
,
PADDED_WIDTH
));
header
.
append
(
EOLN
);
header
.
append
(
START_FRAGMENT_CMT
);
header
.
append
(
EOLN
);
byte
[]
headerBytes
=
null
,
trailerBytes
=
null
;
try
{
headerBytes
=
new
String
(
header
).
getBytes
(
ENCODING
);
trailerBytes
=
TRAILER
.
getBytes
(
ENCODING
);
}
catch
(
UnsupportedEncodingException
cannotHappen
)
{
}
byte
[]
retval
=
new
byte
[
headerBytes
.
length
+
bytes
.
length
-
1
+
trailerBytes
.
length
];
System
.
arraycopy
(
headerBytes
,
0
,
retval
,
0
,
headerBytes
.
length
);
System
.
arraycopy
(
bytes
,
0
,
retval
,
headerBytes
.
length
,
bytes
.
length
-
1
);
System
.
arraycopy
(
trailerBytes
,
0
,
retval
,
headerBytes
.
length
+
bytes
.
length
-
1
,
trailerBytes
.
length
);
return
retval
;
}
}
/**
* This stream takes an InputStream which provides data in CF_HTML format,
* strips off the description and context to extract the original HTML data.
*/
class
HTMLDecodingInputStream
extends
InputStream
{
private
final
BufferedInputStream
bufferedStream
;
private
boolean
descriptionParsed
=
false
;
private
boolean
closed
=
false
;
private
int
index
;
private
int
end
;
// InputStreamReader uses an 8K buffer. The size is not customizable.
public
static
final
int
BYTE_BUFFER_LEN
=
8192
;
// CharToByteUTF8.getMaxBytesPerChar returns 3, so we should not buffer
// more chars than 3 times the number of bytes we can buffer.
public
static
final
int
CHAR_BUFFER_LEN
=
BYTE_BUFFER_LEN
/
3
;
private
static
final
String
FAILURE_MSG
=
"Unable to parse HTML description: "
;
private
static
final
String
INVALID_MSG
=
" invalid"
;
public
HTMLDecodingInputStream
(
InputStream
bytestream
)
throws
IOException
{
bufferedStream
=
new
BufferedInputStream
(
bytestream
,
BYTE_BUFFER_LEN
);
}
private
void
parseDescription
()
throws
IOException
{
bufferedStream
.
mark
(
BYTE_BUFFER_LEN
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
bufferedStream
,
HTMLSupport
.
ENCODING
),
CHAR_BUFFER_LEN
);
String
version
=
bufferedReader
.
readLine
().
trim
();
if
(
version
==
null
||
!
version
.
startsWith
(
HTMLSupport
.
VERSION
))
{
// Not MS-compliant HTML text. Return raw text from read().
index
=
0
;
end
=
-
1
;
bufferedStream
.
reset
();
return
;
}
String
input
;
boolean
startHTML
,
endHTML
,
startFragment
,
endFragment
;
startHTML
=
endHTML
=
startFragment
=
endFragment
=
false
;
try
{
do
{
input
=
bufferedReader
.
readLine
().
trim
();
if
(
input
==
null
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
);
}
else
if
(
input
.
startsWith
(
HTMLSupport
.
START_HTML
))
{
int
val
=
Integer
.
parseInt
(
input
.
substring
(
HTMLSupport
.
START_HTML
.
length
(),
input
.
length
()).
trim
());
if
(
val
>=
0
)
{
index
=
val
;
startHTML
=
true
;
}
else
if
(
val
!=
-
1
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
+
HTMLSupport
.
START_HTML
+
INVALID_MSG
);
}
}
else
if
(
input
.
startsWith
(
HTMLSupport
.
END_HTML
))
{
int
val
=
Integer
.
parseInt
(
input
.
substring
(
HTMLSupport
.
END_HTML
.
length
(),
input
.
length
()).
trim
());
if
(
val
>=
0
)
{
end
=
val
;
endHTML
=
true
;
}
else
if
(
val
!=
-
1
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
+
HTMLSupport
.
END_HTML
+
INVALID_MSG
);
}
}
else
if
(!
startHTML
&&
!
endHTML
&&
input
.
startsWith
(
HTMLSupport
.
START_FRAGMENT
))
{
index
=
Integer
.
parseInt
(
input
.
substring
(
HTMLSupport
.
START_FRAGMENT
.
length
(),
input
.
length
()).
trim
());
if
(
index
<
0
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
+
HTMLSupport
.
START_FRAGMENT
+
INVALID_MSG
);
}
startFragment
=
true
;
}
else
if
(!
startHTML
&&
!
endHTML
&&
input
.
startsWith
(
HTMLSupport
.
END_FRAGMENT
))
{
end
=
Integer
.
parseInt
(
input
.
substring
(
HTMLSupport
.
END_FRAGMENT
.
length
(),
input
.
length
()).
trim
());
if
(
end
<
0
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
+
HTMLSupport
.
END_FRAGMENT
+
INVALID_MSG
);
}
endFragment
=
true
;
}
}
while
(!((
startHTML
&&
endHTML
)
||
(
startFragment
&&
endFragment
)));
}
catch
(
NumberFormatException
e
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
+
e
);
}
bufferedStream
.
reset
();
for
(
int
i
=
0
;
i
<
index
;
i
++)
{
if
(
bufferedStream
.
read
()
==
-
1
)
{
close
();
throw
new
IOException
(
FAILURE_MSG
+
"Byte stream ends in description."
);
}
}
}
public
int
read
()
throws
IOException
{
if
(
closed
)
{
throw
new
IOException
(
"Stream closed"
);
}
if
(!
descriptionParsed
)
{
parseDescription
();
// initializes 'index' and 'end'
descriptionParsed
=
true
;
}
if
(
end
!=
-
1
&&
index
>=
end
)
{
return
-
1
;
}
int
retval
=
bufferedStream
.
read
();
if
(
retval
==
-
1
)
{
index
=
end
=
0
;
// so future read() calls will fail quickly
return
-
1
;
}
index
++;
// System.out.print((char)retval);
return
retval
;
}
public
void
close
()
throws
IOException
{
if
(!
closed
)
{
closed
=
true
;
bufferedStream
.
close
();
}
}
}
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
浏览文件 @
28ea77aa
...
...
@@ -28,7 +28,6 @@ package sun.lwawt.macosx;
import
sun.lwawt.LWToolkit
;
import
sun.lwawt.LWWindowPeer
;
import
sun.lwawt.macosx.CocoaConstants
;
import
sun.lwawt.macosx.event.NSEvent
;
import
sun.awt.EmbeddedFrame
;
...
...
src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
浏览文件 @
28ea77aa
...
...
@@ -46,17 +46,16 @@ class CFileDialog implements FileDialogPeer {
@Override
public
void
run
()
{
try
{
boolean
navigateApps
=
false
;
int
dialogMode
=
target
.
getMode
(
);
navigateApps
=
true
;
boolean
navigateApps
=
!
AccessController
.
doPrivileged
(
new
GetBooleanAction
(
"apple.awt.use-file-dialog-packages"
)
);
boolean
chooseDirectories
=
AccessController
.
doPrivileged
(
new
GetBooleanAction
(
"apple.awt.fileDialogForDirectories"
))
;
int
dialogMode
=
target
.
getMode
();
String
title
=
target
.
getTitle
();
if
(
title
==
null
)
{
title
=
" "
;
}
Boolean
chooseDirectories
=
AccessController
.
doPrivileged
(
new
GetBooleanAction
(
"apple.awt.fileDialogForDirectories"
));
String
[]
userFileNames
=
nativeRunFileDialog
(
title
,
dialogMode
,
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -28,7 +28,7 @@ package sun.lwawt.macosx;
import
sun.awt.SunToolkit
;
import
sun.lwawt.LWWindowPeer
;
import
sun.lwawt.PlatformEventNotifier
;
import
sun.lwawt.macosx.event.NSEvent
;
import
java.awt.Toolkit
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.InputEvent
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -31,7 +31,6 @@ import java.awt.geom.Rectangle2D;
import
sun.awt.CGraphicsConfig
;
import
sun.awt.CGraphicsEnvironment
;
import
sun.lwawt.LWWindowPeer
;
import
sun.lwawt.macosx.event.NSEvent
;
import
sun.java2d.SurfaceData
;
import
sun.java2d.opengl.CGLLayer
;
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
28ea77aa
...
...
@@ -613,9 +613,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Add myself as a child
if
(
owner
!=
null
&&
owner
.
isVisible
())
{
CWrapper
.
NSWindow
.
addChildWindow
(
owner
.
getNSWindowPtr
(),
nsWindowPtr
,
CWrapper
.
NSWindow
.
NSWindowAbove
);
if
(
target
.
isAlwaysOnTop
())
{
CWrapper
.
NSWindow
.
setLevel
(
nsWindowPtr
,
CWrapper
.
NSWindow
.
NSFloatingWindowLevel
);
}
applyWindowLevel
(
target
);
}
// Add my own children to myself
...
...
@@ -625,9 +623,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
CPlatformWindow
pw
=
(
CPlatformWindow
)((
LWWindowPeer
)
p
).
getPlatformWindow
();
if
(
pw
!=
null
&&
pw
.
isVisible
())
{
CWrapper
.
NSWindow
.
addChildWindow
(
nsWindowPtr
,
pw
.
getNSWindowPtr
(),
CWrapper
.
NSWindow
.
NSWindowAbove
);
if
(
w
.
isAlwaysOnTop
())
{
CWrapper
.
NSWindow
.
setLevel
(
pw
.
getNSWindowPtr
(),
CWrapper
.
NSWindow
.
NSFloatingWindowLevel
);
}
pw
.
applyWindowLevel
(
w
);
}
}
}
...
...
@@ -1050,8 +1046,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
CWrapper
.
NSWindow
.
addChildWindow
(
nsWindowOwnerPtr
,
nsWindowSelfPtr
,
CWrapper
.
NSWindow
.
NSWindowAbove
);
}
if
(
target
.
isAlwaysOnTop
())
{
applyWindowLevel
(
target
);
}
protected
void
applyWindowLevel
(
Window
target
)
{
if
(
target
.
isAlwaysOnTop
()
&&
target
.
getType
()
!=
Window
.
Type
.
POPUP
)
{
CWrapper
.
NSWindow
.
setLevel
(
getNSWindowPtr
(),
CWrapper
.
NSWindow
.
NSFloatingWindowLevel
);
}
else
if
(
target
.
getType
()
==
Window
.
Type
.
POPUP
)
{
CWrapper
.
NSWindow
.
setLevel
(
getNSWindowPtr
(),
CWrapper
.
NSWindow
.
NSPopUpMenuWindowLevel
);
}
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -41,7 +41,7 @@ import javax.print.attribute.standard.PageRanges;
import
sun.java2d.*
;
import
sun.print.*
;
public
class
CPrinterJob
extends
RasterPrinterJob
{
final
class
CPrinterJob
extends
RasterPrinterJob
{
// NOTE: This uses RasterPrinterJob as a base, but it doesn't use
// all of the RasterPrinterJob functions. RasterPrinterJob will
// break down printing to pieces that aren't necessary under MacOSX
...
...
@@ -89,6 +89,7 @@ public class CPrinterJob extends RasterPrinterJob {
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
@Override
public
boolean
printDialog
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
())
{
throw
new
HeadlessException
();
...
...
@@ -131,6 +132,7 @@ public class CPrinterJob extends RasterPrinterJob {
* @see java.awt.GraphicsEnvironment#isHeadless
* @since 1.2
*/
@Override
public
PageFormat
pageDialog
(
PageFormat
page
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
())
{
throw
new
HeadlessException
();
...
...
@@ -156,12 +158,14 @@ public class CPrinterJob extends RasterPrinterJob {
* @return clone of <code>page</code>, altered to describe a default
* <code>PageFormat</code>.
*/
@Override
public
PageFormat
defaultPage
(
PageFormat
page
)
{
PageFormat
newPage
=
(
PageFormat
)
page
.
clone
();
getDefaultPage
(
newPage
);
return
newPage
;
}
@Override
protected
void
setAttributes
(
PrintRequestAttributeSet
attributes
)
throws
PrinterException
{
super
.
setAttributes
(
attributes
);
...
...
@@ -216,7 +220,7 @@ public class CPrinterJob extends RasterPrinterJob {
}
}
@Override
public
void
print
(
PrintRequestAttributeSet
attributes
)
throws
PrinterException
{
// NOTE: Some of this code is copied from RasterPrinterJob.
...
...
@@ -343,6 +347,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch across the width
* of the page.
*/
@Override
protected
double
getXRes
()
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -352,6 +357,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Returns the resolution in dots per inch down the height
* of the page.
*/
@Override
protected
double
getYRes
()
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -362,6 +368,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableX
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -372,6 +379,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableY
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -382,6 +390,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableWidth
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -392,6 +401,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPrintableHeight
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -402,6 +412,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPageWidth
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -412,6 +423,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Value is in device pixels.
* Not adjusted for orientation of the paper.
*/
@Override
protected
double
getPhysicalPageHeight
(
Paper
p
)
{
// NOTE: This is not used in the CPrinterJob code path.
return
0
;
...
...
@@ -429,6 +441,7 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* End a page.
*/
@Override
protected
void
endPage
(
PageFormat
format
,
Printable
painter
,
int
index
)
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
...
...
@@ -441,6 +454,7 @@ public class CPrinterJob extends RasterPrinterJob {
* page. The width and height of the band is
* specified by the caller.
*/
@Override
protected
void
printBand
(
byte
[]
data
,
int
x
,
int
y
,
int
width
,
int
height
)
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
...
...
@@ -450,6 +464,7 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the start of
* a print job.
*/
@Override
protected
void
startDoc
()
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
...
...
@@ -459,12 +474,14 @@ public class CPrinterJob extends RasterPrinterJob {
* Called by the print() method at the end of
* a print job.
*/
@Override
protected
void
endDoc
()
throws
PrinterException
{
// NOTE: This is not used in the CPrinterJob code path.
throw
new
PrinterException
(
sShouldNotReachHere
);
}
/* Called by cancelDoc */
@Override
protected
native
void
abortDoc
();
/**
...
...
@@ -502,10 +519,12 @@ public class CPrinterJob extends RasterPrinterJob {
/**
* validate the paper size against the current printer.
*/
@Override
protected
native
void
validatePaper
(
Paper
origPaper
,
Paper
newPaper
);
// The following methods are CPrinterJob specific.
@Override
protected
void
finalize
()
{
if
(
fNSPrintInfo
!=
-
1
)
{
dispose
(
fNSPrintInfo
);
...
...
src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import
java.awt.*
;
import
java.awt.print.*
;
public
class
CPrinterJobDialog
extends
CPrinterDialog
{
final
class
CPrinterJobDialog
extends
CPrinterDialog
{
private
Pageable
fPageable
;
private
boolean
fAllowPrintToFile
;
...
...
@@ -39,5 +39,6 @@ public class CPrinterJobDialog extends CPrinterDialog {
fAllowPrintToFile
=
allowPrintToFile
;
}
@Override
protected
native
boolean
showDialog
();
}
src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,7 +29,7 @@ package sun.lwawt.macosx;
import
java.awt.*
;
import
java.awt.print.*
;
public
class
CPrinterPageDialog
extends
CPrinterDialog
{
final
class
CPrinterPageDialog
extends
CPrinterDialog
{
private
PageFormat
fPage
;
private
Printable
fPainter
;
...
...
@@ -39,5 +39,6 @@ public class CPrinterPageDialog extends CPrinterDialog {
fPainter
=
painter
;
}
@Override
protected
native
boolean
showDialog
();
}
src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -40,11 +40,11 @@ public class CPrinterSurfaceData extends OSXSurfaceData{
// public static final SurfaceType IntArgbPQ = SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_PQ);
public
static
final
SurfaceType
IntRgbPQ
=
SurfaceType
.
IntRgb
.
deriveSubType
(
DESC_INT_RGB_PQ
);
public
static
SurfaceData
createData
(
PageFormat
pf
,
long
context
)
{
static
SurfaceData
createData
(
PageFormat
pf
,
long
context
)
{
return
new
CPrinterSurfaceData
(
CPrinterGraphicsConfig
.
getConfig
(
pf
),
context
);
}
p
ublic
CPrinterSurfaceData
(
GraphicsConfiguration
gc
,
long
context
)
{
p
rivate
CPrinterSurfaceData
(
GraphicsConfiguration
gc
,
long
context
)
{
super
(
IntRgbPQ
,
gc
.
getColorModel
(),
gc
,
gc
.
getBounds
());
initOps
(
context
,
this
.
fGraphicsStates
,
this
.
fGraphicsStatesObject
,
gc
.
getBounds
().
width
,
gc
.
getBounds
().
height
);
}
...
...
src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -27,7 +27,6 @@ package sun.lwawt.macosx;
import
sun.awt.AWTAccessor
;
import
sun.awt.SunToolkit
;
import
sun.lwawt.macosx.event.NSEvent
;
import
javax.swing.*
;
import
java.awt.*
;
...
...
@@ -76,8 +75,9 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
menuPeer
=
(
CPopupMenu
)
popup
.
getPeer
();
if
(
menuPeer
==
null
)
{
popup
.
addNotify
();
menuPeer
=
(
CPopupMenu
)
popup
.
getPeer
();
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
...
...
@@ -97,8 +97,13 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
//invocation from the AWTTrayIcon.m
public
long
getPopupMenuModel
(){
if
(
popup
==
null
)
{
PopupMenu
popupMenu
=
target
.
getPopupMenu
();
if
(
popupMenu
!=
null
)
{
popup
=
popupMenu
;
}
else
{
return
0L
;
}
}
return
checkAndCreatePopupPeer
().
getModel
();
}
...
...
@@ -134,6 +139,10 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
dummyFrame
.
dispose
();
if
(
popup
!=
null
)
{
popup
.
removeNotify
();
}
LWCToolkit
.
targetDisposedPeer
(
target
,
this
);
target
=
null
;
...
...
src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
浏览文件 @
28ea77aa
...
...
@@ -247,10 +247,7 @@ public final class CWarningWindow extends CPlatformWindow
nsWindowPtr
,
CWrapper
.
NSWindow
.
NSWindowAbove
);
// do not allow security warning to be obscured by other windows
if
(
ownerWindow
.
isAlwaysOnTop
())
{
CWrapper
.
NSWindow
.
setLevel
(
nsWindowPtr
,
CWrapper
.
NSWindow
.
NSFloatingWindowLevel
);
}
applyWindowLevel
(
ownerWindow
);
}
}
}
...
...
src/macosx/classes/sun/lwawt/macosx/CWrapper.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,73 +25,65 @@
package
sun.lwawt.macosx
;
import
java.awt.geom.Rectangle2D
;
public
final
class
CWrapper
{
final
class
CWrapper
{
private
CWrapper
()
{
}
public
static
final
class
NSWindow
{
static
final
class
NSWindow
{
// NSWindowOrderingMode
public
static
final
int
NSWindowAbove
=
1
;
public
static
final
int
NSWindowBelow
=
-
1
;
public
static
final
int
NSWindowOut
=
0
;
static
final
int
NSWindowAbove
=
1
;
static
final
int
NSWindowBelow
=
-
1
;
static
final
int
NSWindowOut
=
0
;
// Window level constants
// The number of supported levels: (we'll use more in the future)
public
static
final
int
MAX_WINDOW_LEVELS
=
2
;
static
final
int
MAX_WINDOW_LEVELS
=
3
;
// The levels: (these are NOT real constants, these are keys. See native code.)
public
static
final
int
NSNormalWindowLevel
=
0
;
public
static
final
int
NSFloatingWindowLevel
=
1
;
static
final
int
NSNormalWindowLevel
=
0
;
static
final
int
NSFloatingWindowLevel
=
1
;
static
final
int
NSPopUpMenuWindowLevel
=
2
;
// 'level' is one of the keys defined above
public
static
native
void
setLevel
(
long
window
,
int
level
);
public
static
native
void
makeKeyAndOrderFront
(
long
window
);
public
static
native
void
makeKeyWindow
(
long
window
);
public
static
native
void
makeMainWindow
(
long
window
);
public
static
native
boolean
canBecomeMainWindow
(
long
window
);
public
static
native
boolean
isKeyWindow
(
long
window
);
static
native
void
setLevel
(
long
window
,
int
level
);
public
static
native
void
orderFront
(
long
window
);
public
static
native
void
orderFrontRegardless
(
long
window
);
public
static
native
void
orderWindow
(
long
window
,
int
ordered
,
long
relativeTo
);
public
static
native
void
orderOut
(
long
window
);
static
native
void
makeKeyAndOrderFront
(
long
window
);
static
native
void
makeKeyWindow
(
long
window
);
static
native
void
makeMainWindow
(
long
window
);
static
native
boolean
canBecomeMainWindow
(
long
window
);
static
native
boolean
isKeyWindow
(
long
window
);
public
static
native
void
addChildWindow
(
long
parent
,
long
child
,
int
ordered
);
public
static
native
void
removeChildWindow
(
long
parent
,
long
child
);
static
native
void
orderFront
(
long
window
);
static
native
void
orderFrontRegardless
(
long
window
);
static
native
void
orderWindow
(
long
window
,
int
ordered
,
long
relativeTo
);
static
native
void
orderOut
(
long
window
);
public
static
native
void
setFrame
(
long
window
,
int
x
,
int
y
,
int
w
,
int
h
,
boolean
display
);
static
native
void
addChildWindow
(
long
parent
,
long
child
,
int
ordered
);
static
native
void
removeChildWindow
(
long
parent
,
long
child
);
public
static
native
void
setAlphaValue
(
long
window
,
float
alpha
);
public
static
native
void
setOpaque
(
long
window
,
boolean
opaque
);
public
static
native
void
setBackgroundColor
(
long
window
,
long
color
);
static
native
void
setAlphaValue
(
long
window
,
float
alpha
);
static
native
void
setOpaque
(
long
window
,
boolean
opaque
);
static
native
void
setBackgroundColor
(
long
window
,
long
color
);
public
static
native
void
miniaturize
(
long
window
);
public
static
native
void
deminiaturize
(
long
window
);
public
static
native
boolean
isZoomed
(
long
window
);
public
static
native
void
zoom
(
long
window
);
static
native
void
miniaturize
(
long
window
);
static
native
void
deminiaturize
(
long
window
);
static
native
boolean
isZoomed
(
long
window
);
static
native
void
zoom
(
long
window
);
public
static
native
void
makeFirstResponder
(
long
window
,
long
responder
);
static
native
void
makeFirstResponder
(
long
window
,
long
responder
);
}
public
static
final
class
NSView
{
public
static
native
void
addSubview
(
long
view
,
long
subview
);
public
static
native
void
removeFromSuperview
(
long
view
);
static
final
class
NSView
{
static
native
void
addSubview
(
long
view
,
long
subview
);
static
native
void
removeFromSuperview
(
long
view
);
public
static
native
void
setFrame
(
long
view
,
int
x
,
int
y
,
int
w
,
int
h
);
public
static
native
Rectangle2D
frame
(
long
view
);
public
static
native
long
window
(
long
view
);
static
native
void
setFrame
(
long
view
,
int
x
,
int
y
,
int
w
,
int
h
);
static
native
long
window
(
long
view
);
public
static
native
void
setHidden
(
long
view
,
boolean
hidden
);
public
static
native
void
setToolTip
(
long
view
,
String
msg
);
}
static
native
void
setHidden
(
long
view
,
boolean
hidden
);
public
static
final
class
NSObject
{
public
static
native
void
release
(
long
object
);
static
native
void
setToolTip
(
long
view
,
String
msg
);
}
public
static
final
class
NSColor
{
public
static
native
long
clearColor
();
static
final
class
NSColor
{
static
native
long
clearColor
();
}
}
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -42,6 +42,7 @@ import java.util.concurrent.Callable;
import
java.net.MalformedURLException
;
import
sun.awt.*
;
import
sun.awt.datatransfer.DataTransferer
;
import
sun.lwawt.*
;
import
sun.lwawt.LWWindowPeer.PeerType
;
import
sun.security.action.GetBooleanAction
;
...
...
@@ -112,8 +113,6 @@ public final class LWCToolkit extends LWToolkit {
private
static
final
boolean
inAWT
;
public
LWCToolkit
()
{
SunToolkit
.
setDataTransfererClassName
(
"sun.lwawt.macosx.CDataTransferer"
);
areExtraMouseButtonsEnabled
=
Boolean
.
parseBoolean
(
System
.
getProperty
(
"sun.awt.enableExtraMouseButtons"
,
"true"
));
//set system property if not yet assigned
System
.
setProperty
(
"sun.awt.enableExtraMouseButtons"
,
""
+
areExtraMouseButtonsEnabled
);
...
...
@@ -159,24 +158,13 @@ public final class LWCToolkit extends LWToolkit {
return
new
AppleSpecificColor
(
color
);
}
static
void
systemColorsChanged
()
{
// This is only called from native code.
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Object
>()
{
public
Object
run
()
{
try
{
final
Method
updateColorsMethod
=
SystemColor
.
class
.
getDeclaredMethod
(
"updateSystemColors"
,
new
Class
[
0
]);
updateColorsMethod
.
setAccessible
(
true
);
updateColorsMethod
.
invoke
(
null
,
new
Object
[
0
]);
}
catch
(
final
Throwable
e
)
{
e
.
printStackTrace
();
// swallow this if something goes horribly wrong
}
static
void
systemColorsChanged
()
{
EventQueue
.
invokeLater
(()
->
{
AccessController
.
doPrivileged
((
PrivilegedAction
<
Object
>)
()
->
{
AWTAccessor
.
getSystemColorAccessor
().
updateSystemColors
();
return
null
;
}
});
}
});
}
...
...
@@ -441,6 +429,11 @@ public final class LWCToolkit extends LWToolkit {
return
true
;
}
@Override
public
DataTransferer
getDataTransferer
()
{
return
CDataTransferer
.
getInstanceImpl
();
}
@Override
public
boolean
isAlwaysOnTopSupported
()
{
return
true
;
...
...
@@ -732,7 +725,7 @@ public final class LWCToolkit extends LWToolkit {
/*
* Returns true if the application (one of its windows) owns keyboard focus.
*/
public
native
boolean
isApplicationActive
();
native
boolean
isApplicationActive
();
/************************
* Native methods section
...
...
src/macosx/classes/sun/lwawt/macosx/
event/
NSEvent.java
→
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -23,16 +23,15 @@
* questions.
*/
package
sun.lwawt.macosx
.event
;
package
sun.lwawt.macosx
;
import
sun.lwawt.macosx.CocoaConstants
;
import
java.awt.event.*
;
/**
* A class representing Cocoa NSEvent class with the fields only necessary for
* JDK functionality.
*/
public
final
class
NSEvent
{
final
class
NSEvent
{
private
int
type
;
private
int
modifierFlags
;
...
...
@@ -50,14 +49,16 @@ public final class NSEvent {
private
short
keyCode
;
private
String
charactersIgnoringModifiers
;
public
NSEvent
(
int
type
,
int
modifierFlags
,
short
keyCode
,
String
charactersIgnoringModifiers
)
{
// Called from native
NSEvent
(
int
type
,
int
modifierFlags
,
short
keyCode
,
String
charactersIgnoringModifiers
)
{
this
.
type
=
type
;
this
.
modifierFlags
=
modifierFlags
;
this
.
keyCode
=
keyCode
;
this
.
charactersIgnoringModifiers
=
charactersIgnoringModifiers
;
}
public
NSEvent
(
int
type
,
int
modifierFlags
,
int
clickCount
,
int
buttonNumber
,
// Called from native
NSEvent
(
int
type
,
int
modifierFlags
,
int
clickCount
,
int
buttonNumber
,
int
x
,
int
y
,
int
absX
,
int
absY
,
double
scrollDeltaY
,
double
scrollDeltaX
)
{
this
.
type
=
type
;
...
...
@@ -72,51 +73,51 @@ public final class NSEvent {
this
.
scrollDeltaX
=
scrollDeltaX
;
}
public
int
getType
()
{
int
getType
()
{
return
type
;
}
public
int
getModifierFlags
()
{
int
getModifierFlags
()
{
return
modifierFlags
;
}
public
int
getClickCount
()
{
int
getClickCount
()
{
return
clickCount
;
}
public
int
getButtonNumber
()
{
int
getButtonNumber
()
{
return
buttonNumber
;
}
public
int
getX
()
{
int
getX
()
{
return
x
;
}
public
int
getY
()
{
int
getY
()
{
return
y
;
}
public
double
getScrollDeltaY
()
{
double
getScrollDeltaY
()
{
return
scrollDeltaY
;
}
public
double
getScrollDeltaX
()
{
double
getScrollDeltaX
()
{
return
scrollDeltaX
;
}
public
int
getAbsX
()
{
int
getAbsX
()
{
return
absX
;
}
public
int
getAbsY
()
{
int
getAbsY
()
{
return
absY
;
}
public
short
getKeyCode
()
{
short
getKeyCode
()
{
return
keyCode
;
}
public
String
getCharactersIgnoringModifiers
()
{
String
getCharactersIgnoringModifiers
()
{
return
charactersIgnoringModifiers
;
}
...
...
@@ -131,7 +132,7 @@ public final class NSEvent {
/*
* Converts an NSEvent button number to a MouseEvent constant.
*/
public
static
int
nsToJavaButton
(
int
buttonNumber
)
{
static
int
nsToJavaButton
(
int
buttonNumber
)
{
int
jbuttonNumber
=
buttonNumber
+
1
;
switch
(
buttonNumber
)
{
case
CocoaConstants
.
kCGMouseButtonLeft
:
...
...
@@ -150,7 +151,7 @@ public final class NSEvent {
/*
* Converts NPCocoaEvent types to AWT event types.
*/
public
static
int
npToJavaEventType
(
int
npEventType
)
{
static
int
npToJavaEventType
(
int
npEventType
)
{
int
jeventType
=
0
;
switch
(
npEventType
)
{
case
CocoaConstants
.
NPCocoaEventMouseDown
:
...
...
@@ -184,7 +185,7 @@ public final class NSEvent {
/*
* Converts NSEvent types to AWT event types.
*/
public
static
int
nsToJavaEventType
(
int
nsEventType
)
{
static
int
nsToJavaEventType
(
int
nsEventType
)
{
int
jeventType
=
0
;
switch
(
nsEventType
)
{
case
CocoaConstants
.
NSLeftMouseDown
:
...
...
@@ -227,31 +228,31 @@ public final class NSEvent {
/*
* Converts NSEvent mouse modifiers to AWT mouse modifiers.
*/
public
static
native
int
nsToJavaMouseModifiers
(
int
buttonNumber
,
static
native
int
nsToJavaMouseModifiers
(
int
buttonNumber
,
int
modifierFlags
);
/*
* Converts NSEvent key modifiers to AWT key modifiers.
*/
public
static
native
int
nsToJavaKeyModifiers
(
int
modifierFlags
);
static
native
int
nsToJavaKeyModifiers
(
int
modifierFlags
);
/*
* Converts NSEvent key info to AWT key info.
*/
public
static
native
boolean
nsToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
static
native
boolean
nsToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
/*
* Converts NSEvent key modifiers to AWT key info.
*/
public
static
native
void
nsKeyModifiersToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
static
native
void
nsKeyModifiersToJavaKeyInfo
(
int
[]
in
,
int
[]
out
);
/*
* There is a small number of NS characters that need to be converted
* into other characters before we pass them to AWT.
*/
public
static
native
char
nsToJavaChar
(
char
nsChar
,
int
modifierFlags
);
static
native
char
nsToJavaChar
(
char
nsChar
,
int
modifierFlags
);
public
static
boolean
isPopupTrigger
(
int
jmodifiers
)
{
static
boolean
isPopupTrigger
(
int
jmodifiers
)
{
final
boolean
isRightButtonDown
=
((
jmodifiers
&
InputEvent
.
BUTTON3_DOWN_MASK
)
!=
0
);
final
boolean
isLeftButtonDown
=
((
jmodifiers
&
InputEvent
.
BUTTON1_DOWN_MASK
)
!=
0
);
final
boolean
isControlDown
=
((
jmodifiers
&
InputEvent
.
CTRL_DOWN_MASK
)
!=
0
);
...
...
src/macosx/lib/flavormap.properties
浏览文件 @
28ea77aa
...
...
@@ -79,3 +79,5 @@ JFIF=image/x-java-image;class=java.awt.Image
TIFF=image/x-java-image;class=java.awt.Image
RICH_TEXT=text/rtf
HTML=text/html;charset=utf-8;eoln="
\r\n
";terminators=1
URL=application/x-java-url;class=java.net.URL
URL=text/uri-list;eoln="
\r\n
";terminators=1
src/macosx/native/sun/awt/AWTEvent.m
浏览文件 @
28ea77aa
/*
*
Copyright
(
c
)
2011
,
201
3
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
Copyright
(
c
)
2011
,
201
4
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
DO
NOT
ALTER
OR
REMOVE
COPYRIGHT
NOTICES
OR
THIS
FILE
HEADER
.
*
*
This
code
is
free
software
;
you
can
redistribute
it
and
/
or
modify
it
...
...
@@ -633,12 +633,12 @@ Java_java_awt_AWTEvent_nativeSetSource
}
/*
*
Class
:
sun
_
lwawt
_
macosx
_
event
_
NSEvent
*
Class
:
sun
_
lwawt
_
macosx
_
NSEvent
*
Method
:
nsToJavaMouseModifiers
*
Signature
:
(
II
)
I
*/
JNIEXPORT
jint
JNICALL
Java
_
sun
_
lwawt
_
macosx
_
event
_
NSEvent
_
nsToJavaMouseModifiers
Java
_
sun
_
lwawt
_
macosx
_
NSEvent
_
nsToJavaMouseModifiers
(
JNIEnv
*
env
,
jclass
cls
,
jint
buttonNumber
,
jint
modifierFlags
)
{
jint
jmodifiers
=
0
;
...
...
@@ -653,12 +653,12 @@ JNF_COCOA_EXIT(env);
}
/*
*
Class
:
sun
_
lwawt
_
macosx
_
event
_
NSEvent
*
Class
:
sun
_
lwawt
_
macosx
_
NSEvent
*
Method
:
nsToJavaKeyModifiers
*
Signature
:
(
I
)
I
*/
JNIEXPORT
jint
JNICALL
Java
_
sun
_
lwawt
_
macosx
_
event
_
NSEvent
_
nsToJavaKeyModifiers
Java
_
sun
_
lwawt
_
macosx
_
NSEvent
_
nsToJavaKeyModifiers
(
JNIEnv
*
env
,
jclass
cls
,
jint
modifierFlags
)
{
jint
jmodifiers
=
0
;
...
...
@@ -673,12 +673,12 @@ JNF_COCOA_EXIT(env);
}
/*
*
Class
:
sun
_
lwawt
_
macosx
_
event
_
NSEvent
*
Class
:
sun
_
lwawt
_
macosx
_
NSEvent
*
Method
:
nsToJavaKeyInfo
*
Signature
:
([
I
[
I
)
Z
*/
JNIEXPORT
jboolean
JNICALL
Java
_
sun
_
lwawt
_
macosx
_
event
_
NSEvent
_
nsToJavaKeyInfo
Java
_
sun
_
lwawt
_
macosx
_
NSEvent
_
nsToJavaKeyInfo
(
JNIEnv
*
env
,
jclass
cls
,
jintArray
inData
,
jintArray
outData
)
{
BOOL
postsTyped
=
NO
;
...
...
@@ -715,12 +715,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_
event_
NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsKeyModifiersToJavaKeyInfo
* Signature: ([I[I)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_
event_
NSEvent_nsKeyModifiersToJavaKeyInfo
Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
(JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
{
JNF_COCOA_ENTER(env);
...
...
@@ -753,12 +753,12 @@ JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_
event_
NSEvent
* Class: sun_lwawt_macosx_NSEvent
* Method: nsToJavaChar
* Signature: (CI)C
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_
event_
NSEvent_nsToJavaChar
Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
{
jchar javaChar = 0;
...
...
src/macosx/native/sun/awt/AWTView.h
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,7 +29,7 @@
#import "CDragSource.h"
#import "CDropTarget.h"
@interface
AWTView
:
NSView
<
NSTextInputClient
>
{
@interface
AWTView
:
NSView
<
NSTextInputClient
,
CDragSourceHolder
,
CDropTargetHolder
>
{
@private
jobject
m_cPlatformView
;
...
...
@@ -61,14 +61,8 @@
-
(
id
)
initWithRect
:(
NSRect
)
rect
platformView
:
(
jobject
)
cPlatformView
windowLayer
:(
CALayer
*
)
windowLayer
;
-
(
void
)
deliverJavaMouseEvent
:
(
NSEvent
*
)
event
;
-
(
void
)
resetTrackingArea
;
-
(
void
)
deliverJavaKeyEventHelper
:
(
NSEvent
*
)
event
;
-
(
jobject
)
awtComponent
:(
JNIEnv
*
)
env
;
-
(
void
)
setDragSource
:(
CDragSource
*
)
source
;
-
(
void
)
setDropTarget
:(
CDropTarget
*
)
target
;
// Input method-related events
-
(
void
)
setInputMethod
:(
jobject
)
inputMethod
;
-
(
void
)
abandonInput
;
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -42,6 +42,10 @@
@interface
AWTView
()
@property
(
retain
)
CDropTarget
*
_dropTarget
;
@property
(
retain
)
CDragSource
*
_dragSource
;
-
(
void
)
deliverResize
:
(
NSRect
)
rect
;
-
(
void
)
resetTrackingArea
;
-
(
void
)
deliverJavaKeyEventHelper
:
(
NSEvent
*
)
event
;
@end
// Uncomment this line to see fprintfs of each InputMethod API being called on this View
...
...
@@ -376,7 +380,7 @@ AWT_ASSERT_APPKIT_THREAD;
clickCount
=
[
event
clickCount
];
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/
event/
NSEvent"
);
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IIIIIIIIDD)V"
);
jobject
jEvent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
...
...
@@ -393,7 +397,7 @@ AWT_ASSERT_APPKIT_THREAD;
}
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverMouseEvent
,
jc_PlatformView
,
"deliverMouseEvent"
,
"(Lsun/lwawt/macosx/
event/
NSEvent;)V"
);
static
JNF_MEMBER_CACHE
(
jm_deliverMouseEvent
,
jc_PlatformView
,
"deliverMouseEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverMouseEvent
,
jEvent
);
}
...
...
@@ -441,7 +445,7 @@ AWT_ASSERT_APPKIT_THREAD;
characters
=
JNFNSToJavaString
(
env
,
[
event
characters
]);
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/
event/
NSEvent"
);
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IISLjava/lang/String;)V"
);
jobject
jevent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
...
...
@@ -451,7 +455,7 @@ AWT_ASSERT_APPKIT_THREAD;
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverKeyEvent
,
jc_PlatformView
,
"deliverKeyEvent"
,
"(Lsun/lwawt/macosx/
event/
NSEvent;)V"
);
"deliverKeyEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverKeyEvent
,
jevent
);
if
(
characters
!=
NULL
)
{
...
...
src/macosx/native/sun/awt/CDragSource.h
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,9 +29,15 @@
#import <Cocoa/Cocoa.h>
#include <jni.h>
@class
CDragSource
;
@protocol
CDragSourceHolder
-
(
void
)
setDragSource
:(
CDragSource
*
)
source
;
@end
@interface
CDragSource
:
NSObject
{
@private
NSView
*
fView
;
NSView
<
CDragSourceHolder
>*
fView
;
jobject
fComponent
;
jobject
fDragSourceContextPeer
;
...
...
@@ -53,8 +59,6 @@
jint
fDragMouseModifiers
;
}
+
(
CDragSource
*
)
currentDragSource
;
// Common methods:
-
(
id
)
init
:(
jobject
)
jDragSourceContextPeer
component
:(
jobject
)
jComponent
...
...
@@ -84,13 +88,6 @@
-
(
void
)
draggedImage
:(
NSImage
*
)
image
movedTo
:(
NSPoint
)
screenPoint
;
-
(
BOOL
)
ignoreModifierKeysWhileDragging
;
// Updates from the destination to the source
-
(
void
)
postDragEnter
;
-
(
void
)
postDragExit
;
// Utility
-
(
NSPoint
)
mapNSScreenPointToJavaWithOffset
:(
NSPoint
)
point
;
@end
#endif // CDragSource_h
src/macosx/native/sun/awt/CDragSource.m
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -75,14 +75,17 @@ JNF_CLASS_CACHE(CImageClass, "sun/lwawt/macosx/CImage");
static
NSDragOperation
sDragOperation
;
static
NSPoint
sDraggingLocation
;
static
CDragSource
*
sCurrentDragSource
;
static
BOOL
sNeedsEnter
;
@implementation
CDragSource
@interface
CDragSource
()
// Updates from the destination to the source
-
(
void
)
postDragEnter
;
-
(
void
)
postDragExit
;
// Utility
-
(
NSPoint
)
mapNSScreenPointToJavaWithOffset
:(
NSPoint
)
point
;
@end
+
(
CDragSource
*
)
currentDragSource
{
return
sCurrentDragSource
;
}
@implementation
CDragSource
-
(
id
)
init
:(
jobject
)
jDragSourceContextPeer
component
:(
jobject
)
jComponent
...
...
@@ -515,8 +518,6 @@ static BOOL sNeedsEnter;
fDragKeyModifiers
=
[
DnDUtilities
extractJavaExtKeyModifiersFromJavaExtModifiers
:
fModifiers
];
fDragMouseModifiers
=
[
DnDUtilities
extractJavaExtMouseModifiersFromJavaExtModifiers
:
fModifiers
];
// Set the current DragSource
sCurrentDragSource
=
self
;
sNeedsEnter
=
YES
;
@try
{
...
...
@@ -566,8 +567,6 @@ static BOOL sNeedsEnter;
JNF_MEMBER_CACHE
(
resetHoveringMethod
,
CDragSourceContextPeerClass
,
"resetHovering"
,
"()V"
);
JNFCallVoidMethod
(
env
,
fDragSourceContextPeer
,
resetHoveringMethod
);
// Hust reset static variable
}
@finally
{
// Clear the current DragSource
sCurrentDragSource
=
nil
;
sNeedsEnter
=
NO
;
}
...
...
src/macosx/native/sun/awt/CDropTarget.h
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -31,9 +31,15 @@
@class
ControlModel
;
@class
CDropTarget
;
@protocol
CDropTargetHolder
-
(
void
)
setDropTarget
:(
CDropTarget
*
)
target
;
@end
@interface
CDropTarget
:
NSObject
{
@private
NSView
*
fView
;
NSView
<
CDropTargetHolder
>*
fView
;
jobject
fComponent
;
jobject
fDropTarget
;
jobject
fDropTargetContextPeer
;
...
...
src/macosx/native/sun/awt/CTrayIcon.m
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -135,7 +135,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
clickCount
=
[
event
clickCount
];
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/
event/
NSEvent"
);
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IIIIIIIIDD)V"
);
jobject
jEvent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
...
...
@@ -152,7 +152,7 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
}
static
JNF_CLASS_CACHE
(
jc_TrayIcon
,
"sun/lwawt/macosx/CTrayIcon"
);
static
JNF_MEMBER_CACHE
(
jm_handleMouseEvent
,
jc_TrayIcon
,
"handleMouseEvent"
,
"(Lsun/lwawt/macosx/
event/
NSEvent;)V"
);
static
JNF_MEMBER_CACHE
(
jm_handleMouseEvent
,
jc_TrayIcon
,
"handleMouseEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
peer
,
jm_handleMouseEvent
,
jEvent
);
}
...
...
src/macosx/native/sun/awt/CWrapper.m
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -23,37 +23,10 @@
* questions.
*/
#import "CWrapper.h"
#import
<JavaNativeFoundation
/
JavaNativeFoundation.h
>
#import "AWTWindow.h"
#import "LWCToolkit.h"
#import "GeomUtilities.h"
#import "ThreadUtilities.h"
#import "sun_lwawt_macosx_CWrapper_NSWindow.h"
/*
* Class: sun_lwawt_macosx_CWrapper$NSObject
* Method: release
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSObject_release
(JNIEnv *env, jclass cls, jlong objectPtr)
{
JNF_COCOA_ENTER(env);
id obj = (id)jlong_to_ptr(objectPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
CFRelease(obj);
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSWindow
* Method: makeKeyAndOrderFront
...
...
@@ -249,6 +222,7 @@ static void initLevels()
dispatch_once(
&
pred, ^{
LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSNormalWindowLevel] = NSNormalWindowLevel;
LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSFloatingWindowLevel] = NSFloatingWindowLevel;
LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSPopUpMenuWindowLevel] = NSPopUpMenuWindowLevel;
});
}
...
...
@@ -308,8 +282,8 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_removeChildWindow
{
JNF_COCOA_ENTER
(
env
);
AWTWindow
*parent =
(AWT
Window
*
)
jlong_to_ptr
(
parentPtr
);
AWTWindow
*child =
(AWT
Window
*
)
jlong_to_ptr
(
childPtr
);
NSWindow
*parent =
(NS
Window
*
)
jlong_to_ptr
(
parentPtr
);
NSWindow
*child =
(NS
Window
*
)
jlong_to_ptr
(
childPtr
);
[
ThreadUtilities
performOnMainThread:
@
selector
(
removeChildWindow:
)
on:parent
withObject:child
...
...
@@ -318,26 +292,6 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT
(
env
);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSWindow
*
Method:
setFrame
*
Signature:
(
JIIIIZ
)
V
*
/
JNIEXPORT
void
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setFrame
(
JNIEnv
*env
,
jclass
cls
,
jlong
windowPtr
,
jint
x
,
jint
y
,
jint
w
,
jint
h
,
jboolean
display
)
{
JNF_COCOA_ENTER
(
env
);
AWTWindow
*window =
(AWTWindow
*
)
jlong_to_ptr
(
windowPtr
);
NSRect
frame =
NSMakeRect(x,
y
,
w
,
h
);
[
ThreadUtilities
performOnMainThreadWaiting:NO
block:
^(){
[
window
setFrame:frame
display:display
];
}];
JNF_COCOA_EXIT
(
env
);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSWindow
*
Method:
setAlphaValue
...
...
@@ -349,7 +303,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setAlphaValue
{
JNF_COCOA_ENTER
(
env
);
AWTWindow
*window =
(AWT
Window
*
)
jlong_to_ptr
(
windowPtr
);
NSWindow
*window =
(NS
Window
*
)
jlong_to_ptr
(
windowPtr
);
[
ThreadUtilities
performOnMainThreadWaiting:NO
block:
^(){
[
window
setAlphaValue:
(
CGFloat
)
alpha
];
}];
...
...
@@ -368,7 +322,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setOpaque
{
JNF_COCOA_ENTER
(
env
);
AWTWindow
*window =
(AWT
Window
*
)
jlong_to_ptr
(
windowPtr
);
NSWindow
*window =
(NS
Window
*
)
jlong_to_ptr
(
windowPtr
);
[
ThreadUtilities
performOnMainThreadWaiting:NO
block:
^(){
[
window
setOpaque:
(
BOOL
)
opaque
];
}];
...
...
@@ -387,7 +341,7 @@ Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setBackgroundColor
{
JNF_COCOA_ENTER
(
env
);
AWTWindow
*window =
(AWT
Window
*
)
jlong_to_ptr
(
windowPtr
);
NSWindow
*window =
(NS
Window
*
)
jlong_to_ptr
(
windowPtr
);
NSColor
*color =
(NSColor
*
)
jlong_to_ptr
(
colorPtr
);
[
ThreadUtilities
performOnMainThreadWaiting:NO
block:
^(){
[
window
setBackgroundColor:color
];
...
...
@@ -397,6 +351,7 @@ JNF_COCOA_EXIT(env);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSWindow
*
Method:
miniaturize
*
Signature:
(
J
)
V
*
/
...
...
@@ -558,33 +513,6 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT
(
env
);
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSView
*
Method:
frame
*
Signature:
(
J
)
Ljava
/
awt
/
Rectangle
;
*
/
JNIEXPORT
jobject
JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSView_frame
(
JNIEnv
*env
,
jclass
cls
,
jlong
viewPtr
)
{
jobject
jRect =
NULL;
JNF_COCOA_ENTER
(
env
);
__block
NSRect
rect =
NSZeroRect;
NSView
*view =
(NSView
*
)
jlong_to_ptr
(
viewPtr
);
[
ThreadUtilities
performOnMainThreadWaiting:YES
block:
^(){
rect =
[view
frame
];
}];
jRect =
NSToJavaRect(env,
rect
);
JNF_COCOA_EXIT
(
env
);
return
jRect
;
}
/
*
*
Class:
sun_lwawt_macosx_CWrapper
$
NSView
*
Method:
window
...
...
src/share/classes/java/awt/DefaultKeyboardFocusManager.java
浏览文件 @
28ea77aa
...
...
@@ -287,7 +287,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
synchronized
(
this
)
{
KeyEvent
ke
=
enqueuedKeyEvents
.
isEmpty
()
?
null
:
enqueuedKeyEvents
.
getFirst
();
if
(
ke
!=
null
&&
time
>=
ke
.
getWhen
())
{
TypeAheadMarker
marker
=
typeAheadMarkers
.
getFirst
();
TypeAheadMarker
marker
=
typeAheadMarkers
.
isEmpty
()
?
null
:
typeAheadMarkers
.
getFirst
();
if
(
marker
!=
null
)
{
Window
toplevel
=
marker
.
untilFocused
.
getContainingWindow
();
// Check that the component awaiting focus belongs to
...
...
src/share/classes/java/awt/SystemColor.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -24,6 +24,8 @@
*/
package
java.awt
;
import
sun.awt.AWTAccessor
;
import
java.io.ObjectStreamException
;
import
java.lang.annotation.Native
;
...
...
@@ -459,6 +461,7 @@ public final class SystemColor extends Color implements java.io.Serializable {
};
static
{
AWTAccessor
.
setSystemColorAccessor
(
SystemColor:
:
updateSystemColors
);
updateSystemColors
();
}
...
...
src/share/classes/java/awt/datatransfer/DataFlavor.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -570,7 +570,7 @@ public class DataFlavor implements Externalizable, Cloneable {
if
(
DataTransferer
.
isFlavorCharsetTextType
(
this
)
&&
(
isRepresentationClassInputStream
()
||
isRepresentationClassByteBuffer
()
||
DataTransferer
.
byteArrayC
lass
.
equals
(
representationClass
)))
byte
[].
c
lass
.
equals
(
representationClass
)))
{
params
+=
";charset="
+
DataTransferer
.
getTextCharset
(
this
);
}
...
...
@@ -1015,7 +1015,7 @@ public class DataFlavor implements Externalizable, Cloneable {
!(
isRepresentationClassReader
()
||
String
.
class
.
equals
(
representationClass
)
||
isRepresentationClassCharBuffer
()
||
DataTransferer
.
charArrayC
lass
.
equals
(
representationClass
)))
char
[].
c
lass
.
equals
(
representationClass
)))
{
String
thisCharset
=
DataTransferer
.
canonicalName
(
getParameter
(
"charset"
));
...
...
@@ -1100,8 +1100,7 @@ public class DataFlavor implements Externalizable, Cloneable {
!(
isRepresentationClassReader
()
||
String
.
class
.
equals
(
representationClass
)
||
isRepresentationClassCharBuffer
()
||
DataTransferer
.
charArrayClass
.
equals
(
representationClass
)))
char
[].
class
.
equals
(
representationClass
)))
{
String
charset
=
DataTransferer
.
canonicalName
(
getParameter
(
"charset"
));
...
...
src/share/classes/java/awt/dnd/DragGestureEvent.java
浏览文件 @
28ea77aa
...
...
@@ -36,6 +36,7 @@ import java.awt.event.InputEvent;
import
java.awt.datatransfer.Transferable
;
import
java.io.InvalidObjectException
;
import
java.util.EventObject
;
import
java.util.Collections
;
...
...
@@ -329,22 +330,50 @@ public class DragGestureEvent extends EventObject {
{
ObjectInputStream
.
GetField
f
=
s
.
readFields
();
dragSource
=
(
DragSource
)
f
.
get
(
"dragSource"
,
null
);
component
=
(
Component
)
f
.
get
(
"component"
,
null
);
origin
=
(
Point
)
f
.
get
(
"origin"
,
null
);
action
=
f
.
get
(
"action"
,
0
);
DragSource
newDragSource
=
(
DragSource
)
f
.
get
(
"dragSource"
,
null
);
if
(
newDragSource
==
null
)
{
throw
new
InvalidObjectException
(
"null DragSource"
);
}
dragSource
=
newDragSource
;
Component
newComponent
=
(
Component
)
f
.
get
(
"component"
,
null
);
if
(
newComponent
==
null
)
{
throw
new
InvalidObjectException
(
"null component"
);
}
component
=
newComponent
;
Point
newOrigin
=
(
Point
)
f
.
get
(
"origin"
,
null
);
if
(
newOrigin
==
null
)
{
throw
new
InvalidObjectException
(
"null origin"
);
}
origin
=
newOrigin
;
int
newAction
=
f
.
get
(
"action"
,
0
);
if
(
newAction
!=
DnDConstants
.
ACTION_COPY
&&
newAction
!=
DnDConstants
.
ACTION_MOVE
&&
newAction
!=
DnDConstants
.
ACTION_LINK
)
{
throw
new
InvalidObjectException
(
"bad action"
);
}
action
=
newAction
;
// Pre-1.4 support. 'events' was previously non-transient
List
newEvents
;
try
{
e
vents
=
(
List
)
f
.
get
(
"events"
,
null
);
newE
vents
=
(
List
)
f
.
get
(
"events"
,
null
);
}
catch
(
IllegalArgumentException
e
)
{
// 1.4-compatible byte stream. 'events' was written explicitly
e
vents
=
(
List
)
s
.
readObject
();
newE
vents
=
(
List
)
s
.
readObject
();
}
// Implementation assumes 'events' is never null.
if
(
events
==
null
)
{
events
=
Collections
.
EMPTY_LIST
;
if
(
newEvents
!=
null
&&
newEvents
.
isEmpty
())
{
// Constructor treats empty events list as invalid value
// Throw exception if serialized list is empty
throw
new
InvalidObjectException
(
"empty list of events"
);
}
else
if
(
newEvents
==
null
)
{
newEvents
=
Collections
.
emptyList
();
}
events
=
newEvents
;
}
/*
...
...
src/share/classes/java/awt/dnd/DragGestureRecognizer.java
浏览文件 @
28ea77aa
...
...
@@ -29,6 +29,8 @@ import java.awt.event.InputEvent;
import
java.awt.Component
;
import
java.awt.Point
;
import
java.io.InvalidObjectException
;
import
java.util.Collections
;
import
java.util.TooManyListenersException
;
import
java.util.ArrayList
;
...
...
@@ -411,10 +413,21 @@ public abstract class DragGestureRecognizer implements Serializable {
*
* @since 1.4
*/
@SuppressWarnings
(
"unchecked"
)
private
void
readObject
(
ObjectInputStream
s
)
throws
ClassNotFoundException
,
IOException
{
s
.
defaultReadObject
();
ObjectInputStream
.
GetField
f
=
s
.
readFields
();
DragSource
newDragSource
=
(
DragSource
)
f
.
get
(
"dragSource"
,
null
);
if
(
newDragSource
==
null
)
{
throw
new
InvalidObjectException
(
"null DragSource"
);
}
dragSource
=
newDragSource
;
component
=
(
Component
)
f
.
get
(
"component"
,
null
);
sourceActions
=
f
.
get
(
"sourceActions"
,
0
)
&
(
DnDConstants
.
ACTION_COPY_OR_MOVE
|
DnDConstants
.
ACTION_LINK
);
events
=
(
ArrayList
<
InputEvent
>)
f
.
get
(
"events"
,
new
ArrayList
<>(
1
));
dragGestureListener
=
(
DragGestureListener
)
s
.
readObject
();
}
...
...
src/share/classes/java/awt/dnd/DragSourceContext.java
浏览文件 @
28ea77aa
...
...
@@ -37,6 +37,7 @@ import java.awt.datatransfer.UnsupportedFlavorException;
import
java.awt.dnd.peer.DragSourceContextPeer
;
import
java.io.IOException
;
import
java.io.InvalidObjectException
;
import
java.io.ObjectOutputStream
;
import
java.io.ObjectInputStream
;
import
java.io.Serializable
;
...
...
@@ -562,7 +563,36 @@ public class DragSourceContext
private
void
readObject
(
ObjectInputStream
s
)
throws
ClassNotFoundException
,
IOException
{
s
.
defaultReadObject
();
ObjectInputStream
.
GetField
f
=
s
.
readFields
();
DragGestureEvent
newTrigger
=
(
DragGestureEvent
)
f
.
get
(
"trigger"
,
null
);
if
(
newTrigger
==
null
)
{
throw
new
InvalidObjectException
(
"Null trigger"
);
}
if
(
newTrigger
.
getDragSource
()
==
null
)
{
throw
new
InvalidObjectException
(
"Null DragSource"
);
}
if
(
newTrigger
.
getComponent
()
==
null
)
{
throw
new
InvalidObjectException
(
"Null trigger component"
);
}
int
DGRActions
=
newTrigger
.
getSourceAsDragGestureRecognizer
().
getSourceActions
()
&
(
DnDConstants
.
ACTION_COPY_OR_MOVE
|
DnDConstants
.
ACTION_LINK
);
if
(
DGRActions
==
DnDConstants
.
ACTION_NONE
)
{
throw
new
InvalidObjectException
(
"Invalid source actions"
);
}
int
triggerActions
=
newTrigger
.
getDragAction
();
if
(
triggerActions
!=
DnDConstants
.
ACTION_COPY
&&
triggerActions
!=
DnDConstants
.
ACTION_MOVE
&&
triggerActions
!=
DnDConstants
.
ACTION_LINK
)
{
throw
new
InvalidObjectException
(
"No drag action"
);
}
trigger
=
newTrigger
;
cursor
=
(
Cursor
)
f
.
get
(
"cursor"
,
null
);
useCustomCursor
=
f
.
get
(
"useCustomCursor"
,
false
);
sourceActions
=
f
.
get
(
"sourceActions"
,
0
)
&
(
DnDConstants
.
ACTION_COPY_OR_MOVE
|
DnDConstants
.
ACTION_LINK
);
transferable
=
(
Transferable
)
s
.
readObject
();
listener
=
(
DragSourceListener
)
s
.
readObject
();
...
...
@@ -630,5 +660,5 @@ public class DragSourceContext
*
* @serial
*/
private
final
int
sourceActions
;
private
int
sourceActions
;
}
src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
浏览文件 @
28ea77aa
...
...
@@ -200,6 +200,13 @@ import static sun.invoke.util.Wrapper.isWrapperType;
implIsInstanceMethod
?
"instance"
:
"static"
,
implInfo
,
instantiatedArity
,
samArity
));
}
for
(
MethodType
bridgeMT
:
additionalBridges
)
{
if
(
bridgeMT
.
parameterCount
()
!=
samArity
)
{
throw
new
LambdaConversionException
(
String
.
format
(
"Incorrect number of parameters for bridge signature %s; incompatible with %s"
,
bridgeMT
,
samMethodType
));
}
}
// If instance: first captured arg (receiver) must be subtype of class where impl method is defined
final
int
capturedStart
;
...
...
@@ -274,11 +281,18 @@ import static sun.invoke.util.Wrapper.isWrapperType;
String
.
format
(
"Type mismatch for lambda return: %s is not convertible to %s"
,
actualReturnType
,
expectedType
));
}
if
(!
isAdaptableToAsReturn
(
expectedType
,
samReturnType
))
{
if
(!
isAdaptableToAsReturn
Strict
(
expectedType
,
samReturnType
))
{
throw
new
LambdaConversionException
(
String
.
format
(
"Type mismatch for lambda expected return: %s is not convertible to %s"
,
expectedType
,
samReturnType
));
}
for
(
MethodType
bridgeMT
:
additionalBridges
)
{
if
(!
isAdaptableToAsReturnStrict
(
expectedType
,
bridgeMT
.
returnType
()))
{
throw
new
LambdaConversionException
(
String
.
format
(
"Type mismatch for lambda expected return: %s is not convertible to %s"
,
expectedType
,
bridgeMT
.
returnType
()));
}
}
}
/**
...
...
@@ -330,6 +344,10 @@ import static sun.invoke.util.Wrapper.isWrapperType;
return
toType
.
equals
(
void
.
class
)
||
!
fromType
.
equals
(
void
.
class
)
&&
isAdaptableTo
(
fromType
,
toType
,
false
);
}
private
boolean
isAdaptableToAsReturnStrict
(
Class
<?>
fromType
,
Class
<?>
toType
)
{
if
(
fromType
.
equals
(
void
.
class
))
return
toType
.
equals
(
void
.
class
);
return
isAdaptableTo
(
fromType
,
toType
,
true
);
}
/*********** Logging support -- for debugging only, uncomment as needed
...
...
src/share/classes/java/lang/invoke/TypeConvertingMethodAdapter.java
浏览文件 @
28ea77aa
...
...
@@ -212,7 +212,7 @@ class TypeConvertingMethodAdapter extends MethodVisitor {
* @param functional
*/
void
convertType
(
Class
<?>
arg
,
Class
<?>
target
,
Class
<?>
functional
)
{
if
(
arg
.
equals
(
target
))
{
if
(
arg
.
equals
(
target
)
&&
arg
.
equals
(
functional
)
)
{
return
;
}
if
(
arg
==
Void
.
TYPE
||
target
==
Void
.
TYPE
)
{
...
...
src/share/classes/sun/awt/AWTAccessor.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -728,6 +728,13 @@ public final class AWTAccessor {
void
dispose
(
InvocationEvent
event
);
}
/*
* An accessor object for the SystemColor class
*/
public
interface
SystemColorAccessor
{
void
updateSystemColors
();
}
/*
* Accessor instances are initialized in the static initializers of
* corresponding AWT classes by using setters defined below.
...
...
@@ -757,6 +764,7 @@ public final class AWTAccessor {
private
static
SequencedEventAccessor
sequencedEventAccessor
;
private
static
ToolkitAccessor
toolkitAccessor
;
private
static
InvocationEventAccessor
invocationEventAccessor
;
private
static
SystemColorAccessor
systemColorAccessor
;
/*
* Set an accessor object for the java.awt.Component class.
...
...
@@ -1182,4 +1190,22 @@ public final class AWTAccessor {
public
static
InvocationEventAccessor
getInvocationEventAccessor
()
{
return
invocationEventAccessor
;
}
/*
* Get the accessor object for the java.awt.SystemColor class.
*/
public
static
SystemColorAccessor
getSystemColorAccessor
()
{
if
(
systemColorAccessor
==
null
)
{
unsafe
.
ensureClassInitialized
(
SystemColor
.
class
);
}
return
systemColorAccessor
;
}
/*
* Set the accessor object for the java.awt.SystemColor class.
*/
public
static
void
setSystemColorAccessor
(
SystemColorAccessor
systemColorAccessor
)
{
AWTAccessor
.
systemColorAccessor
=
systemColorAccessor
;
}
}
src/share/classes/sun/awt/HToolkit.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,6 +25,8 @@
package
sun.awt
;
import
sun.awt.datatransfer.DataTransferer
;
import
java.awt.*
;
import
java.awt.dnd.*
;
import
java.awt.dnd.peer.DragSourceContextPeer
;
...
...
@@ -184,6 +186,11 @@ public class HToolkit extends SunToolkit
return
false
;
}
@Override
public
DataTransferer
getDataTransferer
()
{
return
null
;
}
public
GlobalCursorManager
getGlobalCursorManager
()
throws
HeadlessException
{
throw
new
HeadlessException
();
...
...
src/share/classes/sun/awt/SunToolkit.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -46,6 +46,7 @@ import java.util.concurrent.locks.Condition;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.ReentrantLock
;
import
sun.awt.datatransfer.DataTransferer
;
import
sun.security.util.SecurityConstants
;
import
sun.util.logging.PlatformLogger
;
import
sun.misc.SoftCache
;
...
...
@@ -203,6 +204,8 @@ public abstract class SunToolkit extends Toolkit
public
abstract
boolean
isTraySupported
();
public
abstract
DataTransferer
getDataTransferer
();
@SuppressWarnings
(
"deprecation"
)
public
abstract
FontPeer
getFontPeer
(
String
name
,
int
style
);
...
...
@@ -1191,19 +1194,6 @@ public abstract class SunToolkit extends Toolkit
return
getStartupLocale
();
}
private
static
String
dataTransfererClassName
=
null
;
protected
static
void
setDataTransfererClassName
(
String
className
)
{
dataTransfererClassName
=
className
;
}
public
static
String
getDataTransfererClassName
()
{
if
(
dataTransfererClassName
==
null
)
{
Toolkit
.
getDefaultToolkit
();
// transferer set during toolkit init
}
return
dataTransfererClassName
;
}
// Support for window closing event notifications
private
transient
WindowClosingListener
windowClosingListener
=
null
;
/**
...
...
src/share/classes/sun/awt/datatransfer/DataTransferer.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2000, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,10 +25,10 @@
package
sun.awt.datatransfer
;
import
java.awt.AWTError
;
import
java.awt.EventQueue
;
import
java.awt.Image
;
import
java.awt.Graphics
;
import
java.awt.Image
;
import
java.awt.Toolkit
;
import
java.awt.datatransfer.DataFlavor
;
import
java.awt.datatransfer.FlavorMap
;
...
...
@@ -137,16 +137,6 @@ import java.io.FilePermission;
*/
public
abstract
class
DataTransferer
{
/**
* Cached value of Class.forName("[C");
*/
public
static
final
Class
charArrayClass
;
/**
* Cached value of Class.forName("[B");
*/
public
static
final
Class
byteArrayClass
;
/**
* The <code>DataFlavor</code> representing plain text with Unicode
* encoding, where:
...
...
@@ -241,15 +231,6 @@ public abstract class DataTransferer {
private
static
final
PlatformLogger
dtLog
=
PlatformLogger
.
getLogger
(
"sun.awt.datatransfer.DataTransfer"
);
static
{
Class
tCharArrayClass
=
null
,
tByteArrayClass
=
null
;
try
{
tCharArrayClass
=
Class
.
forName
(
"[C"
);
tByteArrayClass
=
Class
.
forName
(
"[B"
);
}
catch
(
ClassNotFoundException
cannotHappen
)
{
}
charArrayClass
=
tCharArrayClass
;
byteArrayClass
=
tByteArrayClass
;
DataFlavor
tPlainTextStringFlavor
=
null
;
try
{
tPlainTextStringFlavor
=
new
DataFlavor
...
...
@@ -290,63 +271,8 @@ public abstract class DataTransferer {
* that in a headless environment, there may be no DataTransferer instance;
* instead, null will be returned.
*/
public
static
DataTransferer
getInstance
()
{
synchronized
(
DataTransferer
.
class
)
{
if
(
transferer
==
null
)
{
final
String
name
=
SunToolkit
.
getDataTransfererClassName
();
if
(
name
!=
null
)
{
PrivilegedAction
<
DataTransferer
>
action
=
new
PrivilegedAction
<
DataTransferer
>()
{
public
DataTransferer
run
()
{
Class
cls
=
null
;
Method
method
=
null
;
DataTransferer
ret
=
null
;
try
{
cls
=
Class
.
forName
(
name
);
}
catch
(
ClassNotFoundException
e
)
{
ClassLoader
cl
=
ClassLoader
.
getSystemClassLoader
();
if
(
cl
!=
null
)
{
try
{
cls
=
cl
.
loadClass
(
name
);
}
catch
(
ClassNotFoundException
ee
)
{
ee
.
printStackTrace
();
throw
new
AWTError
(
"DataTransferer not found: "
+
name
);
}
}
}
if
(
cls
!=
null
)
{
try
{
method
=
cls
.
getDeclaredMethod
(
"getInstanceImpl"
);
method
.
setAccessible
(
true
);
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
throw
new
AWTError
(
"Cannot instantiate DataTransferer: "
+
name
);
}
catch
(
SecurityException
e
)
{
e
.
printStackTrace
();
throw
new
AWTError
(
"Access is denied for DataTransferer: "
+
name
);
}
}
if
(
method
!=
null
)
{
try
{
ret
=
(
DataTransferer
)
method
.
invoke
(
null
);
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
throw
new
AWTError
(
"Cannot instantiate DataTransferer: "
+
name
);
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
throw
new
AWTError
(
"Cannot access DataTransferer: "
+
name
);
}
}
return
ret
;
}
};
transferer
=
AccessController
.
doPrivileged
(
action
);
}
}
}
return
transferer
;
public
static
synchronized
DataTransferer
getInstance
()
{
return
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
getDataTransferer
();
}
/**
...
...
@@ -459,14 +385,14 @@ public abstract class DataTransferer {
if
(
flavor
.
isRepresentationClassReader
()
||
String
.
class
.
equals
(
rep_class
)
||
flavor
.
isRepresentationClassCharBuffer
()
||
DataTransferer
.
charArrayC
lass
.
equals
(
rep_class
))
char
[].
c
lass
.
equals
(
rep_class
))
{
return
true
;
}
if
(!(
flavor
.
isRepresentationClassInputStream
()
||
flavor
.
isRepresentationClassByteBuffer
()
||
DataTransferer
.
byteArrayC
lass
.
equals
(
rep_class
)))
{
byte
[].
c
lass
.
equals
(
rep_class
)))
{
return
false
;
}
...
...
@@ -490,8 +416,7 @@ public abstract class DataTransferer {
return
(
flavor
.
isRepresentationClassInputStream
()
||
flavor
.
isRepresentationClassByteBuffer
()
||
DataTransferer
.
byteArrayClass
.
equals
(
flavor
.
getRepresentationClass
()));
byte
[].
class
.
equals
(
flavor
.
getRepresentationClass
()));
}
/**
...
...
@@ -1243,7 +1168,7 @@ search:
format
);
// Source data is a char array. Convert to a String and recur.
}
else
if
(
char
ArrayC
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
}
else
if
(
char
[].
c
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
if
(!(
isFlavorCharsetTextType
(
flavor
)
&&
isTextFormat
(
format
)))
{
throw
new
IOException
(
"cannot transfer non-text data as char array"
);
...
...
@@ -1274,7 +1199,7 @@ search:
// Source data is a byte array. For arbitrary flavors, simply return
// the array. For text flavors, decode back to a String and recur to
// reencode according to the requested format.
}
else
if
(
byte
ArrayC
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
}
else
if
(
byte
[].
c
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
byte
[]
bytes
=
(
byte
[])
obj
;
if
(
isFlavorCharsetTextType
(
flavor
)
&&
isTextFormat
(
format
))
{
...
...
@@ -1651,7 +1576,7 @@ search:
// Target data is a char array. Recur to obtain String and convert to
// char array.
}
else
if
(
char
ArrayC
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
}
else
if
(
char
[].
c
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
if
(!(
isFlavorCharsetTextType
(
flavor
)
&&
isTextFormat
(
format
)))
{
throw
new
IOException
(
"cannot transfer non-text data as char array"
);
...
...
@@ -1679,7 +1604,7 @@ search:
// the raw bytes. For text flavors, convert to a String to strip
// terminators and search-and-replace EOLN, then reencode according to
// the requested flavor.
}
else
if
(
byte
ArrayC
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
}
else
if
(
byte
[].
c
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
if
(
isFlavorCharsetTextType
(
flavor
)
&&
isTextFormat
(
format
))
{
theObject
=
translateBytesToString
(
bytes
,
format
,
localeTransferable
...
...
@@ -1807,7 +1732,7 @@ search:
theObject
=
constructFlavoredObject
(
reader
,
flavor
,
Reader
.
class
);
// Target data is a byte array
}
else
if
(
byte
ArrayC
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
}
else
if
(
byte
[].
c
lass
.
equals
(
flavor
.
getRepresentationClass
()))
{
if
(
isFlavorCharsetTextType
(
flavor
)
&&
isTextFormat
(
format
))
{
theObject
=
translateBytesToString
(
inputStreamToByteArray
(
str
),
format
,
localeTransferable
)
.
getBytes
(
DataTransferer
.
getTextCharset
(
flavor
));
...
...
@@ -2857,7 +2782,7 @@ search:
HashMap
decodedTextRepresentationsMap
=
new
HashMap
(
4
,
1.0f
);
decodedTextRepresentationsMap
.
put
(
DataTransferer
.
charArrayC
lass
,
Integer
.
valueOf
(
0
));
(
char
[].
c
lass
,
Integer
.
valueOf
(
0
));
decodedTextRepresentationsMap
.
put
(
java
.
nio
.
CharBuffer
.
class
,
Integer
.
valueOf
(
1
));
decodedTextRepresentationsMap
.
put
...
...
@@ -2873,7 +2798,7 @@ search:
HashMap
encodedTextRepresentationsMap
=
new
HashMap
(
3
,
1.0f
);
encodedTextRepresentationsMap
.
put
(
DataTransferer
.
byteArrayC
lass
,
Integer
.
valueOf
(
0
));
(
byte
[].
c
lass
,
Integer
.
valueOf
(
0
));
encodedTextRepresentationsMap
.
put
(
java
.
nio
.
ByteBuffer
.
class
,
Integer
.
valueOf
(
1
));
encodedTextRepresentationsMap
.
put
...
...
src/solaris/classes/sun/awt/X11/XDataTransferer.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -77,12 +77,10 @@ public class XDataTransferer extends DataTransferer {
private
static
XDataTransferer
transferer
;
static
XDataTransferer
getInstanceImpl
()
{
synchronized
(
XDataTransferer
.
class
)
{
static
synchronized
XDataTransferer
getInstanceImpl
()
{
if
(
transferer
==
null
)
{
transferer
=
new
XDataTransferer
();
}
}
return
transferer
;
}
...
...
@@ -411,7 +409,7 @@ public class XDataTransferer extends DataTransferer {
if
(
df
.
getRepresentationClass
()
!=
null
&&
(
df
.
isRepresentationClassInputStream
()
||
df
.
isRepresentationClassByteBuffer
()
||
byte
ArrayC
lass
.
equals
(
df
.
getRepresentationClass
())))
{
byte
[].
c
lass
.
equals
(
df
.
getRepresentationClass
())))
{
natives
.
add
(
mimeType
);
}
...
...
src/solaris/classes/sun/awt/X11/XToolkit.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -47,6 +47,7 @@ import java.util.*;
import
javax.swing.LookAndFeel
;
import
javax.swing.UIDefaults
;
import
sun.awt.*
;
import
sun.awt.datatransfer.DataTransferer
;
import
sun.font.FontConfigManager
;
import
sun.java2d.SunGraphicsEnvironment
;
import
sun.misc.PerformanceLogger
;
...
...
@@ -300,8 +301,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
return
awtAppClassName
;
}
static
final
String
DATA_TRANSFERER_CLASS_NAME
=
"sun.awt.X11.XDataTransferer"
;
public
XToolkit
()
{
super
();
if
(
PerformanceLogger
.
loggingEnabled
())
{
...
...
@@ -323,7 +322,6 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
init
();
XWM
.
init
();
SunToolkit
.
setDataTransfererClassName
(
DATA_TRANSFERER_CLASS_NAME
);
PrivilegedAction
<
Thread
>
action
=
new
PrivilegedAction
()
{
public
Thread
run
()
{
...
...
@@ -1125,6 +1123,11 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
return
false
;
}
@Override
public
DataTransferer
getDataTransferer
()
{
return
XDataTransferer
.
getInstanceImpl
();
}
/**
* Returns the supported cursor size
*/
...
...
src/windows/classes/sun/awt/windows/WDataTransferer.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2000, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -159,14 +159,10 @@ public class WDataTransferer extends DataTransferer {
private
static
WDataTransferer
transferer
;
public
static
WDataTransferer
getInstanceImpl
()
{
if
(
transferer
==
null
)
{
synchronized
(
WDataTransferer
.
class
)
{
static
synchronized
WDataTransferer
getInstanceImpl
()
{
if
(
transferer
==
null
)
{
transferer
=
new
WDataTransferer
();
}
}
}
return
transferer
;
}
...
...
src/windows/classes/sun/awt/windows/WToolkit.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -41,6 +41,7 @@ import sun.awt.LightweightFrame;
import
sun.awt.SunToolkit
;
import
sun.awt.Win32GraphicsDevice
;
import
sun.awt.Win32GraphicsEnvironment
;
import
sun.awt.datatransfer.DataTransferer
;
import
sun.java2d.d3d.D3DRenderQueue
;
import
sun.java2d.opengl.OGLRenderQueue
;
...
...
@@ -210,8 +211,6 @@ public class WToolkit extends SunToolkit implements Runnable {
*/
public
native
void
embeddedEventLoopIdleProcessing
();
public
static
final
String
DATA_TRANSFERER_CLASS_NAME
=
"sun.awt.windows.WDataTransferer"
;
static
class
ToolkitDisposer
implements
sun
.
java2d
.
DisposerRecord
{
public
void
dispose
()
{
WToolkit
.
postDispose
();
...
...
@@ -255,8 +254,6 @@ public class WToolkit extends SunToolkit implements Runnable {
// swallow the exception
}
SunToolkit
.
setDataTransfererClassName
(
DATA_TRANSFERER_CLASS_NAME
);
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout
(
true
);
...
...
@@ -514,6 +511,11 @@ public class WToolkit extends SunToolkit implements Runnable {
return
true
;
}
@Override
public
DataTransferer
getDataTransferer
()
{
return
WDataTransferer
.
getInstanceImpl
();
}
public
KeyboardFocusManagerPeer
getKeyboardFocusManagerPeer
()
throws
HeadlessException
{
...
...
src/windows/native/sun/windows/ShellFolder2.cpp
浏览文件 @
28ea77aa
/*
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -219,10 +219,15 @@ JNIEXPORT void JNICALL Java_sun_awt_shell_Win32ShellFolder2_initIDs
return
;
}
MID_pIShellFolder
=
env
->
GetMethodID
(
cls
,
"setIShellFolder"
,
"(J)V"
);
CHECK_NULL
(
MID_pIShellFolder
);
FID_pIShellIcon
=
env
->
GetFieldID
(
cls
,
"pIShellIcon"
,
"J"
);
CHECK_NULL
(
FID_pIShellIcon
);
MID_relativePIDL
=
env
->
GetMethodID
(
cls
,
"setRelativePIDL"
,
"(J)V"
);
CHECK_NULL
(
MID_relativePIDL
);
FID_displayName
=
env
->
GetFieldID
(
cls
,
"displayName"
,
"Ljava/lang/String;"
);
CHECK_NULL
(
FID_displayName
);
FID_folderType
=
env
->
GetFieldID
(
cls
,
"folderType"
,
"Ljava/lang/String;"
);
CHECK_NULL
(
FID_folderType
);
}
...
...
@@ -719,8 +724,9 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_parseDisplayName0
// Get relative PIDL for name
LPITEMIDLIST
pIDL
;
int
nLength
=
env
->
GetStringLength
(
jname
);
jchar
*
wszPath
=
new
jchar
[
nLength
+
1
];
const
jchar
*
strPath
=
env
->
GetStringChars
(
jname
,
NULL
);
JNU_CHECK_EXCEPTION_RETURN
(
env
,
0
);
jchar
*
wszPath
=
new
jchar
[
nLength
+
1
];
wcsncpy
(
reinterpret_cast
<
LPWSTR
>
(
wszPath
),
reinterpret_cast
<
LPCWSTR
>
(
strPath
),
nLength
);
wszPath
[
nLength
]
=
0
;
HRESULT
res
=
pIShellFolder
->
ParseDisplayName
(
NULL
,
NULL
,
...
...
@@ -811,6 +817,7 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIcon
HICON
hIcon
=
NULL
;
SHFILEINFO
fileInfo
;
LPCTSTR
pathStr
=
JNU_GetStringPlatformChars
(
env
,
absolutePath
,
NULL
);
JNU_CHECK_EXCEPTION_RETURN
(
env
,
0
);
if
(
fn_SHGetFileInfo
(
pathStr
,
0L
,
&
fileInfo
,
sizeof
(
fileInfo
),
SHGFI_ICON
|
(
getLargeIcon
?
0
:
SHGFI_SMALLICON
))
!=
0
)
{
hIcon
=
fileInfo
.
hIcon
;
...
...
@@ -954,9 +961,11 @@ JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits
ReleaseDC
(
NULL
,
dc
);
// Create java array
iconBits
=
env
->
NewIntArray
(
nBits
);
if
(
!
(
env
->
ExceptionCheck
()))
{
// Copy values to java array
env
->
SetIntArrayRegion
(
iconBits
,
0
,
nBits
,
colorBits
);
}
}
// Fix 4745575 GDI Resource Leak
// MSDN
// GetIconInfo creates bitmaps for the hbmMask and hbmColor members of ICONINFO.
...
...
@@ -1028,6 +1037,7 @@ JNIEXPORT jlong JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconResource
jint
cxDesired
,
jint
cyDesired
,
jboolean
useVGAColors
)
{
const
char
*
pLibName
=
env
->
GetStringUTFChars
(
libName
,
NULL
);
JNU_CHECK_EXCEPTION_RETURN
(
env
,
0
);
HINSTANCE
libHandle
=
(
HINSTANCE
)
JDK_LoadSystemLibrary
(
pLibName
);
if
(
libHandle
!=
NULL
)
{
UINT
fuLoad
=
(
useVGAColors
&&
!
IS_WINXP
)
?
LR_VGACOLOR
:
0
;
...
...
@@ -1046,8 +1056,11 @@ static jobject CreateColumnInfo(JNIEnv *pEnv,
jclass
*
pClass
,
jmethodID
*
pConstructor
,
SHELLDETAILS
*
psd
,
ULONG
visible
)
{
jstring
str
=
jstringFromSTRRET
(
pEnv
,
NULL
,
&
(
psd
->
str
));
JNU_CHECK_EXCEPTION_RETURN
(
pEnv
,
NULL
);
return
pEnv
->
NewObject
(
*
pClass
,
*
pConstructor
,
jstringFromSTRRET
(
pEnv
,
NULL
,
&
(
psd
->
str
))
,
str
,
(
jint
)(
psd
->
cxChar
*
6
),
// TODO: is 6 OK for converting chars to pixels?
(
jint
)
psd
->
fmt
,
(
jboolean
)
visible
);
}
...
...
@@ -1115,6 +1128,10 @@ JNIEXPORT jobjectArray JNICALL
jobject
column
=
CreateColumnInfo
(
env
,
&
columnClass
,
&
columnConstructor
,
&
sd
,
csFlags
&
SHCOLSTATE_ONBYDEFAULT
);
if
(
!
column
){
pIShellFolder2
->
Release
();
return
NULL
;
}
env
->
SetObjectArrayElement
(
columns
,
(
jsize
)
colNum
,
column
);
}
}
...
...
@@ -1155,6 +1172,10 @@ JNIEXPORT jobjectArray JNICALL
jobject
column
=
CreateColumnInfo
(
env
,
&
columnClass
,
&
columnConstructor
,
&
sd
,
1
);
if
(
!
column
){
pIShellDetails
->
Release
();
return
NULL
;
}
env
->
SetObjectArrayElement
(
columns
,
(
jsize
)
colNum
++
,
column
);
}
}
...
...
src/windows/native/sun/windows/awt_Object.cpp
浏览文件 @
28ea77aa
...
...
@@ -232,22 +232,31 @@ Java_sun_awt_windows_WObjectPeer_initIDs(JNIEnv *env, jclass cls) {
TRY
;
AwtObject
::
wObjectPeerClass
=
(
jclass
)
env
->
NewGlobalRef
(
cls
);
DASSERT
(
AwtObject
::
wObjectPeerClass
!=
NULL
);
CHECK_NULL
(
AwtObject
::
wObjectPeerClass
);
AwtObject
::
pDataID
=
env
->
GetFieldID
(
cls
,
"pData"
,
"J"
);
DASSERT
(
AwtObject
::
pDataID
!=
NULL
);
CHECK_NULL
(
AwtObject
::
pDataID
);
AwtObject
::
destroyedID
=
env
->
GetFieldID
(
cls
,
"destroyed"
,
"Z"
);
DASSERT
(
AwtObject
::
destroyedID
!=
NULL
);
CHECK_NULL
(
AwtObject
::
destroyedID
);
AwtObject
::
targetID
=
env
->
GetFieldID
(
cls
,
"target"
,
"Ljava/lang/Object;"
);
DASSERT
(
AwtObject
::
targetID
!=
NULL
);
CHECK_NULL
(
AwtObject
::
targetID
);
AwtObject
::
getPeerForTargetMID
=
env
->
GetStaticMethodID
(
cls
,
"getPeerForTarget"
,
"(Ljava/lang/Object;)Lsun/awt/windows/WObjectPeer;"
);
DASSERT
(
AwtObject
::
getPeerForTargetMID
!=
NULL
);
CHECK_NULL
(
AwtObject
::
getPeerForTargetMID
);
AwtObject
::
createErrorID
=
env
->
GetFieldID
(
cls
,
"createError"
,
"Ljava/lang/Error;"
);
DASSERT
(
AwtObject
::
pDataID
!=
NULL
);
DASSERT
(
AwtObject
::
destroyedID
!=
NULL
);
DASSERT
(
AwtObject
::
targetID
!=
NULL
);
DASSERT
(
AwtObject
::
getPeerForTargetMID
!=
NULL
);
DASSERT
(
AwtObject
::
createErrorID
!=
NULL
);
CHECK_NULL
(
AwtObject
::
createErrorID
);
CATCH_BAD_ALLOC
;
}
...
...
src/windows/native/sun/windows/awt_PrintDialog.cpp
浏览文件 @
28ea77aa
...
...
@@ -183,11 +183,13 @@ Java_sun_awt_windows_WPrintDialogPeer_initIDs(JNIEnv *env, jclass cls)
AwtPrintDialog
::
parentID
=
env
->
GetFieldID
(
cls
,
"parent"
,
"Lsun/awt/windows/WComponentPeer;"
);
DASSERT
(
AwtPrintDialog
::
parentID
!=
NULL
);
CHECK_NULL
(
AwtPrintDialog
::
parentID
);
AwtPrintDialog
::
setHWndMID
=
env
->
GetMethodID
(
cls
,
"setHWnd"
,
"(J)V"
);
DASSERT
(
AwtPrintDialog
::
parentID
!=
NULL
);
DASSERT
(
AwtPrintDialog
::
setHWndMID
!=
NULL
);
CHECK_NULL
(
AwtPrintDialog
::
setHWndMID
);
CATCH_BAD_ALLOC
;
}
...
...
test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 7159566
@summary The choice positioned in the top of applet when clicking the choice.
@author Petr Pchelko
@library ../../regtesthelpers
@build Util
@run main ChoiceLocationTest
*/
import
java.awt.*
;
import
javax.swing.*
;
import
java.awt.event.InputEvent
;
import
java.util.stream.Stream
;
import
test.java.awt.regtesthelpers.Util
;
public
class
ChoiceLocationTest
{
private
static
final
int
FRAME_LOCATION
=
100
;
private
static
final
int
FRAME_SIZE
=
400
;
private
static
final
int
CLICK_STEP
=
5
;
private
static
String
[]
choiceItems
=
new
String
[]
{
"test item 1"
,
"test item 2"
,
"test item 3"
};
private
static
volatile
Frame
frame
;
private
static
volatile
Choice
choice
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
SwingUtilities
.
invokeAndWait
(
ChoiceLocationTest:
:
initAndShowUI
);
Robot
r
=
new
Robot
();
r
.
waitForIdle
();
r
.
delay
(
100
);
Util
.
clickOnComp
(
choice
,
r
);
choice
.
addItemListener
(
event
->
{
throw
new
RuntimeException
(
"Failed: the choice popup is in the wrong place"
);});
// Test: click in several places on the top of the frame an ensure there' no choice there
Point
locOnScreen
=
frame
.
getLocationOnScreen
();
int
x
=
locOnScreen
.
x
+
FRAME_SIZE
/
2
;
for
(
int
y
=
locOnScreen
.
y
+
frame
.
getInsets
().
top
+
10
;
y
<
locOnScreen
.
y
+
FRAME_SIZE
/
3
;
y
+=
CLICK_STEP
)
{
r
.
mouseMove
(
x
,
y
);
r
.
waitForIdle
();
r
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
r
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
r
.
waitForIdle
();
r
.
delay
(
100
);
}
}
finally
{
if
(
frame
!=
null
)
{
frame
.
dispose
();
}
}
}
private
static
void
initAndShowUI
()
{
frame
=
new
Frame
(
"Test frame"
);
choice
=
new
Choice
();
Stream
.
of
(
choiceItems
).
forEach
(
choice:
:
add
);
frame
.
add
(
choice
);
frame
.
setBounds
(
FRAME_LOCATION
,
FRAME_LOCATION
,
FRAME_SIZE
,
FRAME_SIZE
);
frame
.
setVisible
(
true
);
}
}
test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html
0 → 100644
浏览文件 @
28ea77aa
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<!--
@test
@bug 8026869
@summary Support apple.awt.use-file-dialog-packages property.
@author Petr Pchelko area=awt.filedialog
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno FileDialogForPackages.html
-->
<head>
<title>
FileDialogForPackages
</title>
</head>
<body>
<h1>
FileDialogForPackages
<br>
Bug ID: 8026869
</h1>
<p>
See the dialog box (usually in upper left corner) for instructions
</p>
<APPLET
CODE=
"FileDialogForPackages.class"
WIDTH=
200
HEIGHT=
200
></APPLET>
</body>
</html>
test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
sun.awt.OSInfo
;
import
test.java.awt.regtesthelpers.Sysout
;
import
java.applet.Applet
;
import
java.awt.Button
;
import
java.awt.FileDialog
;
import
java.awt.Frame
;
import
java.awt.GridLayout
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
public
class
FileDialogForPackages
extends
Applet
implements
ActionListener
{
private
static
final
String
APPLICATIONS_FOLDER
=
"/Applications"
;
private
volatile
Button
showBtn
;
private
volatile
FileDialog
fd
;
@Override
public
void
init
()
{
if
(
OSInfo
.
getOSType
()
!=
OSInfo
.
OSType
.
MACOSX
)
{
Sysout
.
createDialogWithInstructions
(
new
String
[]{
"Press PASS, this test is for MacOS X only."
});
return
;
}
System
.
setProperty
(
"apple.awt.use-file-dialog-packages"
,
"true"
);
setLayout
(
new
GridLayout
(
1
,
1
));
fd
=
new
FileDialog
(
new
Frame
(),
"Open"
);
fd
.
setDirectory
(
APPLICATIONS_FOLDER
);
showBtn
=
new
Button
(
"Show File Dialog"
);
showBtn
.
addActionListener
(
this
);
add
(
showBtn
);
String
[]
instructions
=
{
"1) Click on 'Show File Dialog' button. A file dialog will come up."
,
"2) Navigate to the Applications folder if not already there"
,
"3) Check that the application bundles can be selected and can not be navigated"
,
"4) If it's true then the test passed, otherwise it failed."
};
Sysout
.
createDialogWithInstructions
(
instructions
);
}
@Override
public
void
start
()
{
setSize
(
200
,
200
);
show
();
}
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
e
.
getSource
()
==
showBtn
)
{
fd
.
setVisible
(
true
);
String
output
=
fd
.
getFile
();
if
(
output
!=
null
)
{
Sysout
.
println
(
output
+
" is selected"
);
}
}
}
}
test/java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8032872
* @summary Tests JComboBox selection via the mouse
* @author Dmitry Markov
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
javax.swing.plaf.basic.BasicComboPopup
;
import
javax.swing.plaf.basic.ComboPopup
;
import
javax.swing.plaf.metal.MetalComboBoxUI
;
import
javax.swing.plaf.metal.MetalLookAndFeel
;
import
java.awt.*
;
import
java.awt.event.InputEvent
;
import
java.awt.event.KeyEvent
;
public
class
MouseComboBoxTest
{
private
static
final
String
[]
items
=
{
"One"
,
"Two"
,
"Three"
,
"Four"
,
"Five"
};
private
static
SunToolkit
toolkit
=
null
;
private
static
Robot
robot
=
null
;
private
static
JFrame
frame
=
null
;
private
static
JComboBox
comboBox
=
null
;
private
static
MyComboBoxUI
comboBoxUI
=
null
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
robot
=
new
Robot
();
robot
.
setAutoDelay
(
50
);
UIManager
.
setLookAndFeel
(
new
MetalLookAndFeel
());
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
createAndShowGUI
();
}
});
toolkit
.
realSync
();
for
(
int
i
=
0
;
i
<
items
.
length
;
i
++)
{
// Open popup
robot
.
keyPress
(
KeyEvent
.
VK_DOWN
);
robot
.
keyRelease
(
KeyEvent
.
VK_DOWN
);
toolkit
.
realSync
();
Point
point
=
getItemPointToClick
(
i
);
robot
.
mouseMove
(
point
.
x
,
point
.
y
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_DOWN_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_DOWN_MASK
);
toolkit
.
realSync
();
if
(
i
!=
getSelectedIndex
())
{
throw
new
RuntimeException
(
"Test Failed! Incorrect value of selected index = "
+
getSelectedIndex
()
+
", expected value = "
+
i
);
}
}
}
private
static
Point
getItemPointToClick
(
final
int
item
)
throws
Exception
{
final
Point
[]
result
=
new
Point
[
1
];
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
BasicComboPopup
popup
=
(
BasicComboPopup
)
comboBoxUI
.
getComboPopup
();
Point
point
=
popup
.
getLocationOnScreen
();
Dimension
size
=
popup
.
getSize
();
int
step
=
size
.
height
/
items
.
length
;
point
.
x
+=
size
.
width
/
2
;
point
.
y
+=
step
/
2
+
step
*
item
;
result
[
0
]
=
point
;
}
});
return
result
[
0
];
}
private
static
int
getSelectedIndex
()
throws
Exception
{
final
int
[]
result
=
new
int
[
1
];
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
result
[
0
]
=
comboBox
.
getSelectedIndex
();
}
});
return
result
[
0
];
}
private
static
void
createAndShowGUI
()
{
frame
=
new
JFrame
(
"MouseComboBoxTest"
);
comboBox
=
new
JComboBox
(
items
);
comboBox
.
setEditable
(
true
);
comboBoxUI
=
new
MyComboBoxUI
();
comboBox
.
setUI
(
comboBoxUI
);
frame
.
pack
();
frame
.
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
frame
.
setVisible
(
true
);
JWindow
window
=
new
JWindow
(
frame
);
window
.
add
(
comboBox
);
window
.
pack
();
window
.
setVisible
(
true
);
}
private
static
class
MyComboBoxUI
extends
MetalComboBoxUI
{
public
ComboPopup
getComboPopup
()
{
return
popup
;
}
}
}
test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html
0 → 100644
浏览文件 @
28ea77aa
<!--
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<!--
@test
@bug 8007220
@summary The popup menu is not added to the tray icon after it was added to tray
@author Petr Pchelko
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno AddPopupAfterShowTest.html
-->
<head>
<title>
AddPopupAfterShowTest
</title>
</head>
<body>
<h1>
AddPopupAfterShowTest
<br>
Bug ID: 8007220
</h1>
<p>
See the dialog box (usually in upper left corner) for instructions
</p>
<APPLET
CODE=
"AddPopupAfterShowTest.class"
WIDTH=
200
HEIGHT=
200
></APPLET>
</body>
</html>
test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
test.java.awt.regtesthelpers.Sysout
;
import
java.applet.Applet
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
public
class
AddPopupAfterShowTest
extends
Applet
{
@Override
public
void
init
()
{
if
(!
SystemTray
.
isSupported
())
{
Sysout
.
createDialogWithInstructions
(
new
String
[]{
"Press PASS, the System Tray is not supported"
});
return
;
}
String
[]
instructions
=
{
"1) The red circle icon was added to the system tray."
,
"2) Check that a popup menu is opened when the icon is clicked."
,
"3) If true the test is passed, otherwise failed."
};
Sysout
.
createDialogWithInstructions
(
instructions
);
}
@Override
public
void
start
()
{
setSize
(
200
,
200
);
show
();
createSystemTrayIcon
();
}
private
static
void
createSystemTrayIcon
()
{
final
TrayIcon
trayIcon
=
new
TrayIcon
(
createTrayIconImage
());
trayIcon
.
setImageAutoSize
(
true
);
try
{
// Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
SystemTray
.
getSystemTray
().
add
(
trayIcon
);
trayIcon
.
setPopupMenu
(
createTrayIconPopupMenu
());
}
catch
(
final
AWTException
awte
)
{
awte
.
printStackTrace
();
}
}
private
static
Image
createTrayIconImage
()
{
/**
* Create a small image of a red circle to use as the icon for the tray icon
*/
int
trayIconImageSize
=
32
;
final
BufferedImage
trayImage
=
new
BufferedImage
(
trayIconImageSize
,
trayIconImageSize
,
BufferedImage
.
TYPE_INT_ARGB
);
final
Graphics2D
trayImageGraphics
=
(
Graphics2D
)
trayImage
.
getGraphics
();
trayImageGraphics
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
trayImageGraphics
.
setColor
(
new
Color
(
255
,
255
,
255
,
0
));
trayImageGraphics
.
fillRect
(
0
,
0
,
trayImage
.
getWidth
(),
trayImage
.
getHeight
());
trayImageGraphics
.
setColor
(
Color
.
red
);
int
trayIconImageInset
=
4
;
trayImageGraphics
.
fillOval
(
trayIconImageInset
,
trayIconImageInset
,
trayImage
.
getWidth
()
-
2
*
trayIconImageInset
,
trayImage
.
getHeight
()
-
2
*
trayIconImageInset
);
trayImageGraphics
.
setColor
(
Color
.
darkGray
);
trayImageGraphics
.
drawOval
(
trayIconImageInset
,
trayIconImageInset
,
trayImage
.
getWidth
()
-
2
*
trayIconImageInset
,
trayImage
.
getHeight
()
-
2
*
trayIconImageInset
);
return
trayImage
;
}
private
static
PopupMenu
createTrayIconPopupMenu
()
{
final
PopupMenu
trayIconPopupMenu
=
new
PopupMenu
();
final
MenuItem
popupMenuItem
=
new
MenuItem
(
"TEST PASSED!"
);
trayIconPopupMenu
.
add
(
popupMenuItem
);
return
trayIconPopupMenu
;
}
}
test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 8007220
@summary Reference to the popup leaks after the TrayIcon is removed
@author Petr Pchelko
@run main/othervm -Xmx50m PopupMenuLeakTest
*/
import
java.awt.*
;
import
javax.swing.SwingUtilities
;
import
sun.awt.SunToolkit
;
import
java.awt.image.BufferedImage
;
import
java.lang.ref.WeakReference
;
import
java.util.ArrayList
;
import
java.util.concurrent.atomic.AtomicReference
;
public
class
PopupMenuLeakTest
{
static
final
AtomicReference
<
WeakReference
<
TrayIcon
>>
iconWeakReference
=
new
AtomicReference
<>();
static
final
AtomicReference
<
WeakReference
<
PopupMenu
>>
popupWeakReference
=
new
AtomicReference
<>();
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SwingUtilities
.
invokeAndWait
(
PopupMenuLeakTest:
:
createSystemTrayIcon
);
sleep
();
// To make the test automatic we explicitly call addNotify on a popup to create the peer
SwingUtilities
.
invokeAndWait
(
PopupMenuLeakTest:
:
addNotifyPopup
);
sleep
();
SwingUtilities
.
invokeAndWait
(
PopupMenuLeakTest:
:
removeIcon
);
sleep
();
assertCollected
(
popupWeakReference
.
get
(),
"Failed, reference to popup not collected"
);
assertCollected
(
iconWeakReference
.
get
(),
"Failed, reference to tray icon not collected"
);
}
private
static
void
addNotifyPopup
()
{
PopupMenu
menu
=
popupWeakReference
.
get
().
get
();
if
(
menu
==
null
)
{
throw
new
RuntimeException
(
"Failed: popup collected too early"
);
}
menu
.
addNotify
();
}
private
static
void
removeIcon
()
{
TrayIcon
icon
=
iconWeakReference
.
get
().
get
();
if
(
icon
==
null
)
{
throw
new
RuntimeException
(
"Failed: TrayIcon collected too early"
);
}
SystemTray
.
getSystemTray
().
remove
(
icon
);
}
private
static
void
assertCollected
(
WeakReference
<?>
reference
,
String
message
)
{
java
.
util
.
List
<
byte
[]>
bytes
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
try
{
while
(
true
)
{
bytes
.
add
(
new
byte
[
1024
]);
}
}
catch
(
OutOfMemoryError
err
)
{
bytes
=
new
ArrayList
<>();
}
}
if
(
reference
.
get
()
!=
null
)
{
throw
new
RuntimeException
(
message
);
}
}
private
static
void
createSystemTrayIcon
()
{
final
TrayIcon
trayIcon
=
new
TrayIcon
(
createTrayIconImage
());
trayIcon
.
setImageAutoSize
(
true
);
try
{
// Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
trayIcon
.
setPopupMenu
(
createTrayIconPopupMenu
());
SystemTray
.
getSystemTray
().
add
(
trayIcon
);
iconWeakReference
.
set
(
new
WeakReference
<>(
trayIcon
));
popupWeakReference
.
set
(
new
WeakReference
<>(
trayIcon
.
getPopupMenu
()));
}
catch
(
final
AWTException
awte
)
{
awte
.
printStackTrace
();
}
}
private
static
Image
createTrayIconImage
()
{
/**
* Create a small image of a red circle to use as the icon for the tray icon
*/
int
trayIconImageSize
=
32
;
final
BufferedImage
trayImage
=
new
BufferedImage
(
trayIconImageSize
,
trayIconImageSize
,
BufferedImage
.
TYPE_INT_ARGB
);
final
Graphics2D
trayImageGraphics
=
(
Graphics2D
)
trayImage
.
getGraphics
();
trayImageGraphics
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
trayImageGraphics
.
setColor
(
new
Color
(
255
,
255
,
255
,
0
));
trayImageGraphics
.
fillRect
(
0
,
0
,
trayImage
.
getWidth
(),
trayImage
.
getHeight
());
trayImageGraphics
.
setColor
(
Color
.
red
);
int
trayIconImageInset
=
4
;
trayImageGraphics
.
fillOval
(
trayIconImageInset
,
trayIconImageInset
,
trayImage
.
getWidth
()
-
2
*
trayIconImageInset
,
trayImage
.
getHeight
()
-
2
*
trayIconImageInset
);
trayImageGraphics
.
setColor
(
Color
.
darkGray
);
trayImageGraphics
.
drawOval
(
trayIconImageInset
,
trayIconImageInset
,
trayImage
.
getWidth
()
-
2
*
trayIconImageInset
,
trayImage
.
getHeight
()
-
2
*
trayIconImageInset
);
return
trayImage
;
}
private
static
PopupMenu
createTrayIconPopupMenu
()
{
final
PopupMenu
trayIconPopupMenu
=
new
PopupMenu
();
final
MenuItem
popupMenuItem
=
new
MenuItem
(
"TEST!"
);
trayIconPopupMenu
.
add
(
popupMenuItem
);
return
trayIconPopupMenu
;
}
private
static
void
sleep
()
{
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
ignored
)
{
}
}
}
test/java/awt/Window/Grab/GrabTest.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -38,7 +38,10 @@ import test.java.awt.regtesthelpers.Util;
public
class
GrabTest
{
private
static
Frame
f
;
private
static
Frame
f1
;
private
static
Frame
frame
;
private
static
Window
w
;
private
static
Window
window1
;
private
static
Window
window2
;
private
static
Button
b
;
private
static
Robot
robot
;
...
...
@@ -96,6 +99,15 @@ public class GrabTest {
f
.
setVisible
(
true
);
w
.
setVisible
(
true
);
frame
=
new
Frame
();
window1
=
new
Window
(
frame
);
window1
.
setBounds
(
0
,
0
,
100
,
100
);
window1
.
setBackground
(
Color
.
blue
);
window2
=
new
Window
(
window1
);
window2
.
setBounds
(
0
,
0
,
50
,
50
);
window2
.
setBackground
(
Color
.
green
);
tk
=
(
sun
.
awt
.
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
try
{
...
...
@@ -194,6 +206,24 @@ public class GrabTest {
passed
=
false
;
System
.
err
.
println
(
"Failure: [7] Window disposal didn't cause ungrab"
);
}
ungrabbed
=
false
;
// 8. Check that mouse click on subwindow does not cause ungrab
frame
.
setVisible
(
true
);
window1
.
setVisible
(
true
);
window2
.
setVisible
(
true
);
Util
.
waitForIdle
(
robot
);
tk
.
grab
(
window1
);
Util
.
clickOnComp
(
window2
,
robot
);
Util
.
waitForIdle
(
robot
);
if
(
ungrabbed
)
{
passed
=
false
;
System
.
err
.
println
(
"Failure: [8] Press on the subwindow caused ungrab"
);
}
if
(
passed
)
{
System
.
out
.
println
(
"Test passed."
);
...
...
test/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8030050
* @summary Validate fields on DnD class deserialization
* @author petr.pchelko@oracle.com
*/
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InvalidObjectException
;
import
java.io.ObjectInputStream
;
import
java.util.stream.Stream
;
public
class
BadSerializationTest
{
private
static
final
String
[]
badSerialized
=
new
String
[]
{
"badAction"
,
"noEvents"
,
"nullComponent"
,
"nullDragSource"
,
"nullOrigin"
};
private
static
final
String
goodSerialized
=
"good"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
testSrc
=
System
.
getProperty
(
"test.src"
)
+
File
.
separator
;
testReadObject
(
testSrc
+
goodSerialized
,
false
);
Stream
.
of
(
badSerialized
).
forEach
(
file
->
testReadObject
(
testSrc
+
file
,
true
));
}
private
static
void
testReadObject
(
String
filename
,
boolean
expectException
)
{
Exception
exceptionCaught
=
null
;
try
(
FileInputStream
fileInputStream
=
new
FileInputStream
(
filename
);
ObjectInputStream
ois
=
new
ObjectInputStream
(
fileInputStream
))
{
ois
.
readObject
();
}
catch
(
InvalidObjectException
e
)
{
exceptionCaught
=
e
;
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"FAILED: IOException"
,
e
);
}
catch
(
ClassNotFoundException
e
)
{
throw
new
RuntimeException
(
"FAILED: ClassNotFoundException"
,
e
);
}
if
(
exceptionCaught
!=
null
&&
!
expectException
)
{
throw
new
RuntimeException
(
"FAILED: UnexpectedException"
,
exceptionCaught
);
}
if
(
exceptionCaught
==
null
&&
expectException
)
{
throw
new
RuntimeException
(
"FAILED: Invalid object was created with no exception"
);
}
}
}
test/java/awt/dnd/BadSerializaionTest/badAction
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/java/awt/dnd/BadSerializaionTest/good
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/java/awt/dnd/BadSerializaionTest/noEvents
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/java/awt/dnd/BadSerializaionTest/nullComponent
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/java/awt/dnd/BadSerializaionTest/nullDragSource
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/java/awt/dnd/BadSerializaionTest/nullOrigin
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/java/awt/dnd/Button2DragTest/Button2DragTest.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006,
2014,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -112,6 +112,7 @@ public class Button2DragTest extends Applet {
Util
.
drag
(
robot
,
startPoint
,
endPoint
,
InputEvent
.
BUTTON2_MASK
);
Util
.
waitForIdle
(
robot
);
robot
.
delay
(
500
);
if
(
dropSuccess
)
{
System
.
err
.
println
(
"test passed"
);
...
...
test/java/awt/dnd/URLDragTest/URLDragTest.html
0 → 100644
浏览文件 @
28ea77aa
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<!--
@test
@bug 8031964
@summary Dragging images from the browser does not work
@author Petr Pchelko : area=dnd
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno URLDragTest.html
-->
<head>
<title>
DnD of URL across JVM
</title>
</head>
<body>
<h1>
URLDragTest
<br>
Bug ID: 8031964
</h1>
<p>
This is an AUTOMATIC test, simply wait for completion
</p>
<APPLET
CODE=
"URLDragTest.class"
WIDTH=
200
HEIGHT=
200
></APPLET>
</body>
</html>
test/java/awt/dnd/URLDragTest/URLDragTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
test
@bug 8031964
@summary Dragging images from the browser does not work
@author Petr Pchelko : area=dnd
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno URLDragTest.html
*/
import
test.java.awt.regtesthelpers.Sysout
;
import
java.applet.Applet
;
import
java.awt.*
;
import
java.awt.datatransfer.DataFlavor
;
import
java.awt.dnd.DnDConstants
;
import
java.awt.dnd.DropTarget
;
import
java.awt.dnd.DropTargetAdapter
;
import
java.awt.dnd.DropTargetDragEvent
;
import
java.awt.dnd.DropTargetDropEvent
;
public
class
URLDragTest
extends
Applet
{
@Override
public
void
init
()
{
setBackground
(
Color
.
red
);
setDropTarget
(
new
DropTarget
(
this
,
DnDConstants
.
ACTION_COPY
,
new
DropTargetAdapter
()
{
@Override
public
void
dragEnter
(
DropTargetDragEvent
dtde
)
{
dtde
.
acceptDrag
(
DnDConstants
.
ACTION_COPY
);
}
@Override
public
void
dragOver
(
DropTargetDragEvent
dtde
)
{
dtde
.
acceptDrag
(
DnDConstants
.
ACTION_COPY
);
}
@Override
public
void
drop
(
DropTargetDropEvent
dtde
)
{
dtde
.
acceptDrop
(
DnDConstants
.
ACTION_COPY
);
dtde
.
getCurrentDataFlavorsAsList
()
.
stream
()
.
map
(
DataFlavor:
:
toString
)
.
forEach
(
Sysout:
:
println
);
}
}));
String
[]
instructions
=
{
"1) Open the browser."
,
"2) Drag any image from the browser page to the red square"
,
"3) When the image is dropped you should se the list of available DataFlavors"
,
"4) If you see application/x-java-url and text/uri-list flavors - test PASSED"
,
"5) Otherwise the test is FAILED"
};
Sysout
.
createDialogWithInstructions
(
instructions
);
}
@Override
public
void
start
()
{
setSize
(
200
,
200
);
setVisible
(
true
);
}
}
test/java/lang/invoke/lambda/LambdaReceiver.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035776
* @summary Consistent Lambda construction
*/
import
java.lang.invoke.CallSite
;
import
java.lang.invoke.LambdaMetafactory
;
import
java.lang.invoke.LambdaConversionException
;
import
java.lang.invoke.MethodHandle
;
import
java.lang.invoke.MethodHandles
;
import
java.lang.invoke.MethodType
;
import
java.util.ArrayList
;
import
java.util.List
;
import
LambdaReceiver_anotherpkg.LambdaReceiver_A
;
public
class
LambdaReceiver
extends
LambdaReceiver_A
{
interface
IA
{
int
m
(
LambdaReceiver_A
x
);
}
static
MethodHandles
.
Lookup
l
;
static
MethodHandle
h
;
private
static
MethodType
mt
(
Class
<?>
k
)
{
return
MethodType
.
methodType
(
k
);
}
private
static
MethodType
mt
(
Class
<?>
k
,
Class
<?>
k2
)
{
return
MethodType
.
methodType
(
k
,
k2
);
}
private
static
void
mf
(
List
<
String
>
errs
,
MethodType
mts
,
MethodType
mtf
,
boolean
shouldWork
)
{
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
l
=
MethodHandles
.
lookup
();
h
=
l
.
findVirtual
(
LambdaReceiver_A
.
class
,
"f"
,
mt
(
int
.
class
));
MethodType
X
=
mt
(
int
.
class
,
LambdaReceiver
.
class
);
MethodType
A
=
mt
(
int
.
class
,
LambdaReceiver_A
.
class
);
MethodType
mti
=
mt
(
IA
.
class
);
CallSite
cs
=
LambdaMetafactory
.
metafactory
(
l
,
"m"
,
mti
,
A
,
h
,
X
);
IA
p
=
(
IA
)
cs
.
dynamicInvoker
().
invoke
();
LambdaReceiver_A
lra
=
new
LambdaReceiver_A
();
try
{
p
.
m
(
lra
);
}
catch
(
ClassCastException
cce
)
{
return
;
}
throw
new
AssertionError
(
"CCE expected"
);
}
}
test/java/lang/invoke/lambda/LambdaReceiverBridge.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035776
* @summary Consistent Lambda construction
*/
import
java.lang.invoke.CallSite
;
import
java.lang.invoke.LambdaMetafactory
;
import
java.lang.invoke.LambdaConversionException
;
import
java.lang.invoke.MethodHandle
;
import
java.lang.invoke.MethodHandles
;
import
java.lang.invoke.MethodType
;
import
java.util.ArrayList
;
import
java.util.List
;
import
LambdaReceiver_anotherpkg.LambdaReceiver_A
;
public
class
LambdaReceiverBridge
extends
LambdaReceiver_A
{
interface
IA
{
int
m
(
LambdaReceiver_A
x
);
}
static
MethodHandles
.
Lookup
l
;
static
MethodHandle
h
;
private
static
MethodType
mt
(
Class
<?>
k
)
{
return
MethodType
.
methodType
(
k
);
}
private
static
MethodType
mt
(
Class
<?>
k
,
Class
<?>
k2
)
{
return
MethodType
.
methodType
(
k
,
k2
);
}
private
static
void
mf
(
List
<
String
>
errs
,
MethodType
mts
,
MethodType
mtf
,
boolean
shouldWork
)
{
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
l
=
MethodHandles
.
lookup
();
h
=
l
.
findVirtual
(
LambdaReceiver_A
.
class
,
"f"
,
mt
(
int
.
class
));
MethodType
X
=
mt
(
int
.
class
,
LambdaReceiverBridge
.
class
);
MethodType
A
=
mt
(
int
.
class
,
LambdaReceiver_A
.
class
);
MethodType
mti
=
mt
(
IA
.
class
);
CallSite
cs
=
LambdaMetafactory
.
altMetafactory
(
l
,
"m"
,
mti
,
X
,
h
,
X
,
LambdaMetafactory
.
FLAG_BRIDGES
,
1
,
A
);
IA
p
=
(
IA
)
cs
.
dynamicInvoker
().
invoke
();
LambdaReceiver_A
lra
=
new
LambdaReceiver_A
();
try
{
p
.
m
(
lra
);
}
catch
(
ClassCastException
cce
)
{
return
;
}
throw
new
AssertionError
(
"CCE expected"
);
}
}
src/macosx/native/sun/awt/CWrapper.h
→
test/java/lang/invoke/lambda/LambdaReceiver_anotherpkg/LambdaReceiver_A.java
浏览文件 @
28ea77aa
/*
* Copyright (c) 201
1, 2012
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
* 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
...
...
@@ -22,3 +20,9 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
LambdaReceiver_anotherpkg
;
public
class
LambdaReceiver_A
{
protected
final
int
f
()
{
return
2
;
}
}
test/java/lang/invoke/lambda/LambdaReturn.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035776
* @summary Consistent Lambda construction
*/
import
java.lang.invoke.LambdaMetafactory
;
import
java.lang.invoke.LambdaConversionException
;
import
java.lang.invoke.MethodHandle
;
import
java.lang.invoke.MethodHandles
;
import
java.lang.invoke.MethodType
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
LambdaReturn
{
interface
I
{
void
m
();
}
static
void
hereV
()
{}
static
String
hereS
()
{
return
"hi"
;
}
static
MethodHandles
.
Lookup
l
;
private
static
MethodType
mt
(
Class
<?>
k
)
{
return
MethodType
.
methodType
(
k
);
}
private
static
MethodType
mt
(
Class
<?>
k
,
Class
<?>
k2
)
{
return
MethodType
.
methodType
(
k
,
k2
);
}
private
static
void
amf
(
List
<
String
>
errs
,
MethodHandle
h
,
MethodType
mts
,
MethodType
mtf
,
MethodType
mtb
,
boolean
shouldWork
)
{
MethodType
mti
=
mt
(
I
.
class
);
try
{
LambdaMetafactory
.
altMetafactory
(
l
,
"m"
,
mti
,
mts
,
h
,
mtf
,
LambdaMetafactory
.
FLAG_BRIDGES
,
1
,
mtb
);
}
catch
(
LambdaConversionException
e
)
{
if
(
shouldWork
)
errs
.
add
(
"Error: Should work h="
+
h
+
" s="
+
mts
+
" -- f="
+
mtf
+
" / b="
+
mtb
+
" got: "
+
e
);
return
;
}
if
(!
shouldWork
)
errs
.
add
(
"Error: Should fail h="
+
h
+
" s="
+
mts
+
" -- f="
+
mtf
+
" / b="
+
mtb
);
}
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
l
=
MethodHandles
.
lookup
();
MethodHandle
hV
=
l
.
findStatic
(
LambdaReturn
.
class
,
"hereV"
,
mt
(
void
.
class
));
MethodHandle
hS
=
l
.
findStatic
(
LambdaReturn
.
class
,
"hereS"
,
mt
(
String
.
class
));
List
<
String
>
errs
=
new
ArrayList
<>();
MethodType
V
=
mt
(
void
.
class
);
MethodType
S
=
mt
(
String
.
class
);
MethodType
O
=
mt
(
Object
.
class
);
MethodType
I
=
mt
(
int
.
class
);
amf
(
errs
,
hS
,
S
,
S
,
O
,
true
);
amf
(
errs
,
hS
,
S
,
S
,
V
,
false
);
amf
(
errs
,
hS
,
S
,
S
,
I
,
false
);
amf
(
errs
,
hS
,
O
,
S
,
S
,
true
);
amf
(
errs
,
hS
,
V
,
S
,
S
,
false
);
amf
(
errs
,
hS
,
I
,
S
,
S
,
false
);
amf
(
errs
,
hS
,
O
,
O
,
S
,
false
);
amf
(
errs
,
hS
,
S
,
O
,
O
,
false
);
amf
(
errs
,
hV
,
V
,
V
,
O
,
false
);
amf
(
errs
,
hV
,
V
,
V
,
I
,
false
);
amf
(
errs
,
hV
,
V
,
V
,
S
,
false
);
amf
(
errs
,
hV
,
O
,
V
,
V
,
false
);
amf
(
errs
,
hV
,
I
,
V
,
V
,
false
);
amf
(
errs
,
hV
,
S
,
V
,
V
,
false
);
if
(
errs
.
size
()
>
0
)
{
for
(
String
err
:
errs
)
{
System
.
err
.
println
(
err
);
}
throw
new
AssertionError
(
"Errors: "
+
errs
.
size
());
}
}
}
test/java/lang/invoke/lambda/MetafactoryArityTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035776
* @summary metafactory should fail if arities are mismatched
*/
import
java.lang.invoke.*
;
import
java.util.Arrays
;
import
static
java
.
lang
.
invoke
.
MethodType
.
methodType
;
public
class
MetafactoryArityTest
{
public
interface
I
{}
public
static
class
C
{
public
static
String
m
(
int
arg
)
{
return
""
;
}
}
static
final
MethodHandles
.
Lookup
lookup
=
MethodHandles
.
lookup
();
static
final
Class
<?>[]
capInt
=
{
int
.
class
};
static
final
MethodHandle
C_m
;
static
{
try
{
C_m
=
lookup
.
findStatic
(
C
.
class
,
"m"
,
methodType
(
String
.
class
,
int
.
class
));
}
catch
(
NoSuchMethodException
|
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
static
void
main
(
String
...
args
)
{
MethodType
unary
=
methodType
(
String
.
class
,
int
.
class
);
MethodType
nullary
=
methodType
(
String
.
class
);
MethodType
binary
=
methodType
(
String
.
class
,
int
.
class
,
int
.
class
);
MethodType
unaryCS
=
methodType
(
CharSequence
.
class
,
int
.
class
);
MethodType
nullaryCS
=
methodType
(
CharSequence
.
class
);
MethodType
binaryCS
=
methodType
(
CharSequence
.
class
,
int
.
class
,
int
.
class
);
MethodType
unaryObj
=
methodType
(
Object
.
class
,
int
.
class
);
MethodType
nullaryObj
=
methodType
(
Object
.
class
);
MethodType
binaryObj
=
methodType
(
Object
.
class
,
int
.
class
,
int
.
class
);
test
(
true
,
C_m
,
unary
,
unary
);
test
(
false
,
C_m
,
unary
,
nullary
);
test
(
false
,
C_m
,
nullary
,
unary
);
test
(
false
,
C_m
,
unary
,
binary
);
test
(
false
,
C_m
,
binary
,
unary
);
testBridge
(
true
,
C_m
,
unary
,
unary
,
unaryCS
);
testBridge
(
false
,
C_m
,
unary
,
unary
,
nullaryCS
);
testBridge
(
false
,
C_m
,
unary
,
unary
,
binaryCS
);
testBridge
(
true
,
C_m
,
unary
,
unary
,
unaryCS
,
unaryObj
);
testBridge
(
false
,
C_m
,
unary
,
unary
,
unaryCS
,
nullaryObj
);
testBridge
(
false
,
C_m
,
unary
,
unary
,
unaryCS
,
binaryObj
);
testCapture
(
true
,
C_m
,
capInt
,
nullary
,
nullary
);
testCapture
(
false
,
C_m
,
capInt
,
binary
,
binary
);
testCapture
(
false
,
C_m
,
capInt
,
nullary
,
unary
);
testCapture
(
false
,
C_m
,
capInt
,
nullary
,
binary
);
testCapture
(
false
,
C_m
,
capInt
,
unary
,
nullary
);
testCapture
(
false
,
C_m
,
capInt
,
unary
,
binary
);
testCaptureBridge
(
true
,
C_m
,
capInt
,
nullary
,
nullary
,
nullaryCS
);
testCaptureBridge
(
false
,
C_m
,
capInt
,
unary
,
unary
,
unaryCS
);
testCaptureBridge
(
false
,
C_m
,
capInt
,
nullary
,
nullary
,
unaryCS
);
testCaptureBridge
(
false
,
C_m
,
capInt
,
nullary
,
nullary
,
binaryCS
);
testCaptureBridge
(
true
,
C_m
,
capInt
,
nullary
,
nullary
,
nullaryCS
,
nullaryObj
);
testCaptureBridge
(
false
,
C_m
,
capInt
,
unary
,
unary
,
unaryCS
,
unaryObj
);
testCaptureBridge
(
false
,
C_m
,
capInt
,
nullary
,
nullary
,
nullaryCS
,
unaryObj
);
testCaptureBridge
(
false
,
C_m
,
capInt
,
nullary
,
nullary
,
nullaryCS
,
binaryObj
);
}
static
void
test
(
boolean
correct
,
MethodHandle
mh
,
MethodType
instMT
,
MethodType
samMT
)
{
tryMetafactory
(
correct
,
mh
,
new
Class
<?>[]{},
instMT
,
samMT
);
tryAltMetafactory
(
correct
,
mh
,
new
Class
<?>[]{},
instMT
,
samMT
);
}
static
void
testBridge
(
boolean
correct
,
MethodHandle
mh
,
MethodType
instMT
,
MethodType
samMT
,
MethodType
...
bridgeMTs
)
{
tryAltMetafactory
(
correct
,
mh
,
new
Class
<?>[]{},
instMT
,
samMT
,
bridgeMTs
);
}
static
void
testCapture
(
boolean
correct
,
MethodHandle
mh
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
)
{
tryMetafactory
(
correct
,
mh
,
captured
,
instMT
,
samMT
);
tryAltMetafactory
(
correct
,
mh
,
captured
,
instMT
,
samMT
);
}
static
void
testCaptureBridge
(
boolean
correct
,
MethodHandle
mh
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
,
MethodType
...
bridgeMTs
)
{
tryAltMetafactory
(
correct
,
mh
,
captured
,
instMT
,
samMT
,
bridgeMTs
);
}
static
void
tryMetafactory
(
boolean
correct
,
MethodHandle
mh
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
)
{
try
{
LambdaMetafactory
.
metafactory
(
lookup
,
"run"
,
methodType
(
I
.
class
,
captured
),
samMT
,
mh
,
instMT
);
if
(!
correct
)
{
throw
new
AssertionError
(
"Uncaught linkage error:"
+
" impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
);
}
}
catch
(
LambdaConversionException
e
)
{
if
(
correct
)
{
throw
new
AssertionError
(
"Unexpected linkage error:"
+
" e="
+
e
+
", impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
);
}
}
}
static
void
tryAltMetafactory
(
boolean
correct
,
MethodHandle
mh
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
,
MethodType
...
bridgeMTs
)
{
boolean
bridge
=
bridgeMTs
.
length
>
0
;
Object
[]
args
=
new
Object
[
bridge
?
5
+
bridgeMTs
.
length
:
4
];
args
[
0
]
=
samMT
;
args
[
1
]
=
mh
;
args
[
2
]
=
instMT
;
args
[
3
]
=
bridge
?
LambdaMetafactory
.
FLAG_BRIDGES
:
0
;
if
(
bridge
)
{
args
[
4
]
=
bridgeMTs
.
length
;
for
(
int
i
=
0
;
i
<
bridgeMTs
.
length
;
i
++)
args
[
5
+
i
]
=
bridgeMTs
[
i
];
}
try
{
LambdaMetafactory
.
altMetafactory
(
lookup
,
"run"
,
methodType
(
I
.
class
,
captured
),
args
);
if
(!
correct
)
{
throw
new
AssertionError
(
"Uncaught linkage error:"
+
" impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
+
", bridges="
+
Arrays
.
toString
(
bridgeMTs
));
}
}
catch
(
LambdaConversionException
e
)
{
if
(
correct
)
{
throw
new
AssertionError
(
"Unexpected linkage error:"
+
" e="
+
e
+
", impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
+
", bridges="
+
Arrays
.
toString
(
bridgeMTs
));
}
}
}
}
test/java/lang/invoke/lambda/MetafactoryParameterCastTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035776
* @summary Ensure that invocation parameters are always cast to the instantiatedMethodType
*/
import
java.lang.invoke.*
;
import
java.util.Arrays
;
import
static
java
.
lang
.
invoke
.
MethodType
.
methodType
;
public
class
MetafactoryParameterCastTest
{
static
final
MethodHandles
.
Lookup
lookup
=
MethodHandles
.
lookup
();
public
static
class
A
{
}
public
static
class
B
extends
A
{
void
instance0
()
{}
void
instance1
(
B
arg
)
{}
static
void
static1
(
B
arg
)
{}
static
void
static2
(
B
arg1
,
B
arg2
)
{}
}
public
static
class
C
extends
B
{}
public
static
class
NotC
extends
B
{}
public
interface
ASink
{
void
take
(
A
arg
);
}
public
interface
BSink
{
void
take
(
B
arg
);
}
public
static
void
main
(
String
...
args
)
throws
Throwable
{
new
MetafactoryParameterCastTest
().
test
();
}
void
test
()
throws
Throwable
{
MethodType
takeA
=
methodType
(
void
.
class
,
A
.
class
);
MethodType
takeB
=
methodType
(
void
.
class
,
B
.
class
);
MethodType
takeC
=
methodType
(
void
.
class
,
C
.
class
);
Class
<?>[]
noCapture
=
{};
Class
<?>[]
captureB
=
{
B
.
class
};
MethodHandle
[]
oneBParam
=
{
lookup
.
findVirtual
(
B
.
class
,
"instance0"
,
methodType
(
void
.
class
)),
lookup
.
findStatic
(
B
.
class
,
"static1"
,
methodType
(
void
.
class
,
B
.
class
))
};
MethodHandle
[]
twoBParams
=
{
lookup
.
findVirtual
(
B
.
class
,
"instance1"
,
methodType
(
void
.
class
,
B
.
class
)),
lookup
.
findStatic
(
B
.
class
,
"static2"
,
methodType
(
void
.
class
,
B
.
class
,
B
.
class
))
};
for
(
MethodHandle
mh
:
oneBParam
)
{
// sam
tryASink
(
invokeMetafactory
(
mh
,
ASink
.
class
,
"take"
,
noCapture
,
takeC
,
takeA
));
tryBSink
(
invokeMetafactory
(
mh
,
BSink
.
class
,
"take"
,
noCapture
,
takeC
,
takeB
));
tryASink
(
invokeAltMetafactory
(
mh
,
ASink
.
class
,
"take"
,
noCapture
,
takeC
,
takeA
));
tryBSink
(
invokeAltMetafactory
(
mh
,
BSink
.
class
,
"take"
,
noCapture
,
takeC
,
takeB
));
// bridge
tryASink
(
invokeAltMetafactory
(
mh
,
ASink
.
class
,
"take"
,
noCapture
,
takeC
,
takeC
,
takeA
));
tryBSink
(
invokeAltMetafactory
(
mh
,
BSink
.
class
,
"take"
,
noCapture
,
takeC
,
takeC
,
takeB
));
}
for
(
MethodHandle
mh
:
twoBParams
)
{
// sam
tryCapASink
(
invokeMetafactory
(
mh
,
ASink
.
class
,
"take"
,
captureB
,
takeC
,
takeA
));
tryCapBSink
(
invokeMetafactory
(
mh
,
BSink
.
class
,
"take"
,
captureB
,
takeC
,
takeB
));
tryCapASink
(
invokeAltMetafactory
(
mh
,
ASink
.
class
,
"take"
,
captureB
,
takeC
,
takeA
));
tryCapBSink
(
invokeAltMetafactory
(
mh
,
BSink
.
class
,
"take"
,
captureB
,
takeC
,
takeB
));
// bridge
tryCapASink
(
invokeAltMetafactory
(
mh
,
ASink
.
class
,
"take"
,
captureB
,
takeC
,
takeC
,
takeA
));
tryCapBSink
(
invokeAltMetafactory
(
mh
,
BSink
.
class
,
"take"
,
captureB
,
takeC
,
takeC
,
takeB
));
}
}
void
tryASink
(
CallSite
cs
)
throws
Throwable
{
ASink
sink
=
(
ASink
)
cs
.
dynamicInvoker
().
invoke
();
tryASink
(
sink
);
}
void
tryCapASink
(
CallSite
cs
)
throws
Throwable
{
ASink
sink
=
(
ASink
)
cs
.
dynamicInvoker
().
invoke
(
new
B
());
tryASink
(
sink
);
}
void
tryBSink
(
CallSite
cs
)
throws
Throwable
{
BSink
sink
=
(
BSink
)
cs
.
dynamicInvoker
().
invoke
();
tryBSink
(
sink
);
}
void
tryCapBSink
(
CallSite
cs
)
throws
Throwable
{
BSink
sink
=
(
BSink
)
cs
.
dynamicInvoker
().
invoke
(
new
B
());
tryBSink
(
sink
);
}
void
tryASink
(
ASink
sink
)
{
try
{
sink
.
take
(
new
C
());
}
catch
(
ClassCastException
e
)
{
throw
new
AssertionError
(
"Unexpected cast failure: "
+
e
+
" "
+
lastMFParams
());
}
try
{
sink
.
take
(
new
B
());
throw
new
AssertionError
(
"Missing cast from A to C: "
+
lastMFParams
());
}
catch
(
ClassCastException
e
)
{
/* expected */
}
try
{
sink
.
take
(
new
NotC
());
throw
new
AssertionError
(
"Missing cast from A to C: "
+
lastMFParams
());
}
catch
(
ClassCastException
e
)
{
/* expected */
}
}
void
tryBSink
(
BSink
sink
)
{
try
{
sink
.
take
(
new
C
());
}
catch
(
ClassCastException
e
)
{
throw
new
AssertionError
(
"Unexpected cast failure: "
+
e
+
" "
+
lastMFParams
());
}
try
{
sink
.
take
(
new
B
());
throw
new
AssertionError
(
"Missing cast from B to C: "
+
lastMFParams
());
}
catch
(
ClassCastException
e
)
{
/* expected */
}
try
{
sink
.
take
(
new
NotC
());
throw
new
AssertionError
(
"Missing cast from B to C: "
+
lastMFParams
());
}
catch
(
ClassCastException
e
)
{
/* expected */
}
}
MethodHandle
lastMH
;
Class
<?>[]
lastCaptured
;
MethodType
lastInstMT
;
MethodType
lastSamMT
;
MethodType
[]
lastBridgeMTs
;
String
lastMFParams
()
{
return
"mh="
+
lastMH
+
", captured="
+
Arrays
.
toString
(
lastCaptured
)
+
", instMT="
+
lastInstMT
+
", samMT="
+
lastSamMT
+
", bridgeMTs="
+
Arrays
.
toString
(
lastBridgeMTs
);
}
CallSite
invokeMetafactory
(
MethodHandle
mh
,
Class
<?>
sam
,
String
methodName
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
)
{
lastMH
=
mh
;
lastCaptured
=
captured
;
lastInstMT
=
instMT
;
lastSamMT
=
samMT
;
lastBridgeMTs
=
new
MethodType
[]{};
try
{
return
LambdaMetafactory
.
metafactory
(
lookup
,
methodName
,
methodType
(
sam
,
captured
),
samMT
,
mh
,
instMT
);
}
catch
(
LambdaConversionException
e
)
{
// unexpected linkage error
throw
new
RuntimeException
(
e
);
}
}
CallSite
invokeAltMetafactory
(
MethodHandle
mh
,
Class
<?>
sam
,
String
methodName
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
,
MethodType
...
bridgeMTs
)
{
lastMH
=
mh
;
lastCaptured
=
captured
;
lastInstMT
=
instMT
;
lastSamMT
=
samMT
;
lastBridgeMTs
=
bridgeMTs
;
try
{
boolean
bridge
=
bridgeMTs
.
length
>
0
;
Object
[]
args
=
new
Object
[
bridge
?
5
+
bridgeMTs
.
length
:
4
];
args
[
0
]
=
samMT
;
args
[
1
]
=
mh
;
args
[
2
]
=
instMT
;
args
[
3
]
=
bridge
?
LambdaMetafactory
.
FLAG_BRIDGES
:
0
;
if
(
bridge
)
{
args
[
4
]
=
bridgeMTs
.
length
;
for
(
int
i
=
0
;
i
<
bridgeMTs
.
length
;
i
++)
args
[
5
+
i
]
=
bridgeMTs
[
i
];
}
return
LambdaMetafactory
.
altMetafactory
(
lookup
,
methodName
,
methodType
(
sam
,
captured
),
args
);
}
catch
(
LambdaConversionException
e
)
{
// unexpected linkage error
throw
new
RuntimeException
(
e
);
}
}
}
test/java/lang/invoke/lambda/MetafactorySamReturnTest.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035776
* @summary metafactory should fail if impl return does not match sam/bridge returns
*/
import
java.lang.invoke.*
;
import
java.util.Arrays
;
import
static
java
.
lang
.
invoke
.
MethodType
.
methodType
;
public
class
MetafactorySamReturnTest
{
static
final
MethodHandles
.
Lookup
lookup
=
MethodHandles
.
lookup
();
public
interface
I
{}
public
static
class
C
{
public
static
void
m_void
(
String
arg
)
{}
public
static
boolean
m_boolean
(
String
arg
)
{
return
true
;
}
public
static
char
m_char
(
String
arg
)
{
return
'x'
;
}
public
static
byte
m_byte
(
String
arg
)
{
return
12
;
}
public
static
short
m_short
(
String
arg
)
{
return
12
;
}
public
static
int
m_int
(
String
arg
)
{
return
12
;
}
public
static
long
m_long
(
String
arg
)
{
return
12
;
}
public
static
float
m_float
(
String
arg
)
{
return
12
;
}
public
static
double
m_double
(
String
arg
)
{
return
12
;
}
public
static
String
m_String
(
String
arg
)
{
return
""
;
}
public
static
Integer
m_Integer
(
String
arg
)
{
return
23
;
}
public
static
Object
m_Object
(
String
arg
)
{
return
new
Object
();
}
public
static
MethodHandle
getMH
(
Class
<?>
c
)
{
try
{
return
lookup
.
findStatic
(
C
.
class
,
"m_"
+
c
.
getSimpleName
(),
methodType
(
c
,
String
.
class
));
}
catch
(
NoSuchMethodException
|
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
public
static
void
main
(
String
...
args
)
{
Class
<?>[]
t
=
{
void
.
class
,
boolean
.
class
,
char
.
class
,
byte
.
class
,
short
.
class
,
int
.
class
,
long
.
class
,
float
.
class
,
double
.
class
,
String
.
class
,
Integer
.
class
,
Object
.
class
};
for
(
int
i
=
0
;
i
<
t
.
length
;
i
++)
{
MethodHandle
mh
=
C
.
getMH
(
t
[
i
]);
for
(
int
j
=
0
;
j
<
t
.
length
;
j
++)
{
// TEMPORARY EXCEPTIONS
if
(
t
[
j
]
==
void
.
class
)
continue
;
if
(
t
[
i
].
isPrimitive
()
&&
t
[
j
]
==
Object
.
class
)
continue
;
if
(
t
[
i
]
==
char
.
class
&&
(
t
[
j
]
==
int
.
class
||
t
[
j
]
==
long
.
class
||
t
[
j
]
==
float
.
class
||
t
[
j
]
==
double
.
class
))
continue
;
if
(
t
[
i
]
==
byte
.
class
&&
(
t
[
j
]
==
short
.
class
||
t
[
j
]
==
int
.
class
||
t
[
j
]
==
long
.
class
||
t
[
j
]
==
float
.
class
||
t
[
j
]
==
double
.
class
))
continue
;
if
(
t
[
i
]
==
short
.
class
&&
(
t
[
j
]
==
int
.
class
||
t
[
j
]
==
long
.
class
||
t
[
j
]
==
float
.
class
||
t
[
j
]
==
double
.
class
))
continue
;
if
(
t
[
i
]
==
int
.
class
&&
(
t
[
j
]
==
long
.
class
||
t
[
j
]
==
float
.
class
||
t
[
j
]
==
double
.
class
))
continue
;
if
(
t
[
i
]
==
long
.
class
&&
(
t
[
j
]
==
float
.
class
||
t
[
j
]
==
double
.
class
))
continue
;
if
(
t
[
i
]
==
float
.
class
&&
t
[
j
]
==
double
.
class
)
continue
;
if
(
t
[
i
]
==
int
.
class
&&
t
[
j
]
==
Integer
.
class
)
continue
;
if
(
t
[
i
]
==
Integer
.
class
&&
(
t
[
j
]
==
int
.
class
||
t
[
j
]
==
long
.
class
||
t
[
j
]
==
float
.
class
||
t
[
j
]
==
double
.
class
))
continue
;
// END TEMPORARY EXCEPTIONS
boolean
correct
=
(
t
[
i
].
isPrimitive
()
||
t
[
j
].
isPrimitive
())
?
t
[
i
]
==
t
[
j
]
:
t
[
j
].
isAssignableFrom
(
t
[
i
]);
MethodType
mti
=
methodType
(
t
[
i
],
String
.
class
);
MethodType
mtiCS
=
methodType
(
t
[
i
],
CharSequence
.
class
);
MethodType
mtj
=
methodType
(
t
[
j
],
String
.
class
);
MethodType
mtjObj
=
methodType
(
t
[
j
],
Object
.
class
);
test
(
correct
,
mh
,
mti
,
mtj
);
testBridge
(
correct
,
mh
,
mti
,
mti
,
mtjObj
);
testBridge
(
correct
,
mh
,
mti
,
mti
,
mtiCS
,
mtjObj
);
}
}
}
static
void
test
(
boolean
correct
,
MethodHandle
mh
,
MethodType
instMT
,
MethodType
samMT
)
{
tryMetafactory
(
correct
,
mh
,
new
Class
<?>[]{},
instMT
,
samMT
);
tryAltMetafactory
(
correct
,
mh
,
new
Class
<?>[]{},
instMT
,
samMT
);
}
static
void
testBridge
(
boolean
correct
,
MethodHandle
mh
,
MethodType
instMT
,
MethodType
samMT
,
MethodType
...
bridgeMTs
)
{
tryAltMetafactory
(
correct
,
mh
,
new
Class
<?>[]{},
instMT
,
samMT
,
bridgeMTs
);
}
static
void
tryMetafactory
(
boolean
correct
,
MethodHandle
mh
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
)
{
try
{
LambdaMetafactory
.
metafactory
(
lookup
,
"run"
,
methodType
(
I
.
class
,
captured
),
samMT
,
mh
,
instMT
);
if
(!
correct
)
{
throw
new
AssertionError
(
"Uncaught linkage error:"
+
" impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
);
}
}
catch
(
LambdaConversionException
e
)
{
if
(
correct
)
{
throw
new
AssertionError
(
"Unexpected linkage error:"
+
" e="
+
e
+
", impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
);
}
}
}
static
void
tryAltMetafactory
(
boolean
correct
,
MethodHandle
mh
,
Class
<?>[]
captured
,
MethodType
instMT
,
MethodType
samMT
,
MethodType
...
bridgeMTs
)
{
boolean
bridge
=
bridgeMTs
.
length
>
0
;
Object
[]
args
=
new
Object
[
bridge
?
5
+
bridgeMTs
.
length
:
4
];
args
[
0
]
=
samMT
;
args
[
1
]
=
mh
;
args
[
2
]
=
instMT
;
args
[
3
]
=
bridge
?
LambdaMetafactory
.
FLAG_BRIDGES
:
0
;
if
(
bridge
)
{
args
[
4
]
=
bridgeMTs
.
length
;
for
(
int
i
=
0
;
i
<
bridgeMTs
.
length
;
i
++)
args
[
5
+
i
]
=
bridgeMTs
[
i
];
}
try
{
LambdaMetafactory
.
altMetafactory
(
lookup
,
"run"
,
methodType
(
I
.
class
,
captured
),
args
);
if
(!
correct
)
{
throw
new
AssertionError
(
"Uncaught linkage error:"
+
" impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
+
", bridges="
+
Arrays
.
toString
(
bridgeMTs
));
}
}
catch
(
LambdaConversionException
e
)
{
if
(
correct
)
{
throw
new
AssertionError
(
"Unexpected linkage error:"
+
" e="
+
e
+
", impl="
+
mh
+
", captured="
+
Arrays
.
toString
(
captured
)
+
", inst="
+
instMT
+
", sam="
+
samMT
+
", bridges="
+
Arrays
.
toString
(
bridgeMTs
));
}
}
}
}
test/javax/swing/JPopupMenu/7154841/bug7154841.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 7154841
@summary JPopupMenu is overlapped by a Dock on Mac OS X
@author Petr Pchelko
*/
import
sun.awt.OSInfo
;
import
sun.awt.SunToolkit
;
import
java.awt.*
;
import
javax.swing.*
;
import
java.awt.event.MouseEvent
;
import
java.awt.event.MouseMotionAdapter
;
import
java.util.concurrent.atomic.AtomicReference
;
public
class
bug7154841
{
private
static
final
int
STEP
=
10
;
private
static
volatile
boolean
passed
=
false
;
private
static
JFrame
frame
;
private
static
JPopupMenu
popupMenu
;
private
static
AtomicReference
<
Rectangle
>
screenBounds
=
new
AtomicReference
<>();
private
static
void
initAndShowUI
()
{
popupMenu
=
new
JPopupMenu
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
JRadioButtonMenuItem
item
=
new
JRadioButtonMenuItem
(
" Test "
+
i
);
item
.
addMouseMotionListener
(
new
MouseMotionAdapter
()
{
@Override
public
void
mouseMoved
(
MouseEvent
e
)
{
passed
=
true
;
}
});
popupMenu
.
add
(
item
);
}
frame
=
new
JFrame
();
screenBounds
.
set
(
getScreenBounds
());
frame
.
setBounds
(
screenBounds
.
get
());
frame
.
setVisible
(
true
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
OSInfo
.
getOSType
()
!=
OSInfo
.
OSType
.
MACOSX
)
{
return
;
// Test only for Mac OS X
}
try
{
Robot
r
=
new
Robot
();
r
.
setAutoDelay
(
100
);
r
.
setAutoWaitForIdle
(
true
);
r
.
mouseMove
(
0
,
0
);
SwingUtilities
.
invokeAndWait
(
bug7154841:
:
initAndShowUI
);
sleep
();
SwingUtilities
.
invokeAndWait
(()
->
{
popupMenu
.
show
(
frame
,
frame
.
getX
()
+
frame
.
getWidth
()
/
2
,
frame
.
getY
()
+
frame
.
getHeight
()
/
2
);
});
sleep
();
int
y
=
(
int
)
screenBounds
.
get
().
getY
()
+
(
int
)
screenBounds
.
get
().
getHeight
()
-
10
;
int
center
=
(
int
)(
screenBounds
.
get
().
getX
()
+
screenBounds
.
get
().
getWidth
()
/
2
);
for
(
int
x
=
center
-
10
*
STEP
;
x
<
center
+
10
*
STEP
;
x
+=
STEP
)
{
r
.
mouseMove
(
x
,
y
);
}
if
(!
passed
)
{
throw
new
RuntimeException
(
"Failed: no mouse events on the popup menu"
);
}
}
finally
{
SwingUtilities
.
invokeLater
(()
->
{
if
(
frame
!=
null
)
{
frame
.
dispose
();
}
});
}
}
public
static
Rectangle
getScreenBounds
()
{
return
GraphicsEnvironment
.
getLocalGraphicsEnvironment
()
.
getDefaultScreenDevice
()
.
getDefaultConfiguration
()
.
getBounds
();
}
private
static
void
sleep
()
{
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
try
{
Thread
.
sleep
(
200
);
}
catch
(
InterruptedException
ignored
)
{
}
}
}
test/javax/xml/jaxp/parsers/8027359/XML11EntityScannerTest.java
0 → 100644
浏览文件 @
28ea77aa
此差异已折叠。
点击以展开。
test/javax/xml/jaxp/parsers/8032909/XSLT.java
0 → 100644
浏览文件 @
28ea77aa
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8032909
* @summary Test for XSLT string-length function with complementary chars
* @compile XSLT.java
* @run main/othervm XSLT a_utf16.xml a_utf16.xsl 1270
* @run main/othervm XSLT a_utf8.xml a_utf8.xsl 130
* @run main/othervm XSLT a_windows1252.xml a_windows1252.xsl 200
*/
import
java.io.ByteArrayOutputStream
;
import
javax.xml.transform.stream.StreamResult
;
import
javax.xml.transform.stream.StreamSource
;
import
javax.xml.transform.Transformer
;
import
javax.xml.transform.TransformerFactory
;
public
class
XSLT
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ByteArrayOutputStream
resStream
=
new
ByteArrayOutputStream
();
TransformerFactory
trf
=
TransformerFactory
.
newInstance
();
Transformer
tr
=
trf
.
newTransformer
(
new
StreamSource
(
System
.
getProperty
(
"test.src"
,
"."
)+
"/"
+
args
[
1
]));
String
res
,
expectedRes
;
tr
.
transform
(
new
StreamSource
(
System
.
getProperty
(
"test.src"
,
"."
)+
"/"
+
args
[
0
]),
new
StreamResult
(
resStream
));
res
=
resStream
.
toString
();
System
.
out
.
println
(
"Transformation completed. Result:"
+
res
);
if
(!
res
.
replaceAll
(
"\\s"
,
""
).
equals
(
args
[
2
]))
throw
new
RuntimeException
(
"Incorrect transformation result. Expected:"
+
args
[
2
]+
" Observed:"
+
res
);
}
}
test/javax/xml/jaxp/parsers/8032909/a_utf16.xml
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/javax/xml/jaxp/parsers/8032909/a_utf16.xsl
0 → 100644
浏览文件 @
28ea77aa
文件已添加
test/javax/xml/jaxp/parsers/8032909/a_utf8.xml
0 → 100644
浏览文件 @
28ea77aa
<?xml version="1.0" encoding="UTF-8"?>
<testxml>
<Element>
UTF-8_Element
</Element>
<Element2></Element2>
</testxml>
test/javax/xml/jaxp/parsers/8032909/a_utf8.xsl
0 → 100644
浏览文件 @
28ea77aa
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version=
"1.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
method=
"text"
/>
<xsl:template
match=
"Element"
>
<xsl:value-of
select=
"string-length(.)"
/>
</xsl:template>
<xsl:template
match=
"Element2"
>
<xsl:value-of
select=
"string-length(.)"
/>
</xsl:template>
</xsl:stylesheet>
test/javax/xml/jaxp/parsers/8032909/a_windows1252.xml
0 → 100644
浏览文件 @
28ea77aa
<?xml version="1.0" encoding="windows-1252"?>
<testxml>
<Element>
Windows-1252_Element
</Element>
<Element2></Element2>
</testxml>
test/javax/xml/jaxp/parsers/8032909/a_windows1252.xsl
0 → 100644
浏览文件 @
28ea77aa
<?xml version="1.0" encoding="windows-1252"?>
<xsl:stylesheet
version=
"1.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
method=
"text"
/>
<xsl:template
match=
"Element"
>
<xsl:value-of
select=
"string-length(.)"
/>
</xsl:template>
<xsl:template
match=
"Element2"
>
<xsl:value-of
select=
"string-length(.)"
/>
</xsl:template>
</xsl:stylesheet>
test/sun/util/calendar/zi/Zoneinfo.java
浏览文件 @
28ea77aa
...
...
@@ -372,6 +372,7 @@ class Zoneinfo {
ZoneRec
zrec
=
zone
.
get
(
zone
.
size
()-
1
);
tz
.
getOffsetIndex
(
zrec
.
getGmtOffset
());
int
lastGmtOffsetValue
=
-
1
;
int
currentSave
=
0
;
boolean
usedZone
;
for
(
int
zindex
=
0
;
zindex
<
zone
.
size
();
zindex
++)
{
...
...
@@ -380,9 +381,12 @@ class Zoneinfo {
gmtOffset
=
zrec
.
getGmtOffset
();
int
stdOffset
=
zrec
.
getDirectSave
();
if
(
gmtOffset
!=
lastGmtOffsetValue
)
{
tz
.
setRawOffset
(
gmtOffset
,
fromTime
);
lastGmtOffsetValue
=
gmtOffset
;
}
// If this is the last zone record, take the last rule info.
if
(!
zrec
.
hasUntil
())
{
tz
.
setRawOffset
(
gmtOffset
,
fromTime
);
if
(
zrec
.
hasRuleReference
())
{
tz
.
setLastRules
(
zrec
.
getRuleRef
().
getLastRules
());
}
else
if
(
stdOffset
!=
0
)
{
...
...
test/sun/util/calendar/zi/tzdata/VERSION
浏览文件 @
28ea77aa
...
...
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
tzdata201
3i
tzdata201
4a
test/sun/util/calendar/zi/tzdata/asia
浏览文件 @
28ea77aa
...
...
@@ -1113,8 +1113,13 @@ Rule Zion 1986 only - May 18 0:00 1:00 D
Rule Zion 1986 only - Sep 7 0:00 0 S
Rule Zion 1987 only - Apr 15 0:00 1:00 D
Rule Zion 1987 only - Sep 13 0:00 0 S
Rule Zion 1988 only - Apr 9 0:00 1:00 D
Rule Zion 1988 only - Sep 3 0:00 0 S
# From Avigdor Finkelstein (2014-03-05):
# I check the Parliament (Knesset) records and there it's stated that the
# [1988] transition should take place on Saturday night, when the Sabbath
# ends and changes to Sunday.
Rule Zion 1988 only - Apr 10 0:00 1:00 D
Rule Zion 1988 only - Sep 4 0:00 0 S
# From Ephraim Silverberg
# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
...
...
test/sun/util/calendar/zi/tzdata/australasia
浏览文件 @
28ea77aa
此差异已折叠。
点击以展开。
test/sun/util/calendar/zi/tzdata/europe
浏览文件 @
28ea77aa
此差异已折叠。
点击以展开。
test/sun/util/calendar/zi/tzdata/northamerica
浏览文件 @
28ea77aa
此差异已折叠。
点击以展开。
test/sun/util/calendar/zi/tzdata/southamerica
浏览文件 @
28ea77aa
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录