Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2ff3b4e4
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看板
提交
2ff3b4e4
编写于
5月 10, 2013
作者:
M
mduigou
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
9a61dcd4
46ca7e07
变更
60
展开全部
隐藏空白更改
内联
并排
Showing
60 changed file
with
1541 addition
and
1341 deletion
+1541
-1341
.hgtags
.hgtags
+1
-0
makefiles/CompileNativeLibraries.gmk
makefiles/CompileNativeLibraries.gmk
+73
-48
makefiles/GensrcX11Wrappers.gmk
makefiles/GensrcX11Wrappers.gmk
+6
-1
makefiles/Images.gmk
makefiles/Images.gmk
+9
-3
src/macosx/classes/sun/awt/CGraphicsDevice.java
src/macosx/classes/sun/awt/CGraphicsDevice.java
+38
-12
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
+44
-35
src/macosx/classes/sun/lwawt/LWComponentPeer.java
src/macosx/classes/sun/lwawt/LWComponentPeer.java
+20
-25
src/macosx/classes/sun/lwawt/LWWindowPeer.java
src/macosx/classes/sun/lwawt/LWWindowPeer.java
+29
-7
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+5
-1
src/macosx/native/sun/awt/AWTEvent.h
src/macosx/native/sun/awt/AWTEvent.h
+2
-1
src/macosx/native/sun/awt/AWTEvent.m
src/macosx/native/sun/awt/AWTEvent.m
+2
-3
src/macosx/native/sun/awt/CGraphicsEnv.m
src/macosx/native/sun/awt/CGraphicsEnv.m
+4
-3
src/macosx/native/sun/awt/CMenuItem.m
src/macosx/native/sun/awt/CMenuItem.m
+11
-2
src/macosx/native/sun/awt/CTextPipe.m
src/macosx/native/sun/awt/CTextPipe.m
+11
-0
src/macosx/native/sun/awt/awt.m
src/macosx/native/sun/awt/awt.m
+4
-1
src/macosx/native/sun/java2d/opengl/CGLLayer.m
src/macosx/native/sun/java2d/opengl/CGLLayer.m
+5
-1
src/share/classes/java/awt/Component.java
src/share/classes/java/awt/Component.java
+5
-5
src/share/classes/java/awt/Window.java
src/share/classes/java/awt/Window.java
+1
-1
src/share/classes/java/beans/MetaData.java
src/share/classes/java/beans/MetaData.java
+77
-70
src/share/classes/java/beans/XMLEncoder.java
src/share/classes/java/beans/XMLEncoder.java
+15
-1
src/share/classes/java/lang/reflect/Executable.java
src/share/classes/java/lang/reflect/Executable.java
+25
-19
src/share/classes/java/lang/reflect/Field.java
src/share/classes/java/lang/reflect/Field.java
+1
-1
src/share/classes/java/lang/reflect/Modifier.java
src/share/classes/java/lang/reflect/Modifier.java
+42
-8
src/share/classes/java/lang/reflect/Parameter.java
src/share/classes/java/lang/reflect/Parameter.java
+13
-0
src/share/classes/java/util/regex/Pattern.java
src/share/classes/java/util/regex/Pattern.java
+87
-4
src/share/classes/javax/swing/JDesktopPane.java
src/share/classes/javax/swing/JDesktopPane.java
+9
-0
src/share/classes/sun/java2d/pipe/AAShapePipe.java
src/share/classes/sun/java2d/pipe/AAShapePipe.java
+2
-2
src/share/classes/sun/reflect/annotation/TypeAnnotation.java
src/share/classes/sun/reflect/annotation/TypeAnnotation.java
+7
-6
src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java
.../classes/sun/reflect/annotation/TypeAnnotationParser.java
+33
-34
src/share/classes/sun/security/provider/certpath/CertPathHelper.java
...lasses/sun/security/provider/certpath/CertPathHelper.java
+1
-1
src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java
.../security/provider/certpath/DistributionPointFetcher.java
+9
-8
src/share/classes/sun/security/provider/certpath/OCSP.java
src/share/classes/sun/security/provider/certpath/OCSP.java
+4
-5
src/share/classes/sun/security/provider/certpath/OCSPResponse.java
.../classes/sun/security/provider/certpath/OCSPResponse.java
+27
-4
src/share/classes/sun/security/provider/certpath/URICertStore.java
.../classes/sun/security/provider/certpath/URICertStore.java
+30
-1
src/solaris/classes/sun/awt/X11/XWindowPeer.java
src/solaris/classes/sun/awt/X11/XWindowPeer.java
+3
-1
src/windows/classes/sun/awt/windows/WComponentPeer.java
src/windows/classes/sun/awt/windows/WComponentPeer.java
+12
-3
src/windows/classes/sun/awt/windows/WWindowPeer.java
src/windows/classes/sun/awt/windows/WWindowPeer.java
+6
-0
src/windows/classes/sun/nio/fs/WindowsFileCopy.java
src/windows/classes/sun/nio/fs/WindowsFileCopy.java
+2
-16
src/windows/classes/sun/nio/fs/WindowsLinkSupport.java
src/windows/classes/sun/nio/fs/WindowsLinkSupport.java
+1
-15
src/windows/classes/sun/nio/fs/WindowsPath.java
src/windows/classes/sun/nio/fs/WindowsPath.java
+1
-1
test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java
...impleWindowActivationTest/SimpleWindowActivationTest.java
+5
-5
test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh
test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh
+3
-2
test/java/awt/WMSpecificTests/Metacity/FullscreenDialogModality.java
...wt/WMSpecificTests/Metacity/FullscreenDialogModality.java
+144
-0
test/java/beans/XMLEncoder/AbstractTest.java
test/java/beans/XMLEncoder/AbstractTest.java
+22
-4
test/java/beans/XMLEncoder/BeanValidator.java
test/java/beans/XMLEncoder/BeanValidator.java
+15
-22
test/java/beans/XMLEncoder/Test4631471.java
test/java/beans/XMLEncoder/Test4631471.java
+0
-5
test/java/beans/XMLEncoder/Test4679556.java
test/java/beans/XMLEncoder/Test4679556.java
+0
-1
test/java/beans/XMLEncoder/java_awt_BorderLayout.java
test/java/beans/XMLEncoder/java_awt_BorderLayout.java
+2
-4
test/java/beans/XMLEncoder/java_awt_CardLayout.java
test/java/beans/XMLEncoder/java_awt_CardLayout.java
+83
-0
test/java/beans/XMLEncoder/java_awt_GridBagLayout.java
test/java/beans/XMLEncoder/java_awt_GridBagLayout.java
+101
-0
test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java
.../java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java
+6
-0
test/java/lang/Math/DivModTests.java
test/java/lang/Math/DivModTests.java
+5
-4
test/java/lang/annotation/TypeAnnotationReflection.java
test/java/lang/annotation/TypeAnnotationReflection.java
+151
-1
test/java/nio/file/Files/NameLimits.java
test/java/nio/file/Files/NameLimits.java
+103
-0
test/java/util/regex/RegExTest.java
test/java/util/regex/RegExTest.java
+19
-2
test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java
...swing/JInternalFrame/InternalFrameIsNotCollectedTest.java
+138
-0
test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java
...ionListenerCalledTwice/ActionListenerCalledTwiceTest.java
+67
-18
test/sun/security/provider/certpath/X509CertPath/ForwardBuildCompromised.java
...ovider/certpath/X509CertPath/ForwardBuildCompromised.java
+0
-312
test/sun/security/provider/certpath/X509CertPath/ReverseBuildCompromised.java
...ovider/certpath/X509CertPath/ReverseBuildCompromised.java
+0
-315
test/sun/security/provider/certpath/X509CertPath/ValidateCompromised.java
...y/provider/certpath/X509CertPath/ValidateCompromised.java
+0
-297
未找到文件。
.hgtags
浏览文件 @
2ff3b4e4
...
@@ -209,3 +209,4 @@ ac519af51769e92c51b597a730974e8607357709 jdk8-b83
...
@@ -209,3 +209,4 @@ ac519af51769e92c51b597a730974e8607357709 jdk8-b83
296676d534c52888c36e305a2bf7f345c4ca70f8 jdk8-b85
296676d534c52888c36e305a2bf7f345c4ca70f8 jdk8-b85
7989cd0cc3a9149864589438ee2c949015d8aa9a jdk8-b86
7989cd0cc3a9149864589438ee2c949015d8aa9a jdk8-b86
d5228e624826a10ccc5b05f30ad8d839b58fe48d jdk8-b87
d5228e624826a10ccc5b05f30ad8d839b58fe48d jdk8-b87
8dbb4b159e04de3c447c9242c70505e71f8624c7 jdk8-b88
makefiles/CompileNativeLibraries.gmk
浏览文件 @
2ff3b4e4
...
@@ -63,7 +63,12 @@ WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
...
@@ -63,7 +63,12 @@ WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
# not on other platforms.
# not on other platforms.
ifeq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(OPENJDK_TARGET_OS), windows)
WINDOWS_ONLY := true
DEBUG_ALL_BINARIES := true
endif
# Build everything with debugging on OpenJDK
ifdef OPENJDK
DEBUG_ALL_BINARIES := true
endif
endif
#
#
...
@@ -91,7 +96,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
...
@@ -91,7 +96,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
CFLAGS_windows_debug:=-DLOGGING,\
CFLAGS_windows_debug:=-DLOGGING,\
ARFLAGS:=$(ARFLAGS),\
ARFLAGS:=$(ARFLAGS),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
else
else
...
@@ -105,7 +111,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC,\
...
@@ -105,7 +111,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC,\
CFLAGS:=$(CFLAGS_JDKLIB) \
CFLAGS:=$(CFLAGS_JDKLIB) \
-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
LDFLAGS:=-nostdlib -r -arch x86_64,\
LDFLAGS:=-nostdlib -r -arch x86_64,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC)
$(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC)
...
@@ -257,7 +264,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\
...
@@ -257,7 +264,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
REORDER:=$(LIBJAVA_REORDER), \
REORDER:=$(LIBJAVA_REORDER), \
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBJAVA)
BUILD_LIBRARIES += $(BUILD_LIBJAVA)
...
@@ -308,7 +315,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE,\
...
@@ -308,7 +315,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE,\
-D "JDK_INTERNAL_NAME=mlib_image" \
-D "JDK_INTERNAL_NAME=mlib_image" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBMLIB_IMAGE) : $(BUILD_LIBJAVA)
$(BUILD_LIBMLIB_IMAGE) : $(BUILD_LIBJAVA)
...
@@ -431,7 +438,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V,\
...
@@ -431,7 +438,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V,\
$(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
$(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
$(call SET_SHARED_LIBRARY_ORIGIN),\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX_solaris:=-lc,\
LDFLAGS_SUFFIX_solaris:=-lc,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image_v))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image_v,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
$(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
...
@@ -739,7 +747,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT,\
...
@@ -739,7 +747,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT,\
-D "JDK_INTERNAL_NAME=awt" \
-D "JDK_INTERNAL_NAME=awt" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBAWT) : $(BUILD_LIBJAVA)
$(BUILD_LIBAWT) : $(BUILD_LIBJAVA)
...
@@ -895,7 +903,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT,\
...
@@ -895,7 +903,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT,\
-D "JDK_FNAME=xawt.dll" \
-D "JDK_FNAME=xawt.dll" \
-D "JDK_INTERNAL_NAME=xawt" \
-D "JDK_INTERNAL_NAME=xawt" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(BUILD_LIBAWT_XAWT) : $(BUILD_LIBJAVA)
$(BUILD_LIBAWT_XAWT) : $(BUILD_LIBJAVA)
...
@@ -956,7 +965,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\
...
@@ -956,7 +965,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\
-D "JDK_INTERNAL_NAME=zip" \
-D "JDK_INTERNAL_NAME=zip" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBZIP) : $(BUILD_LIBJAVA)
$(BUILD_LIBZIP) : $(BUILD_LIBJAVA)
...
@@ -986,7 +995,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK,\
...
@@ -986,7 +995,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK,\
-D "JDK_FNAME=unpack.dll" \
-D "JDK_FNAME=unpack.dll" \
-D "JDK_INTERNAL_NAME=unpack" \
-D "JDK_INTERNAL_NAME=unpack" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBUNPACK) : $(BUILD_LIBJAVA)
$(BUILD_LIBUNPACK) : $(BUILD_LIBJAVA)
...
@@ -1100,7 +1109,7 @@ ifeq ($(OPENJDK_TARGET_OS),windows)
...
@@ -1100,7 +1109,7 @@ ifeq ($(OPENJDK_TARGET_OS),windows)
-D "JDK_INTERNAL_NAME=dt_shmem" \
-D "JDK_INTERNAL_NAME=dt_shmem" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
...
@@ -1134,7 +1143,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP,\
...
@@ -1134,7 +1143,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP,\
-D "JDK_INTERNAL_NAME=jdwp" \
-D "JDK_INTERNAL_NAME=jdwp" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBJDWP) : $(BUILD_LIBJAVA)
$(BUILD_LIBJDWP) : $(BUILD_LIBJAVA)
...
@@ -1175,7 +1184,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS,\
...
@@ -1175,7 +1184,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS,\
-D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
-D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBJAAS) : $(BUILD_LIBJAVA)
$(BUILD_LIBJAAS) : $(BUILD_LIBJAVA)
...
@@ -1240,7 +1249,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJSDT)
...
@@ -1240,7 +1249,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJSDT)
-D "JDK_INTERNAL_NAME=lcms" \
-D "JDK_INTERNAL_NAME=lcms" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/liblcms,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/liblcms,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBLCMS)
BUILD_LIBRARIES += $(BUILD_LIBLCMS)
...
@@ -1300,7 +1309,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJPEG,\
...
@@ -1300,7 +1309,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJPEG,\
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
REORDER:=$(BUILD_LIBJPEG_REORDER),\
REORDER:=$(BUILD_LIBJPEG_REORDER),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBJPEG) : $(BUILD_LIBJAVA)
$(BUILD_LIBJPEG) : $(BUILD_LIBJAVA)
...
@@ -1377,7 +1386,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER,\
...
@@ -1377,7 +1386,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER,\
-D "JDK_INTERNAL_NAME=fontmanager" \
-D "JDK_INTERNAL_NAME=fontmanager" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT)
$(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT)
...
@@ -1434,7 +1443,7 @@ ifndef OPENJDK
...
@@ -1434,7 +1443,7 @@ ifndef OPENJDK
-D "JDK_INTERNAL_NAME=t2k" \
-D "JDK_INTERNAL_NAME=t2k" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
# t2k is linked against fontmanager
# t2k is linked against fontmanager
$(BUILD_LIBT2K) : $(BUILD_LIBFONTMANAGER)
$(BUILD_LIBT2K) : $(BUILD_LIBFONTMANAGER)
...
@@ -1472,7 +1481,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
...
@@ -1472,7 +1481,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=jawt" \
-D "JDK_INTERNAL_NAME=jawt" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBJAWT) : $(BUILD_LIBAWT)
$(BUILD_LIBJAWT) : $(BUILD_LIBAWT)
...
@@ -1521,7 +1530,8 @@ else # OPENJDK_TARGET_OS not windows
...
@@ -1521,7 +1530,8 @@ else # OPENJDK_TARGET_OS not windows
LDFLAGS_SUFFIX_solaris:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender,\
LDFLAGS_SUFFIX_solaris:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender,\
LDFLAGS_SUFFIX_macosx:=-Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
LDFLAGS_SUFFIX_macosx:=-Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
-framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX),\
-framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
ifndef BUILD_HEADLESS_ONLY
ifndef BUILD_HEADLESS_ONLY
$(BUILD_LIBJAWT) : $(BUILD_LIBAWT_XAWT)
$(BUILD_LIBJAWT) : $(BUILD_LIBAWT_XAWT)
...
@@ -1828,7 +1838,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET,\
...
@@ -1828,7 +1838,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET,\
-D "JDK_INTERNAL_NAME=net" \
-D "JDK_INTERNAL_NAME=net" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBNET) : $(BUILD_LIBJAVA)
$(BUILD_LIBNET) : $(BUILD_LIBJAVA)
...
@@ -1965,7 +1975,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO,\
...
@@ -1965,7 +1975,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO,\
-D "JDK_INTERNAL_NAME=nio" \
-D "JDK_INTERNAL_NAME=nio" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBNIO)
BUILD_LIBRARIES += $(BUILD_LIBNIO)
...
@@ -2002,7 +2012,8 @@ ifeq ($(OPENJDK_TARGET_OS_API),posix)
...
@@ -2002,7 +2012,8 @@ ifeq ($(OPENJDK_TARGET_OS_API),posix)
LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\
LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\
LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBSCTP)
BUILD_LIBRARIES += $(BUILD_LIBSCTP)
...
@@ -2126,7 +2137,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI,\
...
@@ -2126,7 +2137,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI,\
-D "JDK_INTERNAL_NAME=jli" \
-D "JDK_INTERNAL_NAME=jli" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBJLI)
BUILD_LIBRARIES += $(BUILD_LIBJLI)
...
@@ -2143,7 +2154,8 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
...
@@ -2143,7 +2154,8 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
OPTIMIZATION:=HIGH, \
OPTIMIZATION:=HIGH, \
CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
ARFLAGS:=$(ARFLAGS),\
ARFLAGS:=$(ARFLAGS),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
...
@@ -2161,7 +2173,8 @@ else ifeq ($(OPENJDK_TARGET_OS),macosx)
...
@@ -2161,7 +2173,8 @@ else ifeq ($(OPENJDK_TARGET_OS),macosx)
OPTIMIZATION:=HIGH, \
OPTIMIZATION:=HIGH, \
CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS),\
CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS),\
LDFLAGS:=-nostdlib -r,\
LDFLAGS:=-nostdlib -r,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(JDK_OUTPUTDIR)/objs/libjli_static.a : $(BUILD_LIBJLI_STATIC)
$(JDK_OUTPUTDIR)/objs/libjli_static.a : $(BUILD_LIBJLI_STATIC)
$(call install-file)
$(call install-file)
...
@@ -2192,7 +2205,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJFR,\
...
@@ -2192,7 +2205,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJFR,\
-D "JDK_INTERNAL_NAME=jfr" \
-D "JDK_INTERNAL_NAME=jfr" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBJFR)
BUILD_LIBRARIES += $(BUILD_LIBJFR)
...
@@ -2244,7 +2257,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS,\
...
@@ -2244,7 +2257,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS,\
-D "JDK_INTERNAL_NAME=kcms" \
-D "JDK_INTERNAL_NAME=kcms" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBKCMS) : $(BUILD_LIBJAVA)
$(BUILD_LIBKCMS) : $(BUILD_LIBJAVA)
...
@@ -2279,7 +2292,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNWJDGA, \
...
@@ -2279,7 +2292,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNWJDGA, \
LDFLAGS:=$(LDFLAGS_JDKLIB) \
LDFLAGS:=$(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
...
@@ -2369,7 +2383,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
...
@@ -2369,7 +2383,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,\
LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
$(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
...
@@ -2462,7 +2477,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\
...
@@ -2462,7 +2477,7 @@ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\
-D "JDK_INTERNAL_NAME=splashscreen" \
-D "JDK_INTERNAL_NAME=splashscreen" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
...
@@ -2504,7 +2519,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBDCPR,\
...
@@ -2504,7 +2519,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBDCPR,\
-D "JDK_INTERNAL_NAME=dcpr" \
-D "JDK_INTERNAL_NAME=dcpr" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBDCPR) : $(BUILD_LIBJAVA)
$(BUILD_LIBDCPR) : $(BUILD_LIBJAVA)
...
@@ -2538,7 +2553,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC,\
...
@@ -2538,7 +2553,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC,\
-D "JDK_INTERNAL_NAME=j2pcsc" \
-D "JDK_INTERNAL_NAME=j2pcsc" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
...
@@ -2560,7 +2575,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
...
@@ -2560,7 +2575,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
$(call SET_SHARED_LIBRARY_ORIGIN),\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX:=$(LIBDL),\
LDFLAGS_SUFFIX:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=-lc,\
LDFLAGS_SUFFIX_solaris:=-lc,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2gss))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2gss,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
endif
endif
...
@@ -2599,7 +2615,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\
...
@@ -2599,7 +2615,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\
-D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
-D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBKRB5)
BUILD_LIBRARIES += $(BUILD_LIBKRB5)
endif
endif
...
@@ -2625,7 +2641,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI,\
...
@@ -2625,7 +2641,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI,\
-D "JDK_INTERNAL_NAME=sunmscapi" \
-D "JDK_INTERNAL_NAME=sunmscapi" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
endif
endif
...
@@ -2657,7 +2673,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11,\
...
@@ -2657,7 +2673,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11,\
-D "JDK_INTERNAL_NAME=j2pkcs11" \
-D "JDK_INTERNAL_NAME=j2pkcs11" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
...
@@ -2703,7 +2719,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNEC,\
...
@@ -2703,7 +2719,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNEC,\
-D "JDK_INTERNAL_NAME=sunec" \
-D "JDK_INTERNAL_NAME=sunec" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
endif
endif
...
@@ -2847,7 +2863,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND,\
...
@@ -2847,7 +2863,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND,\
-D "JDK_INTERNAL_NAME=jsound" \
-D "JDK_INTERNAL_NAME=jsound" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBJSOUND) : $(BUILD_LIBJAVA)
$(BUILD_LIBJSOUND) : $(BUILD_LIBJAVA)
...
@@ -2882,7 +2898,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA,\
...
@@ -2882,7 +2898,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA,\
LDFLAGS:=$(LDFLAGS_JDKLIB)\
LDFLAGS:=$(LDFLAGS_JDKLIB)\
$(call SET_SHARED_LIBRARY_ORIGIN),\
$(call SET_SHARED_LIBRARY_ORIGIN),\
LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(BUILD_LIBJSOUNDALSA) : $(BUILD_LIBJAVA)
$(BUILD_LIBJSOUNDALSA) : $(BUILD_LIBJAVA)
...
@@ -2915,7 +2932,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS,\
...
@@ -2915,7 +2932,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS,\
-D "JDK_INTERNAL_NAME=jsoundds" \
-D "JDK_INTERNAL_NAME=jsoundds" \
-D "JDK_FTYPE=0x2L",\
-D "JDK_FTYPE=0x2L",\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds,\
DEBUG_SYMBOLS:=$(
WINDOWS_ONLY
)))
DEBUG_SYMBOLS:=$(
DEBUG_ALL_BINARIES
)))
$(BUILD_LIBJSOUNDDS) : $(BUILD_LIBJAVA)
$(BUILD_LIBJSOUNDDS) : $(BUILD_LIBJAVA)
...
@@ -2940,7 +2957,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2UCRYPTO,\
...
@@ -2940,7 +2957,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2UCRYPTO,\
LDFLAGS:=$(LDFLAGS_JDKLIB),\
LDFLAGS:=$(LDFLAGS_JDKLIB),\
LDFLAGS_SUFFIX:=$(LIBDL),\
LDFLAGS_SUFFIX:=$(LIBDL),\
LDFLAGS_SUFFIX_solaris:=-lc,\
LDFLAGS_SUFFIX_solaris:=-lc,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(BUILD_LIBJ2UCRYPTO) : $(BUILD_LIBJAVA)
$(BUILD_LIBJ2UCRYPTO) : $(BUILD_LIBJAVA)
...
@@ -2970,7 +2988,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\
...
@@ -2970,7 +2988,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaNativeFoundation \
$(LDFLAGS_JDKLIB_SUFFIX),\
$(LDFLAGS_JDKLIB_SUFFIX),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(BUILD_LIBAPPLESCRIPTENGINE) : $(BUILD_LIBJAVA)
$(BUILD_LIBAPPLESCRIPTENGINE) : $(BUILD_LIBJAVA)
...
@@ -3009,7 +3028,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\
...
@@ -3009,7 +3028,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\
-framework OpenGL \
-framework OpenGL \
-framework IOSurface \
-framework IOSurface \
-framework QuartzCore, \
-framework QuartzCore, \
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxapp))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxapp,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBOSXAPP)
BUILD_LIBRARIES += $(BUILD_LIBOSXAPP)
...
@@ -3049,7 +3069,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\
...
@@ -3049,7 +3069,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\
-framework Security \
-framework Security \
-framework SystemConfiguration \
-framework SystemConfiguration \
$(LDFLAGS_JDKLIB_SUFFIX), \
$(LDFLAGS_JDKLIB_SUFFIX), \
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosx))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosx,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBOSX)
BUILD_LIBRARIES += $(BUILD_LIBOSX)
...
@@ -3182,7 +3203,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT,\
...
@@ -3182,7 +3203,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT,\
-framework JavaRuntimeSupport \
-framework JavaRuntimeSupport \
-framework OpenGL \
-framework OpenGL \
-framework QuartzCore -ljava,\
-framework QuartzCore -ljava,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
...
@@ -3222,7 +3244,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI,\
...
@@ -3222,7 +3244,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI,\
-framework JavaNativeFoundation \
-framework JavaNativeFoundation \
-framework JavaRuntimeSupport \
-framework JavaRuntimeSupport \
-ljava -ljvm,\
-ljava -ljvm,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
...
@@ -3262,7 +3285,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32,\
...
@@ -3262,7 +3285,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32,\
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaNativeFoundation \
-lffi, \
-lffi, \
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
LIBRARY:=JObjC,\
LIBRARY:=JObjC,\
...
@@ -3286,7 +3310,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
...
@@ -3286,7 +3310,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaNativeFoundation \
-lffi, \
-lffi, \
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64))
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64,\
DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
$(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
$(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
$(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
$(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
...
...
makefiles/GensrcX11Wrappers.gmk
浏览文件 @
2ff3b4e4
...
@@ -86,10 +86,15 @@ ifneq ($(COMPILE_TYPE),cross)
...
@@ -86,10 +86,15 @@ ifneq ($(COMPILE_TYPE),cross)
$(MKDIR) -p $(@D)
$(MKDIR) -p $(@D)
$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
# use -m32/-m64 only if the compiler supports it
ifeq ($(COMPILER_SUPPORTS_TARGET_BITS_FLAG),true)
MEMORY_MODEL_FLAG="-m$*"
endif
# Compile the C code into an executable.
# Compile the C code into an executable.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
$(MKDIR) -p $(@D)
$(MKDIR) -p $(@D)
(cd $(@D) && $(CC)
-m$*
-o $@ $< \
(cd $(@D) && $(CC)
$(MEMORY_MODEL_FLAG)
-o $@ $< \
$(X_CFLAGS) \
$(X_CFLAGS) \
$(X_LIBS) \
$(X_LIBS) \
-I$(JDK_OUTPUTDIR)/include \
-I$(JDK_OUTPUTDIR)/include \
...
...
makefiles/Images.gmk
浏览文件 @
2ff3b4e4
...
@@ -352,16 +352,22 @@ ifneq ($(OPENJDK_TARGET_OS),windows)
...
@@ -352,16 +352,22 @@ ifneq ($(OPENJDK_TARGET_OS),windows)
JDK_MAN_PAGES += jvisualvm.1
JDK_MAN_PAGES += jvisualvm.1
endif
endif
ifndef OPENJDK
MAN_SRC_BASEDIR:=$(JDK_TOPDIR)/src/closed
else
MAN_SRC_BASEDIR:=$(JDK_TOPDIR)/src
endif
ifeq ($(OPENJDK_TARGET_OS), linux)
ifeq ($(OPENJDK_TARGET_OS), linux)
MAN_SRC_DIR:=$(
JDK_TOPDIR)/src
/linux/doc
MAN_SRC_DIR:=$(
MAN_SRC_BASEDIR)
/linux/doc
MAN1_SUBDIR:=man
MAN1_SUBDIR:=man
endif
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifeq ($(OPENJDK_TARGET_OS), solaris)
MAN_SRC_DIR:=$(
JDK_TOPDIR)/src
/solaris/doc
MAN_SRC_DIR:=$(
MAN_SRC_BASEDIR)
/solaris/doc
MAN1_SUBDIR:=sun/man/man1
MAN1_SUBDIR:=sun/man/man1
endif
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(OPENJDK_TARGET_OS), macosx)
MAN_SRC_DIR:=$(
JDK_TOPDIR)/src
/bsd/doc
MAN_SRC_DIR:=$(
MAN_SRC_BASEDIR)
/bsd/doc
MAN1_SUBDIR:=man
MAN1_SUBDIR:=man
JDK_MAN_PAGES := $(filter-out jcmd.1, $(JDK_MAN_PAGES))
JDK_MAN_PAGES := $(filter-out jcmd.1, $(JDK_MAN_PAGES))
JDK_MAN_PAGES := $(filter-out jvisualvm.1, $(JDK_MAN_PAGES))
JDK_MAN_PAGES := $(filter-out jvisualvm.1, $(JDK_MAN_PAGES))
...
...
src/macosx/classes/sun/awt/CGraphicsDevice.java
浏览文件 @
2ff3b4e4
...
@@ -35,10 +35,18 @@ import java.util.Objects;
...
@@ -35,10 +35,18 @@ import java.util.Objects;
import
sun.java2d.opengl.CGLGraphicsConfig
;
import
sun.java2d.opengl.CGLGraphicsConfig
;
public
final
class
CGraphicsDevice
extends
GraphicsDevice
{
public
final
class
CGraphicsDevice
extends
GraphicsDevice
implements
DisplayChangedListener
{
// CoreGraphics display ID
/**
private
final
int
displayID
;
* CoreGraphics display ID. This identifier can become non-valid at any time
* therefore methods, which is using this id should be ready to it.
*/
private
volatile
int
displayID
;
private
volatile
Insets
screenInsets
;
private
volatile
double
xResolution
;
private
volatile
double
yResolution
;
private
volatile
int
scale
;
// Array of all GraphicsConfig instances for this device
// Array of all GraphicsConfig instances for this device
private
final
GraphicsConfiguration
[]
configs
;
private
final
GraphicsConfiguration
[]
configs
;
...
@@ -51,7 +59,7 @@ public final class CGraphicsDevice extends GraphicsDevice {
...
@@ -51,7 +59,7 @@ public final class CGraphicsDevice extends GraphicsDevice {
// Save/restore DisplayMode for the Full Screen mode
// Save/restore DisplayMode for the Full Screen mode
private
DisplayMode
originalMode
;
private
DisplayMode
originalMode
;
public
CGraphicsDevice
(
int
displayID
)
{
public
CGraphicsDevice
(
final
int
displayID
)
{
this
.
displayID
=
displayID
;
this
.
displayID
=
displayID
;
configs
=
new
GraphicsConfiguration
[]
{
configs
=
new
GraphicsConfiguration
[]
{
CGLGraphicsConfig
.
getConfig
(
this
,
0
)
CGLGraphicsConfig
.
getConfig
(
this
,
0
)
...
@@ -89,7 +97,7 @@ public final class CGraphicsDevice extends GraphicsDevice {
...
@@ -89,7 +97,7 @@ public final class CGraphicsDevice extends GraphicsDevice {
*/
*/
@Override
@Override
public
String
getIDstring
()
{
public
String
getIDstring
()
{
return
"Display "
+
this
.
displayID
;
return
"Display "
+
displayID
;
}
}
/**
/**
...
@@ -104,15 +112,37 @@ public final class CGraphicsDevice extends GraphicsDevice {
...
@@ -104,15 +112,37 @@ public final class CGraphicsDevice extends GraphicsDevice {
}
}
public
double
getXResolution
()
{
public
double
getXResolution
()
{
return
nativeGetXResolution
(
displayID
)
;
return
xResolution
;
}
}
public
double
getYResolution
()
{
public
double
getYResolution
()
{
return
nativeGetYResolution
(
displayID
)
;
return
yResolution
;
}
}
public
Insets
getScreenInsets
()
{
public
Insets
getScreenInsets
()
{
return
nativeGetScreenInsets
(
displayID
);
return
screenInsets
;
}
public
int
getScaleFactor
()
{
return
scale
;
}
public
void
invalidate
(
final
int
defaultDisplayID
)
{
displayID
=
defaultDisplayID
;
}
@Override
public
void
displayChanged
()
{
xResolution
=
nativeGetXResolution
(
displayID
);
yResolution
=
nativeGetYResolution
(
displayID
);
screenInsets
=
nativeGetScreenInsets
(
displayID
);
scale
=
(
int
)
nativeGetScaleFactor
(
displayID
);
//TODO configs/fullscreenWindow/modes?
}
@Override
public
void
paletteChanged
()
{
// devices do not need to react to this event.
}
}
/**
/**
...
@@ -219,10 +249,6 @@ public final class CGraphicsDevice extends GraphicsDevice {
...
@@ -219,10 +249,6 @@ public final class CGraphicsDevice extends GraphicsDevice {
return
nativeGetDisplayModes
(
displayID
);
return
nativeGetDisplayModes
(
displayID
);
}
}
public
int
getScaleFactor
()
{
return
(
int
)
nativeGetScaleFactor
(
displayID
);
}
private
static
native
double
nativeGetScaleFactor
(
int
displayID
);
private
static
native
double
nativeGetScaleFactor
(
int
displayID
);
private
static
native
void
nativeSetDisplayMode
(
int
displayID
,
int
w
,
int
h
,
int
bpp
,
int
refrate
);
private
static
native
void
nativeSetDisplayMode
(
int
displayID
,
int
w
,
int
h
,
int
bpp
,
int
refrate
);
...
...
src/macosx/classes/sun/awt/CGraphicsEnvironment.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -26,19 +26,20 @@
...
@@ -26,19 +26,20 @@
package
sun.awt
;
package
sun.awt
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.print.*
;
import
java.util.*
;
import
java.util.*
;
import
sun.java2d.*
;
import
sun.java2d.*
;
/**
/**
* This is an implementation of a GraphicsEnvironment object for the default local GraphicsEnvironment used by the Java
* This is an implementation of a GraphicsEnvironment object for the default
* Runtime Environment for Mac OS X GUI environments.
* local GraphicsEnvironment used by the Java Runtime Environment for Mac OS X
* GUI environments.
*
*
* @see GraphicsDevice
* @see GraphicsDevice
* @see GraphicsConfiguration
* @see GraphicsConfiguration
*/
*/
public
class
CGraphicsEnvironment
extends
SunGraphicsEnvironment
{
public
final
class
CGraphicsEnvironment
extends
SunGraphicsEnvironment
{
// Global initialization of the Cocoa runtime.
// Global initialization of the Cocoa runtime.
private
static
native
void
initCocoa
();
private
static
native
void
initCocoa
();
...
@@ -53,7 +54,8 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -53,7 +54,8 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
private
static
native
int
getMainDisplayID
();
private
static
native
int
getMainDisplayID
();
/**
/**
* Noop function that just acts as an entry point for someone to force a static initialization of this class.
* Noop function that just acts as an entry point for someone to force a
* static initialization of this class.
*/
*/
public
static
void
init
()
{
}
public
static
void
init
()
{
}
...
@@ -78,8 +80,9 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -78,8 +80,9 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
}
}
/**
/**
* Register the instance with CGDisplayRegisterReconfigurationCallback()
* Register the instance with CGDisplayRegisterReconfigurationCallback().
* The registration uses a weak global reference -- if our instance is garbage collected, the reference will be dropped.
* The registration uses a weak global reference -- if our instance is
* garbage collected, the reference will be dropped.
*
*
* @return Return the registration context (a pointer).
* @return Return the registration context (a pointer).
*/
*/
...
@@ -91,7 +94,7 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -91,7 +94,7 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
private
native
void
deregisterDisplayReconfiguration
(
long
context
);
private
native
void
deregisterDisplayReconfiguration
(
long
context
);
/** Available CoreGraphics displays. */
/** Available CoreGraphics displays. */
private
final
Map
<
Integer
,
CGraphicsDevice
>
devices
=
new
HashMap
<
Integer
,
CGraphicsDevice
>(
);
private
final
Map
<
Integer
,
CGraphicsDevice
>
devices
=
new
HashMap
<
>(
5
);
/** Reference to the display reconfiguration callback context. */
/** Reference to the display reconfiguration callback context. */
private
final
long
displayReconfigContext
;
private
final
long
displayReconfigContext
;
...
@@ -118,11 +121,18 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -118,11 +121,18 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
/**
/**
* Called by the CoreGraphics Display Reconfiguration Callback.
* Called by the CoreGraphics Display Reconfiguration Callback.
*
*
* @param displayId
* @param displayId
CoreGraphics displayId
*
CoreGraphics displayId
*
@param removed true if displayId was removed, false otherwise.
*/
*/
void
_displayReconfiguration
(
long
displayId
)
{
void
_displayReconfiguration
(
final
int
displayId
,
final
boolean
removed
)
{
displayChanged
();
synchronized
(
this
)
{
if
(
removed
&&
devices
.
containsKey
(
displayId
))
{
final
CGraphicsDevice
gd
=
devices
.
remove
(
displayId
);
gd
.
invalidate
(
getMainDisplayID
());
gd
.
displayChanged
();
}
}
initDevices
();
}
}
@Override
@Override
...
@@ -135,31 +145,30 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -135,31 +145,30 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
}
}
/**
/**
* (Re)create all CGraphicsDevices
* (Re)create all CGraphicsDevices, reuses a devices if it is possible.
*
* @return
*/
*/
private
synchronized
void
initDevices
()
{
private
void
initDevices
()
{
devices
.
clear
();
synchronized
(
this
)
{
final
Map
<
Integer
,
CGraphicsDevice
>
old
=
new
HashMap
<>(
devices
);
int
mainID
=
getMainDisplayID
();
devices
.
clear
();
// initialization of the graphics device may change
int
mainID
=
getMainDisplayID
();
// list of displays on hybrid systems via an activation
// of discrete video.
// initialization of the graphics device may change
// So, we initialize the main display first, and then
// list of displays on hybrid systems via an activation
// retrieve actual list of displays.
// of discrete video.
CGraphicsDevice
mainDevice
=
new
CGraphicsDevice
(
mainID
);
// So, we initialize the main display first, and then
// retrieve actual list of displays.
final
int
[]
displayIDs
=
getDisplayIDs
();
if
(!
old
.
containsKey
(
mainID
))
{
old
.
put
(
mainID
,
new
CGraphicsDevice
(
mainID
));
}
for
(
int
displayID
:
displayIDs
)
{
for
(
final
int
id
:
getDisplayIDs
())
{
if
(
displayID
!=
mainID
)
{
devices
.
put
(
id
,
old
.
containsKey
(
id
)
?
old
.
get
(
id
)
devices
.
put
(
displayID
,
new
CGraphicsDevice
(
displayID
));
:
new
CGraphicsDevice
(
id
));
}
else
{
devices
.
put
(
mainID
,
mainDevice
);
}
}
}
}
displayChanged
();
}
}
@Override
@Override
...
@@ -167,7 +176,7 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
...
@@ -167,7 +176,7 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
final
int
mainDisplayID
=
getMainDisplayID
();
final
int
mainDisplayID
=
getMainDisplayID
();
CGraphicsDevice
d
=
devices
.
get
(
mainDisplayID
);
CGraphicsDevice
d
=
devices
.
get
(
mainDisplayID
);
if
(
d
==
null
)
{
if
(
d
==
null
)
{
// we do not ex
epct that this may happen, the only responc
e
// we do not ex
pect that this may happen, the only respons
e
// is to re-initialize the list of devices
// is to re-initialize the list of devices
initDevices
();
initDevices
();
...
...
src/macosx/classes/sun/lwawt/LWComponentPeer.java
浏览文件 @
2ff3b4e4
...
@@ -87,18 +87,22 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
...
@@ -87,18 +87,22 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
private
final
T
target
;
private
final
T
target
;
// Container peer. It may not be the peer of the target's direct
/**
// parent, for example, in the case of hw/lw mixing. However,
* Container peer. It may not be the peer of the target's direct parent, for
// let's skip this scenario for the time being. We also assume
* example, in the case of hw/lw mixing. However, let's skip this scenario
// the container peer is not null, which might also be false if
* for the time being. We also assume the container peer is not null, which
// addNotify() is called for a component outside of the hierarchy.
* might also be false if addNotify() is called for a component outside of
// The exception is LWWindowPeers: their parents are always null
* the hierarchy. The exception is LWWindowPeers: their containers are
private
LWContainerPeer
containerPeer
;
* always null
*/
// Handy reference to the top-level window peer. Window peer is
private
final
LWContainerPeer
containerPeer
;
// borrowed from the containerPeer in constructor, and should also
// be updated when the component is reparented to another container
/**
private
LWWindowPeer
windowPeer
;
* Handy reference to the top-level window peer. Window peer is borrowed
* from the containerPeer in constructor, and should also be updated when
* the component is reparented to another container
*/
private
final
LWWindowPeer
windowPeer
;
private
final
AtomicBoolean
disposed
=
new
AtomicBoolean
(
false
);
private
final
AtomicBoolean
disposed
=
new
AtomicBoolean
(
false
);
...
@@ -183,13 +187,13 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
...
@@ -183,13 +187,13 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
this
.
target
=
target
;
this
.
target
=
target
;
this
.
platformComponent
=
platformComponent
;
this
.
platformComponent
=
platformComponent
;
initializeContainerPeer
();
// Container peer is always null for LWWindowPeers, so
// Container peer is always null for LWWindowPeers, so
// windowPeer is always null for them as well. On the other
// windowPeer is always null for them as well. On the other
// hand, LWWindowPeer shouldn't use windowPeer at all
// hand, LWWindowPeer shouldn't use windowPeer at all
if
(
containerPeer
!=
null
)
{
final
Container
container
=
SunToolkit
.
getNativeContainer
(
target
);
windowPeer
=
containerPeer
.
getWindowPeerOrSelf
();
containerPeer
=
(
LWContainerPeer
)
LWToolkit
.
targetToPeer
(
container
);
}
windowPeer
=
containerPeer
!=
null
?
containerPeer
.
getWindowPeerOrSelf
()
:
null
;
// don't bother about z-order here as updateZOrder()
// don't bother about z-order here as updateZOrder()
// will be called from addNotify() later anyway
// will be called from addNotify() later anyway
if
(
containerPeer
!=
null
)
{
if
(
containerPeer
!=
null
)
{
...
@@ -356,15 +360,6 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
...
@@ -356,15 +360,6 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
return
containerPeer
;
return
containerPeer
;
}
}
// Just a helper method
// Overridden in LWWindowPeer to skip containerPeer initialization
protected
void
initializeContainerPeer
()
{
Container
parent
=
LWToolkit
.
getNativeContainer
(
target
);
if
(
parent
!=
null
)
{
containerPeer
=
(
LWContainerPeer
)
LWToolkit
.
targetToPeer
(
parent
);
}
}
public
PlatformWindow
getPlatformWindow
()
{
public
PlatformWindow
getPlatformWindow
()
{
LWWindowPeer
windowPeer
=
getWindowPeer
();
LWWindowPeer
windowPeer
=
getWindowPeer
();
return
windowPeer
.
getPlatformWindow
();
return
windowPeer
.
getPlatformWindow
();
...
...
src/macosx/classes/sun/lwawt/LWWindowPeer.java
浏览文件 @
2ff3b4e4
...
@@ -41,7 +41,7 @@ import sun.util.logging.PlatformLogger;
...
@@ -41,7 +41,7 @@ import sun.util.logging.PlatformLogger;
public
class
LWWindowPeer
public
class
LWWindowPeer
extends
LWContainerPeer
<
Window
,
JComponent
>
extends
LWContainerPeer
<
Window
,
JComponent
>
implements
WindowPeer
,
FramePeer
,
DialogPeer
,
FullScreenCapable
implements
FramePeer
,
DialogPeer
,
FullScreenCapable
,
DisplayChangedListener
{
{
public
static
enum
PeerType
{
public
static
enum
PeerType
{
SIMPLEWINDOW
,
SIMPLEWINDOW
,
...
@@ -189,6 +189,7 @@ public class LWWindowPeer
...
@@ -189,6 +189,7 @@ public class LWWindowPeer
if
(
getSurfaceData
()
==
null
)
{
if
(
getSurfaceData
()
==
null
)
{
replaceSurfaceData
(
false
);
replaceSurfaceData
(
false
);
}
}
activateDisplayListener
();
}
}
// Just a helper method
// Just a helper method
...
@@ -201,15 +202,11 @@ public class LWWindowPeer
...
@@ -201,15 +202,11 @@ public class LWWindowPeer
return
this
;
return
this
;
}
}
@Override
protected
void
initializeContainerPeer
()
{
// No-op as LWWindowPeer doesn't have any containerPeer
}
// ---- PEER METHODS ---- //
// ---- PEER METHODS ---- //
@Override
@Override
protected
void
disposeImpl
()
{
protected
void
disposeImpl
()
{
deactivateDisplayListener
();
SurfaceData
oldData
=
getSurfaceData
();
SurfaceData
oldData
=
getSurfaceData
();
synchronized
(
surfaceDataLock
){
synchronized
(
surfaceDataLock
){
surfaceData
=
null
;
surfaceData
=
null
;
...
@@ -880,6 +877,18 @@ public class LWWindowPeer
...
@@ -880,6 +877,18 @@ public class LWWindowPeer
// ---- UTILITY METHODS ---- //
// ---- UTILITY METHODS ---- //
private
void
activateDisplayListener
()
{
final
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
((
SunGraphicsEnvironment
)
ge
).
addDisplayChangedListener
(
this
);
}
private
void
deactivateDisplayListener
()
{
final
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
((
SunGraphicsEnvironment
)
ge
).
removeDisplayChangedListener
(
this
);
}
private
void
postWindowStateChangedEvent
(
int
newWindowState
)
{
private
void
postWindowStateChangedEvent
(
int
newWindowState
)
{
if
(
getTarget
()
instanceof
Frame
)
{
if
(
getTarget
()
instanceof
Frame
)
{
AWTAccessor
.
getFrameAccessor
().
setExtendedState
(
AWTAccessor
.
getFrameAccessor
().
setExtendedState
(
...
@@ -941,7 +950,6 @@ public class LWWindowPeer
...
@@ -941,7 +950,6 @@ public class LWWindowPeer
graphicsDevice
=
newGraphicsDevice
;
graphicsDevice
=
newGraphicsDevice
;
}
}
// TODO: DisplayChangedListener stuff
final
GraphicsConfiguration
newGC
=
newGraphicsDevice
.
getDefaultConfiguration
();
final
GraphicsConfiguration
newGC
=
newGraphicsDevice
.
getDefaultConfiguration
();
if
(!
setGraphicsConfig
(
newGC
))
return
false
;
if
(!
setGraphicsConfig
(
newGC
))
return
false
;
...
@@ -954,6 +962,20 @@ public class LWWindowPeer
...
@@ -954,6 +962,20 @@ public class LWWindowPeer
return
true
;
return
true
;
}
}
@Override
public
final
void
displayChanged
()
{
updateGraphicsDevice
();
// Replace surface unconditionally, because internal state of the
// GraphicsDevice could be changed.
replaceSurfaceData
();
repaintPeer
();
}
@Override
public
final
void
paletteChanged
()
{
// components do not need to react to this event.
}
/*
/*
* May be called by delegate to provide SD to Java2D code.
* May be called by delegate to provide SD to Java2D code.
*/
*/
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
2ff3b4e4
...
@@ -32,6 +32,7 @@ import java.awt.peer.WindowPeer;
...
@@ -32,6 +32,7 @@ import java.awt.peer.WindowPeer;
import
java.beans.*
;
import
java.beans.*
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
javax.swing.*
;
import
javax.swing.*
;
...
@@ -916,9 +917,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
...
@@ -916,9 +917,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
final
Rectangle
oldB
=
nativeBounds
;
final
Rectangle
oldB
=
nativeBounds
;
nativeBounds
=
new
Rectangle
(
x
,
y
,
width
,
height
);
nativeBounds
=
new
Rectangle
(
x
,
y
,
width
,
height
);
final
GraphicsConfiguration
oldGC
=
peer
.
getGraphicsConfiguration
();
peer
.
notifyReshape
(
x
,
y
,
width
,
height
);
peer
.
notifyReshape
(
x
,
y
,
width
,
height
);
final
GraphicsConfiguration
newGC
=
peer
.
getGraphicsConfiguration
();
// System-dependent appearance optimization.
if
((
byUser
&&
!
oldB
.
getSize
().
equals
(
nativeBounds
.
getSize
()))
if
((
byUser
&&
!
oldB
.
getSize
().
equals
(
nativeBounds
.
getSize
()))
||
isFullScreenAnimationOn
)
{
||
isFullScreenAnimationOn
||
!
Objects
.
equals
(
newGC
,
oldGC
)
)
{
flushBuffers
();
flushBuffers
();
}
}
}
}
...
...
src/macosx/native/sun/awt/AWTEvent.h
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,5 +35,6 @@ void SendAdditionalJavaEvents(JNIEnv *env, NSEvent *nsEvent, jobject peer);
...
@@ -35,5 +35,6 @@ void SendAdditionalJavaEvents(JNIEnv *env, NSEvent *nsEvent, jobject peer);
jint
GetJavaMouseModifiers
(
NSInteger
button
,
NSUInteger
modifierFlags
);
jint
GetJavaMouseModifiers
(
NSInteger
button
,
NSUInteger
modifierFlags
);
jint
NsKeyModifiersToJavaModifiers
(
NSUInteger
nsFlags
,
BOOL
isExtMods
);
jint
NsKeyModifiersToJavaModifiers
(
NSUInteger
nsFlags
,
BOOL
isExtMods
);
NSUInteger
JavaModifiersToNsKeyModifiers
(
jint
javaModifiers
,
BOOL
isExtMods
);
NSUInteger
JavaModifiersToNsKeyModifiers
(
jint
javaModifiers
,
BOOL
isExtMods
);
unichar
NsCharToJavaChar
(
unichar
nsChar
,
NSUInteger
modifiers
);
#endif
/* __AWTEVENT_H */
#endif
/* __AWTEVENT_H */
src/macosx/native/sun/awt/AWTEvent.m
浏览文件 @
2ff3b4e4
/*
/*
*
Copyright
(
c
)
2011
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
Copyright
(
c
)
2011
,
2013
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
DO
NOT
ALTER
OR
REMOVE
COPYRIGHT
NOTICES
OR
THIS
FILE
HEADER
.
*
DO
NOT
ALTER
OR
REMOVE
COPYRIGHT
NOTICES
OR
THIS
FILE
HEADER
.
*
*
*
This
code
is
free
software
;
you
can
redistribute
it
and
/
or
modify
it
*
This
code
is
free
software
;
you
can
redistribute
it
and
/
or
modify
it
...
@@ -341,8 +341,7 @@ const charTable[] = {
...
@@ -341,8 +341,7 @@ const charTable[] = {
{
0
,
0
,
0
}
{
0
,
0
,
0
}
}
;
}
;
static
unichar
unichar
NsCharToJavaChar
(
unichar
nsChar
,
NSUInteger
modifiers
)
NsCharToJavaChar
(
unichar
nsChar
,
NSUInteger
modifiers
)
{
{
const
struct
_
char
*
cur
;
const
struct
_
char
*
cur
;
//
Mask
off
just
the
keyboard
modifiers
from
the
event
modifier
mask
.
//
Mask
off
just
the
keyboard
modifiers
from
the
event
modifier
mask
.
...
...
src/macosx/native/sun/awt/CGraphicsEnv.m
浏览文件 @
2ff3b4e4
...
@@ -124,10 +124,11 @@ static void displaycb_handle
...
@@ -124,10 +124,11 @@ static void displaycb_handle
jobject graphicsEnv = [wrapper jObjectWithEnv:env];
jobject graphicsEnv = [wrapper jObjectWithEnv:env];
if (graphicsEnv == NULL) return; // ref already GC'd
if (graphicsEnv == NULL) return; // ref already GC'd
static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(J)V");
static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V");
JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration);
JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
(jint) display,
(jboolean) flags & kCGDisplayRemoveFlag);
});
});
}
}
...
...
src/macosx/native/sun/awt/CMenuItem.m
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -71,12 +71,21 @@ AWT_ASSERT_APPKIT_THREAD;
...
@@ -71,12 +71,21 @@ AWT_ASSERT_APPKIT_THREAD;
JNF_COCOA_ENTER
(
env
);
JNF_COCOA_ENTER
(
env
);
// If we are called as a result of user pressing a shorcut, do nothing,
// If we are called as a result of user pressing a shorcut, do nothing,
// because AVTView has already sent corresponding key event to the Java
// because AVTView has already sent corresponding key event to the Java
// layer from performKeyEquivalent
// layer from performKeyEquivalent
NSEvent
*
currEvent
=
[[
NSApplication
sharedApplication
]
currentEvent
];
NSEvent
*
currEvent
=
[[
NSApplication
sharedApplication
]
currentEvent
];
if
([
currEvent
type
]
==
NSKeyDown
)
{
if
([
currEvent
type
]
==
NSKeyDown
)
{
NSString
*
menuKey
=
[
sender
keyEquivalent
];
NSString
*
menuKey
=
[
sender
keyEquivalent
];
NSString
*
eventKey
=
[
currEvent
charactersIgnoringModifiers
];
NSString
*
eventKey
=
[
currEvent
charactersIgnoringModifiers
];
// Apple uses characters from private Unicode range for some of the
// keys, so we need to do the same translation here that we do
// for the regular key down events
if
([
eventKey
length
]
==
1
)
{
unichar
ch
=
NsCharToJavaChar
([
eventKey
characterAtIndex
:
0
],
0
);
eventKey
=
[
NSString
stringWithCharacters
:
&
ch
length
:
1
];
}
if
([
menuKey
isEqualToString
:
eventKey
])
{
if
([
menuKey
isEqualToString
:
eventKey
])
{
return
;
return
;
}
}
...
...
src/macosx/native/sun/awt/CTextPipe.m
浏览文件 @
2ff3b4e4
...
@@ -143,6 +143,8 @@ void JavaCT_DrawGlyphVector
...
@@ -143,6 +143,8 @@ void JavaCT_DrawGlyphVector
CGContextRef
cgRef
=
qsdo
->
cgRef
;
CGContextRef
cgRef
=
qsdo
->
cgRef
;
CGAffineTransform
ctmText
=
CGContextGetTextMatrix
(
cgRef
);
CGAffineTransform
ctmText
=
CGContextGetTextMatrix
(
cgRef
);
BOOL
saved
=
false
;
/* Save and restore of graphics context is done before the iteration.
/* Save and restore of graphics context is done before the iteration.
This seems to work using our test case (see bug ID 7158350) so we are restoring it at
This seems to work using our test case (see bug ID 7158350) so we are restoring it at
the end of the for loop. If we find out that save/restore outside the loop
the end of the for loop. If we find out that save/restore outside the loop
...
@@ -175,10 +177,19 @@ void JavaCT_DrawGlyphVector
...
@@ -175,10 +177,19 @@ void JavaCT_DrawGlyphVector
CFRelease
(
fallback
);
CFRelease
(
fallback
);
if
(
cgFallback
)
{
if
(
cgFallback
)
{
if
(
!
saved
)
{
CGContextSaveGState
(
cgRef
);
saved
=
true
;
}
CGContextSetFont
(
cgRef
,
cgFallback
);
CGContextSetFont
(
cgRef
,
cgFallback
);
CFRelease
(
cgFallback
);
CFRelease
(
cgFallback
);
}
}
}
}
}
else
{
if
(
saved
)
{
CGContextRestoreGState
(
cgRef
);
saved
=
false
;
}
}
}
// if we have per-glyph transformations
// if we have per-glyph transformations
...
...
src/macosx/native/sun/awt/awt.m
浏览文件 @
2ff3b4e4
...
@@ -316,7 +316,10 @@ AWT_ASSERT_APPKIT_THREAD;
...
@@ -316,7 +316,10 @@ AWT_ASSERT_APPKIT_THREAD;
// its finishLaunching has initialized it.
// its finishLaunching has initialized it.
// ApplicationDelegate is the support code for com.apple.eawt.
// ApplicationDelegate is the support code for com.apple.eawt.
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
OSXAPP_SetApplicationDelegate
([
ApplicationDelegate
sharedDelegate
]);
id
<
NSApplicationDelegate
>
delegate
=
[
ApplicationDelegate
sharedDelegate
];
if
(
delegate
!=
nil
)
{
OSXAPP_SetApplicationDelegate
(
delegate
);
}
}];
}];
}
}
...
...
src/macosx/native/sun/java2d/opengl/CGLLayer.m
浏览文件 @
2ff3b4e4
...
@@ -216,7 +216,11 @@ Java_sun_java2d_opengl_CGLLayer_nativeSetScale
...
@@ -216,7 +216,11 @@ Java_sun_java2d_opengl_CGLLayer_nativeSetScale
{
{
JNF_COCOA_ENTER
(
env
);
JNF_COCOA_ENTER
(
env
);
CGLLayer
*
layer
=
jlong_to_ptr
(
layerPtr
);
CGLLayer
*
layer
=
jlong_to_ptr
(
layerPtr
);
[
ThreadUtilities
performOnMainThreadWaiting
:
NO
block
:
^
(){
// We always call all setXX methods asynchronously, exception is only in
// this method where we need to change native texture size and layer's scale
// in one call on appkit, otherwise we'll get window's contents blinking,
// during screen-2-screen moving.
[
ThreadUtilities
performOnMainThreadWaiting
:[
NSThread
isMainThread
]
block
:
^
(){
layer
.
contentsScale
=
scale
;
layer
.
contentsScale
=
scale
;
}];
}];
JNF_COCOA_EXIT
(
env
);
JNF_COCOA_EXIT
(
env
);
...
...
src/share/classes/java/awt/Component.java
浏览文件 @
2ff3b4e4
...
@@ -1051,11 +1051,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -1051,11 +1051,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
return
parent
;
return
parent
;
}
}
// This method is overriden in the Window class to return null,
// This method is overrid
d
en in the Window class to return null,
// because the parent field of the Window object contains
// because the parent field of the Window object contains
// the owner of the window, not its parent.
// the owner of the window, not its parent.
Container
getContainer
()
{
Container
getContainer
()
{
return
getParent
();
return
getParent
_NoClientCode
();
}
}
/**
/**
...
@@ -8194,10 +8194,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -8194,10 +8194,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Fetches the native container somewhere higher up in the component
* Fetches the native container somewhere higher up in the component
* tree that contains this component.
* tree that contains this component.
*/
*/
Container
getNativeContainer
()
{
final
Container
getNativeContainer
()
{
Container
p
=
parent
;
Container
p
=
getContainer
()
;
while
(
p
!=
null
&&
p
.
peer
instanceof
LightweightPeer
)
{
while
(
p
!=
null
&&
p
.
peer
instanceof
LightweightPeer
)
{
p
=
p
.
get
Parent_NoClientCode
();
p
=
p
.
get
Container
();
}
}
return
p
;
return
p
;
}
}
...
...
src/share/classes/java/awt/Window.java
浏览文件 @
2ff3b4e4
...
@@ -3914,7 +3914,7 @@ public class Window extends Container implements Accessible {
...
@@ -3914,7 +3914,7 @@ public class Window extends Container implements Accessible {
// ************************** MIXING CODE *******************************
// ************************** MIXING CODE *******************************
// A window has a
parent
, but it does NOT have a container
// A window has a
n owner
, but it does NOT have a container
@Override
@Override
final
Container
getContainer
()
{
final
Container
getContainer
()
{
return
null
;
return
null
;
...
...
src/share/classes/java/beans/MetaData.java
浏览文件 @
2ff3b4e4
此差异已折叠。
点击以展开。
src/share/classes/java/beans/XMLEncoder.java
浏览文件 @
2ff3b4e4
...
@@ -604,7 +604,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
...
@@ -604,7 +604,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
return
;
return
;
}
}
Class
<?>
primitiveType
=
ReflectionUtils
.
primitiveTypeFor
(
value
.
getClass
());
Class
<?>
primitiveType
=
primitiveTypeFor
(
value
.
getClass
());
if
(
primitiveType
!=
null
&&
target
==
value
.
getClass
()
&&
if
(
primitiveType
!=
null
&&
target
==
value
.
getClass
()
&&
methodName
.
equals
(
"new"
))
{
methodName
.
equals
(
"new"
))
{
String
primitiveTypeName
=
primitiveType
.
getName
();
String
primitiveTypeName
=
primitiveType
.
getName
();
...
@@ -778,4 +778,18 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
...
@@ -778,4 +778,18 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
indentation
--;
indentation
--;
writeln
(
"</"
+
tag
+
">"
);
writeln
(
"</"
+
tag
+
">"
);
}
}
@SuppressWarnings
(
"rawtypes"
)
static
Class
primitiveTypeFor
(
Class
wrapper
)
{
if
(
wrapper
==
Boolean
.
class
)
return
Boolean
.
TYPE
;
if
(
wrapper
==
Byte
.
class
)
return
Byte
.
TYPE
;
if
(
wrapper
==
Character
.
class
)
return
Character
.
TYPE
;
if
(
wrapper
==
Short
.
class
)
return
Short
.
TYPE
;
if
(
wrapper
==
Integer
.
class
)
return
Integer
.
TYPE
;
if
(
wrapper
==
Long
.
class
)
return
Long
.
TYPE
;
if
(
wrapper
==
Float
.
class
)
return
Float
.
TYPE
;
if
(
wrapper
==
Double
.
class
)
return
Double
.
TYPE
;
if
(
wrapper
==
Void
.
class
)
return
Void
.
TYPE
;
return
null
;
}
}
}
src/share/classes/java/lang/reflect/Executable.java
浏览文件 @
2ff3b4e4
...
@@ -510,12 +510,12 @@ public abstract class Executable extends AccessibleObject
...
@@ -510,12 +510,12 @@ public abstract class Executable extends AccessibleObject
*/
*/
AnnotatedType
getAnnotatedReturnType0
(
Type
returnType
)
{
AnnotatedType
getAnnotatedReturnType0
(
Type
returnType
)
{
return
TypeAnnotationParser
.
buildAnnotatedType
(
getTypeAnnotationBytes
(),
return
TypeAnnotationParser
.
buildAnnotatedType
(
getTypeAnnotationBytes
(),
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getConstantPool
(
getDeclaringClass
()),
this
,
this
,
getDeclaringClass
(),
getDeclaringClass
(),
returnType
,
returnType
,
TypeAnnotation
.
TypeAnnotationTarget
.
METHOD_RETURN_TYPE
);
TypeAnnotation
.
TypeAnnotationTarget
.
METHOD_RETURN
);
}
}
/**
/**
...
@@ -535,12 +535,12 @@ public abstract class Executable extends AccessibleObject
...
@@ -535,12 +535,12 @@ public abstract class Executable extends AccessibleObject
*/
*/
public
AnnotatedType
getAnnotatedReceiverType
()
{
public
AnnotatedType
getAnnotatedReceiverType
()
{
return
TypeAnnotationParser
.
buildAnnotatedType
(
getTypeAnnotationBytes
(),
return
TypeAnnotationParser
.
buildAnnotatedType
(
getTypeAnnotationBytes
(),
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getConstantPool
(
getDeclaringClass
()),
this
,
this
,
getDeclaringClass
(),
getDeclaringClass
(),
getDeclaringClass
(),
getDeclaringClass
(),
TypeAnnotation
.
TypeAnnotationTarget
.
METHOD_RECEIVER_TYPE
);
TypeAnnotation
.
TypeAnnotationTarget
.
METHOD_RECEIVER
);
}
}
/**
/**
...
@@ -556,7 +556,13 @@ public abstract class Executable extends AccessibleObject
...
@@ -556,7 +556,13 @@ public abstract class Executable extends AccessibleObject
* @since 1.8
* @since 1.8
*/
*/
public
AnnotatedType
[]
getAnnotatedParameterTypes
()
{
public
AnnotatedType
[]
getAnnotatedParameterTypes
()
{
throw
new
UnsupportedOperationException
(
"Not yet"
);
return
TypeAnnotationParser
.
buildAnnotatedTypes
(
getTypeAnnotationBytes
(),
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
this
,
getDeclaringClass
(),
getParameterTypes
(),
TypeAnnotation
.
TypeAnnotationTarget
.
METHOD_FORMAL_PARAMETER
);
}
}
/**
/**
...
@@ -573,12 +579,12 @@ public abstract class Executable extends AccessibleObject
...
@@ -573,12 +579,12 @@ public abstract class Executable extends AccessibleObject
*/
*/
public
AnnotatedType
[]
getAnnotatedExceptionTypes
()
{
public
AnnotatedType
[]
getAnnotatedExceptionTypes
()
{
return
TypeAnnotationParser
.
buildAnnotatedTypes
(
getTypeAnnotationBytes
(),
return
TypeAnnotationParser
.
buildAnnotatedTypes
(
getTypeAnnotationBytes
(),
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
sun
.
misc
.
SharedSecrets
.
getJavaLangAccess
().
getConstantPool
(
getDeclaringClass
()),
getConstantPool
(
getDeclaringClass
()),
this
,
this
,
getDeclaringClass
(),
getDeclaringClass
(),
getGenericExceptionTypes
(),
getGenericExceptionTypes
(),
TypeAnnotation
.
TypeAnnotationTarget
.
THROWS
);
TypeAnnotation
.
TypeAnnotationTarget
.
THROWS
);
}
}
}
}
src/share/classes/java/lang/reflect/Field.java
浏览文件 @
2ff3b4e4
...
@@ -1161,6 +1161,6 @@ class Field extends AccessibleObject implements Member {
...
@@ -1161,6 +1161,6 @@ class Field extends AccessibleObject implements Member {
this
,
this
,
getDeclaringClass
(),
getDeclaringClass
(),
getGenericType
(),
getGenericType
(),
TypeAnnotation
.
TypeAnnotationTarget
.
FIELD
_TYPE
);
TypeAnnotation
.
TypeAnnotationTarget
.
FIELD
);
}
}
}
}
src/share/classes/java/lang/reflect/Modifier.java
浏览文件 @
2ff3b4e4
...
@@ -350,8 +350,19 @@ public class Modifier {
...
@@ -350,8 +350,19 @@ public class Modifier {
return
(
mod
&
MANDATED
)
!=
0
;
return
(
mod
&
MANDATED
)
!=
0
;
}
}
/**
// Note on the FOO_MODIFIERS fields and fooModifiers() methods:
* See JLSv3 section 8.1.1.
// the sets of modifiers are not guaranteed to be constants
// across time and Java SE releases. Therefore, it would not be
// appropriate to expose an external interface to this information
// that would allow the values to be treated as Java-level
// constants since the values could be constant folded and updates
// to the sets of modifiers missed. Thus, the fooModifiers()
// methods return an unchanging values for a given release, but a
// value that can potentially change over time.
/**
* The Java source modifiers that can be applied to a class.
* @jls 8.1.1 Class Modifiers
*/
*/
private
static
final
int
CLASS_MODIFIERS
=
private
static
final
int
CLASS_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
...
@@ -359,7 +370,8 @@ public class Modifier {
...
@@ -359,7 +370,8 @@ public class Modifier {
Modifier
.
STRICT
;
Modifier
.
STRICT
;
/**
/**
* See JLSv3 section 9.1.1.
* The Java source modifiers that can be applied to an interface.
* @jls 9.1.1 Interface Modifiers
*/
*/
private
static
final
int
INTERFACE_MODIFIERS
=
private
static
final
int
INTERFACE_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
...
@@ -367,13 +379,15 @@ public class Modifier {
...
@@ -367,13 +379,15 @@ public class Modifier {
/**
/**
* See JLSv3 section 8.8.3.
* The Java source modifiers that can be applied to a constructor.
* @jls 8.8.3 Constructor Modifiers
*/
*/
private
static
final
int
CONSTRUCTOR_MODIFIERS
=
private
static
final
int
CONSTRUCTOR_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
;
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
;
/**
/**
* See JLSv3 section 8.4.3.
* The Java source modifiers that can be applied to a method.
* @jls8.4.3 Method Modifiers
*/
*/
private
static
final
int
METHOD_MODIFIERS
=
private
static
final
int
METHOD_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
...
@@ -381,13 +395,21 @@ public class Modifier {
...
@@ -381,13 +395,21 @@ public class Modifier {
Modifier
.
SYNCHRONIZED
|
Modifier
.
NATIVE
|
Modifier
.
STRICT
;
Modifier
.
SYNCHRONIZED
|
Modifier
.
NATIVE
|
Modifier
.
STRICT
;
/**
/**
* See JLSv3 section 8.3.1.
* The Java source modifiers that can be applied to a field.
* @jls 8.3.1 Field Modifiers
*/
*/
private
static
final
int
FIELD_MODIFIERS
=
private
static
final
int
FIELD_MODIFIERS
=
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
PUBLIC
|
Modifier
.
PROTECTED
|
Modifier
.
PRIVATE
|
Modifier
.
STATIC
|
Modifier
.
FINAL
|
Modifier
.
TRANSIENT
|
Modifier
.
STATIC
|
Modifier
.
FINAL
|
Modifier
.
TRANSIENT
|
Modifier
.
VOLATILE
;
Modifier
.
VOLATILE
;
/**
* The Java source modifiers that can be applied to a method or constructor parameter.
* @jls 8.4.1 Formal Parameters
*/
private
static
final
int
PARAMETER_MODIFIERS
=
Modifier
.
FINAL
;
/**
/**
*
*
*/
*/
...
@@ -411,7 +433,7 @@ public class Modifier {
...
@@ -411,7 +433,7 @@ public class Modifier {
* Return an {@code int} value OR-ing together the source language
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to an interface.
* modifiers that can be applied to an interface.
* @return an {@code int} value OR-ing together the source language
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to an inteface.
* modifiers that can be applied to an inte
r
face.
*
*
* @jls 9.1.1 Interface Modifiers
* @jls 9.1.1 Interface Modifiers
* @since 1.7
* @since 1.7
...
@@ -446,7 +468,6 @@ public class Modifier {
...
@@ -446,7 +468,6 @@ public class Modifier {
return
METHOD_MODIFIERS
;
return
METHOD_MODIFIERS
;
}
}
/**
/**
* Return an {@code int} value OR-ing together the source language
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a field.
* modifiers that can be applied to a field.
...
@@ -459,4 +480,17 @@ public class Modifier {
...
@@ -459,4 +480,17 @@ public class Modifier {
public
static
int
fieldModifiers
()
{
public
static
int
fieldModifiers
()
{
return
FIELD_MODIFIERS
;
return
FIELD_MODIFIERS
;
}
}
/**
* Return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a parameter.
* @return an {@code int} value OR-ing together the source language
* modifiers that can be applied to a parameter.
*
* @jls 8.4.1 Formal Parameters
* @since 1.8
*/
public
static
int
parameterModifiers
()
{
return
PARAMETER_MODIFIERS
;
}
}
}
src/share/classes/java/lang/reflect/Parameter.java
浏览文件 @
2ff3b4e4
...
@@ -200,6 +200,19 @@ public final class Parameter implements AnnotatedElement {
...
@@ -200,6 +200,19 @@ public final class Parameter implements AnnotatedElement {
return
tmp
;
return
tmp
;
}
}
/**
* Returns an AnnotatedType object that represents the use of a type to
* specify the type of the formal parameter represented by this Parameter.
*
* @return an {@code AnnotatedType} object representing the use of a type
* to specify the type of the formal parameter represented by this
* Parameter
*/
public
AnnotatedType
getAnnotatedType
()
{
// no caching for now
return
executable
.
getAnnotatedParameterTypes
()[
index
];
}
private
transient
volatile
Class
<?>
parameterClassCache
=
null
;
private
transient
volatile
Class
<?>
parameterClassCache
=
null
;
/**
/**
...
...
src/share/classes/java/util/regex/Pattern.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 1999, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -25,15 +25,19 @@
...
@@ -25,15 +25,19 @@
package
java.util.regex
;
package
java.util.regex
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.text.CharacterIterator
;
import
java.text.Normalizer
;
import
java.text.Normalizer
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.NoSuchElementException
;
import
java.util.Spliterator
;
import
java.util.Spliterators
;
import
java.util.function.Predicate
;
import
java.util.stream.Stream
;
import
java.util.stream.StreamSupport
;
/**
/**
...
@@ -5742,4 +5746,83 @@ NEXT: while (i <= last) {
...
@@ -5742,4 +5746,83 @@ NEXT: while (i <= last) {
return
Character
.
isMirrored
(
ch
);}});
return
Character
.
isMirrored
(
ch
);}});
}
}
}
}
/**
* Creates a predicate which can be used to match a string.
*
* @return The predicate which can be used for matching on a string
* @since 1.8
*/
public
Predicate
<
String
>
asPredicate
()
{
return
s
->
matcher
(
s
).
find
();
}
/**
* Creates a stream from the given input sequence around matches of this
* pattern.
*
* <p> The stream returned by this method contains each substring of the
* input sequence that is terminated by another subsequence that matches
* this pattern or is terminated by the end of the input sequence. The
* substrings in the stream are in the order in which they occur in the
* input.
*
* <p> If this pattern does not match any subsequence of the input then
* the resulting stream has just one element, namely the input sequence in
* string form.
*
* <p> If the input sequence is mutable, it must remain constant during the
* execution of the terminal stream operation. Otherwise, the result of the
* terminal stream operation is undefined.
*
* @param input
* The character sequence to be split
*
* @return The stream of strings computed by splitting the input
* around matches of this pattern
* @see #split(CharSequence)
* @since 1.8
*/
public
Stream
<
String
>
splitAsStream
(
final
CharSequence
input
)
{
class
MatcherIterator
implements
Iterator
<
String
>
{
private
final
Matcher
matcher
;
// The start position of the next sub-sequence of input
// when current == input.length there are no more elements
private
int
current
;
// null if the next element, if any, needs to obtained
private
String
nextElement
;
MatcherIterator
()
{
this
.
matcher
=
matcher
(
input
);
}
public
String
next
()
{
if
(!
hasNext
())
throw
new
NoSuchElementException
();
String
n
=
nextElement
;
nextElement
=
null
;
return
n
;
}
public
boolean
hasNext
()
{
if
(
nextElement
!=
null
)
return
true
;
if
(
current
==
input
.
length
())
return
false
;
if
(
matcher
.
find
())
{
nextElement
=
input
.
subSequence
(
current
,
matcher
.
start
()).
toString
();
current
=
matcher
.
end
();
}
else
{
nextElement
=
input
.
subSequence
(
current
,
input
.
length
()).
toString
();
current
=
input
.
length
();
}
return
true
;
}
}
return
StreamSupport
.
stream
(
Spliterators
.
spliteratorUnknownSize
(
new
MatcherIterator
(),
Spliterator
.
ORDERED
|
Spliterator
.
NONNULL
));
}
}
}
src/share/classes/javax/swing/JDesktopPane.java
浏览文件 @
2ff3b4e4
...
@@ -427,6 +427,15 @@ public class JDesktopPane extends JLayeredPane implements Accessible
...
@@ -427,6 +427,15 @@ public class JDesktopPane extends JLayeredPane implements Accessible
}
}
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
remove
(
Component
comp
)
{
super
.
remove
(
comp
);
updateFramesCache
();
}
/**
/**
* Selects the next <code>JInternalFrame</code> in this desktop pane.
* Selects the next <code>JInternalFrame</code> in this desktop pane.
*
*
...
...
src/share/classes/sun/java2d/pipe/AAShapePipe.java
浏览文件 @
2ff3b4e4
...
@@ -127,7 +127,7 @@ public class AAShapePipe
...
@@ -127,7 +127,7 @@ public class AAShapePipe
private
static
byte
[]
theTile
;
private
static
byte
[]
theTile
;
p
ublic
synchronized
static
byte
[]
getAlphaTile
(
int
len
)
{
p
rivate
synchronized
static
byte
[]
getAlphaTile
(
int
len
)
{
byte
[]
t
=
theTile
;
byte
[]
t
=
theTile
;
if
(
t
==
null
||
t
.
length
<
len
)
{
if
(
t
==
null
||
t
.
length
<
len
)
{
t
=
new
byte
[
len
];
t
=
new
byte
[
len
];
...
@@ -137,7 +137,7 @@ public class AAShapePipe
...
@@ -137,7 +137,7 @@ public class AAShapePipe
return
t
;
return
t
;
}
}
p
ublic
synchronized
static
void
dropAlphaTile
(
byte
[]
t
)
{
p
rivate
synchronized
static
void
dropAlphaTile
(
byte
[]
t
)
{
theTile
=
t
;
theTile
=
t
;
}
}
...
...
src/share/classes/sun/reflect/annotation/TypeAnnotation.java
浏览文件 @
2ff3b4e4
...
@@ -83,12 +83,13 @@ public class TypeAnnotation {
...
@@ -83,12 +83,13 @@ public class TypeAnnotation {
CLASS_TYPE_PARAMETER
,
CLASS_TYPE_PARAMETER
,
METHOD_TYPE_PARAMETER
,
METHOD_TYPE_PARAMETER
,
CLASS_EXTENDS
,
CLASS_EXTENDS
,
CLASS_IMPLEMENTS
,
CLASS_IMPLEMENTS
,
// Not in the spec
CLASS_PARAMETER_BOUND
,
CLASS_TYPE_PARAMETER_BOUND
,
METHOD_PARAMETER_BOUND
,
METHOD_TYPE_PARAMETER_BOUND
,
METHOD_RETURN_TYPE
,
FIELD
,
METHOD_RECEIVER_TYPE
,
METHOD_RETURN
,
FIELD_TYPE
,
METHOD_RECEIVER
,
METHOD_FORMAL_PARAMETER
,
THROWS
;
THROWS
;
}
}
public
static
class
TypeAnnotationTargetInfo
{
public
static
class
TypeAnnotationTargetInfo
{
...
...
src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java
浏览文件 @
2ff3b4e4
...
@@ -282,10 +282,10 @@ public class TypeAnnotationParser {
...
@@ -282,10 +282,10 @@ public class TypeAnnotationParser {
AnnotatedElement
boundsDecl
;
AnnotatedElement
boundsDecl
;
TypeAnnotationTarget
target
;
TypeAnnotationTarget
target
;
if
(
decl
instanceof
Class
)
{
if
(
decl
instanceof
Class
)
{
target
=
TypeAnnotationTarget
.
CLASS_PARAMETER_BOUND
;
target
=
TypeAnnotationTarget
.
CLASS_
TYPE_
PARAMETER_BOUND
;
boundsDecl
=
(
Class
)
decl
;
boundsDecl
=
(
Class
)
decl
;
}
else
{
}
else
{
target
=
TypeAnnotationTarget
.
METHOD_PARAMETER_BOUND
;
target
=
TypeAnnotationTarget
.
METHOD_
TYPE_
PARAMETER_BOUND
;
boundsDecl
=
(
Executable
)
decl
;
boundsDecl
=
(
Executable
)
decl
;
}
}
return
TypeAnnotation
.
filter
(
TypeAnnotationParser
.
parseAllTypeAnnotations
(
boundsDecl
),
target
);
return
TypeAnnotation
.
filter
(
TypeAnnotationParser
.
parseAllTypeAnnotations
(
boundsDecl
),
target
);
...
@@ -371,14 +371,15 @@ public class TypeAnnotationParser {
...
@@ -371,14 +371,15 @@ public class TypeAnnotationParser {
private
static
final
byte
LOCAL_VARIABLE
=
(
byte
)
0x40
;
private
static
final
byte
LOCAL_VARIABLE
=
(
byte
)
0x40
;
private
static
final
byte
RESOURCE_VARIABLE
=
(
byte
)
0x41
;
private
static
final
byte
RESOURCE_VARIABLE
=
(
byte
)
0x41
;
private
static
final
byte
EXCEPTION_PARAMETER
=
(
byte
)
0x42
;
private
static
final
byte
EXCEPTION_PARAMETER
=
(
byte
)
0x42
;
private
static
final
byte
CAST
=
(
byte
)
0x43
;
private
static
final
byte
INSTANCEOF
=
(
byte
)
0x43
;
private
static
final
byte
INSTANCEOF
=
(
byte
)
0x44
;
private
static
final
byte
NEW
=
(
byte
)
0x44
;
private
static
final
byte
NEW
=
(
byte
)
0x45
;
private
static
final
byte
CONSTRUCTOR_REFERENCE
=
(
byte
)
0x45
;
private
static
final
byte
CONSTRUCTOR_REFERENCE_RECEIVER
=
(
byte
)
0x46
;
private
static
final
byte
METHOD_REFERENCE
=
(
byte
)
0x46
;
private
static
final
byte
METHOD_REFERENCE_RECEIVER
=
(
byte
)
0x47
;
private
static
final
byte
CAST
=
(
byte
)
0x47
;
private
static
final
byte
LAMBDA_FORMAL_PARAMETER
=
(
byte
)
0x48
;
private
static
final
byte
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
=
(
byte
)
0x48
;
private
static
final
byte
METHOD_REFERENCE
=
(
byte
)
0x49
;
private
static
final
byte
METHOD_INVOCATION_TYPE_ARGUMENT
=
(
byte
)
0x49
;
private
static
final
byte
METHOD_REFERENCE_TYPE_ARGUMENT
=
(
byte
)
0x50
;
private
static
final
byte
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
=
(
byte
)
0x4A
;
private
static
final
byte
METHOD_REFERENCE_TYPE_ARGUMENT
=
(
byte
)
0x4B
;
private
static
TypeAnnotation
parseTypeAnnotation
(
ByteBuffer
buf
,
private
static
TypeAnnotation
parseTypeAnnotation
(
ByteBuffer
buf
,
ConstantPool
cp
,
ConstantPool
cp
,
...
@@ -417,19 +418,20 @@ public class TypeAnnotationParser {
...
@@ -417,19 +418,20 @@ public class TypeAnnotationParser {
return
res
;
return
res
;
}}
break
;
}}
break
;
case
CLASS_TYPE_PARAMETER_BOUND:
case
CLASS_TYPE_PARAMETER_BOUND:
return
parse2ByteTarget
(
TypeAnnotationTarget
.
CLASS_PARAMETER_BOUND
,
buf
);
return
parse2ByteTarget
(
TypeAnnotationTarget
.
CLASS_
TYPE_
PARAMETER_BOUND
,
buf
);
case
METHOD_TYPE_PARAMETER_BOUND:
case
METHOD_TYPE_PARAMETER_BOUND:
return
parse2ByteTarget
(
TypeAnnotationTarget
.
METHOD_PARAMETER_BOUND
,
buf
);
return
parse2ByteTarget
(
TypeAnnotationTarget
.
METHOD_
TYPE_
PARAMETER_BOUND
,
buf
);
case
FIELD:
case
FIELD:
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
FIELD
_TYPE
);
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
FIELD
);
case
METHOD_RETURN:
case
METHOD_RETURN:
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
METHOD_RETURN
_TYPE
);
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
METHOD_RETURN
);
case
METHOD_RECEIVER:
case
METHOD_RECEIVER:
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
METHOD_RECEIVER
_TYPE
);
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
METHOD_RECEIVER
);
case
METHOD_FORMAL_PARAMETER:
{
case
METHOD_FORMAL_PARAMETER:
{
// Todo
byte
index
=
buf
.
get
();
byte
index
=
buf
.
get
();
}
break
;
return
new
TypeAnnotationTargetInfo
(
TypeAnnotationTarget
.
METHOD_FORMAL_PARAMETER
,
index
);
}
//unreachable break;
case
THROWS:
case
THROWS:
return
parseShortTarget
(
TypeAnnotationTarget
.
THROWS
,
buf
);
return
parseShortTarget
(
TypeAnnotationTarget
.
THROWS
,
buf
);
...
@@ -445,30 +447,27 @@ public class TypeAnnotationParser {
...
@@ -445,30 +447,27 @@ public class TypeAnnotationParser {
short
varLength
=
buf
.
getShort
();
short
varLength
=
buf
.
getShort
();
short
index
=
buf
.
getShort
();
short
index
=
buf
.
getShort
();
}
}
break
;
return
null
;
case
EXCEPTION_PARAMETER:
{
case
EXCEPTION_PARAMETER:
{
byte
index
=
buf
.
get
();
byte
index
=
buf
.
get
();
}
break
;
}
case
CAST:
return
null
;
case
INSTANCEOF:
case
INSTANCEOF:
case
NEW:
{
case
NEW:
short
offset
=
buf
.
getShort
();
case
CONSTRUCTOR_REFERENCE:
}
break
;
case
METHOD_REFERENCE:
{
case
CONSTRUCTOR_REFERENCE_RECEIVER:
case
METHOD_REFERENCE_RECEIVER:
{
short
offset
=
buf
.
getShort
();
short
offset
=
buf
.
getShort
();
byte
index
=
buf
.
get
();
}
}
break
;
return
null
;
case
LAMBDA_FORMAL_PARAMETER:
{
case
CAST:
byte
index
=
buf
.
get
();
case
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
}
break
;
case
METHOD_INVOCATION_TYPE_ARGUMENT:
case
METHOD_REFERENCE:
case
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
// This one isn't in the spec yet
break
;
case
METHOD_REFERENCE_TYPE_ARGUMENT:
{
case
METHOD_REFERENCE_TYPE_ARGUMENT:
{
short
offset
=
buf
.
getShort
();
short
offset
=
buf
.
getShort
();
byte
index
=
buf
.
get
();
byte
index
=
buf
.
get
();
}
break
;
}
return
null
;
default
:
default
:
// will throw error below
// will throw error below
...
...
src/share/classes/sun/security/provider/certpath/CertPathHelper.java
浏览文件 @
2ff3b4e4
...
@@ -64,7 +64,7 @@ public abstract class CertPathHelper {
...
@@ -64,7 +64,7 @@ public abstract class CertPathHelper {
instance
.
implSetPathToNames
(
sel
,
names
);
instance
.
implSetPathToNames
(
sel
,
names
);
}
}
static
void
setDateAndTime
(
X509CRLSelector
sel
,
Date
date
,
long
skew
)
{
public
static
void
setDateAndTime
(
X509CRLSelector
sel
,
Date
date
,
long
skew
)
{
instance
.
implSetDateAndTime
(
sel
,
date
,
skew
);
instance
.
implSetDateAndTime
(
sel
,
date
,
skew
);
}
}
}
}
src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java
浏览文件 @
2ff3b4e4
...
@@ -50,7 +50,7 @@ import sun.security.x509.*;
...
@@ -50,7 +50,7 @@ import sun.security.x509.*;
* @author Sean Mullan
* @author Sean Mullan
* @since 1.4.2
* @since 1.4.2
*/
*/
class
DistributionPointFetcher
{
public
class
DistributionPointFetcher
{
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"certpath"
);
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"certpath"
);
...
@@ -66,13 +66,14 @@ class DistributionPointFetcher {
...
@@ -66,13 +66,14 @@ class DistributionPointFetcher {
* Return the X509CRLs matching this selector. The selector must be
* Return the X509CRLs matching this selector. The selector must be
* an X509CRLSelector with certificateChecking set.
* an X509CRLSelector with certificateChecking set.
*/
*/
static
Collection
<
X509CRL
>
getCRLs
(
X509CRLSelector
selector
,
public
static
Collection
<
X509CRL
>
getCRLs
(
X509CRLSelector
selector
,
boolean
signFlag
,
PublicKey
prevKey
,
boolean
signFlag
,
String
provider
,
PublicKey
prevKey
,
List
<
CertStore
>
certStores
,
String
provider
,
boolean
[]
reasonsMask
,
List
<
CertStore
>
certStores
,
Set
<
TrustAnchor
>
trustAnchors
,
boolean
[]
reasonsMask
,
Date
validity
)
Set
<
TrustAnchor
>
trustAnchors
,
Date
validity
)
throws
CertStoreException
throws
CertStoreException
{
{
X509Certificate
cert
=
selector
.
getCertificateChecking
();
X509Certificate
cert
=
selector
.
getCertificateChecking
();
...
...
src/share/classes/sun/security/provider/certpath/OCSP.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2009, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -85,10 +85,9 @@ public final class OCSP {
...
@@ -85,10 +85,9 @@ public final class OCSP {
* value is negative, set the timeout length to the default.
* value is negative, set the timeout length to the default.
*/
*/
private
static
int
initializeTimeout
()
{
private
static
int
initializeTimeout
()
{
int
tmp
=
java
.
security
.
AccessController
.
doPrivileged
(
Integer
tmp
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetIntegerAction
(
"com.sun.security.ocsp.timeout"
,
new
GetIntegerAction
(
"com.sun.security.ocsp.timeout"
));
DEFAULT_CONNECT_TIMEOUT
));
if
(
tmp
==
null
||
tmp
<
0
)
{
if
(
tmp
<
0
)
{
return
DEFAULT_CONNECT_TIMEOUT
;
return
DEFAULT_CONNECT_TIMEOUT
;
}
}
// Convert to milliseconds, as the system property will be
// Convert to milliseconds, as the system property will be
...
...
src/share/classes/sun/security/provider/certpath/OCSPResponse.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -43,6 +43,7 @@ import java.util.Map;
...
@@ -43,6 +43,7 @@ import java.util.Map;
import
javax.security.auth.x500.X500Principal
;
import
javax.security.auth.x500.X500Principal
;
import
sun.misc.HexDumpEncoder
;
import
sun.misc.HexDumpEncoder
;
import
sun.security.action.GetIntegerAction
;
import
sun.security.x509.*
;
import
sun.security.x509.*
;
import
sun.security.util.*
;
import
sun.security.util.*
;
...
@@ -144,9 +145,31 @@ public final class OCSPResponse {
...
@@ -144,9 +145,31 @@ public final class OCSPResponse {
// Object identifier for the OCSPSigning key purpose
// Object identifier for the OCSPSigning key purpose
private
static
final
String
KP_OCSP_SIGNING_OID
=
"1.3.6.1.5.5.7.3.9"
;
private
static
final
String
KP_OCSP_SIGNING_OID
=
"1.3.6.1.5.5.7.3.9"
;
// Maximum clock skew in milliseconds (15 minutes) allowed when checking
// Default maximum clock skew in milliseconds (15 minutes)
// validity of OCSP responses
// allowed when checking validity of OCSP responses
private
static
final
long
MAX_CLOCK_SKEW
=
900000
;
private
static
final
int
DEFAULT_MAX_CLOCK_SKEW
=
900000
;
/**
* Integer value indicating the maximum allowable clock skew, in seconds,
* to be used for the OCSP check.
*/
private
static
final
int
MAX_CLOCK_SKEW
=
initializeClockSkew
();
/**
* Initialize the maximum allowable clock skew by getting the OCSP
* clock skew system property. If the property has not been set, or if its
* value is negative, set the skew to the default.
*/
private
static
int
initializeClockSkew
()
{
Integer
tmp
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetIntegerAction
(
"com.sun.security.ocsp.clockSkew"
));
if
(
tmp
==
null
||
tmp
<
0
)
{
return
DEFAULT_MAX_CLOCK_SKEW
;
}
// Convert to milliseconds, as the system property will be
// specified in seconds
return
tmp
*
1000
;
}
// an array of all of the CRLReasons (used in SingleResponse)
// an array of all of the CRLReasons (used in SingleResponse)
private
static
CRLReason
[]
values
=
CRLReason
.
values
();
private
static
CRLReason
[]
values
=
CRLReason
.
values
();
...
...
src/share/classes/sun/security/provider/certpath/URICertStore.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2006, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -51,6 +51,7 @@ import java.util.Collection;
...
@@ -51,6 +51,7 @@ import java.util.Collection;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
sun.security.action.GetIntegerAction
;
import
sun.security.x509.AccessDescription
;
import
sun.security.x509.AccessDescription
;
import
sun.security.x509.GeneralNameInterface
;
import
sun.security.x509.GeneralNameInterface
;
import
sun.security.x509.URIName
;
import
sun.security.x509.URIName
;
...
@@ -121,6 +122,33 @@ class URICertStore extends CertStoreSpi {
...
@@ -121,6 +122,33 @@ class URICertStore extends CertStoreSpi {
private
CertStore
ldapCertStore
;
private
CertStore
ldapCertStore
;
private
String
ldapPath
;
private
String
ldapPath
;
// Default maximum connect timeout in milliseconds (15 seconds)
// allowed when downloading CRLs
private
static
final
int
DEFAULT_CRL_CONNECT_TIMEOUT
=
15000
;
/**
* Integer value indicating the connect timeout, in seconds, to be
* used for the CRL download. A timeout of zero is interpreted as
* an infinite timeout.
*/
private
static
final
int
CRL_CONNECT_TIMEOUT
=
initializeTimeout
();
/**
* Initialize the timeout length by getting the CRL timeout
* system property. If the property has not been set, or if its
* value is negative, set the timeout length to the default.
*/
private
static
int
initializeTimeout
()
{
Integer
tmp
=
java
.
security
.
AccessController
.
doPrivileged
(
new
GetIntegerAction
(
"com.sun.security.crl.timeout"
));
if
(
tmp
==
null
||
tmp
<
0
)
{
return
DEFAULT_CRL_CONNECT_TIMEOUT
;
}
// Convert to milliseconds, as the system property will be
// specified in seconds
return
tmp
*
1000
;
}
/**
/**
* Creates a URICertStore.
* Creates a URICertStore.
*
*
...
@@ -364,6 +392,7 @@ class URICertStore extends CertStoreSpi {
...
@@ -364,6 +392,7 @@ class URICertStore extends CertStoreSpi {
connection
.
setIfModifiedSince
(
lastModified
);
connection
.
setIfModifiedSince
(
lastModified
);
}
}
long
oldLastModified
=
lastModified
;
long
oldLastModified
=
lastModified
;
connection
.
setConnectTimeout
(
CRL_CONNECT_TIMEOUT
);
try
(
InputStream
in
=
connection
.
getInputStream
())
{
try
(
InputStream
in
=
connection
.
getInputStream
())
{
lastModified
=
connection
.
getLastModified
();
lastModified
=
connection
.
getLastModified
();
if
(
oldLastModified
!=
0
)
{
if
(
oldLastModified
!=
0
)
{
...
...
src/solaris/classes/sun/awt/X11/XWindowPeer.java
浏览文件 @
2ff3b4e4
...
@@ -1887,7 +1887,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
...
@@ -1887,7 +1887,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
switch
(
getWindowType
())
switch
(
getWindowType
())
{
{
case
NORMAL:
case
NORMAL:
typeAtom
=
protocol
.
XA_NET_WM_WINDOW_TYPE_NORMAL
;
typeAtom
=
(
ownerPeer
==
null
)
?
protocol
.
XA_NET_WM_WINDOW_TYPE_NORMAL
:
protocol
.
XA_NET_WM_WINDOW_TYPE_DIALOG
;
break
;
break
;
case
UTILITY:
case
UTILITY:
typeAtom
=
protocol
.
XA_NET_WM_WINDOW_TYPE_UTILITY
;
typeAtom
=
protocol
.
XA_NET_WM_WINDOW_TYPE_UTILITY
;
...
...
src/windows/classes/sun/awt/windows/WComponentPeer.java
浏览文件 @
2ff3b4e4
...
@@ -759,9 +759,7 @@ public abstract class WComponentPeer extends WObjectPeer
...
@@ -759,9 +759,7 @@ public abstract class WComponentPeer extends WObjectPeer
WComponentPeer
(
Component
target
)
{
WComponentPeer
(
Component
target
)
{
this
.
target
=
target
;
this
.
target
=
target
;
this
.
paintArea
=
new
RepaintArea
();
this
.
paintArea
=
new
RepaintArea
();
Container
parent
=
WToolkit
.
getNativeContainer
(
target
);
create
(
getNativeParent
());
WComponentPeer
parentPeer
=
(
WComponentPeer
)
WToolkit
.
targetToPeer
(
parent
);
create
(
parentPeer
);
// fix for 5088782: check if window object is created successfully
// fix for 5088782: check if window object is created successfully
checkCreation
();
checkCreation
();
...
@@ -771,6 +769,17 @@ public abstract class WComponentPeer extends WObjectPeer
...
@@ -771,6 +769,17 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
abstract
void
create
(
WComponentPeer
parent
);
abstract
void
create
(
WComponentPeer
parent
);
/**
* Gets the native parent of this peer. We use the term "parent" explicitly,
* because we override the method in top-level window peer implementations.
*
* @return the parent container/owner of this peer.
*/
WComponentPeer
getNativeParent
()
{
Container
parent
=
SunToolkit
.
getNativeContainer
((
Component
)
target
);
return
(
WComponentPeer
)
WToolkit
.
targetToPeer
(
parent
);
}
protected
void
checkCreation
()
protected
void
checkCreation
()
{
{
if
((
hwnd
==
0
)
||
(
pData
==
0
))
if
((
hwnd
==
0
)
||
(
pData
==
0
))
...
...
src/windows/classes/sun/awt/windows/WWindowPeer.java
浏览文件 @
2ff3b4e4
...
@@ -215,6 +215,12 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
...
@@ -215,6 +215,12 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
createAwtWindow
(
parent
);
createAwtWindow
(
parent
);
}
}
@Override
final
WComponentPeer
getNativeParent
()
{
final
Container
owner
=
((
Window
)
target
).
getOwner
();
return
(
WComponentPeer
)
WToolkit
.
targetToPeer
(
owner
);
}
// should be overriden in WDialogPeer
// should be overriden in WDialogPeer
protected
void
realShow
()
{
protected
void
realShow
()
{
super
.
show
();
super
.
show
();
...
...
src/windows/classes/sun/nio/fs/WindowsFileCopy.java
浏览文件 @
2ff3b4e4
...
@@ -224,7 +224,7 @@ class WindowsFileCopy {
...
@@ -224,7 +224,7 @@ class WindowsFileCopy {
String
linkTarget
=
WindowsLinkSupport
.
readLink
(
source
);
String
linkTarget
=
WindowsLinkSupport
.
readLink
(
source
);
int
flags
=
SYMBOLIC_LINK_FLAG_DIRECTORY
;
int
flags
=
SYMBOLIC_LINK_FLAG_DIRECTORY
;
CreateSymbolicLink
(
targetPath
,
CreateSymbolicLink
(
targetPath
,
addPrefixIfNeeded
(
linkTarget
),
WindowsPath
.
addPrefixIfNeeded
(
linkTarget
),
flags
);
flags
);
}
}
}
catch
(
WindowsException
x
)
{
}
catch
(
WindowsException
x
)
{
...
@@ -414,7 +414,7 @@ class WindowsFileCopy {
...
@@ -414,7 +414,7 @@ class WindowsFileCopy {
}
else
{
}
else
{
String
linkTarget
=
WindowsLinkSupport
.
readLink
(
source
);
String
linkTarget
=
WindowsLinkSupport
.
readLink
(
source
);
CreateSymbolicLink
(
targetPath
,
CreateSymbolicLink
(
targetPath
,
addPrefixIfNeeded
(
linkTarget
),
WindowsPath
.
addPrefixIfNeeded
(
linkTarget
),
SYMBOLIC_LINK_FLAG_DIRECTORY
);
SYMBOLIC_LINK_FLAG_DIRECTORY
);
}
}
}
catch
(
WindowsException
x
)
{
}
catch
(
WindowsException
x
)
{
...
@@ -502,18 +502,4 @@ class WindowsFileCopy {
...
@@ -502,18 +502,4 @@ class WindowsFileCopy {
priv
.
drop
();
priv
.
drop
();
}
}
}
}
/**
* Add long path prefix to path if required
*/
private
static
String
addPrefixIfNeeded
(
String
path
)
{
if
(
path
.
length
()
>
248
)
{
if
(
path
.
startsWith
(
"\\\\"
))
{
path
=
"\\\\?\\UNC"
+
path
.
substring
(
1
,
path
.
length
());
}
else
{
path
=
"\\\\?\\"
+
path
;
}
}
return
path
;
}
}
}
src/windows/classes/sun/nio/fs/WindowsLinkSupport.java
浏览文件 @
2ff3b4e4
...
@@ -231,7 +231,7 @@ class WindowsLinkSupport {
...
@@ -231,7 +231,7 @@ class WindowsLinkSupport {
int
end
=
(
next
==
-
1
)
?
path
.
length
()
:
next
;
int
end
=
(
next
==
-
1
)
?
path
.
length
()
:
next
;
String
search
=
sb
.
toString
()
+
path
.
substring
(
curr
,
end
);
String
search
=
sb
.
toString
()
+
path
.
substring
(
curr
,
end
);
try
{
try
{
FirstFile
fileData
=
FindFirstFile
(
addLongPath
PrefixIfNeeded
(
search
));
FirstFile
fileData
=
FindFirstFile
(
WindowsPath
.
add
PrefixIfNeeded
(
search
));
FindClose
(
fileData
.
handle
());
FindClose
(
fileData
.
handle
());
// if a reparse point is encountered then we must return the
// if a reparse point is encountered then we must return the
...
@@ -405,20 +405,6 @@ class WindowsLinkSupport {
...
@@ -405,20 +405,6 @@ class WindowsLinkSupport {
return
path
;
return
path
;
}
}
/**
* Add long path prefix to path if required.
*/
private
static
String
addLongPathPrefixIfNeeded
(
String
path
)
{
if
(
path
.
length
()
>
248
)
{
if
(
path
.
startsWith
(
"\\\\"
))
{
path
=
"\\\\?\\UNC"
+
path
.
substring
(
1
,
path
.
length
());
}
else
{
path
=
"\\\\?\\"
+
path
;
}
}
return
path
;
}
/**
/**
* Strip long path or symbolic link prefix from path
* Strip long path or symbolic link prefix from path
*/
*/
...
...
src/windows/classes/sun/nio/fs/WindowsPath.java
浏览文件 @
2ff3b4e4
...
@@ -283,7 +283,7 @@ class WindowsPath extends AbstractPath {
...
@@ -283,7 +283,7 @@ class WindowsPath extends AbstractPath {
// Add long path prefix to path if required
// Add long path prefix to path if required
static
String
addPrefixIfNeeded
(
String
path
)
{
static
String
addPrefixIfNeeded
(
String
path
)
{
if
(
path
.
length
()
>
248
)
{
if
(
path
.
length
()
>
MAX_PATH
)
{
if
(
path
.
startsWith
(
"\\\\"
))
{
if
(
path
.
startsWith
(
"\\\\"
))
{
path
=
"\\\\?\\UNC"
+
path
.
substring
(
1
,
path
.
length
());
path
=
"\\\\?\\UNC"
+
path
.
substring
(
1
,
path
.
length
());
}
else
{
}
else
{
...
...
test/java/awt/Focus/
OverrideRedirectWindowActivationTest/OverrideRedirect
WindowActivationTest.java
→
test/java/awt/Focus/
SimpleWindowActivationTest/Simple
WindowActivationTest.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
* @author anton.tarasov@sun.com: area=awt.focus
* @author anton.tarasov@sun.com: area=awt.focus
* @library ../../regtesthelpers
* @library ../../regtesthelpers
* @build Util
* @build Util
* @run main
OverrideRedirect
WindowActivationTest
* @run main
Simple
WindowActivationTest
*/
*/
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.awt.event.*
;
...
@@ -37,7 +37,7 @@ import javax.swing.SwingUtilities;
...
@@ -37,7 +37,7 @@ import javax.swing.SwingUtilities;
import
sun.awt.SunToolkit
;
import
sun.awt.SunToolkit
;
import
test.java.awt.regtesthelpers.Util
;
import
test.java.awt.regtesthelpers.Util
;
public
class
OverrideRedirect
WindowActivationTest
{
public
class
Simple
WindowActivationTest
{
private
static
Frame
frame
;
private
static
Frame
frame
;
private
static
Window
window
;
private
static
Window
window
;
...
@@ -115,7 +115,7 @@ public class OverrideRedirectWindowActivationTest {
...
@@ -115,7 +115,7 @@ public class OverrideRedirectWindowActivationTest {
wbutton
=
new
Button
(
"wbutton"
);
wbutton
=
new
Button
(
"wbutton"
);
label
=
new
Label
(
"label"
);
label
=
new
Label
(
"label"
);
window
.
setBounds
(
800
,
200
,
2
00
,
100
);
window
.
setBounds
(
800
,
200
,
3
00
,
100
);
window
.
setLayout
(
new
FlowLayout
());
window
.
setLayout
(
new
FlowLayout
());
window
.
add
(
wbutton
);
window
.
add
(
wbutton
);
window
.
add
(
label
);
window
.
add
(
label
);
...
@@ -126,7 +126,7 @@ public class OverrideRedirectWindowActivationTest {
...
@@ -126,7 +126,7 @@ public class OverrideRedirectWindowActivationTest {
private
static
void
createAndShowFrame
()
{
private
static
void
createAndShowFrame
()
{
fbutton
=
new
Button
(
"fbutton"
);
fbutton
=
new
Button
(
"fbutton"
);
frame
.
setBounds
(
800
,
0
,
2
00
,
100
);
frame
.
setBounds
(
800
,
0
,
3
00
,
100
);
frame
.
setLayout
(
new
FlowLayout
());
frame
.
setLayout
(
new
FlowLayout
());
frame
.
add
(
fbutton
);
frame
.
add
(
fbutton
);
frame
.
setVisible
(
true
);
frame
.
setVisible
(
true
);
...
...
test/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh
浏览文件 @
2ff3b4e4
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012,
2013,
Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -22,7 +22,8 @@
...
@@ -22,7 +22,8 @@
${
TESTJAVA
}
/bin/javac
-cp
${
TESTSRC
}
-d
.
${
TESTSRC
}
/BadDisplayTest.java
${
TESTJAVA
}
/bin/javac
-cp
${
TESTSRC
}
-d
.
${
TESTSRC
}
/BadDisplayTest.java
export
DISPLAY
=
DISPLAY
=
export
DISPLAY
OS
=
`
uname
-s
`
OS
=
`
uname
-s
`
case
"
$OS
"
in
case
"
$OS
"
in
...
...
test/java/awt/WMSpecificTests/Metacity/FullscreenDialogModality.java
0 → 100644
浏览文件 @
2ff3b4e4
/*
* 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 8012586
* @summary verify that modal dialog will appeared above fullscreen window under Metacity WM.
* @run main FullscreenDialogModality
* @run main/othervm FullscreenDialogModality
* @author vkravets
*/
import
test.java.awt.regtesthelpers.Util
;
import
java.awt.*
;
import
java.lang.reflect.InvocationTargetException
;
public
class
FullscreenDialogModality
extends
Frame
{
static
Robot
robot
=
null
;
public
void
enterFS
()
{
GraphicsDevice
gd
=
getGraphicsConfiguration
().
getDevice
();
final
boolean
fs
=
gd
.
isFullScreenSupported
();
System
.
out
.
println
(
"FullscreenSupported: "
+
(
fs
?
"yes"
:
"no"
));
gd
.
setFullScreenWindow
(
this
);
try
{
// Give the system time to set the FS window and display it
// properly
Thread
.
sleep
(
2000
);
}
catch
(
Exception
e
)
{}
}
public
void
exitFS
()
{
GraphicsDevice
gd
=
getGraphicsConfiguration
().
getDevice
();
// reset window
gd
.
setFullScreenWindow
(
null
);
try
{
// Give the system time to set the FS window and display it
// properly
Thread
.
sleep
(
2000
);
}
catch
(
Exception
e
)
{}
}
public
void
checkDialogModality
()
throws
InvocationTargetException
,
InterruptedException
{
// Dialog
final
Dialog
d
=
new
Dialog
(
FullscreenDialogModality
.
this
,
"Modal dialog"
,
Dialog
.
ModalityType
.
APPLICATION_MODAL
);
d
.
setBounds
(
500
,
500
,
160
,
160
);
d
.
setModal
(
true
);
d
.
setBackground
(
Color
.
red
);
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
d
.
setVisible
(
true
);
}
});
// Wait until the dialog is shown
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
// Empty
}
});
Util
.
waitForIdle
(
robot
);
try
{
//Check color
Point
checkPoint
=
new
Point
(
d
.
getX
()
+
d
.
getWidth
()
/
2
,
d
.
getY
()
+
d
.
getHeight
()
/
2
);
Color
actual
=
robot
.
getPixelColor
(
checkPoint
.
x
,
checkPoint
.
y
);
System
.
out
.
println
(
"Color = "
+
actual
);
if
(
actual
.
getRGB
()
==
Color
.
GREEN
.
getRGB
())
{
throw
new
RuntimeException
(
"Test FAILED: Modal dialog shown below fullscreen window"
);
}
else
if
(
actual
.
getRGB
()
==
Color
.
RED
.
getRGB
())
{
System
.
out
.
println
(
"Test PASSED: Modal dialog shown above fullscreen window"
);
}
else
{
System
.
out
.
println
(
"pixelColor "
+
Integer
.
toHexString
(
actual
.
getRGB
())
+
" at coordinates ("
+
checkPoint
.
x
+
", "
+
checkPoint
.
y
+
")"
);
throw
new
RuntimeException
(
"Test FAILED: Unexpected behavior"
);
}
robot
.
delay
(
2000
);
Util
.
waitForIdle
(
robot
);
}
finally
{
d
.
dispose
();
}
}
public
static
void
main
(
String
args
[])
throws
InvocationTargetException
,
InterruptedException
{
if
(
Util
.
getWMID
()
!=
Util
.
METACITY_WM
)
{
System
.
out
.
println
(
"This test is only useful on Metacity"
);
return
;
}
robot
=
Util
.
createRobot
();
Util
.
waitForIdle
(
robot
);
final
FullscreenDialogModality
frame
=
new
FullscreenDialogModality
();
frame
.
setUndecorated
(
true
);
frame
.
setBackground
(
Color
.
green
);
frame
.
setSize
(
500
,
500
);
frame
.
setVisible
(
true
);
try
{
robot
.
delay
(
100
);
Util
.
waitForIdle
(
robot
);
EventQueue
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
frame
.
enterFS
();
}
});
robot
.
delay
(
200
);
Util
.
waitForIdle
(
robot
);
frame
.
checkDialogModality
();
EventQueue
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
frame
.
exitFS
();
}
});
}
finally
{
frame
.
dispose
();
}
}
}
test/java/beans/XMLEncoder/AbstractTest.java
浏览文件 @
2ff3b4e4
...
@@ -30,8 +30,10 @@ import java.io.ByteArrayOutputStream;
...
@@ -30,8 +30,10 @@ import java.io.ByteArrayOutputStream;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.lang.reflect.Field
;
abstract
class
AbstractTest
<
T
>
implements
ExceptionListener
{
abstract
class
AbstractTest
<
T
>
implements
ExceptionListener
{
private
final
BeanValidator
validator
=
new
BeanValidator
();
final
BeanValidator
validator
=
new
BeanValidator
();
public
final
void
exceptionThrown
(
Exception
exception
)
{
public
final
void
exceptionThrown
(
Exception
exception
)
{
throw
new
Error
(
"unexpected exception"
,
exception
);
throw
new
Error
(
"unexpected exception"
,
exception
);
...
@@ -59,7 +61,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
...
@@ -59,7 +61,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
}
}
/**
/**
* This method should be overriden
* This method should be overrid
d
en
* if specified encoder should be initialized.
* if specified encoder should be initialized.
*
*
* @param encoder the XML encoder to initialize
* @param encoder the XML encoder to initialize
...
@@ -68,7 +70,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
...
@@ -68,7 +70,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
}
}
/**
/**
* This method should be overriden
* This method should be overrid
d
en
* if specified decoder should be initialized.
* if specified decoder should be initialized.
*
*
* @param decoder the XML decoder to initialize
* @param decoder the XML decoder to initialize
...
@@ -77,7 +79,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
...
@@ -77,7 +79,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
}
}
/**
/**
* This method should be overriden
* This method should be overrid
d
en
* for test-specific comparison.
* for test-specific comparison.
*
*
* @param before the object before encoding
* @param before the object before encoding
...
@@ -134,6 +136,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
...
@@ -134,6 +136,7 @@ abstract class AbstractTest<T> implements ExceptionListener {
private
byte
[]
writeObject
(
Object
object
)
{
private
byte
[]
writeObject
(
Object
object
)
{
ByteArrayOutputStream
output
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
output
=
new
ByteArrayOutputStream
();
XMLEncoder
encoder
=
new
XMLEncoder
(
output
);
XMLEncoder
encoder
=
new
XMLEncoder
(
output
);
encoder
.
setExceptionListener
(
this
);
initialize
(
encoder
);
initialize
(
encoder
);
encoder
.
writeObject
(
object
);
encoder
.
writeObject
(
object
);
encoder
.
close
();
encoder
.
close
();
...
@@ -143,9 +146,24 @@ abstract class AbstractTest<T> implements ExceptionListener {
...
@@ -143,9 +146,24 @@ abstract class AbstractTest<T> implements ExceptionListener {
private
Object
readObject
(
byte
[]
array
)
{
private
Object
readObject
(
byte
[]
array
)
{
ByteArrayInputStream
input
=
new
ByteArrayInputStream
(
array
);
ByteArrayInputStream
input
=
new
ByteArrayInputStream
(
array
);
XMLDecoder
decoder
=
new
XMLDecoder
(
input
);
XMLDecoder
decoder
=
new
XMLDecoder
(
input
);
decoder
.
setExceptionListener
(
this
);
initialize
(
decoder
);
initialize
(
decoder
);
Object
object
=
decoder
.
readObject
();
Object
object
=
decoder
.
readObject
();
decoder
.
close
();
decoder
.
close
();
return
object
;
return
object
;
}
}
static
Field
getField
(
String
name
)
{
try
{
int
index
=
name
.
lastIndexOf
(
'.'
);
String
className
=
name
.
substring
(
0
,
index
);
String
fieldName
=
name
.
substring
(
1
+
index
);
Field
field
=
Class
.
forName
(
className
).
getDeclaredField
(
fieldName
);
field
.
setAccessible
(
true
);
return
field
;
}
catch
(
Exception
exception
)
{
throw
new
Error
(
exception
);
}
}
}
}
test/java/beans/XMLEncoder/BeanValidator.java
浏览文件 @
2ff3b4e4
...
@@ -63,6 +63,15 @@ final class BeanValidator {
...
@@ -63,6 +63,15 @@ final class BeanValidator {
}
}
Class
type
=
object1
.
getClass
();
Class
type
=
object1
.
getClass
();
if
(!
type
.
equals
(
object2
.
getClass
()))
{
if
(!
type
.
equals
(
object2
.
getClass
()))
{
// resolve different implementations of the Map.Entry interface
if
((
object1
instanceof
Map
.
Entry
)
&&
(
object2
instanceof
Map
.
Entry
))
{
log
(
"!!! special case"
,
"Map.Entry"
);
Map
.
Entry
entry1
=
(
Map
.
Entry
)
object1
;
Map
.
Entry
entry2
=
(
Map
.
Entry
)
object2
;
validate
(
entry1
.
getKey
(),
entry2
.
getKey
());
validate
(
entry1
.
getValue
(),
entry2
.
getValue
());
return
;
}
throw
new
IllegalStateException
(
"could not compare objects with different types"
);
throw
new
IllegalStateException
(
"could not compare objects with different types"
);
}
}
// validate elements of arrays
// validate elements of arrays
...
@@ -82,10 +91,14 @@ final class BeanValidator {
...
@@ -82,10 +91,14 @@ final class BeanValidator {
}
}
return
;
return
;
}
}
// special case for collections: do not use equals
boolean
ignore
=
Collection
.
class
.
isAssignableFrom
(
type
)
||
Map
.
Entry
.
class
.
isAssignableFrom
(
type
)
||
Map
.
class
.
isAssignableFrom
(
type
);
// validate objects using equals()
// validate objects using equals()
// we assume that the method equals(Object) can be called,
// we assume that the method equals(Object) can be called,
// if the class declares such method
// if the class declares such method
if
(
isDefined
(
type
,
"equals"
,
Object
.
class
))
{
if
(
!
ignore
&&
isDefined
(
type
,
"equals"
,
Object
.
class
))
{
if
(
object1
.
equals
(
object2
))
{
if
(
object1
.
equals
(
object2
))
{
return
;
return
;
}
}
...
@@ -205,27 +218,7 @@ final class BeanValidator {
...
@@ -205,27 +218,7 @@ final class BeanValidator {
}
}
private
void
validate
(
Map
map1
,
Map
map2
,
boolean
sorted
)
{
private
void
validate
(
Map
map1
,
Map
map2
,
boolean
sorted
)
{
if
(
map1
.
size
()
!=
map2
.
size
())
{
validate
(
map1
.
entrySet
(),
map2
.
entrySet
(),
sorted
);
throw
new
IllegalStateException
(
"could not compare maps with different sizes"
);
}
if
(
sorted
)
{
Iterator
first
=
map1
.
entrySet
().
iterator
();
Iterator
second
=
map2
.
entrySet
().
iterator
();
int
index
=
0
;
while
(
first
.
hasNext
()
&&
second
.
hasNext
())
{
log
(
"validate map entry"
,
Integer
.
valueOf
(
index
++));
validate
(
first
.
next
(),
second
.
next
());
}
if
(
first
.
hasNext
()
||
second
.
hasNext
())
{
throw
new
IllegalStateException
(
"one map contains more entries than another one"
);
}
}
else
{
// assume that equals() can be used for keys
for
(
Object
key
:
map1
.
keySet
())
{
log
(
"validate map value for key"
,
key
);
validate
(
map1
.
get
(
key
),
map2
.
get
(
key
));
}
}
}
}
private
boolean
isCyclic
(
Object
object1
,
Object
object2
)
{
private
boolean
isCyclic
(
Object
object1
,
Object
object2
)
{
...
...
test/java/beans/XMLEncoder/Test4631471.java
浏览文件 @
2ff3b4e4
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
* @author Sergey Malenkov, Mark Davidson
* @author Sergey Malenkov, Mark Davidson
*/
*/
import
java.beans.XMLEncoder
;
import
javax.swing.JTree
;
import
javax.swing.JTree
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultTreeModel
;
import
javax.swing.tree.DefaultTreeModel
;
...
@@ -78,10 +77,6 @@ public abstract class Test4631471 extends AbstractTest {
...
@@ -78,10 +77,6 @@ public abstract class Test4631471 extends AbstractTest {
// do not any validation
// do not any validation
}
}
protected
final
void
initialize
(
XMLEncoder
encoder
)
{
encoder
.
setExceptionListener
(
this
);
}
public
static
TreeNode
getRoot
()
{
public
static
TreeNode
getRoot
()
{
DefaultMutableTreeNode
node
=
new
DefaultMutableTreeNode
(
"root"
);
DefaultMutableTreeNode
node
=
new
DefaultMutableTreeNode
(
"root"
);
DefaultMutableTreeNode
first
=
new
DefaultMutableTreeNode
(
"first"
);
DefaultMutableTreeNode
first
=
new
DefaultMutableTreeNode
(
"first"
);
...
...
test/java/beans/XMLEncoder/Test4679556.java
浏览文件 @
2ff3b4e4
...
@@ -103,7 +103,6 @@ public class Test4679556 extends AbstractTest {
...
@@ -103,7 +103,6 @@ public class Test4679556 extends AbstractTest {
}
}
protected
void
initialize
(
XMLEncoder
encoder
)
{
protected
void
initialize
(
XMLEncoder
encoder
)
{
encoder
.
setExceptionListener
(
this
);
encoder
.
setPersistenceDelegate
(
C
.
class
,
new
DefaultPersistenceDelegate
()
{
encoder
.
setPersistenceDelegate
(
C
.
class
,
new
DefaultPersistenceDelegate
()
{
protected
Expression
instantiate
(
Object
oldInstance
,
Encoder
out
)
{
protected
Expression
instantiate
(
Object
oldInstance
,
Encoder
out
)
{
C
c
=
(
C
)
oldInstance
;
C
c
=
(
C
)
oldInstance
;
...
...
test/java/beans/XMLEncoder/java_awt_BorderLayout.java
浏览文件 @
2ff3b4e4
...
@@ -68,11 +68,9 @@ public final class java_awt_BorderLayout extends AbstractTest<BorderLayout> {
...
@@ -68,11 +68,9 @@ public final class java_awt_BorderLayout extends AbstractTest<BorderLayout> {
@Override
@Override
protected
void
validate
(
BorderLayout
before
,
BorderLayout
after
)
{
protected
void
validate
(
BorderLayout
before
,
BorderLayout
after
)
{
super
.
validate
(
before
,
after
);
super
.
validate
(
before
,
after
);
BeanValidator
validator
=
new
BeanValidator
();
for
(
String
constraint
:
CONSTRAINTS
)
{
for
(
String
constraint
:
CONSTRAINTS
)
{
validator
.
validate
(
before
.
getLayoutComponent
(
constraint
),
super
.
validator
.
validate
(
before
.
getLayoutComponent
(
constraint
),
after
.
getLayoutComponent
(
constraint
));
after
.
getLayoutComponent
(
constraint
));
}
}
}
}
...
...
src/share/classes/java/beans/ReflectionUtils
.java
→
test/java/beans/XMLEncoder/java_awt_CardLayout
.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 20
03, 2009
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 20
13
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* published by the Free Software Foundation.
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
...
@@ -22,57 +20,64 @@
...
@@ -22,57 +20,64 @@
* or visit www.oracle.com if you need additional information or have any
* or visit www.oracle.com if you need additional information or have any
* questions.
* questions.
*/
*/
package
java.beans
;
/*
* @test
* @bug 8007458
* @summary Tests CardLayout encoding
* @author Sergey Malenkov
*/
import
java.awt.CardLayout
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.Vector
;
import
javax.swing.JLabel
;
/**
public
final
class
java_awt_CardLayout
extends
AbstractTest
<
CardLayout
>
{
* A utility class for reflectively finding methods, constuctors and fields
private
static
final
Field
VECTOR
=
getField
(
"java.awt.CardLayout.vector"
);
* using reflection.
private
static
final
Field
NAME
=
getField
(
"java.awt.CardLayout$Card.name"
);
*/
private
static
final
Field
COMP
=
getField
(
"java.awt.CardLayout$Card.comp"
);
class
ReflectionUtils
{
@SuppressWarnings
(
"rawtypes"
)
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
boolean
isPrimitive
(
Class
type
)
{
new
java_awt_CardLayout
().
test
(
true
);
return
primitiveTypeFor
(
type
)
!=
null
;
}
}
@SuppressWarnings
(
"rawtypes"
)
@Override
public
static
Class
primitiveTypeFor
(
Class
wrapper
)
{
protected
CardLayout
getObject
()
{
if
(
wrapper
==
Boolean
.
class
)
return
Boolean
.
TYPE
;
CardLayout
layout
=
new
CardLayout
();
if
(
wrapper
==
Byte
.
class
)
return
Byte
.
TYPE
;
layout
.
addLayoutComponent
(
new
JLabel
(
"a"
),
"a"
);
if
(
wrapper
==
Character
.
class
)
return
Character
.
TYPE
;
layout
.
addLayoutComponent
(
new
JLabel
(
"b"
),
"b"
);
if
(
wrapper
==
Short
.
class
)
return
Short
.
TYPE
;
layout
.
addLayoutComponent
(
new
JLabel
(
"c"
),
"c"
);
if
(
wrapper
==
Integer
.
class
)
return
Integer
.
TYPE
;
return
layout
;
if
(
wrapper
==
Long
.
class
)
return
Long
.
TYPE
;
if
(
wrapper
==
Float
.
class
)
return
Float
.
TYPE
;
if
(
wrapper
==
Double
.
class
)
return
Double
.
TYPE
;
if
(
wrapper
==
Void
.
class
)
return
Void
.
TYPE
;
return
null
;
}
}
/**
@Override
* Returns the value of a private field.
protected
CardLayout
getAnotherObject
()
{
*
CardLayout
layout
=
new
CardLayout
();
* @param instance object instance
layout
.
addLayoutComponent
(
new
JLabel
(
"a"
),
"a"
);
* @param cls class
layout
.
addLayoutComponent
(
new
JLabel
(
"b"
),
"b"
);
* @param name name of the field
layout
.
addLayoutComponent
(
new
JLabel
(
"c"
),
"c"
);
* @param el an exception listener to handle exceptions; or null
layout
.
addLayoutComponent
(
new
JLabel
(
"d"
),
"d"
);
* @return value of the field; null if not found or an error is encountered
return
layout
;
*/
}
@SuppressWarnings
(
"rawtypes"
)
public
static
Object
getPrivateField
(
Object
instance
,
Class
cls
,
@Override
String
name
,
ExceptionListener
el
)
{
protected
void
validate
(
CardLayout
before
,
CardLayout
after
)
{
super
.
validate
(
before
,
after
);
try
{
try
{
Field
f
=
cls
.
getDeclaredField
(
name
);
Vector
a
=
(
Vector
)
VECTOR
.
get
(
after
);
f
.
setAccessible
(
true
);
Vector
b
=
(
Vector
)
VECTOR
.
get
(
before
);
return
f
.
get
(
instance
);
int
size
=
a
.
size
();
}
if
(
size
!=
b
.
size
())
{
catch
(
Exception
e
)
{
throw
new
Error
(
"different content"
);
if
(
el
!=
null
)
{
el
.
exceptionThrown
(
e
);
}
}
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
super
.
validator
.
validate
(
NAME
.
get
(
a
.
get
(
i
)),
NAME
.
get
(
b
.
get
(
i
)));
super
.
validator
.
validate
(
COMP
.
get
(
a
.
get
(
i
)),
COMP
.
get
(
b
.
get
(
i
)));
}
}
catch
(
Exception
exception
)
{
throw
new
Error
(
exception
);
}
}
return
null
;
}
}
}
}
test/java/beans/XMLEncoder/java_awt_GridBagLayout.java
0 → 100644
浏览文件 @
2ff3b4e4
/*
* 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 8007458
* @summary Tests GridBagLayout encoding
* @author Sergey Malenkov
*/
import
java.awt.Component
;
import
java.awt.GridBagConstraints
;
import
java.awt.GridBagLayout
;
import
java.lang.reflect.Field
;
import
java.util.Hashtable
;
import
java.util.Map
;
import
javax.swing.JLabel
;
public
final
class
java_awt_GridBagLayout
extends
AbstractTest
<
GridBagLayout
>
{
private
static
final
Field
HASHTABLE
=
getField
(
"java.awt.GridBagLayout.comptable"
);
public
static
void
main
(
String
[]
args
)
{
new
java_awt_GridBagLayout
().
test
(
true
);
}
@Override
protected
GridBagLayout
getObject
()
{
GridBagLayout
layout
=
new
GridBagLayout
();
update
(
layout
,
"1"
,
1
,
1
);
update
(
layout
,
"2"
,
2
,
2
);
update
(
layout
,
"3"
,
3
,
3
);
return
layout
;
}
@Override
protected
GridBagLayout
getAnotherObject
()
{
GridBagLayout
layout
=
new
GridBagLayout
();
update
(
layout
,
"11"
,
1
,
1
);
update
(
layout
,
"12"
,
1
,
2
);
update
(
layout
,
"21"
,
2
,
1
);
update
(
layout
,
"22"
,
2
,
2
);
return
layout
;
}
@Override
protected
void
validate
(
GridBagLayout
before
,
GridBagLayout
after
)
{
super
.
validate
(
before
,
after
);
try
{
Hashtable
a
=
(
Hashtable
)
HASHTABLE
.
get
(
after
);
Hashtable
b
=
(
Hashtable
)
HASHTABLE
.
get
(
before
);
super
.
validator
.
validate
(
a
,
b
);
// for (int i = 0; i < size; i++) {
// validator.validate(NAME.get(a.get(i)), NAME.get(b.get(i)));
// validator.validate(COMP.get(a.get(i)), COMP.get(b.get(i)));
// }
}
catch
(
Exception
exception
)
{
throw
new
Error
(
exception
);
}
// for (String name : names) {
// validator.validate(getConstraints(before, name), getConstraints(after, name));
// }
}
private
static
void
update
(
GridBagLayout
layout
,
String
id
,
int
x
,
int
y
)
{
GridBagConstraints
gbc
=
new
GridBagConstraints
();
gbc
.
gridx
=
x
;
gbc
.
gridy
=
y
;
layout
.
addLayoutComponent
(
new
JLabel
(
id
),
gbc
);
}
/*
private static GridBagConstraints getConstraints(GridBagLayout layout, String id) {
return (layout == null) ? null : ((MyGridBagLayout) layout).getConstraints(id);
}
*/
}
test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java
浏览文件 @
2ff3b4e4
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
* @author Sergey Malenkov
* @author Sergey Malenkov
*/
*/
import
java.beans.XMLEncoder
;
import
javax.swing.DefaultCellEditor
;
import
javax.swing.DefaultCellEditor
;
import
javax.swing.JTextField
;
import
javax.swing.JTextField
;
import
javax.swing.text.JTextComponent
;
import
javax.swing.text.JTextComponent
;
...
@@ -46,6 +47,11 @@ public final class javax_swing_DefaultCellEditor extends AbstractTest<DefaultCel
...
@@ -46,6 +47,11 @@ public final class javax_swing_DefaultCellEditor extends AbstractTest<DefaultCel
// return new DefaultCellEditor(new JTextField("Second"));
// return new DefaultCellEditor(new JTextField("Second"));
}
}
@Override
protected
void
initialize
(
XMLEncoder
encoder
)
{
encoder
.
setExceptionListener
(
null
);
// TODO: ignore non-public listener because of 4808251
}
protected
void
validate
(
DefaultCellEditor
before
,
DefaultCellEditor
after
)
{
protected
void
validate
(
DefaultCellEditor
before
,
DefaultCellEditor
after
)
{
String
text
=
((
JTextComponent
)
after
.
getComponent
()).
getText
();
String
text
=
((
JTextComponent
)
after
.
getComponent
()).
getText
();
if
(!
text
.
equals
(((
JTextComponent
)
before
.
getComponent
()).
getText
()))
if
(!
text
.
equals
(((
JTextComponent
)
before
.
getComponent
()).
getText
()))
...
...
test/java/lang/Math/DivModTests.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -137,7 +137,8 @@ public class DivModTests {
...
@@ -137,7 +137,8 @@ public class DivModTests {
int
tmp
=
x
/
y
;
// Force ArithmeticException for divide by zero
int
tmp
=
x
/
y
;
// Force ArithmeticException for divide by zero
double
ff
=
x
-
Math
.
floor
((
double
)
x
/
(
double
)
y
)
*
y
;
double
ff
=
x
-
Math
.
floor
((
double
)
x
/
(
double
)
y
)
*
y
;
int
fr
=
(
int
)
ff
;
int
fr
=
(
int
)
ff
;
if
(
fr
!=
result
)
{
boolean
t
=
(
fr
==
((
Integer
)
result
));
if
(!
result
.
equals
(
fr
))
{
fail
(
"FAIL: Math.floorMod(%d, %d) = %s differs from Math.floor(x, y): %d%n"
,
x
,
y
,
result
,
fr
);
fail
(
"FAIL: Math.floorMod(%d, %d) = %s differs from Math.floor(x, y): %d%n"
,
x
,
y
,
result
,
fr
);
}
}
}
catch
(
ArithmeticException
ae
)
{
}
catch
(
ArithmeticException
ae
)
{
...
@@ -240,8 +241,8 @@ public class DivModTests {
...
@@ -240,8 +241,8 @@ public class DivModTests {
resultD
=
resultD
.
multiply
(
yD
);
resultD
=
resultD
.
multiply
(
yD
);
resultD
=
xD
.
subtract
(
resultD
);
resultD
=
xD
.
subtract
(
resultD
);
long
fr
=
resultD
.
longValue
();
long
fr
=
resultD
.
longValue
();
if
(
fr
!=
result
)
{
if
(
!
result
.
equals
(
fr
)
)
{
fail
(
"FAIL: Long.floorMod(%d, %d) = %d is different than BigDecimal result: %d%n"
,
x
,
y
,
result
,
fr
);
fail
(
"FAIL: Long.floorMod(%d, %d) = %d is different than BigDecimal result: %d%n"
,
x
,
y
,
result
,
fr
);
}
}
}
catch
(
ArithmeticException
ae
)
{
}
catch
(
ArithmeticException
ae
)
{
...
...
test/java/lang/annotation/TypeAnnotationReflection.java
浏览文件 @
2ff3b4e4
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/*
/*
* @test
* @test
* @bug 8004698
* @bug 8004698
8007073
* @summary Unit test for type annotations
* @summary Unit test for type annotations
*/
*/
...
@@ -48,6 +48,8 @@ public class TypeAnnotationReflection {
...
@@ -48,6 +48,8 @@ public class TypeAnnotationReflection {
testParameterizedType
();
testParameterizedType
();
testNestedParameterizedType
();
testNestedParameterizedType
();
testWildcardType
();
testWildcardType
();
testParameterTypes
();
testParameterType
();
}
}
private
static
void
check
(
boolean
b
)
{
private
static
void
check
(
boolean
b
)
{
...
@@ -359,6 +361,154 @@ public class TypeAnnotationReflection {
...
@@ -359,6 +361,154 @@ public class TypeAnnotationReflection {
t
=
w
.
getAnnotatedLowerBounds
();
t
=
w
.
getAnnotatedLowerBounds
();
check
(
t
.
length
==
1
);
check
(
t
.
length
==
1
);
}
}
private
static
void
testParameterTypes
()
throws
Exception
{
// NO PARAMS
Method
m
=
Params
.
class
.
getDeclaredMethod
(
"noParams"
,
(
Class
<?>[])
null
);
AnnotatedType
[]
t
=
m
.
getAnnotatedParameterTypes
();
check
(
t
.
length
==
0
);
// ONLY ANNOTATED PARAM TYPES
Class
[]
argsArr
=
{
String
.
class
,
String
.
class
,
String
.
class
};
m
=
Params
.
class
.
getDeclaredMethod
(
"onlyAnnotated"
,
(
Class
<?>[])
argsArr
);
t
=
m
.
getAnnotatedParameterTypes
();
check
(
t
.
length
==
3
);
check
(
t
[
0
].
getAnnotations
().
length
==
1
);
check
(
t
[
0
].
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t
[
0
].
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"1"
));
check
(
t
[
1
].
getAnnotations
().
length
==
1
);
check
(
t
[
1
].
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t
[
1
].
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"2"
));
check
(
t
[
2
].
getAnnotations
().
length
==
2
);
check
(
t
[
2
].
getAnnotations
()[
0
].
annotationType
().
equals
(
TypeAnno
.
class
));
check
(
t
[
2
].
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t
[
2
].
getAnnotation
(
TypeAnno2
.
class
)
!=
null
);
check
(
t
[
2
].
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"3a"
));
check
(
t
[
2
].
getAnnotationsByType
(
TypeAnno2
.
class
)[
0
].
value
().
equals
(
"3b"
));
// MIXED ANNOTATED PARAM TYPES
m
=
Params
.
class
.
getDeclaredMethod
(
"mixed"
,
(
Class
<?>[])
argsArr
);
t
=
m
.
getAnnotatedParameterTypes
();
check
(
t
.
length
==
3
);
check
(
t
[
0
].
getAnnotations
().
length
==
1
);
check
(
t
[
0
].
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t
[
0
].
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"1"
));
check
(
t
[
1
].
getAnnotations
().
length
==
0
);
check
(
t
[
1
].
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t
[
1
].
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
check
(
t
[
2
].
getAnnotations
().
length
==
2
);
check
(
t
[
2
].
getAnnotations
()[
0
].
annotationType
().
equals
(
TypeAnno
.
class
));
check
(
t
[
2
].
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t
[
2
].
getAnnotation
(
TypeAnno2
.
class
)
!=
null
);
check
(
t
[
2
].
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"3a"
));
check
(
t
[
2
].
getAnnotationsByType
(
TypeAnno2
.
class
)[
0
].
value
().
equals
(
"3b"
));
// NO ANNOTATED PARAM TYPES
m
=
Params
.
class
.
getDeclaredMethod
(
"unAnnotated"
,
(
Class
<?>[])
argsArr
);
t
=
m
.
getAnnotatedParameterTypes
();
check
(
t
.
length
==
3
);
check
(
t
[
0
].
getAnnotations
().
length
==
0
);
check
(
t
[
0
].
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t
[
0
].
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
check
(
t
[
1
].
getAnnotations
().
length
==
0
);
check
(
t
[
1
].
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t
[
1
].
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
check
(
t
[
2
].
getAnnotations
().
length
==
0
);
check
(
t
[
2
].
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t
[
2
].
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
}
private
static
void
testParameterType
()
throws
Exception
{
// NO PARAMS
Method
m
=
Params
.
class
.
getDeclaredMethod
(
"noParams"
,
(
Class
<?>[])
null
);
Parameter
[]
p
=
m
.
getParameters
();
check
(
p
.
length
==
0
);
// ONLY ANNOTATED PARAM TYPES
Class
[]
argsArr
=
{
String
.
class
,
String
.
class
,
String
.
class
};
m
=
Params
.
class
.
getDeclaredMethod
(
"onlyAnnotated"
,
(
Class
<?>[])
argsArr
);
p
=
m
.
getParameters
();
check
(
p
.
length
==
3
);
AnnotatedType
t0
=
p
[
0
].
getAnnotatedType
();
AnnotatedType
t1
=
p
[
1
].
getAnnotatedType
();
AnnotatedType
t2
=
p
[
2
].
getAnnotatedType
();
check
(
t0
.
getAnnotations
().
length
==
1
);
check
(
t0
.
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t0
.
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"1"
));
check
(
t1
.
getAnnotations
().
length
==
1
);
check
(
t1
.
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t1
.
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"2"
));
check
(
t2
.
getAnnotations
().
length
==
2
);
check
(
t2
.
getAnnotations
()[
0
].
annotationType
().
equals
(
TypeAnno
.
class
));
check
(
t2
.
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t2
.
getAnnotation
(
TypeAnno2
.
class
)
!=
null
);
check
(
t2
.
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"3a"
));
check
(
t2
.
getAnnotationsByType
(
TypeAnno2
.
class
)[
0
].
value
().
equals
(
"3b"
));
// MIXED ANNOTATED PARAM TYPES
m
=
Params
.
class
.
getDeclaredMethod
(
"mixed"
,
(
Class
<?>[])
argsArr
);
p
=
m
.
getParameters
();
check
(
p
.
length
==
3
);
t0
=
p
[
0
].
getAnnotatedType
();
t1
=
p
[
1
].
getAnnotatedType
();
t2
=
p
[
2
].
getAnnotatedType
();
check
(
t0
.
getAnnotations
().
length
==
1
);
check
(
t0
.
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t0
.
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"1"
));
check
(
t1
.
getAnnotations
().
length
==
0
);
check
(
t1
.
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t1
.
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
check
(
t2
.
getAnnotations
().
length
==
2
);
check
(
t2
.
getAnnotations
()[
0
].
annotationType
().
equals
(
TypeAnno
.
class
));
check
(
t2
.
getAnnotation
(
TypeAnno
.
class
)
!=
null
);
check
(
t2
.
getAnnotation
(
TypeAnno2
.
class
)
!=
null
);
check
(
t2
.
getAnnotationsByType
(
TypeAnno
.
class
)[
0
].
value
().
equals
(
"3a"
));
check
(
t2
.
getAnnotationsByType
(
TypeAnno2
.
class
)[
0
].
value
().
equals
(
"3b"
));
// NO ANNOTATED PARAM TYPES
m
=
Params
.
class
.
getDeclaredMethod
(
"unAnnotated"
,
(
Class
<?>[])
argsArr
);
p
=
m
.
getParameters
();
check
(
p
.
length
==
3
);
t0
=
p
[
0
].
getAnnotatedType
();
t1
=
p
[
1
].
getAnnotatedType
();
t2
=
p
[
2
].
getAnnotatedType
();
check
(
t0
.
getAnnotations
().
length
==
0
);
check
(
t0
.
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t0
.
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
check
(
t1
.
getAnnotations
().
length
==
0
);
check
(
t1
.
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t1
.
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
check
(
t2
.
getAnnotations
().
length
==
0
);
check
(
t2
.
getAnnotation
(
TypeAnno
.
class
)
==
null
);
check
(
t2
.
getAnnotation
(
TypeAnno2
.
class
)
==
null
);
}
}
class
Params
{
public
void
noParams
()
{}
public
void
onlyAnnotated
(
@TypeAnno
(
"1"
)
String
s1
,
@TypeAnno
(
"2"
)
String
s2
,
@TypeAnno
(
"3a"
)
@TypeAnno2
(
"3b"
)
String
s3
)
{}
public
void
mixed
(
@TypeAnno
(
"1"
)
String
s1
,
String
s2
,
@TypeAnno
(
"3a"
)
@TypeAnno2
(
"3b"
)
String
s3
)
{}
public
void
unAnnotated
(
String
s1
,
String
s2
,
String
s3
)
{}
}
}
abstract
class
TestWildcardType
{
abstract
class
TestWildcardType
{
...
...
test/java/nio/file/Files/NameLimits.java
0 → 100644
浏览文件 @
2ff3b4e4
/*
* 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 8011128
* @summary Test file and directory name limits. This test is primarily
* intended to test Files.createDirectory on resolved paths at or around
* the short path limit of 248 on Windows.
*/
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
public
class
NameLimits
{
static
final
int
MAX_PATH
=
255
;
static
final
int
MIN_PATH
=
8
;
// arbitrarily chosen
static
Path
generatePath
(
int
len
)
{
if
(
len
<
MIN_PATH
)
throw
new
RuntimeException
(
"Attempting to generate path less than MIN_PATH"
);
StringBuilder
sb
=
new
StringBuilder
(
len
);
sb
.
append
(
"name"
);
while
(
sb
.
length
()
<
len
)
{
sb
.
append
(
'X'
);
}
return
Paths
.
get
(
sb
.
toString
());
}
static
boolean
tryCreateFile
(
int
len
)
throws
IOException
{
Path
name
=
generatePath
(
len
);
try
{
Files
.
createFile
(
name
);
}
catch
(
IOException
ioe
)
{
System
.
err
.
format
(
"Unable to create file of length %d (full path %d), %s%n"
,
name
.
toString
().
length
(),
name
.
toAbsolutePath
().
toString
().
length
(),
ioe
);
return
false
;
}
Files
.
delete
(
name
);
return
true
;
}
static
boolean
tryCreateDirectory
(
int
len
)
throws
IOException
{
Path
name
=
generatePath
(
len
);
try
{
Files
.
createDirectory
(
name
);
}
catch
(
IOException
ioe
)
{
System
.
err
.
format
(
"Unable to create directory of length %d (full path %d), %s%n"
,
name
.
toString
().
length
(),
name
.
toAbsolutePath
().
toString
().
length
(),
ioe
);
return
false
;
}
Files
.
delete
(
name
);
return
true
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
int
len
;
// find the maximum file name if MAX_PATH or less
len
=
MAX_PATH
;
while
(!
tryCreateFile
(
len
))
{
len
--;
}
System
.
out
.
format
(
"Testing createFile on paths %d .. %d%n"
,
MIN_PATH
,
len
);
while
(
len
>=
MIN_PATH
)
{
if
(!
tryCreateFile
(
len
--))
throw
new
RuntimeException
(
"Test failed"
);
}
// find the maximum directory name if MAX_PATH or less
len
=
MAX_PATH
;
while
(!
tryCreateDirectory
(
len
))
{
len
--;
}
System
.
out
.
format
(
"Testing createDirectory on paths %d .. %d%n"
,
MIN_PATH
,
len
);
while
(
len
>=
MIN_PATH
)
{
if
(!
tryCreateDirectory
(
len
--))
throw
new
RuntimeException
(
"Test failed"
);
}
}
}
test/java/util/regex/RegExTest.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 1999, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
* 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
* 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254
* 7067045 7014640 7189363 8007395 8013252 8013254
8012646
*/
*/
import
java.util.regex.*
;
import
java.util.regex.*
;
...
@@ -41,6 +41,7 @@ import java.util.Random;
...
@@ -41,6 +41,7 @@ import java.util.Random;
import
java.io.*
;
import
java.io.*
;
import
java.util.*
;
import
java.util.*
;
import
java.nio.CharBuffer
;
import
java.nio.CharBuffer
;
import
java.util.function.Predicate
;
/**
/**
* This is a test class created to check the operation of
* This is a test class created to check the operation of
...
@@ -145,6 +146,7 @@ public class RegExTest {
...
@@ -145,6 +146,7 @@ public class RegExTest {
linebreakTest
();
linebreakTest
();
branchTest
();
branchTest
();
groupCurlyNotFoundSuppTest
();
groupCurlyNotFoundSuppTest
();
patternAsPredicate
();
if
(
failure
)
{
if
(
failure
)
{
throw
new
throw
new
RuntimeException
(
"RegExTest failed, 1st failure: "
+
RuntimeException
(
"RegExTest failed, 1st failure: "
+
...
@@ -3997,4 +3999,19 @@ public class RegExTest {
...
@@ -3997,4 +3999,19 @@ public class RegExTest {
report
(
"GroupCurly NotFoundSupp"
);
report
(
"GroupCurly NotFoundSupp"
);
}
}
// This test is for 8012646
private
static
void
patternAsPredicate
()
throws
Exception
{
Predicate
<
String
>
p
=
Pattern
.
compile
(
"[a-z]+"
).
asPredicate
();
if
(
p
.
test
(
""
))
{
failCount
++;
}
if
(!
p
.
test
(
"word"
))
{
failCount
++;
}
if
(
p
.
test
(
"1234"
))
{
failCount
++;
}
report
(
"Pattern.asPredicate"
);
}
}
}
test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java
0 → 100644
浏览文件 @
2ff3b4e4
/*
* 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 8012004
@summary JINTERNALFRAME NOT BEING FINALIZED AFTER CLOSING
@author mcherkas
@run main InternalFrameIsNotCollectedTest
*/
import
sun.awt.SunToolkit
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.KeyEvent
;
import
java.beans.PropertyVetoException
;
import
java.util.Date
;
public
class
InternalFrameIsNotCollectedTest
{
public
static
final
int
waitTime
=
10000
;
private
static
Robot
robot
;
public
static
void
sync
()
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
toolkit
.
realSync
();
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
initRobot
();
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
initUI
();
try
{
closeInternalFrame
();
}
catch
(
PropertyVetoException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
});
sync
();
invokeGC
();
Thread
.
sleep
(
1000
);
// it's better to wait 1 sec now then 10 sec later
Date
startWaiting
=
new
Date
();
synchronized
(
CustomInternalFrame
.
waiter
)
{
// Sync with finalization thread.
Date
now
=
new
Date
();
while
(
now
.
getTime
()
-
startWaiting
.
getTime
()
<
waitTime
&&
!
CustomInternalFrame
.
finalized
)
{
CustomInternalFrame
.
waiter
.
wait
(
waitTime
);
now
=
new
Date
();
}
}
if
(!
CustomInternalFrame
.
finalized
)
{
throw
new
RuntimeException
(
"Closed internal frame wasn't collected"
);
}
}
private
static
void
initRobot
()
throws
AWTException
{
robot
=
new
Robot
();
robot
.
setAutoDelay
(
100
);
}
private
static
void
closeInternalFrame
()
throws
PropertyVetoException
{
robot
.
keyPress
(
KeyEvent
.
VK_CONTROL
);
robot
.
keyPress
(
KeyEvent
.
VK_F4
);
robot
.
keyRelease
(
KeyEvent
.
VK_F4
);
robot
.
keyRelease
(
KeyEvent
.
VK_CONTROL
);
}
private
static
void
initUI
()
{
JFrame
frame
=
new
JFrame
(
"Internal Frame Test"
);
frame
.
getContentPane
().
setLayout
(
new
BorderLayout
());
JDesktopPane
desktopPane
=
new
JDesktopPane
();
desktopPane
.
setDesktopManager
(
new
DefaultDesktopManager
());
frame
.
getContentPane
().
add
(
desktopPane
,
BorderLayout
.
CENTER
);
CustomInternalFrame
iFrame
=
new
CustomInternalFrame
(
"Dummy Frame"
);
iFrame
.
setSize
(
200
,
200
);
iFrame
.
setDefaultCloseOperation
(
WindowConstants
.
DISPOSE_ON_CLOSE
);
desktopPane
.
add
(
iFrame
);
frame
.
setSize
(
800
,
600
);
frame
.
setDefaultCloseOperation
(
WindowConstants
.
DISPOSE_ON_CLOSE
);
frame
.
setVisible
(
true
);
iFrame
.
setVisible
(
true
);
}
private
static
void
invokeGC
()
{
System
.
out
.
println
(
"Firing garbage collection!"
);
try
{
StringBuilder
sb
=
new
StringBuilder
();
while
(
true
)
{
sb
.
append
(
"any string. some test. a little bit more text."
+
sb
.
toString
());
}
}
catch
(
Throwable
e
)
{
// do nothing
}
}
public
static
class
CustomInternalFrame
extends
JInternalFrame
{
public
static
volatile
boolean
finalized
=
false
;
public
static
Object
waiter
=
new
Object
();
public
CustomInternalFrame
(
String
title
)
{
super
(
title
,
true
,
true
,
true
,
true
);
}
protected
void
finalize
()
{
System
.
out
.
println
(
"Finalized!"
);
finalized
=
true
;
waiter
.
notifyAll
();
}
}
}
\ No newline at end of file
test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java
浏览文件 @
2ff3b4e4
/*
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
2013,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -35,43 +35,72 @@ import java.awt.event.*;
...
@@ -35,43 +35,72 @@ import java.awt.event.*;
import
javax.swing.*
;
import
javax.swing.*
;
public
class
ActionListenerCalledTwiceTest
{
public
class
ActionListenerCalledTwiceTest
{
static
String
menuItems
[]
=
{
"Item1"
,
"Item2"
};
static
KeyStroke
keyStrokes
[]
=
{
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_E
,
InputEvent
.
META_MASK
),
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_DELETE
,
0
)
};
static
volatile
int
listenerCallCounter
=
0
;
static
volatile
int
listenerCallCounter
=
0
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
sun
.
awt
.
OSInfo
.
getOSType
()
!=
sun
.
awt
.
OSInfo
.
OSType
.
MACOSX
)
{
if
(
sun
.
awt
.
OSInfo
.
getOSType
()
!=
sun
.
awt
.
OSInfo
.
OSType
.
MACOSX
)
{
System
.
out
.
println
(
"This test is for MacOS only. Automatically passed on other platforms."
);
System
.
out
.
println
(
"This test is for MacOS only. Automatically passed on other platforms."
);
return
;
return
;
}
}
System
.
setProperty
(
"apple.laf.useScreenMenuBar"
,
"true"
);
System
.
setProperty
(
"apple.laf.useScreenMenuBar"
,
"true"
);
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
createAndShowGUI
();
createAndShowGUI
();
}
}
});
});
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
Robot
robot
=
new
Robot
();
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
100
);
robot
.
setAutoDelay
(
100
);
robot
.
keyPress
(
KeyEvent
.
VK_META
);
robot
.
keyPress
(
KeyEvent
.
VK_E
);
for
(
int
i
=
0
;
i
<
menuItems
.
length
;
++
i
)
{
robot
.
keyRelease
(
KeyEvent
.
VK_E
);
KeyStroke
ks
=
keyStrokes
[
i
];
robot
.
keyRelease
(
KeyEvent
.
VK_META
);
int
modKeyCode
=
getModKeyCode
(
ks
.
getModifiers
());
toolkit
.
realSync
();
if
(
listenerCallCounter
!=
1
)
{
if
(
modKeyCode
!=
0
)
{
throw
new
Exception
(
"Test failed: ActionListener called "
+
listenerCallCounter
+
" times instead of 1!"
);
robot
.
keyPress
(
modKeyCode
);
}
robot
.
keyPress
(
ks
.
getKeyCode
());
robot
.
keyRelease
(
ks
.
getKeyCode
());
if
(
modKeyCode
!=
0
)
{
robot
.
keyRelease
(
modKeyCode
);
}
toolkit
.
realSync
();
if
(
listenerCallCounter
!=
1
)
{
throw
new
Exception
(
"Test failed: ActionListener for "
+
menuItems
[
i
]
+
" called "
+
listenerCallCounter
+
" times instead of 1!"
);
}
listenerCallCounter
=
0
;
}
}
}
}
private
static
void
createAndShowGUI
()
{
private
static
void
createAndShowGUI
()
{
JMenuItem
newItem
=
new
JMenuItem
(
"Exit"
);
newItem
.
setAccelerator
(
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_E
,
InputEvent
.
META_MASK
));
newItem
.
addActionListener
(
new
ActionListener
(){
public
void
actionPerformed
(
ActionEvent
e
)
{
listenerCallCounter
++;
}
}
);
JMenu
menu
=
new
JMenu
(
"Menu"
);
JMenu
menu
=
new
JMenu
(
"Menu"
);
menu
.
add
(
newItem
);
for
(
int
i
=
0
;
i
<
menuItems
.
length
;
++
i
)
{
JMenuItem
newItem
=
new
JMenuItem
(
menuItems
[
i
]);
newItem
.
setAccelerator
(
keyStrokes
[
i
]);
newItem
.
addActionListener
(
new
ActionListener
(){
public
void
actionPerformed
(
ActionEvent
e
)
{
listenerCallCounter
++;
}
}
);
menu
.
add
(
newItem
);
}
JMenuBar
bar
=
new
JMenuBar
();
JMenuBar
bar
=
new
JMenuBar
();
bar
.
add
(
menu
);
bar
.
add
(
menu
);
JFrame
frame
=
new
JFrame
(
"Test"
);
JFrame
frame
=
new
JFrame
(
"Test"
);
...
@@ -80,4 +109,24 @@ public class ActionListenerCalledTwiceTest {
...
@@ -80,4 +109,24 @@ public class ActionListenerCalledTwiceTest {
frame
.
pack
();
frame
.
pack
();
frame
.
setVisible
(
true
);
frame
.
setVisible
(
true
);
}
}
private
static
int
getModKeyCode
(
int
mod
)
{
if
((
mod
&
(
InputEvent
.
SHIFT_DOWN_MASK
|
InputEvent
.
SHIFT_MASK
))
!=
0
)
{
return
KeyEvent
.
VK_SHIFT
;
}
if
((
mod
&
(
InputEvent
.
CTRL_DOWN_MASK
|
InputEvent
.
CTRL_MASK
))
!=
0
)
{
return
KeyEvent
.
VK_CONTROL
;
}
if
((
mod
&
(
InputEvent
.
ALT_DOWN_MASK
|
InputEvent
.
ALT_MASK
))
!=
0
)
{
return
KeyEvent
.
VK_ALT
;
}
if
((
mod
&
(
InputEvent
.
META_DOWN_MASK
|
InputEvent
.
META_MASK
))
!=
0
)
{
return
KeyEvent
.
VK_META
;
}
return
0
;
}
}
}
test/sun/security/provider/certpath/X509CertPath/ForwardBuildCompromised.java
已删除
100644 → 0
浏览文件 @
9a61dcd4
/*
* Copyright (c) 2012, 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 7123519
* @summary Problem with java/classes_security
*/
import
java.net.*
;
import
java.util.*
;
import
java.io.*
;
import
javax.net.ssl.*
;
import
java.security.KeyStore
;
import
java.security.cert.*
;
import
java.security.spec.*
;
import
java.security.interfaces.*
;
public
class
ForwardBuildCompromised
{
// DigiNotar Root CA, untrusted root certificate
static
String
trustedCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n"
+
"VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n"
+
"ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n"
+
"KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n"
+
"ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1\n"
+
"MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE\n"
+
"ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j\n"
+
"b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF\n"
+
"bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg\n"
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B7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n"
+
"ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n"
+
"ZFdYf+hthc3m6IcJ\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Root CA, compromised certificate
static
String
compromisedCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n"
+
"Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n"
+
"HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES\n"
+
"MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg\n"
+
"MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB\n"
+
"AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B\n"
+
"8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY\n"
+
"tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl\n"
+
"HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj\n"
+
"zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3AlnU\n"
+
"JgEbjt+tUwbRrhjd4rI6y9eIOI6sWym5GdOY+RgDz0iChmYLG2kPyes4iHomGgVM\n"
+
"ktck1JbyrFIto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aKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU\n"
+
"9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9\n"
+
"j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Public CA 2025, intermediate certificate
static
String
intermediateCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIGAzCCA+ugAwIBAgIQHn16Uz1FMEGWQA9xSB9FBDANBgkqhkiG9w0BAQUFADBf\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n"
+
"Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n"
+
"HhcNMDYwMjA2MTYwNzAyWhcNMjUwMzI4MTYwNzAyWjBmMQswCQYDVQQGEwJOTDES\n"
+
"MBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdpTm90YXIgUHVibGljIENB\n"
+
"IDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5vdGFyLm5sMIIBIjANBgkq\n"
+
"hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/2eu/I5fMG8lbvPph3e8zfJpZQtg/72\n"
+
"Yx29+ivtKehiF6A3n785XyoY6IT3vlCrhy1CbMOY3M0x1n4YQlv17B0XZ/DqHyBA\n"
+
"SQvnDNbkM9j4NoSy/sRtGsP6PetIFFjrhE9whZuvuSUC1PY4PruEEJp8zOCx4+wU\n"
+
"Zt9xvjy4Xra+bSia5rwccQ/R5FYTGKrYCthOy9C9ud5Fhd++rlVhgdA/78w+Cs2s\n"
+
"xS4i0MAxG75P3/e/bATJKepbydHdDjkyz9o3RW/wdPUXhzEw4EwUjYg6XJrDzMad\n"
+
"6aL9M/eaxDjgz6o48EaWRDrGptaE2uJ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9bHEh52QzqkWvIDqs42910IUy1nYNPIUG\n"
+
"yYJV/T7H8Jb6vfMZWe47iUFvtNZCi8+b542gRUwdi+ca+hGviBC9Qr4Wv1pl7CBQ\n"
+
"Hy1axTkHiQawUo/hgmoetCpftugl9yJTfvsBorUV1ZMxn9B1JLSGtWnbUsFRla7G\n"
+
"fNa0IsUkzmmha8XCzvNu0d1PDGtcQyUqmDOE1Hx4cIBeuF8ipuIXkrVCr9zAZ4ZC\n"
+
"hgz6aA1gDTW8whSRJqYEYEQ0pcMEFLyXE+Nz3O8NinO2AuxqKhjMk13203xA7lPY\n"
+
"MnBQ0v7S3qqbp/pvPMiUhOz/VaYted6QmOY5EATBnFiLCuw87JXoAyp382eJ3WX1\n"
+
"hOiR4IX9Tg==\n"
+
"-----END CERTIFICATE-----"
;
// The fraudulent certificate issued by above compromised CA
static
String
targetCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdp\n"
+
"Tm90YXIgUHVibGljIENBIDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5v\n"
+
"dGFyLm5sMB4XDTExMDcxMDE5MDYzMFoXDTEzMDcwOTE5MDYzMFowajELMAkGA1UE\n"
+
"BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxFjAUBgNVBAcTDU1vdW50YWluIFZp\n"
+
"ZXcxFzAVBgNVBAUTDlBLMDAwMjI5MjAwMDAyMRUwEwYDVQQDEwwqLmdvb2dsZS5j\n"
+
"b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNbeKubCV0aCxhOiOS\n"
+
"CSQ/w9HXTYuD5BLKuiqXNw3setdTymeJz2L8aWOHo3nicFNDVwWTgwWomGNr2J6Q\n"
+
"7g1i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\n"
+
"UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB\n"
+
"pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM\n"
+
"FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum\n"
+
"U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK\n"
+
"baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg==\n"
+
"-----END CERTIFICATE-----"
;
public
static
void
main
(
String
args
[])
throws
Exception
{
Exception
reservedException
=
null
;
try
{
build
();
}
catch
(
CertPathBuilderException
cpbe
)
{
reservedException
=
cpbe
;
}
if
(
reservedException
==
null
)
{
throw
new
Exception
(
"Unable to block fraudulent certificate"
);
}
System
.
out
.
println
(
"The expected untrusted cert exception: "
+
reservedException
);
}
private
static
X509CertSelector
generateSelector
()
throws
Exception
{
// generate certificate from cert strings
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
X509Certificate
target
=
null
;
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
targetCertStr
.
getBytes
()))
{
target
=
(
X509Certificate
)
cf
.
generateCertificate
(
is
);
}
X509CertSelector
selector
=
new
X509CertSelector
();
selector
.
setCertificate
(
target
);
return
selector
;
}
private
static
CertStore
generateCertificateStore
()
throws
Exception
{
// generate certificate from cert strings
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
// generate certification path
Set
<
Certificate
>
entries
=
new
HashSet
();
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
targetCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
intermediateCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
compromisedCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
untrustedCrossCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
return
CertStore
.
getInstance
(
"Collection"
,
new
CollectionCertStoreParameters
(
entries
));
}
private
static
Set
<
TrustAnchor
>
generateTrustAnchors
()
throws
CertificateException
,
IOException
{
// generate certificate from cert string
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
Certificate
trustedCert
=
null
;
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
trustedCertStr
.
getBytes
()))
{
trustedCert
=
cf
.
generateCertificate
(
is
);
}
// generate a trust anchor
TrustAnchor
anchor
=
new
TrustAnchor
((
X509Certificate
)
trustedCert
,
null
);
return
Collections
.
singleton
(
anchor
);
}
private
static
void
build
()
throws
Exception
{
X509CertSelector
selector
=
generateSelector
();
Set
<
TrustAnchor
>
anchors
=
generateTrustAnchors
();
CertStore
certs
=
generateCertificateStore
();
PKIXBuilderParameters
params
=
new
PKIXBuilderParameters
(
anchors
,
selector
);
params
.
addCertStore
(
certs
);
params
.
setRevocationEnabled
(
false
);
params
.
setDate
(
new
Date
(
111
,
11
,
25
));
// 2011-12-25
CertPathBuilder
builder
=
CertPathBuilder
.
getInstance
(
"PKIX"
);
PKIXCertPathBuilderResult
result
=
(
PKIXCertPathBuilderResult
)
builder
.
build
(
params
);
}
}
test/sun/security/provider/certpath/X509CertPath/ReverseBuildCompromised.java
已删除
100644 → 0
浏览文件 @
9a61dcd4
/*
* Copyright (c) 2012, 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 7123519
* @summary Problem with java/classes_security
*/
import
java.net.*
;
import
java.util.*
;
import
java.io.*
;
import
javax.net.ssl.*
;
import
java.security.KeyStore
;
import
java.security.cert.*
;
import
java.security.spec.*
;
import
java.security.interfaces.*
;
import
sun.security.provider.certpath.SunCertPathBuilderParameters
;
public
class
ReverseBuildCompromised
{
// DigiNotar Root CA, untrusted root certificate
static
String
trustedCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n"
+
"VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n"
+
"ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n"
+
"KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n"
+
"ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1\n"
+
"MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE\n"
+
"ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j\n"
+
"b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExw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qGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh\n"
+
"xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n"
+
"ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n"
+
"ZFdYf+hthc3m6IcJ\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Root CA, compromised certificate
static
String
compromisedCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n"
+
"Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n"
+
"HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES\n"
+
"MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg\n"
+
"MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB\n"
+
"AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B\n"
+
"8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY\n"
+
"tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl\n"
+
"HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj\n"
+
"zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3Aln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nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE\n"
+
"O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU\n"
+
"9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9\n"
+
"j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Public CA 2025, intermediate certificate
static
String
intermediateCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIGAzCCA+ugAwIBAgIQHn16Uz1FMEGWQA9xSB9FBDANBgkqhkiG9w0BAQUFADBf\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n"
+
"Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n"
+
"HhcNMDYwMjA2MTYwNzAyWhcNMjUwMzI4MTYwNzAyWjBmMQswCQYDVQQGEwJOTDES\n"
+
"MBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdpTm90YXIgUHVibGljIENB\n"
+
"IDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5vdGFyLm5sMIIBIjANBgkq\n"
+
"hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/2eu/I5fMG8lbvPph3e8zfJpZQtg/72\n"
+
"Yx29+ivtKehiF6A3n785XyoY6IT3vlCrhy1CbMOY3M0x1n4YQlv17B0XZ/DqHyBA\n"
+
"SQvnDNbkM9j4NoSy/sRtGsP6PetIFFjrhE9whZuvuSUC1PY4PruEEJp8zOCx4+wU\n"
+
"Zt9xvjy4Xra+bSia5rwccQ/R5FYTGKrYCthOy9C9ud5Fhd++rlVhgdA/78w+Cs2s\n"
+
"xS4i0MAxG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SOqlbPRPexBuNghlc7PfcPIyFis2LJXDRMWiAd3TcfdALwRsuKMR/T+cwyr\n"
+
"asy69OEGHplLT57otQ524BDctDXNzlH9bHEh52QzqkWvIDqs42910IUy1nYNPIUG\n"
+
"yYJV/T7H8Jb6vfMZWe47iUFvtNZCi8+b542gRUwdi+ca+hGviBC9Qr4Wv1pl7CBQ\n"
+
"Hy1axTkHiQawUo/hgmoetCpftugl9yJTfvsBorUV1ZMxn9B1JLSGtWnbUsFRla7G\n"
+
"fNa0IsUkzmmha8XCzvNu0d1PDGtcQyUqmDOE1Hx4cIBeuF8ipuIXkrVCr9zAZ4ZC\n"
+
"hgz6aA1gDTW8whSRJqYEYEQ0pcMEFLyXE+Nz3O8NinO2AuxqKhjMk13203xA7lPY\n"
+
"MnBQ0v7S3qqbp/pvPMiUhOz/VaYted6QmOY5EATBnFiLCuw87JXoAyp382eJ3WX1\n"
+
"hOiR4IX9Tg==\n"
+
"-----END CERTIFICATE-----"
;
// The fraudulent certificate issued by above compromised CA
static
String
targetCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdp\n"
+
"Tm90YXIgUHVibGljIENBIDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5v\n"
+
"dGFyLm5sMB4XDTExMDcxMDE5MDYzMFoXDTEzMDcwOTE5MDYzMFowajELMAkGA1UE\n"
+
"BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxFjAUBgNVBAcTDU1vdW50YWluIFZp\n"
+
"ZXcxFzAVBgNVBAUTDlBLMDAwMjI5MjAwMDAyMRUwEwYDVQQDEwwqLmdvb2dsZS5j\n"
+
"b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNbeKubCV0a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N6eF/7TANBgkqhkiG\n"
+
"9w0BAQUFAAOCAQEAAs5dL7N9wzRJkI4Aq4lC5t8j5ZadqnqUcgYLADzSv4ExytNH\n"
+
"UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB\n"
+
"pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM\n"
+
"FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum\n"
+
"U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK\n"
+
"baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg==\n"
+
"-----END CERTIFICATE-----"
;
public
static
void
main
(
String
args
[])
throws
Exception
{
Exception
reservedException
=
null
;
try
{
build
();
}
catch
(
CertPathBuilderException
cpbe
)
{
reservedException
=
cpbe
;
}
if
(
reservedException
==
null
)
{
throw
new
Exception
(
"Unable to block fraudulent certificate"
);
}
System
.
out
.
println
(
"The expected untrusted cert exception: "
+
reservedException
);
}
private
static
X509CertSelector
generateSelector
()
throws
Exception
{
// generate certificate from cert strings
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
X509Certificate
target
=
null
;
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
targetCertStr
.
getBytes
()))
{
target
=
(
X509Certificate
)
cf
.
generateCertificate
(
is
);
}
X509CertSelector
selector
=
new
X509CertSelector
();
selector
.
setCertificate
(
target
);
selector
.
setSubject
(
target
.
getSubjectX500Principal
());
return
selector
;
}
private
static
CertStore
generateCertificateStore
()
throws
Exception
{
// generate certificate from cert strings
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
// generate certification path
Set
<
Certificate
>
entries
=
new
HashSet
();
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
targetCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
intermediateCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
compromisedCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
untrustedCrossCertStr
.
getBytes
()))
{
entries
.
add
(
cf
.
generateCertificate
(
is
));
}
return
CertStore
.
getInstance
(
"Collection"
,
new
CollectionCertStoreParameters
(
entries
));
}
private
static
Set
<
TrustAnchor
>
generateTrustAnchors
()
throws
CertificateException
,
IOException
{
// generate certificate from cert string
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
Certificate
trustedCert
=
null
;
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
trustedCertStr
.
getBytes
()))
{
trustedCert
=
cf
.
generateCertificate
(
is
);
}
// generate a trust anchor
TrustAnchor
anchor
=
new
TrustAnchor
((
X509Certificate
)
trustedCert
,
null
);
return
Collections
.
singleton
(
anchor
);
}
private
static
void
build
()
throws
Exception
{
X509CertSelector
selector
=
generateSelector
();
Set
<
TrustAnchor
>
anchors
=
generateTrustAnchors
();
CertStore
certs
=
generateCertificateStore
();
SunCertPathBuilderParameters
params
=
new
SunCertPathBuilderParameters
(
anchors
,
selector
);
params
.
setBuildForward
(
false
);
params
.
addCertStore
(
certs
);
params
.
setRevocationEnabled
(
false
);
params
.
setDate
(
new
Date
(
111
,
11
,
25
));
// 2011-12-25
CertPathBuilder
builder
=
CertPathBuilder
.
getInstance
(
"PKIX"
);
PKIXCertPathBuilderResult
result
=
(
PKIXCertPathBuilderResult
)
builder
.
build
(
params
);
}
}
test/sun/security/provider/certpath/X509CertPath/ValidateCompromised.java
已删除
100644 → 0
浏览文件 @
9a61dcd4
/*
* Copyright (c) 2012, 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 7123519
* @summary Problem with java/classes_security
*/
import
java.net.*
;
import
java.util.*
;
import
java.io.*
;
import
javax.net.ssl.*
;
import
java.security.KeyStore
;
import
java.security.cert.*
;
import
java.security.spec.*
;
import
java.security.interfaces.*
;
public
class
ValidateCompromised
{
// DigiNotar Root CA, untrusted root certificate
static
String
trustedCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n"
+
"VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n"
+
"ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n"
+
"KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n"
+
"ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1\n"
+
"MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE\n"
+
"ChMLRW50cnVzdC5uZX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UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa\n"
+
"MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI\n"
+
"hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN\n"
+
"95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd\n"
+
"2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Root CA, untrusted cross-certificate
static
String
untrustedCrossCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC\n"
+
"VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u\n"
+
"ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc\n"
+
"KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u\n"
+
"ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3\n"
+
"MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK\n"
+
"EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI\n"
+
"hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP\n"
+
"ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt\n"
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GMB8G\n"
+
"A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob\n"
+
"BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh\n"
+
"xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd\n"
+
"ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP\n"
+
"ZFdYf+hthc3m6IcJ\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Root CA, compromised certificate
static
String
compromisedCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n"
+
"Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n"
+
"HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES\n"
+
"MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg\n"
+
"MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB\n"
+
"AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B\n"
+
"8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY\n"
+
"tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl\n"
+
"HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8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XHAd3ODy63MUkZoDweoAZbwH\n"
+
"/M8SESIsrqC9OuCiKthZ6SnTGDWkrBFfGbW1G/8iSlzGeuQX7yCpp/Q/rYqnmgQl\n"
+
"nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE\n"
+
"O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU\n"
+
"9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9\n"
+
"j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr\n"
+
"-----END CERTIFICATE-----"
;
// DigiNotar Public CA 2025, intermediate certificate
static
String
intermediateCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIGAzCCA+ugAwIBAgIQHn16Uz1FMEGWQA9xSB9FBDANBgkqhkiG9w0BAQUFADBf\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp\n"
+
"Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww\n"
+
"HhcNMDYwMjA2MTYwNzAyWhcNMjUwMzI4MTYwNzAyWjBmMQswCQYDVQQGEwJOTDES\n"
+
"MBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdpTm90YXIgUHVibGljIENB\n"
+
"IDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5vdGFyLm5sMIIBIjANBgkq\n"
+
"hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/2eu/I5fMG8lbvPph3e8zfJpZQtg/72\n"
+
"Yx29+ivtKehiF6A3n785XyoY6IT3vlCrhy1CbMOY3M0x1n4YQlv17B0XZ/DqHyBA\n"
+
"SQvnDNbkM9j4NoSy/sRtGsP6PetIFFjrhE9whZuvuSUC1PY4P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ccHwM+/TiurR9lgZDzB4\n"
+
"a7++A4XrYyKx9vc9ZwBEnD1nrAe7++gg9cuZgP7e+QL0FBHMjpw+gnCDjr2dzBZC\n"
+
"4r+b8SOqlbPRPexBuNghlc7PfcPIyFis2LJXDRMWiAd3TcfdALwRsuKMR/T+cwyr\n"
+
"asy69OEGHplLT57otQ524BDctDXNzlH9bHEh52QzqkWvIDqs42910IUy1nYNPIUG\n"
+
"yYJV/T7H8Jb6vfMZWe47iUFvtNZCi8+b542gRUwdi+ca+hGviBC9Qr4Wv1pl7CBQ\n"
+
"Hy1axTkHiQawUo/hgmoetCpftugl9yJTfvsBorUV1ZMxn9B1JLSGtWnbUsFRla7G\n"
+
"fNa0IsUkzmmha8XCzvNu0d1PDGtcQyUqmDOE1Hx4cIBeuF8ipuIXkrVCr9zAZ4ZC\n"
+
"hgz6aA1gDTW8whSRJqYEYEQ0pcMEFLyXE+Nz3O8NinO2AuxqKhjMk13203xA7lPY\n"
+
"MnBQ0v7S3qqbp/pvPMiUhOz/VaYted6QmOY5EATBnFiLCuw87JXoAyp382eJ3WX1\n"
+
"hOiR4IX9Tg==\n"
+
"-----END CERTIFICATE-----"
;
// The fraudulent certificate issued by above compromised CA
static
String
targetCertStr
=
"-----BEGIN CERTIFICATE-----\n"
+
"MIIFKDCCBBCgAwIBAgIQBeLmpM0J6lTWZbB1/iKiVjANBgkqhkiG9w0BAQUFADBm\n"
+
"MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMSEwHwYDVQQDExhEaWdp\n"
+
"Tm90YXIgUHVibGljIENBIDIwMjUxIDAeBgkqhkiG9w0BCQEWEWluZm9AZGlnaW5v\n"
+
"dGFyLm5sMB4XDTExMDcxMDE5MDYzMFoXDTEzMDcwOTE5MDYzMFowajELMAkGA1UE\n"
+
"BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxFjAUBgNVBAcTDU1vdW50YWluIFZp\n"
+
"ZXcxFzAVBgNVBAUTDlBLMDAw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JsMA4GA1UdDwEB/wQEAwIEsDAbBgNVHREEFDASgRBhZG1pbkBn\n"
+
"b29nbGUuY29tMB0GA1UdDgQWBBQHSn0WJzIo0eMBMQUNsMqN6eF/7TANBgkqhkiG\n"
+
"9w0BAQUFAAOCAQEAAs5dL7N9wzRJkI4Aq4lC5t8j5ZadqnqUcgYLADzSv4ExytNH\n"
+
"UY2nH6iVTihC0UPSsILWraoeApdT7Rphz/8DLQEBRGdeKWAptNM3EbiXtQaZT2uB\n"
+
"pidL8UoafX0kch3f71Y1scpBEjvu5ZZLnjg0A8AL0tnsereOVdDpU98bKqdbbrnM\n"
+
"FRmBlSf7xdaNca6JJHeEpga4E9Ty683CmccrSGXdU2tTCuHEJww+iOAUtPIZcsum\n"
+
"U7/eYeY1pMyGLyIjbNgRY7nDzRwvM/BsbL9eh4/mSQj/4nncqJd22sVQpCggQiVK\n"
+
"baB2sVGcVNBkK55bT8gPqnx8JypubyUvayzZGg==\n"
+
"-----END CERTIFICATE-----"
;
public
static
void
main
(
String
args
[])
throws
Exception
{
Exception
reservedException
=
null
;
try
{
validate
();
}
catch
(
CertPathValidatorException
cpve
)
{
reservedException
=
cpve
;
}
if
(
reservedException
==
null
)
{
throw
new
Exception
(
"Unable to block fraudulent certificate"
);
}
System
.
out
.
println
(
"The expected untrusted cert exception: "
+
reservedException
);
}
private
static
CertPath
generateCertificatePath
()
throws
CertificateException
,
IOException
{
// generate certificate from cert strings
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
// generate certification path
List
<
Certificate
>
list
=
new
ArrayList
();
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
targetCertStr
.
getBytes
()))
{
list
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
intermediateCertStr
.
getBytes
()))
{
list
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
compromisedCertStr
.
getBytes
()))
{
list
.
add
(
cf
.
generateCertificate
(
is
));
}
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
untrustedCrossCertStr
.
getBytes
()))
{
list
.
add
(
cf
.
generateCertificate
(
is
));
}
return
cf
.
generateCertPath
(
list
);
}
private
static
Set
<
TrustAnchor
>
generateTrustAnchors
()
throws
CertificateException
,
IOException
{
// generate certificate from cert string
CertificateFactory
cf
=
CertificateFactory
.
getInstance
(
"X.509"
);
Certificate
trustedCert
=
null
;
try
(
ByteArrayInputStream
is
=
new
ByteArrayInputStream
(
trustedCertStr
.
getBytes
()))
{
trustedCert
=
cf
.
generateCertificate
(
is
);
}
// generate a trust anchor
TrustAnchor
anchor
=
new
TrustAnchor
((
X509Certificate
)
trustedCert
,
null
);
return
Collections
.
singleton
(
anchor
);
}
private
static
void
validate
()
throws
CertPathValidatorException
,
Exception
{
CertPath
path
=
generateCertificatePath
();
Set
<
TrustAnchor
>
anchors
=
generateTrustAnchors
();
PKIXParameters
params
=
new
PKIXParameters
(
anchors
);
// disable certificate revocation checking
params
.
setRevocationEnabled
(
false
);
// set the validation time
params
.
setDate
(
new
Date
(
111
,
11
,
25
));
// 2011-12-25
CertPathValidator
validator
=
CertPathValidator
.
getInstance
(
"PKIX"
);
validator
.
validate
(
path
,
params
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录