Merge
This commit is contained in:
commit
9e2e7197f6
1
.hgtags
1
.hgtags
@ -28,3 +28,4 @@ caf58ffa084568990cbb3441f9ae188e36b31770 jdk7-b42
|
||||
a25c5ec5e40e07733d1ff9898a0abe36159288ff jdk7-b51
|
||||
7a90e89e36d103038f8667f6a7daae34ecfa1ad8 jdk7-b52
|
||||
d52186ee770dac57950536cd00ccbfdef360b04c jdk7-b53
|
||||
15096652c4d48dfb9fc0b2cb135304db94c65ba0 jdk7-b54
|
||||
|
@ -28,3 +28,4 @@ aee93a8992d2389121eb610c00a86196f3e2b9b0 jdk7-b49
|
||||
0f0189d55ce4a1f7840da7582ac7d970b3b7ab15 jdk7-b51
|
||||
4264c2fe66493e57c411045a1b61377796641e45 jdk7-b52
|
||||
c235f4a8559d196879c56af80159f67ee5d0e720 jdk7-b53
|
||||
2ef382b1bbd58a68e668391c6145a4b2066c5b96 jdk7-b54
|
||||
|
@ -28,3 +28,4 @@ d70978bc64bc7a04be7797ab0dcd9b7b1b3a6bff jdk7-b49
|
||||
3eb8f1047a7402a9a79937d1c39560e931e91da2 jdk7-b51
|
||||
bec82237d694f9802b820fa11bbb4f7fa9bf8e77 jdk7-b52
|
||||
3c4d73194f6f89f040ae3b2d257335dfa8a1b2b5 jdk7-b53
|
||||
8130ac858d6789d5853d23044ba4a992afda574a jdk7-b54
|
||||
|
@ -28,3 +28,5 @@ dae503d9f04c1a11e182dbf7f770509c28dc0609 jdk7-b50
|
||||
2581d90c6c9b2012da930eb4742add94a03069a0 jdk7-b51
|
||||
1b1e8f1a4fe8cebc01c022484f78148e17b62a0d jdk7-b52
|
||||
032c6af894dae8d939b3dd31d82042549e7793e0 jdk7-b53
|
||||
fafab5d5349c7c066d677538db67a1ee0fb33bd2 jdk7-b54
|
||||
f8e839c086152da70d6ec5913ba6f9f509282e8d jdk7-b55
|
||||
|
@ -28,3 +28,4 @@ e8514e2be76d90889ebdb90d627aca2db5c150c6 jdk7-b50
|
||||
ae890d80d5dffcd4dc77a1f17d768e192d1852c7 jdk7-b51
|
||||
69ad87dc25cbcaaaded4727199395ad0c78bc427 jdk7-b52
|
||||
e8837366d3fd72f7c7a47ebfdbd5106c16156f12 jdk7-b53
|
||||
946a9f0c493261fa6a010dc33e61b9b535ba80c1 jdk7-b54
|
||||
|
@ -28,3 +28,4 @@ af4a3eeb7812a5d09a241c50b51b3c648a9d45c1 jdk7-b46
|
||||
41a66a42791ba90bff489af72cbfea71be9b40a5 jdk7-b51
|
||||
e646890d18b770f625f14ed4ad5c50554d8d3d8b jdk7-b52
|
||||
b250218eb2e534384667ec73e3713e684667fd4c jdk7-b53
|
||||
50ea00dc5f143fe00025233e704903c37f8464aa jdk7-b54
|
||||
|
@ -28,3 +28,4 @@ b4ac413b1f129eeef0acab3f31081c1b7dfe3b27 jdk7-b47
|
||||
fea0898259ae41c73620b1815aa48f036216155c jdk7-b51
|
||||
bcbeadb4a5d759b29e876ee2c83401e91ff22f60 jdk7-b52
|
||||
a2033addca678f9e4c0d92ffa1e389171cc9321d jdk7-b53
|
||||
d1c43d1f5676a24ba86221ac7cad5694f3a9afda jdk7-b54
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -135,7 +135,8 @@ SUNWprivate_1.1 {
|
||||
Java_java_lang_ClassLoader_00024NativeLibrary_find;
|
||||
Java_java_lang_ClassLoader_00024NativeLibrary_load;
|
||||
Java_java_lang_ClassLoader_00024NativeLibrary_unload;
|
||||
Java_java_lang_ClassLoader_registerNatives;
|
||||
Java_java_lang_ClassLoader_getCaller;
|
||||
Java_java_lang_ClassLoader_registerNatives;
|
||||
Java_java_lang_Compiler_registerNatives;
|
||||
Java_java_lang_Double_longBitsToDouble;
|
||||
Java_java_lang_Double_doubleToRawLongBits;
|
||||
|
@ -39,6 +39,10 @@ FILES_c = \
|
||||
ResolverConfigurationImpl.c \
|
||||
DefaultProxySelector.c
|
||||
|
||||
ifeq ($(PLATFORM), solaris)
|
||||
FILES_c += SdpProvider.c
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), linux)
|
||||
FILES_c += linux_close.c
|
||||
endif
|
||||
|
@ -108,11 +108,24 @@ CLASSES.export += java.lang.Integer java.io.FileDescriptor java.net.InetAddressI
|
||||
#
|
||||
LOCALE_SET_DEFINITION = jre
|
||||
|
||||
properties: $(LIBDIR) $(LIBDIR)/net.properties
|
||||
MISC_FILES = $(LIBDIR) $(LIBDIR)/net.properties
|
||||
|
||||
$(LIBDIR)/net.properties: $(SHARE_SRC)/lib/net.properties
|
||||
@$(RM) $@
|
||||
$(CP) $< $@
|
||||
|
||||
build: properties
|
||||
#
|
||||
# SDP configuration template
|
||||
#
|
||||
ifeq ($(PLATFORM), solaris)
|
||||
SDP_PATH = sdp/sdp.conf.template
|
||||
SDP_CONF = $(LIBDIR)/$(SDP_PATH)
|
||||
$(SDP_CONF): $(PLATFORM_SRC)/lib/$(SDP_PATH)
|
||||
@$(RM) $*
|
||||
$(install-file)
|
||||
|
||||
MISC_FILES += $(SDP_CONF)
|
||||
endif
|
||||
|
||||
build: $(MISC_FILES)
|
||||
|
||||
|
@ -90,6 +90,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_net_dns_ResolverConfigurationImpl_fallbackDomain0;
|
||||
Java_sun_net_spi_DefaultProxySelector_init;
|
||||
Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
|
||||
Java_sun_net_spi_SdpProvider_convert;
|
||||
NET_AllocSockaddr;
|
||||
NET_SockaddrToInetAddress;
|
||||
NET_SockaddrEqualsInetAddress;
|
||||
|
@ -92,11 +92,11 @@ FILES_java = \
|
||||
sun/text/normalizer/SymbolTable.java \
|
||||
sun/text/normalizer/Trie.java \
|
||||
sun/text/normalizer/TrieIterator.java \
|
||||
sun/text/normalizer/UBiDiProps.java \
|
||||
sun/text/normalizer/UCharacter.java \
|
||||
sun/text/normalizer/UCharacterIterator.java \
|
||||
sun/text/normalizer/UCharacterProperty.java \
|
||||
sun/text/normalizer/UCharacterPropertyReader.java \
|
||||
sun/text/normalizer/UProperty.java \
|
||||
sun/text/normalizer/UTF16.java \
|
||||
sun/text/normalizer/UnicodeMatcher.java \
|
||||
sun/text/normalizer/UnicodeSet.java \
|
||||
|
@ -64,7 +64,8 @@ BIFILES = $(TEXT_CLASSDIR)/CharacterBreakIteratorData \
|
||||
$(TEXT_CLASSDIR)/SentenceBreakIteratorData
|
||||
|
||||
ICU_FILES = $(TEXT_CLASSDIR)/unorm.icu \
|
||||
$(TEXT_CLASSDIR)/uprops.icu
|
||||
$(TEXT_CLASSDIR)/uprops.icu \
|
||||
$(TEXT_CLASSDIR)/ubidi.icu
|
||||
|
||||
# builder
|
||||
GENERATEBREAKITERATORDATA_JARFILE = \
|
||||
@ -89,7 +90,7 @@ $(BIFILES): $(GENERATEBREAKITERATORDATA_JARFILE) \
|
||||
build: $(BIFILES) $(ICU_FILES)
|
||||
|
||||
#
|
||||
# Extra rules to copy unorm.icu and uprops.icu
|
||||
# Extra rules to copy unorm.icu, uprops.icu, and ubidi.icu
|
||||
#
|
||||
$(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu
|
||||
$(install-file)
|
||||
@ -97,6 +98,9 @@ $(TEXT_CLASSDIR)/unorm.icu: $(TEXT_SRCDIR)/unorm.icu
|
||||
$(TEXT_CLASSDIR)/uprops.icu: $(TEXT_SRCDIR)/uprops.icu
|
||||
$(install-file)
|
||||
|
||||
$(TEXT_CLASSDIR)/ubidi.icu: $(TEXT_SRCDIR)/ubidi.icu
|
||||
$(install-file)
|
||||
|
||||
clean clobber::
|
||||
$(RM) -r $(TEXT_CLASSES)
|
||||
$(RM) -r $(BIFILES)
|
||||
|
@ -71,6 +71,7 @@ STUBFILES = \
|
||||
$(STUBDIR)/Ole2.h \
|
||||
$(STUBDIR)/Zmouse.h \
|
||||
$(STUBDIR)/cderr.h \
|
||||
$(STUBDIR)/commctrl.h \
|
||||
$(STUBDIR)/commdlg.h \
|
||||
$(STUBDIR)/direct.h \
|
||||
$(STUBDIR)/d3dcom.h \
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -104,7 +104,8 @@ FILES_c = \
|
||||
OGLVertexCache.c \
|
||||
WGLGraphicsConfig.c \
|
||||
WGLSurfaceData.c \
|
||||
AccelGlyphCache.c
|
||||
AccelGlyphCache.c \
|
||||
rect.c
|
||||
|
||||
FILES_cpp = \
|
||||
CmdIDList.cpp \
|
||||
@ -199,5 +200,6 @@ FILES_cpp = \
|
||||
ShellFolder2.cpp \
|
||||
ThemeReader.cpp \
|
||||
ComCtl32Util.cpp \
|
||||
DllUtil.cpp \
|
||||
initIDs.cpp \
|
||||
MouseInfo.cpp
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -107,7 +107,8 @@ FILES_export = \
|
||||
sun/java2d/x11/X11Renderer.java \
|
||||
sun/java2d/x11/X11SurfaceData.java \
|
||||
com/sun/java/swing/plaf/gtk/GTKEngine.java \
|
||||
com/sun/java/swing/plaf/gtk/GTKStyle.java
|
||||
com/sun/java/swing/plaf/gtk/GTKStyle.java \
|
||||
sun/awt/ExtendedKeyCodes.java
|
||||
|
||||
|
||||
FILES_export2 = \
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -154,7 +154,7 @@ FILES_export2 = \
|
||||
sun/awt/datatransfer/DataTransferer.java \
|
||||
sun/awt/datatransfer/SunClipboard.java \
|
||||
sun/awt/dnd/SunDragSourceContextPeer.java \
|
||||
sun/awt/windows/WToolkitThreadBlockedHandler.java
|
||||
sun/awt/windows/WToolkitThreadBlockedHandler.java
|
||||
|
||||
FILES_export3 = \
|
||||
java/awt/CheckboxMenuItem.java \
|
||||
@ -214,6 +214,7 @@ FILES_export3 = \
|
||||
sun/awt/windows/WBufferStrategy.java \
|
||||
sun/awt/windows/WTrayIconPeer.java \
|
||||
sun/awt/image/ImagingLib.java \
|
||||
sun/awt/ExtendedKeyCodes.java \
|
||||
sun/java2d/pipe/hw/AccelSurface.java \
|
||||
sun/java2d/pipe/hw/AccelDeviceEventNotifier.java \
|
||||
sun/java2d/pipe/hw/ContextCapabilities.java \
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -219,6 +219,7 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/image/cvutils
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/shell
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/medialib
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/debug
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/utility
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/loops
|
||||
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe
|
||||
|
@ -6,11 +6,9 @@ runtime, it will probably work with other versions of that compiler.
|
||||
|
||||
Included in this project is a generated file, make.depend, which lists
|
||||
all interdependencies of the source files. This file is generated *on
|
||||
Solaris* with the following commands:
|
||||
Solaris or Linux* with the following command:
|
||||
|
||||
% sccs edit make.depend
|
||||
% gnumake -f Depend.mak
|
||||
% sccs delget make.depend
|
||||
|
||||
This step only needs to be run when new files are added to the project,
|
||||
or include statements are changed.
|
||||
|
File diff suppressed because one or more lines are too long
@ -291,6 +291,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11GraphicsConfig_createBackBuffer;
|
||||
Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
|
||||
Java_sun_awt_X11GraphicsConfig_swapBuffers;
|
||||
Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
|
||||
Java_sun_awt_X11GraphicsDevice_isDBESupported;
|
||||
Java_sun_awt_X11GraphicsDevice_getDisplay;
|
||||
Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
|
||||
|
@ -407,6 +407,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11GraphicsConfig_getNumColors;
|
||||
Java_sun_awt_X11GraphicsConfig_getXResolution;
|
||||
Java_sun_awt_X11GraphicsConfig_getYResolution;
|
||||
Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
|
||||
Java_sun_awt_X11GraphicsDevice_isDBESupported;
|
||||
Java_sun_awt_X11GraphicsDevice_getDisplay;
|
||||
Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
|
||||
|
@ -39,6 +39,7 @@ FILES_java = \
|
||||
sun/net/TransferProtocolClient.java \
|
||||
sun/net/ConnectionResetException.java \
|
||||
sun/net/NetProperties.java \
|
||||
sun/net/NetHooks.java \
|
||||
sun/net/util/IPAddressUtil.java \
|
||||
sun/net/dns/ResolverConfiguration.java \
|
||||
sun/net/dns/ResolverConfigurationImpl.java \
|
||||
@ -123,3 +124,7 @@ FILES_java = \
|
||||
ifeq ($(PLATFORM), windows)
|
||||
FILES_java += sun/net/www/protocol/http/NTLMAuthSequence.java
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), solaris)
|
||||
FILES_java += sun/net/spi/SdpProvider.java
|
||||
endif
|
||||
|
@ -78,4 +78,5 @@ FILES_c = \
|
||||
awt_Plugin.c \
|
||||
gtk2_interface.c \
|
||||
swing_GTKEngine.c \
|
||||
swing_GTKStyle.c
|
||||
swing_GTKStyle.c \
|
||||
rect.c
|
||||
|
@ -79,6 +79,7 @@ vpath %.c $(SHARE_SRC)/native/sun/java2d
|
||||
vpath %.c $(SHARE_SRC)/native/sun/java2d/loops
|
||||
vpath %.c $(SHARE_SRC)/native/sun/java2d/pipe
|
||||
vpath %.c $(SHARE_SRC)/native/sun/awt/medialib
|
||||
vpath %.c $(SHARE_SRC)/native/sun/awt/utility
|
||||
vpath %.cpp $(SHARE_SRC)/native/sun/image
|
||||
vpath %.c $(SHARE_SRC)/native/sun/font
|
||||
vpath %.c $(PLATFORM_SRC)/native/sun/awt/robot_child
|
||||
@ -274,6 +275,23 @@ ICONS = \
|
||||
$(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
|
||||
$(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
|
||||
|
||||
|
||||
ICONPATH=$(PLATFORM_SRC)/classes/sun/awt/X11
|
||||
|
||||
ICONS += \
|
||||
$(ICONPATH)/security-icon-bw16.png \
|
||||
$(ICONPATH)/security-icon-interim16.png \
|
||||
$(ICONPATH)/security-icon-yellow16.png \
|
||||
$(ICONPATH)/security-icon-bw24.png \
|
||||
$(ICONPATH)/security-icon-interim24.png \
|
||||
$(ICONPATH)/security-icon-yellow24.png \
|
||||
$(ICONPATH)/security-icon-bw32.png \
|
||||
$(ICONPATH)/security-icon-interim32.png \
|
||||
$(ICONPATH)/security-icon-yellow32.png \
|
||||
$(ICONPATH)/security-icon-bw48.png \
|
||||
$(ICONPATH)/security-icon-interim48.png \
|
||||
$(ICONPATH)/security-icon-yellow48.png
|
||||
|
||||
TEMPDIR_CLASSES = $(TEMPDIR)/classes
|
||||
|
||||
$(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class: ToBin.java
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -93,6 +93,9 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11_XlibWrapper_XGetWMHints;
|
||||
Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension;
|
||||
Java_sun_awt_X11_XlibWrapper_SetRectangularShape;
|
||||
Java_sun_awt_X11_XlibWrapper_SetBitmapShape;
|
||||
Java_sun_awt_X11_XlibWrapper_XConfigureWindow;
|
||||
Java_sun_awt_X11_XlibWrapper_SetZOrder;
|
||||
Java_sun_awt_X11_XToolkit_initIDs;
|
||||
Java_sun_awt_X11_XWindow_getNativeColor;
|
||||
Java_sun_awt_X11_XWindow_getWMInsets;
|
||||
@ -217,6 +220,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11GraphicsConfig_createBackBuffer;
|
||||
Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
|
||||
Java_sun_awt_X11GraphicsConfig_swapBuffers;
|
||||
Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
|
||||
Java_java_awt_Insets_initIDs;
|
||||
Java_java_awt_KeyboardFocusManager_initIDs;
|
||||
Java_java_awt_Font_initIDs;
|
||||
@ -289,16 +293,26 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11_XlibWrapper_XGetIconSizes;
|
||||
Java_sun_awt_X11_XlibWrapper_XKeycodeToKeysym;
|
||||
Java_sun_awt_X11_XlibWrapper_XKeysymToKeycode;
|
||||
Java_sun_awt_X11_XlibWrapper_XQueryKeymap;
|
||||
Java_sun_awt_X11_XlibWrapper_XQueryKeymap;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbGetEffectiveGroup;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbSelectEvents;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbKeycodeToKeysym;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbQueryExtension;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbGetMap;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbFreeKeyboard;
|
||||
Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode;
|
||||
Java_sun_awt_X11_XlibWrapper_XGetModifierMapping;
|
||||
Java_sun_awt_X11_XlibWrapper_XFreeModifiermap;
|
||||
Java_sun_awt_X11_XlibWrapper_XFreeModifiermap;
|
||||
Java_sun_awt_X11_XlibWrapper_XChangeActivePointerGrab;
|
||||
Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent;
|
||||
Java_sun_awt_X11_XlibWrapper_ExitSecondaryLoop;
|
||||
Java_sun_awt_X11_XlibWrapper_XTextPropertyToStringList;
|
||||
Java_sun_awt_X11_XlibWrapper_XGrabServer;
|
||||
Java_sun_awt_X11_XlibWrapper_XUngrabServer;
|
||||
Java_sun_awt_X11_XlibWrapper_XPutBackEvent;
|
||||
Java_sun_awt_X11_XlibWrapper_XPutBackEvent;
|
||||
Java_sun_awt_X11_XlibWrapper_XConvertCase;
|
||||
Java_sun_awt_X11_XlibWrapper_XSynchronize;
|
||||
Java_java_awt_FileDialog_initIDs;
|
||||
|
@ -144,6 +144,55 @@ class CharacterData00 extends CharacterData {
|
||||
case 0x1FBC : mapChar = 0x1FB3; break;
|
||||
case 0x1FCC : mapChar = 0x1FC3; break;
|
||||
case 0x1FFC : mapChar = 0x1FF3; break;
|
||||
|
||||
case 0x023A : mapChar = 0x2C65; break;
|
||||
case 0x023E : mapChar = 0x2C66; break;
|
||||
case 0x10A0 : mapChar = 0x2D00; break;
|
||||
case 0x10A1 : mapChar = 0x2D01; break;
|
||||
case 0x10A2 : mapChar = 0x2D02; break;
|
||||
case 0x10A3 : mapChar = 0x2D03; break;
|
||||
case 0x10A4 : mapChar = 0x2D04; break;
|
||||
case 0x10A5 : mapChar = 0x2D05; break;
|
||||
case 0x10A6 : mapChar = 0x2D06; break;
|
||||
case 0x10A7 : mapChar = 0x2D07; break;
|
||||
case 0x10A8 : mapChar = 0x2D08; break;
|
||||
case 0x10A9 : mapChar = 0x2D09; break;
|
||||
case 0x10AA : mapChar = 0x2D0A; break;
|
||||
case 0x10AB : mapChar = 0x2D0B; break;
|
||||
case 0x10AC : mapChar = 0x2D0C; break;
|
||||
case 0x10AD : mapChar = 0x2D0D; break;
|
||||
case 0x10AE : mapChar = 0x2D0E; break;
|
||||
case 0x10AF : mapChar = 0x2D0F; break;
|
||||
case 0x10B0 : mapChar = 0x2D10; break;
|
||||
case 0x10B1 : mapChar = 0x2D11; break;
|
||||
case 0x10B2 : mapChar = 0x2D12; break;
|
||||
case 0x10B3 : mapChar = 0x2D13; break;
|
||||
case 0x10B4 : mapChar = 0x2D14; break;
|
||||
case 0x10B5 : mapChar = 0x2D15; break;
|
||||
case 0x10B6 : mapChar = 0x2D16; break;
|
||||
case 0x10B7 : mapChar = 0x2D17; break;
|
||||
case 0x10B8 : mapChar = 0x2D18; break;
|
||||
case 0x10B9 : mapChar = 0x2D19; break;
|
||||
case 0x10BA : mapChar = 0x2D1A; break;
|
||||
case 0x10BB : mapChar = 0x2D1B; break;
|
||||
case 0x10BC : mapChar = 0x2D1C; break;
|
||||
case 0x10BD : mapChar = 0x2D1D; break;
|
||||
case 0x10BE : mapChar = 0x2D1E; break;
|
||||
case 0x10BF : mapChar = 0x2D1F; break;
|
||||
case 0x10C0 : mapChar = 0x2D20; break;
|
||||
case 0x10C1 : mapChar = 0x2D21; break;
|
||||
case 0x10C2 : mapChar = 0x2D22; break;
|
||||
case 0x10C3 : mapChar = 0x2D23; break;
|
||||
case 0x10C4 : mapChar = 0x2D24; break;
|
||||
case 0x10C5 : mapChar = 0x2D25; break;
|
||||
case 0x1E9E : mapChar = 0x00DF; break;
|
||||
case 0x2C62 : mapChar = 0x026B; break;
|
||||
case 0x2C63 : mapChar = 0x1D7D; break;
|
||||
case 0x2C64 : mapChar = 0x027D; break;
|
||||
case 0x2C6D : mapChar = 0x0251; break;
|
||||
case 0x2C6E : mapChar = 0x0271; break;
|
||||
case 0x2C6F : mapChar = 0x0250; break;
|
||||
case 0xA77D : mapChar = 0x1D79; break;
|
||||
// default mapChar is already set, so no
|
||||
// need to redo it here.
|
||||
// default : mapChar = ch;
|
||||
@ -196,6 +245,54 @@ class CharacterData00 extends CharacterData {
|
||||
case 0x1FB3 : mapChar = 0x1FBC; break;
|
||||
case 0x1FC3 : mapChar = 0x1FCC; break;
|
||||
case 0x1FF3 : mapChar = 0x1FFC; break;
|
||||
|
||||
case 0x0250 : mapChar = 0x2C6F; break;
|
||||
case 0x0251 : mapChar = 0x2C6D; break;
|
||||
case 0x026B : mapChar = 0x2C62; break;
|
||||
case 0x0271 : mapChar = 0x2C6E; break;
|
||||
case 0x027D : mapChar = 0x2C64; break;
|
||||
case 0x1D79 : mapChar = 0xA77D; break;
|
||||
case 0x1D7D : mapChar = 0x2C63; break;
|
||||
case 0x2C65 : mapChar = 0x023A; break;
|
||||
case 0x2C66 : mapChar = 0x023E; break;
|
||||
case 0x2D00 : mapChar = 0x10A0; break;
|
||||
case 0x2D01 : mapChar = 0x10A1; break;
|
||||
case 0x2D02 : mapChar = 0x10A2; break;
|
||||
case 0x2D03 : mapChar = 0x10A3; break;
|
||||
case 0x2D04 : mapChar = 0x10A4; break;
|
||||
case 0x2D05 : mapChar = 0x10A5; break;
|
||||
case 0x2D06 : mapChar = 0x10A6; break;
|
||||
case 0x2D07 : mapChar = 0x10A7; break;
|
||||
case 0x2D08 : mapChar = 0x10A8; break;
|
||||
case 0x2D09 : mapChar = 0x10A9; break;
|
||||
case 0x2D0A : mapChar = 0x10AA; break;
|
||||
case 0x2D0B : mapChar = 0x10AB; break;
|
||||
case 0x2D0C : mapChar = 0x10AC; break;
|
||||
case 0x2D0D : mapChar = 0x10AD; break;
|
||||
case 0x2D0E : mapChar = 0x10AE; break;
|
||||
case 0x2D0F : mapChar = 0x10AF; break;
|
||||
case 0x2D10 : mapChar = 0x10B0; break;
|
||||
case 0x2D11 : mapChar = 0x10B1; break;
|
||||
case 0x2D12 : mapChar = 0x10B2; break;
|
||||
case 0x2D13 : mapChar = 0x10B3; break;
|
||||
case 0x2D14 : mapChar = 0x10B4; break;
|
||||
case 0x2D15 : mapChar = 0x10B5; break;
|
||||
case 0x2D16 : mapChar = 0x10B6; break;
|
||||
case 0x2D17 : mapChar = 0x10B7; break;
|
||||
case 0x2D18 : mapChar = 0x10B8; break;
|
||||
case 0x2D19 : mapChar = 0x10B9; break;
|
||||
case 0x2D1A : mapChar = 0x10BA; break;
|
||||
case 0x2D1B : mapChar = 0x10BB; break;
|
||||
case 0x2D1C : mapChar = 0x10BC; break;
|
||||
case 0x2D1D : mapChar = 0x10BD; break;
|
||||
case 0x2D1E : mapChar = 0x10BE; break;
|
||||
case 0x2D1F : mapChar = 0x10BF; break;
|
||||
case 0x2D20 : mapChar = 0x10C0; break;
|
||||
case 0x2D21 : mapChar = 0x10C1; break;
|
||||
case 0x2D22 : mapChar = 0x10C2; break;
|
||||
case 0x2D23 : mapChar = 0x10C3; break;
|
||||
case 0x2D24 : mapChar = 0x10C4; break;
|
||||
case 0x2D25 : mapChar = 0x10C5; break;
|
||||
// ch must have a 1:M case mapping, but we
|
||||
// can't handle it here. Return ch.
|
||||
// since mapChar is already set, no need
|
||||
@ -315,6 +412,12 @@ class CharacterData00 extends CharacterData {
|
||||
case 0x32BE: retval = 49; break; // CIRCLED NUMBER FORTY NINE
|
||||
case 0x32BF: retval = 50; break; // CIRCLED NUMBER FIFTY
|
||||
|
||||
case 0x0D71: retval = 100; break; // MALAYALAM NUMBER ONE HUNDRED
|
||||
case 0x0D72: retval = 1000; break; // MALAYALAM NUMBER ONE THOUSAND
|
||||
case 0x2186: retval = 50; break; // ROMAN NUMERAL FIFTY EARLY FORM
|
||||
case 0x2187: retval = 50000; break; // ROMAN NUMERAL FIFTY THOUSAND
|
||||
case 0x2188: retval = 100000; break; // ROMAN NUMERAL ONE HUNDRED THOUSAND
|
||||
|
||||
default: retval = -2; break;
|
||||
}
|
||||
break;
|
||||
@ -383,6 +486,54 @@ class CharacterData00 extends CharacterData {
|
||||
case 0x00B5 : mapChar = 0x039C; break;
|
||||
case 0x017F : mapChar = 0x0053; break;
|
||||
case 0x1FBE : mapChar = 0x0399; break;
|
||||
|
||||
case 0x0250 : mapChar = 0x2C6F; break;
|
||||
case 0x0251 : mapChar = 0x2C6D; break;
|
||||
case 0x026B : mapChar = 0x2C62; break;
|
||||
case 0x0271 : mapChar = 0x2C6E; break;
|
||||
case 0x027D : mapChar = 0x2C64; break;
|
||||
case 0x1D79 : mapChar = 0xA77D; break;
|
||||
case 0x1D7D : mapChar = 0x2C63; break;
|
||||
case 0x2C65 : mapChar = 0x023A; break;
|
||||
case 0x2C66 : mapChar = 0x023E; break;
|
||||
case 0x2D00 : mapChar = 0x10A0; break;
|
||||
case 0x2D01 : mapChar = 0x10A1; break;
|
||||
case 0x2D02 : mapChar = 0x10A2; break;
|
||||
case 0x2D03 : mapChar = 0x10A3; break;
|
||||
case 0x2D04 : mapChar = 0x10A4; break;
|
||||
case 0x2D05 : mapChar = 0x10A5; break;
|
||||
case 0x2D06 : mapChar = 0x10A6; break;
|
||||
case 0x2D07 : mapChar = 0x10A7; break;
|
||||
case 0x2D08 : mapChar = 0x10A8; break;
|
||||
case 0x2D09 : mapChar = 0x10A9; break;
|
||||
case 0x2D0A : mapChar = 0x10AA; break;
|
||||
case 0x2D0B : mapChar = 0x10AB; break;
|
||||
case 0x2D0C : mapChar = 0x10AC; break;
|
||||
case 0x2D0D : mapChar = 0x10AD; break;
|
||||
case 0x2D0E : mapChar = 0x10AE; break;
|
||||
case 0x2D0F : mapChar = 0x10AF; break;
|
||||
case 0x2D10 : mapChar = 0x10B0; break;
|
||||
case 0x2D11 : mapChar = 0x10B1; break;
|
||||
case 0x2D12 : mapChar = 0x10B2; break;
|
||||
case 0x2D13 : mapChar = 0x10B3; break;
|
||||
case 0x2D14 : mapChar = 0x10B4; break;
|
||||
case 0x2D15 : mapChar = 0x10B5; break;
|
||||
case 0x2D16 : mapChar = 0x10B6; break;
|
||||
case 0x2D17 : mapChar = 0x10B7; break;
|
||||
case 0x2D18 : mapChar = 0x10B8; break;
|
||||
case 0x2D19 : mapChar = 0x10B9; break;
|
||||
case 0x2D1A : mapChar = 0x10BA; break;
|
||||
case 0x2D1B : mapChar = 0x10BB; break;
|
||||
case 0x2D1C : mapChar = 0x10BC; break;
|
||||
case 0x2D1D : mapChar = 0x10BD; break;
|
||||
case 0x2D1E : mapChar = 0x10BE; break;
|
||||
case 0x2D1F : mapChar = 0x10BF; break;
|
||||
case 0x2D20 : mapChar = 0x10C0; break;
|
||||
case 0x2D21 : mapChar = 0x10C1; break;
|
||||
case 0x2D22 : mapChar = 0x10C2; break;
|
||||
case 0x2D23 : mapChar = 0x10C3; break;
|
||||
case 0x2D24 : mapChar = 0x10C4; break;
|
||||
case 0x2D25 : mapChar = 0x10C5; break;
|
||||
default : mapChar = Character.ERROR; break;
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,48 @@ class CharacterData01 extends CharacterData {
|
||||
case 0x10132: retval = 80000; break; // AEGEAN NUMBER EIGHTY THOUSAND
|
||||
case 0x10133: retval = 90000; break; // AEGEAN NUMBER NINETY THOUSAND
|
||||
case 0x10323: retval = 50; break; // OLD ITALIC NUMERAL FIFTY
|
||||
|
||||
case 0x010144: retval = 50; break; // ACROPHONIC ATTIC FIFTY
|
||||
case 0x010145: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED
|
||||
case 0x010146: retval = 5000; break; // ACROPHONIC ATTIC FIVE THOUSAND
|
||||
case 0x010147: retval = 50000; break; // ACROPHONIC ATTIC FIFTY THOUSAND
|
||||
case 0x01014A: retval = 50; break; // ACROPHONIC ATTIC FIFTY TALENTS
|
||||
case 0x01014B: retval = 100; break; // ACROPHONIC ATTIC ONE HUNDRED TALENTS
|
||||
case 0x01014C: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED TALENTS
|
||||
case 0x01014D: retval = 1000; break; // ACROPHONIC ATTIC ONE THOUSAND TALENTS
|
||||
case 0x01014E: retval = 5000; break; // ACROPHONIC ATTIC FIVE THOUSAND TALENTS
|
||||
case 0x010151: retval = 50; break; // ACROPHONIC ATTIC FIFTY STATERS
|
||||
case 0x010152: retval = 100; break; // ACROPHONIC ATTIC ONE HUNDRED STATERS
|
||||
case 0x010153: retval = 500; break; // ACROPHONIC ATTIC FIVE HUNDRED STATERS
|
||||
case 0x010154: retval = 1000; break; // ACROPHONIC ATTIC ONE THOUSAND STATERS
|
||||
case 0x010155: retval = 10000; break; // ACROPHONIC ATTIC TEN THOUSAND STATERS
|
||||
case 0x010156: retval = 50000; break; // ACROPHONIC ATTIC FIFTY THOUSAND STATERS
|
||||
case 0x010166: retval = 50; break; // ACROPHONIC TROEZENIAN FIFTY
|
||||
case 0x010167: retval = 50; break; // ACROPHONIC TROEZENIAN FIFTY ALTERNATE FORM
|
||||
case 0x010168: retval = 50; break; // ACROPHONIC HERMIONIAN FIFTY
|
||||
case 0x010169: retval = 50; break; // ACROPHONIC THESPIAN FIFTY
|
||||
case 0x01016A: retval = 100; break; // ACROPHONIC THESPIAN ONE HUNDRED
|
||||
case 0x01016B: retval = 300; break; // ACROPHONIC THESPIAN THREE HUNDRED
|
||||
case 0x01016C: retval = 500; break; // ACROPHONIC EPIDAUREAN FIVE HUNDRED
|
||||
case 0x01016D: retval = 500; break; // ACROPHONIC TROEZENIAN FIVE HUNDRED
|
||||
case 0x01016E: retval = 500; break; // ACROPHONIC THESPIAN FIVE HUNDRED
|
||||
case 0x01016F: retval = 500; break; // ACROPHONIC CARYSTIAN FIVE HUNDRED
|
||||
case 0x010170: retval = 500; break; // ACROPHONIC NAXIAN FIVE HUNDRED
|
||||
case 0x010171: retval = 1000; break; // ACROPHONIC THESPIAN ONE THOUSAND
|
||||
case 0x010172: retval = 5000; break; // ACROPHONIC THESPIAN FIVE THOUSAND
|
||||
case 0x010174: retval = 50; break; // ACROPHONIC STRATIAN FIFTY MNAS
|
||||
case 0x010341: retval = 90; break; // GOTHIC LETTER NINETY
|
||||
case 0x01034A: retval = 900; break; // GOTHIC LETTER NINE HUNDRED
|
||||
case 0x0103D5: retval = 100; break; // OLD PERSIAN NUMBER HUNDRED
|
||||
case 0x010919: retval = 100; break; // PHOENICIAN NUMBER ONE HUNDRED
|
||||
case 0x010A46: retval = 100; break; // KHAROSHTHI NUMBER ONE HUNDRED
|
||||
case 0x010A47: retval = 1000; break; // KHAROSHTHI NUMBER ONE THOUSAND
|
||||
case 0x01D36C: retval = 40; break; // COUNTING ROD TENS DIGIT FOUR
|
||||
case 0x01D36D: retval = 50; break; // COUNTING ROD TENS DIGIT FIVE
|
||||
case 0x01D36E: retval = 60; break; // COUNTING ROD TENS DIGIT SIX
|
||||
case 0x01D36F: retval = 70; break; // COUNTING ROD TENS DIGIT SEVEN
|
||||
case 0x01D370: retval = 80; break; // COUNTING ROD TENS DIGIT EIGHT
|
||||
case 0x01D371: retval = 90; break; // COUNTING ROD TENS DIGIT NINE
|
||||
default: retval = -2; break;
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,17 @@
|
||||
# SpecialCasing-4.0.0.txt
|
||||
# Date: 2003-03-14, 20:22:04 GMT [MD]
|
||||
# SpecialCasing-5.1.0.txt
|
||||
# Date: 2008-03-03, 21:58:10 GMT [MD]
|
||||
#
|
||||
# Unicode Character Database
|
||||
# Copyright (c) 1991-2008 Unicode, Inc.
|
||||
# For terms of use, see http://www.unicode.org/terms_of_use.html
|
||||
# For documentation, see UCD.html
|
||||
#
|
||||
# Special Casing Properties
|
||||
#
|
||||
# This file is a supplement to the UnicodeData file.
|
||||
# It contains additional information about the casing of Unicode characters.
|
||||
# (For compatibility, the UnicodeData.txt file only contains case mappings for
|
||||
# characters where they are 1-1, and does not have locale-specific mappings.)
|
||||
# characters where they are 1-1, and independent of context and language.
|
||||
# For more information, see the discussion of Case Mappings in the Unicode Standard.
|
||||
#
|
||||
# All code points not listed in this file that do not have a simple case mappings
|
||||
@ -18,31 +23,31 @@
|
||||
#
|
||||
# <code>; <lower> ; <title> ; <upper> ; (<condition_list> ;)? # <comment>
|
||||
#
|
||||
# <code>, <lower>, <title>, and <upper> provide character values in hex. If there is more than
|
||||
# one character, they are separated by spaces. Other than as used to separate elements,
|
||||
# spaces are to be ignored.
|
||||
# <code>, <lower>, <title>, and <upper> provide character values in hex. If there is more
|
||||
# than one character, they are separated by spaces. Other than as used to separate
|
||||
# elements, spaces are to be ignored.
|
||||
#
|
||||
# The <condition_list> is optional. Where present, it consists of one or more locales or contexts,
|
||||
# separated by spaces. In these conditions:
|
||||
# The <condition_list> is optional. Where present, it consists of one or more language IDs
|
||||
# or contexts, separated by spaces. In these conditions:
|
||||
# - A condition list overrides the normal behavior if all of the listed conditions are true.
|
||||
# - The context is always the context of the characters in the original string,
|
||||
# NOT in the resulting string.
|
||||
# - Case distinctions in the condition list are not significant.
|
||||
# - Conditions preceded by "Not_" represent the negation of the condition.
|
||||
# The condition list is not represented in the UCD as a formal property.
|
||||
#
|
||||
# A locale is defined as:
|
||||
# <locale> := <ISO_639_code> ( "_" <ISO_3166_code> ( "_" <variant> )? )?
|
||||
# <ISO_3166_code> := 2-letter ISO country code,
|
||||
# <ISO_639_code> := 2-letter ISO language code
|
||||
# A language ID is defined by BCP 47, with '-' and '_' treated equivalently.
|
||||
#
|
||||
# A context is one of the following, as defined in the Unicode Standard:
|
||||
# Final_Sigma, After_Soft_Dotted, More_Above, Before_Dot, Not_Before_Dot, After_I
|
||||
# A context for a character C is defined by Section 3.13 Default Case
|
||||
# Operations, of The Unicode Standard, Version 5.0.
|
||||
# (This is identical to the context defined by Unicode 4.1.0,
|
||||
# as specified in http://www.unicode.org/versions/Unicode4.1.0/)
|
||||
#
|
||||
# Parsers of this file must be prepared to deal with future additions to this format:
|
||||
# * Additional contexts
|
||||
# * Additional fields
|
||||
# ================================================================================
|
||||
|
||||
# @missing 0000..10FFFF; <slc>; <stc>; <suc>
|
||||
# ================================================================================
|
||||
# Unconditional mappings
|
||||
# ================================================================================
|
||||
@ -170,7 +175,7 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
|
||||
1FF3; 1FF3; 1FFC; 03A9 0399; # GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI
|
||||
1FFC; 1FF3; 1FFC; 03A9 0399; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI
|
||||
|
||||
# Some characters with YPOGEGRAMMENI are also have no corresponding titlecases
|
||||
# Some characters with YPOGEGRAMMENI also have no corresponding titlecases
|
||||
|
||||
1FB2; 1FB2; 1FBA 0345; 1FBA 0399; # GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI
|
||||
1FB4; 1FB4; 0386 0345; 0386 0399; # GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI
|
||||
@ -184,7 +189,14 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
|
||||
1FF7; 1FF7; 03A9 0342 0345; 03A9 0342 0399; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI
|
||||
|
||||
# ================================================================================
|
||||
# Conditional mappings
|
||||
# Conditional Mappings
|
||||
# The remainder of this file provides conditional casing data used to produce
|
||||
# full case mappings.
|
||||
# ================================================================================
|
||||
# Language-Insensitive Mappings
|
||||
# These are characters whose full case mappings do not depend on language, but do
|
||||
# depend on context (which characters come before or after). For more information
|
||||
# see the header of this file and the Unicode Standard.
|
||||
# ================================================================================
|
||||
|
||||
# Special case for final form of sigma
|
||||
@ -203,7 +215,10 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
|
||||
# 03C2; 03C3; 03A3; 03A3; Not_Final_Sigma; # GREEK SMALL LETTER FINAL SIGMA
|
||||
|
||||
# ================================================================================
|
||||
# Locale-sensitive mappings
|
||||
# Language-Sensitive Mappings
|
||||
# These are characters whose full case mappings depend on language and perhaps also
|
||||
# context (which characters come before or after). For more information
|
||||
# see the header of this file and the Unicode Standard.
|
||||
# ================================================================================
|
||||
|
||||
# Lithuanian
|
||||
@ -254,3 +269,6 @@ FB17; FB17; 0544 056D; 0544 053D; # ARMENIAN SMALL LIGATURE MEN XEH
|
||||
# Note: the following case is already in the UnicodeData file.
|
||||
|
||||
# 0131; 0131; 0049; 0049; tr; # LATIN SMALL LETTER DOTLESS I
|
||||
|
||||
# EOF
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
1
jdk/make/tools/UnicodeData/VERSION
Normal file
1
jdk/make/tools/UnicodeData/VERSION
Normal file
@ -0,0 +1 @@
|
||||
5.1.0
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,17 +26,37 @@
|
||||
package com.sun.awt;
|
||||
|
||||
import java.awt.*;
|
||||
import sun.awt.AWTAccessor;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.SunToolkit;
|
||||
|
||||
/**
|
||||
* A collection of utility methods for AWT.
|
||||
*
|
||||
* The functionality provided by the static methods of the class includes:
|
||||
* <ul>
|
||||
* <li>Setting shapes on top-level windows
|
||||
* <li>Setting a constant alpha value for each pixel of a top-level window
|
||||
* <li>Making a window non-opaque, after that it paints only explicitly
|
||||
* painted pixels on the screen, with arbitrary alpha values for every pixel.
|
||||
* <li>Setting a 'mixing-cutout' shape for a component.
|
||||
* </ul>
|
||||
* <p>
|
||||
* A "top-level window" is an instance of the {@code Window} class (or its
|
||||
* descendant, such as {@code JFrame}).
|
||||
* <p>
|
||||
* Some of the mentioned features may not be supported by the native platform.
|
||||
* To determine whether a particular feature is supported, the user must use
|
||||
* the {@code isTranslucencySupported()} method of the class passing a desired
|
||||
* translucency kind (a member of the {@code Translucency} enum) as an
|
||||
* argument.
|
||||
* <p>
|
||||
* The per-pixel alpha feature also requires the user to create her/his
|
||||
* windows using a translucency-capable graphics configuration.
|
||||
* The {@code isTranslucencyCapable()} method must
|
||||
* be used to verify whether any given GraphicsConfiguration supports
|
||||
* the trasnlcency effects.
|
||||
* <p>
|
||||
* <b>WARNING</b>: This class is an implementation detail and only meant
|
||||
* for limited use outside of the core platform. This API may change
|
||||
* drastically between update release, and it may even be
|
||||
@ -50,6 +70,344 @@ public final class AWTUtilities {
|
||||
private AWTUtilities() {
|
||||
}
|
||||
|
||||
/** Kinds of translucency supported by the underlying system.
|
||||
* @see #isTranslucencySupported
|
||||
*/
|
||||
public static enum Translucency {
|
||||
/**
|
||||
* Represents support in the underlying system for windows each pixel
|
||||
* of which is guaranteed to be either completely opaque, with
|
||||
* an alpha value of 1.0, or completely transparent, with an alpha
|
||||
* value of 0.0.
|
||||
*/
|
||||
PERPIXEL_TRANSPARENT,
|
||||
|
||||
/**
|
||||
* Represents support in the underlying system for windows all of
|
||||
* the pixels of which have the same alpha value between or including
|
||||
* 0.0 and 1.0.
|
||||
*/
|
||||
TRANSLUCENT,
|
||||
|
||||
/**
|
||||
* Represents support in the underlying system for windows that
|
||||
* contain or might contain pixels with arbitrary alpha values
|
||||
* between and including 0.0 and 1.0.
|
||||
*/
|
||||
PERPIXEL_TRANSLUCENT;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the given level of translucency is supported by
|
||||
* the underlying system.
|
||||
*
|
||||
* Note that this method may sometimes return the value
|
||||
* indicating that the particular level is supported, but
|
||||
* the native windowing system may still not support the
|
||||
* given level of translucency (due to the bugs in
|
||||
* the windowing system).
|
||||
*
|
||||
* @param translucencyKind a kind of translucency support
|
||||
* (either PERPIXEL_TRANSPARENT,
|
||||
* TRANSLUCENT, or PERPIXEL_TRANSLUCENT)
|
||||
* @return whether the given translucency kind is supported
|
||||
*/
|
||||
public static boolean isTranslucencySupported(Translucency translucencyKind) {
|
||||
switch (translucencyKind) {
|
||||
case PERPIXEL_TRANSPARENT:
|
||||
return isWindowShapingSupported();
|
||||
case TRANSLUCENT:
|
||||
return isWindowOpacitySupported();
|
||||
case PERPIXEL_TRANSLUCENT:
|
||||
return isWindowTranslucencySupported();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the windowing system supports changing the opacity
|
||||
* value of top-level windows.
|
||||
* Note that this method may sometimes return true, but the native
|
||||
* windowing system may still not support the concept of
|
||||
* translucency (due to the bugs in the windowing system).
|
||||
*/
|
||||
private static boolean isWindowOpacitySupported() {
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
return ((SunToolkit)curToolkit).isWindowOpacitySupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the opacity of the window. The opacity is at the range [0..1].
|
||||
* Note that setting the opacity level of 0 may or may not disable
|
||||
* the mouse event handling on this window. This is
|
||||
* a platform-dependent behavior.
|
||||
*
|
||||
* In order for this method to enable the translucency effect,
|
||||
* the isTranslucencySupported() method should indicate that the
|
||||
* TRANSLUCENT level of translucency is supported.
|
||||
*
|
||||
* <p>Also note that the window must not be in the full-screen mode
|
||||
* when setting the opacity value < 1.0f. Otherwise
|
||||
* the IllegalArgumentException is thrown.
|
||||
*
|
||||
* @param window the window to set the opacity level to
|
||||
* @param opacity the opacity level to set to the window
|
||||
* @throws NullPointerException if the window argument is null
|
||||
* @throws IllegalArgumentException if the opacity is out of
|
||||
* the range [0..1]
|
||||
* @throws IllegalArgumentException if the window is in full screen mode,
|
||||
* and the opacity is less than 1.0f
|
||||
* @throws UnsupportedOperationException if the TRANSLUCENT translucency
|
||||
* kind is not supported
|
||||
*/
|
||||
public static void setWindowOpacity(Window window, float opacity) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
|
||||
AWTAccessor.getWindowAccessor().setOpacity(window, opacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the opacity of the window. If the opacity has not
|
||||
* yet being set, this method returns 1.0.
|
||||
*
|
||||
* @param window the window to get the opacity level from
|
||||
* @throws NullPointerException if the window argument is null
|
||||
*/
|
||||
public static float getWindowOpacity(Window window) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
|
||||
return AWTAccessor.getWindowAccessor().getOpacity(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the windowing system supports changing the shape
|
||||
* of top-level windows.
|
||||
* Note that this method may sometimes return true, but the native
|
||||
* windowing system may still not support the concept of
|
||||
* shaping (due to the bugs in the windowing system).
|
||||
*/
|
||||
public static boolean isWindowShapingSupported() {
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
return ((SunToolkit)curToolkit).isWindowShapingSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object that implements the Shape interface and represents
|
||||
* the shape previously set with the call to the setWindowShape() method.
|
||||
* If no shape has been set yet, or the shape has been reset to null,
|
||||
* this method returns null.
|
||||
*
|
||||
* @param window the window to get the shape from
|
||||
* @return the current shape of the window
|
||||
* @throws NullPointerException if the window argument is null
|
||||
*/
|
||||
public static Shape getWindowShape(Window window) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
return AWTAccessor.getWindowAccessor().getShape(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a shape for the given window.
|
||||
* If the shape argument is null, this methods restores
|
||||
* the default shape making the window rectangular.
|
||||
* <p>Note that in order to set a shape, the window must be undecorated.
|
||||
* If the window is decorated, this method ignores the {@code shape}
|
||||
* argument and resets the shape to null.
|
||||
* <p>Also note that the window must not be in the full-screen mode
|
||||
* when setting a non-null shape. Otherwise the IllegalArgumentException
|
||||
* is thrown.
|
||||
* <p>Depending on the platform, the method may return without
|
||||
* effecting the shape of the window if the window has a non-null warning
|
||||
* string ({@link Window#getWarningString()}). In this case the passed
|
||||
* shape object is ignored.
|
||||
*
|
||||
* @param window the window to set the shape to
|
||||
* @param shape the shape to set to the window
|
||||
* @throws NullPointerException if the window argument is null
|
||||
* @throws IllegalArgumentException if the window is in full screen mode,
|
||||
* and the shape is not null
|
||||
* @throws UnsupportedOperationException if the PERPIXEL_TRANSPARENT
|
||||
* translucency kind is not supported
|
||||
*/
|
||||
public static void setWindowShape(Window window, Shape shape) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
AWTAccessor.getWindowAccessor().setShape(window, shape);
|
||||
}
|
||||
|
||||
private static boolean isWindowTranslucencySupported() {
|
||||
/*
|
||||
* Per-pixel alpha is supported if all the conditions are TRUE:
|
||||
* 1. The toolkit is a sort of SunToolkit
|
||||
* 2. The toolkit supports translucency in general
|
||||
* (isWindowTranslucencySupported())
|
||||
* 3. There's at least one translucency-capable
|
||||
* GraphicsConfiguration
|
||||
*/
|
||||
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GraphicsEnvironment env =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
|
||||
// If the default GC supports translucency return true.
|
||||
// It is important to optimize the verification this way,
|
||||
// see CR 6661196 for more details.
|
||||
if (isTranslucencyCapable(env.getDefaultScreenDevice()
|
||||
.getDefaultConfiguration()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// ... otherwise iterate through all the GCs.
|
||||
GraphicsDevice[] devices = env.getScreenDevices();
|
||||
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
GraphicsConfiguration[] configs = devices[i].getConfigurations();
|
||||
for (int j = 0; j < configs.length; j++) {
|
||||
if (isTranslucencyCapable(configs[j])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the per-pixel alpha support for the given window.
|
||||
* Once the window becomes non-opaque (the isOpaque is set to false),
|
||||
* the drawing sub-system is starting to respect the alpha value of each
|
||||
* separate pixel. If a pixel gets painted with alpha color component
|
||||
* equal to zero, it becomes visually transparent, if the alpha of the
|
||||
* pixel is equal to 255, the pixel is fully opaque. Interim values
|
||||
* of the alpha color component make the pixel semi-transparent (i.e.
|
||||
* translucent).
|
||||
* <p>Note that in order for the window to support the per-pixel alpha
|
||||
* mode, the window must be created using the GraphicsConfiguration
|
||||
* for which the {@link #isTranslucencyCapable}
|
||||
* method returns true.
|
||||
* <p>Also note that some native systems enable the per-pixel translucency
|
||||
* mode for any window created using the translucency-compatible
|
||||
* graphics configuration. However, it is highly recommended to always
|
||||
* invoke the setWindowOpaque() method for these windows, at least for
|
||||
* the sake of cross-platform compatibility reasons.
|
||||
* <p>Also note that the window must not be in the full-screen mode
|
||||
* when making it non-opaque. Otherwise the IllegalArgumentException
|
||||
* is thrown.
|
||||
* <p>If the window is a {@code Frame} or a {@code Dialog}, the window must
|
||||
* be undecorated prior to enabling the per-pixel translucency effect (see
|
||||
* {@link Frame#setUndecorated()} and/or {@link Dialog#setUndecorated()}).
|
||||
* If the window becomes decorated through a subsequent call to the
|
||||
* corresponding {@code setUndecorated()} method, the per-pixel
|
||||
* translucency effect will be disabled and the opaque property reset to
|
||||
* {@code true}.
|
||||
* <p>Depending on the platform, the method may return without
|
||||
* effecting the opaque property of the window if the window has a non-null
|
||||
* warning string ({@link Window#getWarningString()}). In this case
|
||||
* the passed 'isOpaque' value is ignored.
|
||||
*
|
||||
* @param window the window to set the shape to
|
||||
* @param isOpaque whether the window must be opaque (true),
|
||||
* or translucent (false)
|
||||
* @throws NullPointerException if the window argument is null
|
||||
* @throws IllegalArgumentException if the window uses
|
||||
* a GraphicsConfiguration for which the
|
||||
* {@code isTranslucencyCapable()}
|
||||
* method returns false
|
||||
* @throws IllegalArgumentException if the window is in full screen mode,
|
||||
* and the isOpaque is false
|
||||
* @throws IllegalArgumentException if the window is decorated and the
|
||||
* isOpaque argument is {@code false}.
|
||||
* @throws UnsupportedOperationException if the PERPIXEL_TRANSLUCENT
|
||||
* translucency kind is not supported
|
||||
*/
|
||||
public static void setWindowOpaque(Window window, boolean isOpaque) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
if (!isOpaque && !isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT)) {
|
||||
throw new UnsupportedOperationException(
|
||||
"The PERPIXEL_TRANSLUCENT translucency kind is not supported");
|
||||
}
|
||||
AWTAccessor.getWindowAccessor().setOpaque(window, isOpaque);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the window is opaque or translucent.
|
||||
*
|
||||
* @param window the window to set the shape to
|
||||
* @return whether the window is currently opaque (true)
|
||||
* or translucent (false)
|
||||
* @throws NullPointerException if the window argument is null
|
||||
*/
|
||||
public static boolean isWindowOpaque(Window window) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
|
||||
return AWTAccessor.getWindowAccessor().isOpaque(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies whether a given GraphicsConfiguration supports
|
||||
* the PERPIXEL_TRANSLUCENT kind of translucency.
|
||||
* All windows that are intended to be used with the {@link #setWindowOpaque}
|
||||
* method must be created using a GraphicsConfiguration for which this method
|
||||
* returns true.
|
||||
* <p>Note that some native systems enable the per-pixel translucency
|
||||
* mode for any window created using a translucency-capable
|
||||
* graphics configuration. However, it is highly recommended to always
|
||||
* invoke the setWindowOpaque() method for these windows, at least
|
||||
* for the sake of cross-platform compatibility reasons.
|
||||
*
|
||||
* @param gc GraphicsConfiguration
|
||||
* @throws NullPointerException if the gc argument is null
|
||||
* @return whether the given GraphicsConfiguration supports
|
||||
* the translucency effects.
|
||||
*/
|
||||
public static boolean isTranslucencyCapable(GraphicsConfiguration gc) {
|
||||
if (gc == null) {
|
||||
throw new NullPointerException("The gc argument should not be null");
|
||||
}
|
||||
/*
|
||||
return gc.isTranslucencyCapable();
|
||||
*/
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
return ((SunToolkit)curToolkit).isTranslucencyCapable(gc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a 'mixing-cutout' shape for the given component.
|
||||
*
|
||||
|
169
jdk/src/share/classes/com/sun/awt/SecurityWarning.java
Normal file
169
jdk/src/share/classes/com/sun/awt/SecurityWarning.java
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package com.sun.awt;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.*;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
|
||||
|
||||
/**
|
||||
* Security Warning control interface.
|
||||
*
|
||||
* This class provides a couple of methods that help a developer relocate
|
||||
* the AWT security warning to an appropriate position relative to the current
|
||||
* window size. A "top-level window" is an instance of the {@code Window}
|
||||
* class (or its descendant, such as {@code JFrame}). The security warning
|
||||
* is applied to all windows created by an untrusted code. All such windows
|
||||
* have a non-null "warning string" (see {@link Window#getWarningString()}).
|
||||
* <p>
|
||||
* <b>WARNING</b>: This class is an implementation detail and only meant
|
||||
* for limited use outside of the core platform. This API may change
|
||||
* drastically between update release, and it may even be
|
||||
* removed or be moved to some other packages or classes.
|
||||
*/
|
||||
public final class SecurityWarning {
|
||||
|
||||
/**
|
||||
* The SecurityWarning class should not be instantiated
|
||||
*/
|
||||
private SecurityWarning() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size of the security warning.
|
||||
*
|
||||
* The returned value is not valid until the peer has been created. Before
|
||||
* invoking this method a developer must call the {@link Window#pack()},
|
||||
* {@link Window#setVisible()}, or some other method that creates the peer.
|
||||
*
|
||||
* @param window the window to get the security warning size for
|
||||
*
|
||||
* @throws NullPointerException if the window argument is null
|
||||
* @throws IllegalArgumentException if the window is trusted (i.e.
|
||||
* the {@code getWarningString()} returns null)
|
||||
*/
|
||||
public static Dimension getSize(Window window) {
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
if (window.getWarningString() == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"The window must have a non-null warning string.");
|
||||
}
|
||||
// We don't check for a non-null peer since it may be destroyed
|
||||
// after assigning a valid value to the security warning size.
|
||||
|
||||
return AWTAccessor.getWindowAccessor().getSecurityWarningSize(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the position of the security warning.
|
||||
* <p>
|
||||
* The {@code alignmentX} and {@code alignmentY} arguments specify the
|
||||
* origin of the coordinate system used to calculate the position of the
|
||||
* security warning. The values must be in the range [0.0f...1.0f]. The
|
||||
* {@code 0.0f} value represents the left (top) edge of the rectangular
|
||||
* bounds of the window. The {@code 1.0f} value represents the right
|
||||
* (bottom) edge of the bounds. Whenever the size of the window changes,
|
||||
* the origin of the coordinate system gets relocated accordingly. For
|
||||
* convenience a developer may use the {@code Component.*_ALIGNMENT}
|
||||
* constants to pass predefined values for these arguments.
|
||||
* <p>
|
||||
* The {@code point} argument specifies the location of the security
|
||||
* warning in the coordinate system described above. If both {@code x} and
|
||||
* {@code y} coordinates of the point are equal to zero, the warning will
|
||||
* be located right in the origin of the coordinate system. On the other
|
||||
* hand, if both {@code alignmentX} and {@code alignmentY} are equal to
|
||||
* zero (i.e. the origin of the coordinate system is placed at the top-left
|
||||
* corner of the window), then the {@code point} argument represents the
|
||||
* absolute location of the security warning relative to the location of
|
||||
* the window. The "absolute" in this case means that the position of the
|
||||
* security warning is not effected by resizing of the window.
|
||||
* <p>
|
||||
* Note that the security warning managment code guarantees that:
|
||||
* <ul>
|
||||
* <li>The security warning cannot be located farther than two pixels from
|
||||
* the rectangular bounds of the window (see {@link Window#getBounds}), and
|
||||
* <li>The security warning is always visible on the screen.
|
||||
* </ul>
|
||||
* If either of the conditions is violated, the calculated position of the
|
||||
* security warning is adjusted by the system to meet both these
|
||||
* conditions.
|
||||
* <p>
|
||||
* The default position of the security warning is in the upper-right
|
||||
* corner of the window, two pixels to the right from the right edge. This
|
||||
* corresponds to the following arguments passed to this method:
|
||||
* <ul>
|
||||
* <li>{@code alignmentX = Component.RIGHT_ALIGNMENT}
|
||||
* <li>{@code alignmentY = Component.TOP_ALIGNMENT}
|
||||
* <li>{@code point = (2, 0)}
|
||||
* </ul>
|
||||
*
|
||||
* @param window the window to set the position of the security warning for
|
||||
* @param alignmentX the horizontal origin of the coordinate system
|
||||
* @param alignmentY the vertical origin of the coordinate system
|
||||
* @param point the position of the security warning in the specified
|
||||
* coordinate system
|
||||
*
|
||||
* @throws NullPointerException if the window argument is null
|
||||
* @throws NullPointerException if the point argument is null
|
||||
* @throws IllegalArgumentException if the window is trusted (i.e.
|
||||
* the {@code getWarningString()} returns null
|
||||
* @throws IllegalArgumentException if the alignmentX or alignmentY
|
||||
* arguments are not within the range [0.0f ... 1.0f]
|
||||
*/
|
||||
public static void setPosition(Window window, Point2D point,
|
||||
float alignmentX, float alignmentY)
|
||||
{
|
||||
if (window == null) {
|
||||
throw new NullPointerException(
|
||||
"The window argument should not be null.");
|
||||
}
|
||||
if (window.getWarningString() == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"The window must have a non-null warning string.");
|
||||
}
|
||||
if (point == null) {
|
||||
throw new NullPointerException(
|
||||
"The point argument must not be null");
|
||||
}
|
||||
if (alignmentX < 0.0f || alignmentX > 1.0f) {
|
||||
throw new IllegalArgumentException(
|
||||
"alignmentX must be in the range [0.0f ... 1.0f].");
|
||||
}
|
||||
if (alignmentY < 0.0f || alignmentY > 1.0f) {
|
||||
throw new IllegalArgumentException(
|
||||
"alignmentY must be in the range [0.0f ... 1.0f].");
|
||||
}
|
||||
|
||||
AWTAccessor.getWindowAccessor().setSecurityWarningPosition(window,
|
||||
point, alignmentX, alignmentY);
|
||||
}
|
||||
}
|
||||
|
@ -279,20 +279,22 @@ class GTKIconFactory {
|
||||
|
||||
public void paintIcon(SynthContext context, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
JToolBar toolbar = (JToolBar)context.getComponent();
|
||||
Orientation orientation =
|
||||
(toolbar.getOrientation() == JToolBar.HORIZONTAL ?
|
||||
Orientation.HORIZONTAL : Orientation.VERTICAL);
|
||||
if (context != null) {
|
||||
JToolBar toolbar = (JToolBar)context.getComponent();
|
||||
Orientation orientation =
|
||||
(toolbar.getOrientation() == JToolBar.HORIZONTAL ?
|
||||
Orientation.HORIZONTAL : Orientation.VERTICAL);
|
||||
|
||||
if (style == null) {
|
||||
style = SynthLookAndFeel.getStyleFactory().getStyle(
|
||||
context.getComponent(), GTKRegion.HANDLE_BOX);
|
||||
if (style == null) {
|
||||
style = SynthLookAndFeel.getStyleFactory().getStyle(
|
||||
context.getComponent(), GTKRegion.HANDLE_BOX);
|
||||
}
|
||||
context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX,
|
||||
style, SynthConstants.ENABLED);
|
||||
|
||||
GTKPainter.INSTANCE.paintIcon(context, g,
|
||||
getMethod(), x, y, w, h, orientation);
|
||||
}
|
||||
context = new SynthContext(toolbar, GTKRegion.HANDLE_BOX,
|
||||
style, SynthConstants.ENABLED);
|
||||
|
||||
GTKPainter.INSTANCE.paintIcon(context, g,
|
||||
getMethod(), x, y, w, h, orientation);
|
||||
}
|
||||
|
||||
public int getIconWidth(SynthContext context) {
|
||||
@ -336,12 +338,14 @@ class GTKIconFactory {
|
||||
|
||||
public void paintIcon(SynthContext context, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
ArrowType arrowDir = ArrowType.RIGHT;
|
||||
if (!context.getComponent().getComponentOrientation().isLeftToRight()) {
|
||||
arrowDir = ArrowType.LEFT;
|
||||
if (context != null) {
|
||||
ArrowType arrowDir = ArrowType.RIGHT;
|
||||
if (!context.getComponent().getComponentOrientation().isLeftToRight()) {
|
||||
arrowDir = ArrowType.LEFT;
|
||||
}
|
||||
GTKPainter.INSTANCE.paintIcon(context, g,
|
||||
getMethod(), x, y, w, h, arrowDir);
|
||||
}
|
||||
GTKPainter.INSTANCE.paintIcon(context, g,
|
||||
getMethod(), x, y, w, h, arrowDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import sun.awt.shell.ShellFolder;
|
||||
import sun.awt.OSInfo;
|
||||
@ -1143,7 +1145,11 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
|
||||
|
||||
File[] baseFolders;
|
||||
if (useShellFolder) {
|
||||
baseFolders = (File[])ShellFolder.get("fileChooserComboBoxFolders");
|
||||
baseFolders = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
|
||||
public File[] run() {
|
||||
return (File[]) ShellFolder.get("fileChooserComboBoxFolders");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
baseFolders = fsv.getRoots();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -329,6 +329,9 @@ public class AWTKeyStroke implements Serializable {
|
||||
* <li><code>java.awt.event.KeyEvent.VK_TAB</code>
|
||||
* <li><code>java.awt.event.KeyEvent.VK_SPACE</code>
|
||||
* </ul>
|
||||
* Alternatively, the key code may be obtained by calling
|
||||
* <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
|
||||
*
|
||||
* The modifiers consist of any combination of:<ul>
|
||||
* <li>java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||
* <li>java.awt.event.InputEvent.CTRL_DOWN_MASK
|
||||
|
@ -25,6 +25,7 @@
|
||||
package java.awt;
|
||||
|
||||
import java.awt.image.BufferStrategy;
|
||||
import java.awt.peer.CanvasPeer;
|
||||
import javax.accessibility.*;
|
||||
|
||||
/**
|
||||
@ -65,7 +66,17 @@ public class Canvas extends Component implements Accessible {
|
||||
*/
|
||||
public Canvas(GraphicsConfiguration config) {
|
||||
this();
|
||||
graphicsConfig = config;
|
||||
setGraphicsConfiguration(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
void setGraphicsConfiguration(GraphicsConfiguration gc) {
|
||||
CanvasPeer peer = (CanvasPeer)getPeer();
|
||||
if (peer != null) {
|
||||
gc = peer.getAppropriateGraphicsConfiguration(gc);
|
||||
}
|
||||
|
||||
super.setGraphicsConfiguration(gc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -300,7 +300,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
* @see GraphicsConfiguration
|
||||
* @see #getGraphicsConfiguration
|
||||
*/
|
||||
transient GraphicsConfiguration graphicsConfig = null;
|
||||
private transient GraphicsConfiguration graphicsConfig = null;
|
||||
|
||||
/**
|
||||
* A reference to a <code>BufferStrategy</code> object
|
||||
@ -799,8 +799,24 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
}
|
||||
}
|
||||
|
||||
// Whether this Component has had the background erase flag
|
||||
// specified via SunToolkit.disableBackgroundErase(). This is
|
||||
// needed in order to make this function work on X11 platforms,
|
||||
// where currently there is no chance to interpose on the creation
|
||||
// of the peer and therefore the call to XSetBackground.
|
||||
transient boolean backgroundEraseDisabled;
|
||||
|
||||
static {
|
||||
AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
|
||||
public void setBackgroundEraseDisabled(Component comp, boolean disabled) {
|
||||
comp.backgroundEraseDisabled = disabled;
|
||||
}
|
||||
public boolean getBackgroundEraseDisabled(Component comp) {
|
||||
return comp.backgroundEraseDisabled;
|
||||
}
|
||||
public Rectangle getBounds(Component comp) {
|
||||
return new Rectangle(comp.x, comp.y, comp.width, comp.height);
|
||||
}
|
||||
public void setMixingCutoutShape(Component comp, Shape shape) {
|
||||
Region region = shape == null ? null :
|
||||
Region.getInstance(shape, null);
|
||||
@ -829,6 +845,22 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setGraphicsConfiguration(Component comp,
|
||||
GraphicsConfiguration gc)
|
||||
{
|
||||
comp.setGraphicsConfiguration(gc);
|
||||
}
|
||||
public boolean requestFocus(Component comp, CausedFocusEvent.Cause cause) {
|
||||
return comp.requestFocus(cause);
|
||||
}
|
||||
public boolean canBeFocusOwner(Component comp) {
|
||||
return comp.canBeFocusOwner();
|
||||
}
|
||||
|
||||
public boolean isVisible_NoClientCode(Component comp) {
|
||||
return comp.isVisible_NoClientCode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -996,50 +1028,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
*/
|
||||
public GraphicsConfiguration getGraphicsConfiguration() {
|
||||
synchronized(getTreeLock()) {
|
||||
if (graphicsConfig != null) {
|
||||
return graphicsConfig;
|
||||
} else if (getParent() != null) {
|
||||
return getParent().getGraphicsConfiguration();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return getGraphicsConfiguration_NoClientCode();
|
||||
}
|
||||
}
|
||||
|
||||
final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
|
||||
GraphicsConfiguration graphicsConfig = this.graphicsConfig;
|
||||
Container parent = this.parent;
|
||||
if (graphicsConfig != null) {
|
||||
return graphicsConfig;
|
||||
} else if (parent != null) {
|
||||
return parent.getGraphicsConfiguration_NoClientCode();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return graphicsConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets this <code>Component</code>'s
|
||||
* <code>GraphicsConfiguration</code> back to a default
|
||||
* value. For most componenets, this is <code>null</code>.
|
||||
* Called from the Toolkit thread, so NO CLIENT CODE.
|
||||
*/
|
||||
void resetGC() {
|
||||
void setGraphicsConfiguration(GraphicsConfiguration gc) {
|
||||
synchronized(getTreeLock()) {
|
||||
graphicsConfig = null;
|
||||
}
|
||||
}
|
||||
graphicsConfig = gc;
|
||||
|
||||
/*
|
||||
* Not called on Component, but needed for Canvas and Window
|
||||
*/
|
||||
void setGCFromPeer() {
|
||||
synchronized(getTreeLock()) {
|
||||
if (peer != null) { // can't imagine how this will be false,
|
||||
// but just in case
|
||||
graphicsConfig = peer.getGraphicsConfiguration();
|
||||
} else {
|
||||
graphicsConfig = null;
|
||||
ComponentPeer peer = getPeer();
|
||||
if (peer != null) {
|
||||
peer.updateGraphicsData(gc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6663,23 +6666,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
|
||||
|
||||
// Update stacking order
|
||||
if (parent != null && parent.peer != null) {
|
||||
ContainerPeer parentContPeer = (ContainerPeer) parent.peer;
|
||||
// if our parent is lightweight and we are not
|
||||
// we should call restack on nearest heavyweight
|
||||
// container.
|
||||
if (parentContPeer instanceof LightweightPeer
|
||||
&& ! (peer instanceof LightweightPeer))
|
||||
{
|
||||
Container hwParent = getNativeContainer();
|
||||
if (hwParent != null && hwParent.peer != null) {
|
||||
parentContPeer = (ContainerPeer) hwParent.peer;
|
||||
}
|
||||
}
|
||||
if (parentContPeer.isRestackSupported()) {
|
||||
parentContPeer.restack();
|
||||
}
|
||||
}
|
||||
peer.setZOrder(getHWPeerAboveMe());
|
||||
|
||||
if (!isAddNotifyComplete) {
|
||||
mixOnShowing();
|
||||
@ -7170,8 +7157,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
requestFocusHelper(false, true);
|
||||
}
|
||||
|
||||
void requestFocus(CausedFocusEvent.Cause cause) {
|
||||
requestFocusHelper(false, true, cause);
|
||||
boolean requestFocus(CausedFocusEvent.Cause cause) {
|
||||
return requestFocusHelper(false, true, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7456,7 +7443,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
// sometimes most recent focus owner may be null, but focus owner is not
|
||||
// e.g. we reset most recent focus owner if user removes focus owner
|
||||
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
if (focusOwner != null && getContainingWindow(focusOwner) != window) {
|
||||
if (focusOwner != null && focusOwner.getContainingWindow() != window) {
|
||||
focusOwner = null;
|
||||
}
|
||||
}
|
||||
@ -8689,30 +8676,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
* null, if component is not a part of window hierarchy
|
||||
*/
|
||||
Window getContainingWindow() {
|
||||
return getContainingWindow(this);
|
||||
return SunToolkit.getContainingWindow(this);
|
||||
}
|
||||
/**
|
||||
* Returns the <code>Window</code> ancestor of the component <code>comp</code>.
|
||||
* @return Window ancestor of the component or component by itself if it is Window;
|
||||
* null, if component is not a part of window hierarchy
|
||||
*/
|
||||
static Window getContainingWindow(Component comp) {
|
||||
while (comp != null && !(comp instanceof Window)) {
|
||||
comp = comp.getParent();
|
||||
}
|
||||
|
||||
return (Window)comp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialize JNI field and method IDs
|
||||
@ -9575,6 +9540,27 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
return nextAbove < 0 ? -1 : nextAbove;
|
||||
}
|
||||
|
||||
final ComponentPeer getHWPeerAboveMe() {
|
||||
checkTreeLock();
|
||||
|
||||
Container cont = getContainer();
|
||||
int indexAbove = getSiblingIndexAbove();
|
||||
|
||||
while (cont != null) {
|
||||
for (int i = indexAbove; i > -1; i--) {
|
||||
Component comp = cont.getComponent(i);
|
||||
if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
|
||||
return comp.getPeer();
|
||||
}
|
||||
}
|
||||
|
||||
indexAbove = cont.getSiblingIndexAbove();
|
||||
cont = cont.getContainer();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
final int getSiblingIndexBelow() {
|
||||
checkTreeLock();
|
||||
Container parent = getContainer();
|
||||
@ -9827,4 +9813,29 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
}
|
||||
|
||||
// ****************** END OF MIXING CODE ********************************
|
||||
|
||||
private static boolean doesClassImplement(Class cls, String interfaceName) {
|
||||
if (cls == null) return false;
|
||||
|
||||
for (Class c : cls.getInterfaces()) {
|
||||
if (c.getName().equals(interfaceName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return doesClassImplement(cls.getSuperclass(), interfaceName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the given object implements the given interface.
|
||||
* @param obj Object to be checked
|
||||
* @param interfaceName The name of the interface. Must be fully-qualified interface name.
|
||||
* @return true, if this object implements the given interface,
|
||||
* false, otherwise, or if obj or interfaceName is null
|
||||
*/
|
||||
static boolean doesImplement(Object obj, String interfaceName) {
|
||||
if (obj == null) return false;
|
||||
if (interfaceName == null) return false;
|
||||
|
||||
return doesClassImplement(obj.getClass(), interfaceName);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -167,6 +167,9 @@ public class Container extends Component {
|
||||
transient int listeningBoundsChildren;
|
||||
transient int descendantsCount;
|
||||
|
||||
/* Non-opaque window support -- see Window.setLayersOpaque */
|
||||
transient Color preserveBackgroundColor = null;
|
||||
|
||||
/**
|
||||
* JDK 1.1 serialVersionUID
|
||||
*/
|
||||
@ -267,9 +270,13 @@ public class Container extends Component {
|
||||
|
||||
/**
|
||||
* Gets the number of components in this panel.
|
||||
* <p>
|
||||
* Note: This method should be called under AWT tree lock.
|
||||
*
|
||||
* @return the number of components in this panel.
|
||||
* @see #getComponent
|
||||
* @since JDK1.1
|
||||
* @see Component#getTreeLock()
|
||||
*/
|
||||
public int getComponentCount() {
|
||||
return countComponents();
|
||||
@ -281,43 +288,65 @@ public class Container extends Component {
|
||||
*/
|
||||
@Deprecated
|
||||
public int countComponents() {
|
||||
synchronized (getTreeLock()) {
|
||||
return component.size();
|
||||
}
|
||||
// This method is not synchronized under AWT tree lock.
|
||||
// Instead, the calling code is responsible for the
|
||||
// synchronization. See 6784816 for details.
|
||||
return component.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nth component in this container.
|
||||
* <p>
|
||||
* Note: This method should be called under AWT tree lock.
|
||||
*
|
||||
* @param n the index of the component to get.
|
||||
* @return the n<sup>th</sup> component in this container.
|
||||
* @exception ArrayIndexOutOfBoundsException
|
||||
* if the n<sup>th</sup> value does not exist.
|
||||
* @see Component#getTreeLock()
|
||||
*/
|
||||
public Component getComponent(int n) {
|
||||
synchronized (getTreeLock()) {
|
||||
if ((n < 0) || (n >= component.size())) {
|
||||
throw new ArrayIndexOutOfBoundsException("No such child: " + n);
|
||||
}
|
||||
// This method is not synchronized under AWT tree lock.
|
||||
// Instead, the calling code is responsible for the
|
||||
// synchronization. See 6784816 for details.
|
||||
try {
|
||||
return component.get(n);
|
||||
} catch (IndexOutOfBoundsException z) {
|
||||
throw new ArrayIndexOutOfBoundsException("No such child: " + n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the components in this container.
|
||||
* <p>
|
||||
* Note: This method should be called under AWT tree lock.
|
||||
*
|
||||
* @return an array of all the components in this container.
|
||||
* @see Component#getTreeLock()
|
||||
*/
|
||||
public Component[] getComponents() {
|
||||
// This method is not synchronized under AWT tree lock.
|
||||
// Instead, the calling code is responsible for the
|
||||
// synchronization. See 6784816 for details.
|
||||
return getComponents_NoClientCode();
|
||||
}
|
||||
|
||||
// NOTE: This method may be called by privileged threads.
|
||||
// This functionality is implemented in a package-private method
|
||||
// to insure that it cannot be overridden by client subclasses.
|
||||
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
|
||||
final Component[] getComponents_NoClientCode() {
|
||||
return component.toArray(EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrapper for getComponents() method with a proper synchronization.
|
||||
*/
|
||||
Component[] getComponentsSync() {
|
||||
synchronized (getTreeLock()) {
|
||||
return component.toArray(EMPTY_ARRAY);
|
||||
return getComponents();
|
||||
}
|
||||
} // getComponents_NoClientCode()
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the insets of this container, which indicate the size
|
||||
@ -503,6 +532,9 @@ public class Container extends Component {
|
||||
adjustDescendants(-(comp.countHierarchyMembers()));
|
||||
|
||||
comp.parent = null;
|
||||
if (needRemoveNotify) {
|
||||
comp.setGraphicsConfiguration(null);
|
||||
}
|
||||
component.remove(index);
|
||||
|
||||
invalidateIfValid();
|
||||
@ -643,10 +675,7 @@ public class Container extends Component {
|
||||
// each HW descendant independently.
|
||||
return !comp.peer.isReparentSupported();
|
||||
} else {
|
||||
// if container didn't change we still might need to recreate component's window as
|
||||
// changes to zorder should be reflected in native window stacking order and it might
|
||||
// not be supported by the platform. This is important only for heavyweight child
|
||||
return !((ContainerPeer)(newNativeContainer.peer)).isRestackSupported();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -786,6 +815,7 @@ public class Container extends Component {
|
||||
component.add(index, comp);
|
||||
}
|
||||
comp.parent = this;
|
||||
comp.setGraphicsConfiguration(getGraphicsConfiguration());
|
||||
|
||||
adjustListeningChildren(AWTEvent.HIERARCHY_EVENT_MASK,
|
||||
comp.numListening(AWTEvent.HIERARCHY_EVENT_MASK));
|
||||
@ -802,11 +832,6 @@ public class Container extends Component {
|
||||
if (peer != null) {
|
||||
if (comp.peer == null) { // Remove notify was called or it didn't have peer - create new one
|
||||
comp.addNotify();
|
||||
// New created peer creates component on top of the stacking order
|
||||
Container newNativeContainer = getHeavyweightContainer();
|
||||
if (((ContainerPeer)newNativeContainer.getPeer()).isRestackSupported()) {
|
||||
((ContainerPeer)newNativeContainer.getPeer()).restack();
|
||||
}
|
||||
} else { // Both container and child have peers, it means child peer should be reparented.
|
||||
// In both cases we need to reparent native widgets.
|
||||
Container newNativeContainer = getHeavyweightContainer();
|
||||
@ -815,13 +840,8 @@ public class Container extends Component {
|
||||
// Native container changed - need to reparent native widgets
|
||||
newNativeContainer.reparentChild(comp);
|
||||
}
|
||||
// If component still has a peer and it is either container or heavyweight
|
||||
// and restack is supported we have to restack native windows since order might have changed
|
||||
if ((!comp.isLightweight() || (comp instanceof Container))
|
||||
&& ((ContainerPeer)newNativeContainer.getPeer()).isRestackSupported())
|
||||
{
|
||||
((ContainerPeer)newNativeContainer.getPeer()).restack();
|
||||
}
|
||||
comp.peer.setZOrder(comp.getHWPeerAboveMe());
|
||||
|
||||
if (!comp.isLightweight() && isLightweight()) {
|
||||
// If component is heavyweight and one of the containers is lightweight
|
||||
// the location of the component should be fixed.
|
||||
@ -1034,9 +1054,9 @@ public class Container extends Component {
|
||||
}
|
||||
checkAddToSelf(comp);
|
||||
checkNotAWindow(comp);
|
||||
if (thisGC != null) {
|
||||
comp.checkGD(thisGC.getDevice().getIDstring());
|
||||
}
|
||||
if (thisGC != null) {
|
||||
comp.checkGD(thisGC.getDevice().getIDstring());
|
||||
}
|
||||
|
||||
/* Reparent the component and tidy up the tree's state. */
|
||||
if (comp.parent != null) {
|
||||
@ -1053,6 +1073,7 @@ public class Container extends Component {
|
||||
component.add(index, comp);
|
||||
}
|
||||
comp.parent = this;
|
||||
comp.setGraphicsConfiguration(thisGC);
|
||||
|
||||
adjustListeningChildren(AWTEvent.HIERARCHY_EVENT_MASK,
|
||||
comp.numListening(AWTEvent.HIERARCHY_EVENT_MASK));
|
||||
@ -1091,6 +1112,19 @@ public class Container extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void setGraphicsConfiguration(GraphicsConfiguration gc) {
|
||||
synchronized (getTreeLock()) {
|
||||
super.setGraphicsConfiguration(gc);
|
||||
|
||||
for (Component comp : component) {
|
||||
if (comp != null) {
|
||||
comp.setGraphicsConfiguration(gc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all Components that this Container contains are on
|
||||
* the same GraphicsDevice as this Container. If not, throws an
|
||||
@ -1148,6 +1182,7 @@ public class Container extends Component {
|
||||
|
||||
comp.parent = null;
|
||||
component.remove(index);
|
||||
comp.setGraphicsConfiguration(null);
|
||||
|
||||
invalidateIfValid();
|
||||
if (containerListener != null ||
|
||||
@ -1224,6 +1259,7 @@ public class Container extends Component {
|
||||
layoutMgr.removeLayoutComponent(comp);
|
||||
}
|
||||
comp.parent = null;
|
||||
comp.setGraphicsConfiguration(null);
|
||||
if (containerListener != null ||
|
||||
(eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0 ||
|
||||
Toolkit.enabledOnToolkit(AWTEvent.CONTAINER_EVENT_MASK)) {
|
||||
@ -1339,7 +1375,7 @@ public class Container extends Component {
|
||||
}
|
||||
|
||||
private int getListenersCount(int id, boolean enabledOnToolkit) {
|
||||
assert Thread.holdsLock(getTreeLock());
|
||||
checkTreeLock();
|
||||
if (enabledOnToolkit) {
|
||||
return descendantsCount;
|
||||
}
|
||||
@ -1357,7 +1393,7 @@ public class Container extends Component {
|
||||
final int createHierarchyEvents(int id, Component changed,
|
||||
Container changedParent, long changeFlags, boolean enabledOnToolkit)
|
||||
{
|
||||
assert Thread.holdsLock(getTreeLock());
|
||||
checkTreeLock();
|
||||
int listeners = getListenersCount(id, enabledOnToolkit);
|
||||
|
||||
for (int count = listeners, i = 0; count > 0; i++) {
|
||||
@ -1372,7 +1408,7 @@ public class Container extends Component {
|
||||
final void createChildHierarchyEvents(int id, long changeFlags,
|
||||
boolean enabledOnToolkit)
|
||||
{
|
||||
assert Thread.holdsLock(getTreeLock());
|
||||
checkTreeLock();
|
||||
if (component.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -1507,6 +1543,7 @@ public class Container extends Component {
|
||||
* @see #validate
|
||||
*/
|
||||
protected void validateTree() {
|
||||
checkTreeLock();
|
||||
if (!isValid()) {
|
||||
if (peer instanceof ContainerPeer) {
|
||||
((ContainerPeer)peer).beginLayout();
|
||||
@ -1783,7 +1820,7 @@ public class Container extends Component {
|
||||
// super.paint(); -- Don't bother, since it's a NOP.
|
||||
|
||||
GraphicsCallback.PaintCallback.getInstance().
|
||||
runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS);
|
||||
runComponents(getComponentsSync(), g, GraphicsCallback.LIGHTWEIGHTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1838,7 +1875,7 @@ public class Container extends Component {
|
||||
}
|
||||
|
||||
GraphicsCallback.PrintCallback.getInstance().
|
||||
runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS);
|
||||
runComponents(getComponentsSync(), g, GraphicsCallback.LIGHTWEIGHTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1851,7 +1888,7 @@ public class Container extends Component {
|
||||
public void paintComponents(Graphics g) {
|
||||
if (isShowing()) {
|
||||
GraphicsCallback.PaintAllCallback.getInstance().
|
||||
runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.TWO_PASSES);
|
||||
runComponents(getComponentsSync(), g, GraphicsCallback.TWO_PASSES);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1873,8 +1910,8 @@ public class Container extends Component {
|
||||
void paintHeavyweightComponents(Graphics g) {
|
||||
if (isShowing()) {
|
||||
GraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
|
||||
runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS |
|
||||
GraphicsCallback.HEAVYWEIGHTS);
|
||||
runComponents(getComponentsSync(), g,
|
||||
GraphicsCallback.LIGHTWEIGHTS | GraphicsCallback.HEAVYWEIGHTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1887,7 +1924,7 @@ public class Container extends Component {
|
||||
public void printComponents(Graphics g) {
|
||||
if (isShowing()) {
|
||||
GraphicsCallback.PrintAllCallback.getInstance().
|
||||
runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.TWO_PASSES);
|
||||
runComponents(getComponentsSync(), g, GraphicsCallback.TWO_PASSES);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1909,8 +1946,8 @@ public class Container extends Component {
|
||||
void printHeavyweightComponents(Graphics g) {
|
||||
if (isShowing()) {
|
||||
GraphicsCallback.PrintHeavyweightComponentsCallback.getInstance().
|
||||
runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS |
|
||||
GraphicsCallback.HEAVYWEIGHTS);
|
||||
runComponents(getComponentsSync(), g,
|
||||
GraphicsCallback.LIGHTWEIGHTS | GraphicsCallback.HEAVYWEIGHTS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2460,9 +2497,7 @@ public class Container extends Component {
|
||||
* @since 1.2
|
||||
*/
|
||||
public Component findComponentAt(int x, int y) {
|
||||
synchronized (getTreeLock()) {
|
||||
return findComponentAt(x, y, true);
|
||||
}
|
||||
return findComponentAt(x, y, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2475,58 +2510,60 @@ public class Container extends Component {
|
||||
* The addition of this feature is temporary, pending the
|
||||
* adoption of new, public API which exports this feature.
|
||||
*/
|
||||
final Component findComponentAt(int x, int y, boolean ignoreEnabled)
|
||||
{
|
||||
if (isRecursivelyVisible()){
|
||||
return findComponentAtImpl(x, y, ignoreEnabled);
|
||||
final Component findComponentAt(int x, int y, boolean ignoreEnabled) {
|
||||
synchronized (getTreeLock()) {
|
||||
if (isRecursivelyVisible()){
|
||||
return findComponentAtImpl(x, y, ignoreEnabled);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
final Component findComponentAtImpl(int x, int y, boolean ignoreEnabled){
|
||||
checkTreeLock();
|
||||
|
||||
if (!(contains(x, y) && visible && (ignoreEnabled || enabled))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Two passes: see comment in sun.awt.SunGraphicsCallback
|
||||
synchronized (getTreeLock()) {
|
||||
for (int i = 0; i < component.size(); i++) {
|
||||
Component comp = component.get(i);
|
||||
if (comp != null &&
|
||||
!(comp.peer instanceof LightweightPeer)) {
|
||||
if (comp instanceof Container) {
|
||||
comp = ((Container)comp).findComponentAtImpl(x - comp.x,
|
||||
y - comp.y,
|
||||
ignoreEnabled);
|
||||
} else {
|
||||
comp = comp.locate(x - comp.x, y - comp.y);
|
||||
}
|
||||
if (comp != null && comp.visible &&
|
||||
(ignoreEnabled || comp.enabled))
|
||||
{
|
||||
return comp;
|
||||
}
|
||||
for (int i = 0; i < component.size(); i++) {
|
||||
Component comp = component.get(i);
|
||||
if (comp != null &&
|
||||
!(comp.peer instanceof LightweightPeer)) {
|
||||
if (comp instanceof Container) {
|
||||
comp = ((Container)comp).findComponentAtImpl(x - comp.x,
|
||||
y - comp.y,
|
||||
ignoreEnabled);
|
||||
} else {
|
||||
comp = comp.locate(x - comp.x, y - comp.y);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < component.size(); i++) {
|
||||
Component comp = component.get(i);
|
||||
if (comp != null &&
|
||||
comp.peer instanceof LightweightPeer) {
|
||||
if (comp instanceof Container) {
|
||||
comp = ((Container)comp).findComponentAtImpl(x - comp.x,
|
||||
y - comp.y,
|
||||
ignoreEnabled);
|
||||
} else {
|
||||
comp = comp.locate(x - comp.x, y - comp.y);
|
||||
}
|
||||
if (comp != null && comp.visible &&
|
||||
(ignoreEnabled || comp.enabled))
|
||||
{
|
||||
return comp;
|
||||
}
|
||||
if (comp != null && comp.visible &&
|
||||
(ignoreEnabled || comp.enabled))
|
||||
{
|
||||
return comp;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < component.size(); i++) {
|
||||
Component comp = component.get(i);
|
||||
if (comp != null &&
|
||||
comp.peer instanceof LightweightPeer) {
|
||||
if (comp instanceof Container) {
|
||||
comp = ((Container)comp).findComponentAtImpl(x - comp.x,
|
||||
y - comp.y,
|
||||
ignoreEnabled);
|
||||
} else {
|
||||
comp = comp.locate(x - comp.x, y - comp.y);
|
||||
}
|
||||
if (comp != null && comp.visible &&
|
||||
(ignoreEnabled || comp.enabled))
|
||||
{
|
||||
return comp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -2584,13 +2621,6 @@ public class Container extends Component {
|
||||
for (int i = 0; i < component.size(); i++) {
|
||||
component.get(i).addNotify();
|
||||
}
|
||||
// Update stacking order if native platform allows
|
||||
ContainerPeer cpeer = (ContainerPeer)peer;
|
||||
if (cpeer.isRestackSupported()) {
|
||||
cpeer.restack();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3488,7 +3518,7 @@ public class Container extends Component {
|
||||
private void writeObject(ObjectOutputStream s) throws IOException {
|
||||
ObjectOutputStream.PutField f = s.putFields();
|
||||
f.put("ncomponents", component.size());
|
||||
f.put("component", component.toArray(EMPTY_ARRAY));
|
||||
f.put("component", getComponentsSync());
|
||||
f.put("layoutMgr", layoutMgr);
|
||||
f.put("dispatcher", dispatcher);
|
||||
f.put("maxSize", maxSize);
|
||||
|
@ -479,7 +479,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
|
||||
// that a Component outside of the focused Window receives a
|
||||
// FOCUS_GAINED event. We synthesize a WINDOW_GAINED_FOCUS
|
||||
// event in that case.
|
||||
final Window newFocusedWindow = Component.getContainingWindow(newFocusOwner);
|
||||
final Window newFocusedWindow = SunToolkit.getContainingWindow(newFocusOwner);
|
||||
final Window currentFocusedWindow = getGlobalFocusedWindow();
|
||||
if (newFocusedWindow != null &&
|
||||
newFocusedWindow != currentFocusedWindow)
|
||||
|
@ -1226,7 +1226,7 @@ public class Dialog extends Window {
|
||||
synchronized (getTreeLock()) {
|
||||
if (keepBlockingEDT) {
|
||||
keepBlockingEDT = false;
|
||||
PeerEvent wakingEvent = new PeerEvent(this, new WakingRunnable(), PeerEvent.PRIORITY_EVENT);
|
||||
PeerEvent wakingEvent = new PeerEvent(getToolkit(), new WakingRunnable(), PeerEvent.PRIORITY_EVENT);
|
||||
AppContext curAppContext = AppContext.getAppContext();
|
||||
if (showAppContext != curAppContext) {
|
||||
// Wake up event dispatch thread on which the dialog was
|
||||
|
@ -36,6 +36,7 @@ import java.io.ObjectInputStream;
|
||||
import java.io.IOException;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.AWTAccessor;
|
||||
import java.lang.ref.WeakReference;
|
||||
import javax.accessibility.*;
|
||||
|
||||
@ -738,11 +739,15 @@ public class Frame extends Window implements MenuContainer {
|
||||
* @since 1.4
|
||||
* @see java.awt.Window#addWindowStateListener
|
||||
*/
|
||||
public synchronized void setExtendedState(int state) {
|
||||
public void setExtendedState(int state) {
|
||||
if ( !isFrameStateSupported( state ) ) {
|
||||
return;
|
||||
}
|
||||
this.state = state;
|
||||
synchronized (getObjectLock()) {
|
||||
this.state = state;
|
||||
}
|
||||
// peer.setState must be called outside of object lock
|
||||
// synchronization block to avoid possible deadlock
|
||||
FramePeer peer = (FramePeer)this.peer;
|
||||
if (peer != null) {
|
||||
peer.setState(state);
|
||||
@ -804,12 +809,27 @@ public class Frame extends Window implements MenuContainer {
|
||||
* @see #setExtendedState(int)
|
||||
* @since 1.4
|
||||
*/
|
||||
public synchronized int getExtendedState() {
|
||||
FramePeer peer = (FramePeer)this.peer;
|
||||
if (peer != null) {
|
||||
state = peer.getState();
|
||||
public int getExtendedState() {
|
||||
synchronized (getObjectLock()) {
|
||||
return state;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
static {
|
||||
AWTAccessor.setFrameAccessor(
|
||||
new AWTAccessor.FrameAccessor() {
|
||||
public void setExtendedState(Frame frame, int state) {
|
||||
synchronized(frame.getObjectLock()) {
|
||||
frame.state = state;
|
||||
}
|
||||
}
|
||||
public int getExtendedState(Frame frame) {
|
||||
synchronized(frame.getObjectLock()) {
|
||||
return frame.state;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -967,7 +987,7 @@ public class Frame extends Window implements MenuContainer {
|
||||
if (resizable) {
|
||||
str += ",resizable";
|
||||
}
|
||||
getExtendedState(); // sync with peer
|
||||
int state = getExtendedState();
|
||||
if (state == NORMAL) {
|
||||
str += ",normal";
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -434,4 +434,20 @@ public abstract class GraphicsConfiguration {
|
||||
}
|
||||
return defaultImageCaps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this GraphicsConfiguration supports
|
||||
* the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
|
||||
* PERPIXEL_TRANSLUCENT} kind of translucency.
|
||||
*
|
||||
* @param gc GraphicsConfiguration
|
||||
* @throws NullPointerException if the gc argument is null
|
||||
* @return whether the given GraphicsConfiguration supports
|
||||
* the translucency effects.
|
||||
* @see Window#setBackground(Color)
|
||||
*/
|
||||
/*public */boolean isTranslucencyCapable() {
|
||||
// Overridden in subclasses
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,10 @@
|
||||
package java.awt;
|
||||
|
||||
import java.awt.image.ColorModel;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.SunToolkit;
|
||||
|
||||
/**
|
||||
* The <code>GraphicsDevice</code> class describes the graphics devices
|
||||
@ -109,6 +112,31 @@ public abstract class GraphicsDevice {
|
||||
*/
|
||||
public final static int TYPE_IMAGE_BUFFER = 2;
|
||||
|
||||
/** Kinds of translucency supported by the underlying system.
|
||||
* @see #isTranslucencySupported
|
||||
*/
|
||||
/*public */static enum WindowTranslucency {
|
||||
/**
|
||||
* Represents support in the underlying system for windows each pixel
|
||||
* of which is guaranteed to be either completely opaque, with
|
||||
* an alpha value of 1.0, or completely transparent, with an alpha
|
||||
* value of 0.0.
|
||||
*/
|
||||
PERPIXEL_TRANSPARENT,
|
||||
/**
|
||||
* Represents support in the underlying system for windows all of
|
||||
* the pixels of which have the same alpha value between or including
|
||||
* 0.0 and 1.0.
|
||||
*/
|
||||
TRANSLUCENT,
|
||||
/**
|
||||
* Represents support in the underlying system for windows that
|
||||
* contain or might contain pixels with arbitrary alpha values
|
||||
* between and including 0.0 and 1.0.
|
||||
*/
|
||||
PERPIXEL_TRANSLUCENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this <code>GraphicsDevice</code>.
|
||||
* @return the type of this <code>GraphicsDevice</code>, which can
|
||||
@ -235,6 +263,21 @@ public abstract class GraphicsDevice {
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setFullScreenWindow(Window w) {
|
||||
if (w != null) {
|
||||
//XXX: The actions should be documented in some non-update release.
|
||||
/*
|
||||
if (w.getShape() != null) {
|
||||
w.setShape(w, null);
|
||||
}
|
||||
if (!w.isOpaque()) {
|
||||
w.setOpaque(false);
|
||||
}
|
||||
if (w.getOpacity() < 1.0f) {
|
||||
w.setOpacity(1.0f);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (fullScreenWindow != null && windowedModeBounds != null) {
|
||||
// if the window went into fs mode before it was realized it may
|
||||
// have (0,0) dimensions
|
||||
@ -424,4 +467,94 @@ public abstract class GraphicsDevice {
|
||||
public int getAvailableAcceleratedMemory() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given level of translucency is supported
|
||||
* this graphics device.
|
||||
*
|
||||
* @param translucencyKind a kind of translucency support
|
||||
* @return whether the given translucency kind is supported
|
||||
*/
|
||||
/*public */boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
|
||||
switch (translucencyKind) {
|
||||
case PERPIXEL_TRANSPARENT:
|
||||
return isWindowShapingSupported();
|
||||
case TRANSLUCENT:
|
||||
return isWindowOpacitySupported();
|
||||
case PERPIXEL_TRANSLUCENT:
|
||||
return isWindowPerpixelTranslucencySupported();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the windowing system supports changing the shape
|
||||
* of top-level windows.
|
||||
* Note that this method may sometimes return true, but the native
|
||||
* windowing system may still not support the concept of
|
||||
* shaping (due to the bugs in the windowing system).
|
||||
*/
|
||||
static boolean isWindowShapingSupported() {
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
return ((SunToolkit)curToolkit).isWindowShapingSupported();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the windowing system supports changing the opacity
|
||||
* value of top-level windows.
|
||||
* Note that this method may sometimes return true, but the native
|
||||
* windowing system may still not support the concept of
|
||||
* translucency (due to the bugs in the windowing system).
|
||||
*/
|
||||
static boolean isWindowOpacitySupported() {
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
return ((SunToolkit)curToolkit).isWindowOpacitySupported();
|
||||
}
|
||||
|
||||
boolean isWindowPerpixelTranslucencySupported() {
|
||||
/*
|
||||
* Per-pixel alpha is supported if all the conditions are TRUE:
|
||||
* 1. The toolkit is a sort of SunToolkit
|
||||
* 2. The toolkit supports translucency in general
|
||||
* (isWindowTranslucencySupported())
|
||||
* 3. There's at least one translucency-capable
|
||||
* GraphicsConfiguration
|
||||
*/
|
||||
Toolkit curToolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(curToolkit instanceof SunToolkit)) {
|
||||
return false;
|
||||
}
|
||||
if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: cache translucency capable GC
|
||||
return getTranslucencyCapableGC() != null;
|
||||
}
|
||||
|
||||
GraphicsConfiguration getTranslucencyCapableGC() {
|
||||
// If the default GC supports translucency return true.
|
||||
// It is important to optimize the verification this way,
|
||||
// see CR 6661196 for more details.
|
||||
GraphicsConfiguration defaultGC = getDefaultConfiguration();
|
||||
if (defaultGC.isTranslucencyCapable()) {
|
||||
return defaultGC;
|
||||
}
|
||||
|
||||
// ... otherwise iterate through all the GCs.
|
||||
GraphicsConfiguration[] configs = getConfigurations();
|
||||
for (int j = 0; j < configs.length; j++) {
|
||||
if (configs[j].isTranslucencyCapable()) {
|
||||
return configs[j];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ import sun.awt.HeadlessToolkit;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.CausedFocusEvent;
|
||||
import sun.awt.KeyboardFocusManagerPeerProvider;
|
||||
import sun.awt.AWTAccessor;
|
||||
|
||||
/**
|
||||
* The KeyboardFocusManager is responsible for managing the active and focused
|
||||
@ -118,6 +119,32 @@ public abstract class KeyboardFocusManager
|
||||
if (!GraphicsEnvironment.isHeadless()) {
|
||||
initIDs();
|
||||
}
|
||||
AWTAccessor.setKeyboardFocusManagerAccessor(
|
||||
new AWTAccessor.KeyboardFocusManagerAccessor() {
|
||||
public int shouldNativelyFocusHeavyweight(Component heavyweight,
|
||||
Component descendant,
|
||||
boolean temporary,
|
||||
boolean focusedWindowChangeAllowed,
|
||||
long time,
|
||||
CausedFocusEvent.Cause cause)
|
||||
{
|
||||
return KeyboardFocusManager.shouldNativelyFocusHeavyweight(
|
||||
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
|
||||
}
|
||||
public boolean processSynchronousLightweightTransfer(Component heavyweight,
|
||||
Component descendant,
|
||||
boolean temporary,
|
||||
boolean focusedWindowChangeAllowed,
|
||||
long time)
|
||||
{
|
||||
return KeyboardFocusManager.processSynchronousLightweightTransfer(
|
||||
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time);
|
||||
}
|
||||
public void removeLastFocusRequest(Component heavyweight) {
|
||||
KeyboardFocusManager.removeLastFocusRequest(heavyweight);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
transient KeyboardFocusManagerPeer peer;
|
||||
@ -2208,7 +2235,7 @@ public abstract class KeyboardFocusManager
|
||||
boolean temporary, boolean focusedWindowChangeAllowed,
|
||||
long time)
|
||||
{
|
||||
Window parentWindow = Component.getContainingWindow(heavyweight);
|
||||
Window parentWindow = SunToolkit.getContainingWindow(heavyweight);
|
||||
if (parentWindow == null || !parentWindow.syncLWRequests) {
|
||||
return false;
|
||||
}
|
||||
@ -2443,79 +2470,7 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
}
|
||||
}
|
||||
static void heavyweightButtonDown(Component heavyweight, long time) {
|
||||
heavyweightButtonDown(heavyweight, time, false);
|
||||
}
|
||||
static void heavyweightButtonDown(Component heavyweight, long time, boolean acceptDuplicates) {
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
if (heavyweight == null) {
|
||||
log.log(Level.FINE, "Assertion (heavyweight != null) failed");
|
||||
}
|
||||
if (time == 0) {
|
||||
log.log(Level.FINE, "Assertion (time != 0) failed");
|
||||
}
|
||||
}
|
||||
KeyboardFocusManager manager = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(heavyweight));
|
||||
|
||||
synchronized (heavyweightRequests) {
|
||||
HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
|
||||
Component currentNativeFocusOwner = (hwFocusRequest == null)
|
||||
? manager.getNativeFocusOwner()
|
||||
: hwFocusRequest.heavyweight;
|
||||
|
||||
// Behavior for all use cases:
|
||||
// 1. Heavyweight leaf Components (e.g., Button, Checkbox, Choice,
|
||||
// List, TextComponent, Canvas) that respond to button down.
|
||||
//
|
||||
// Native platform will generate a FOCUS_GAINED if and only if
|
||||
// the Component is not the focus owner (or, will not be the
|
||||
// focus owner when all outstanding focus requests are
|
||||
// processed).
|
||||
//
|
||||
// 2. Panel with no descendants.
|
||||
//
|
||||
// Same as (1).
|
||||
//
|
||||
// 3. Panel with at least one heavyweight descendant.
|
||||
//
|
||||
// This function should NOT be called for this case!
|
||||
//
|
||||
// 4. Panel with only lightweight descendants.
|
||||
//
|
||||
// Native platform will generate a FOCUS_GAINED if and only if
|
||||
// neither the Panel, nor any of its recursive, lightweight
|
||||
// descendants, is the focus owner. However, we want a
|
||||
// requestFocus() for any lightweight descendant to win out over
|
||||
// the focus request for the Panel. To accomplish this, we
|
||||
// differ from the algorithm for shouldNativelyFocusHeavyweight
|
||||
// as follows:
|
||||
// a. If the requestFocus() for a lightweight descendant has
|
||||
// been fully handled by the time this function is invoked,
|
||||
// then 'hwFocusRequest' will be null and 'heavyweight'
|
||||
// will be the native focus owner. Do *not* synthesize a
|
||||
// focus transfer to the Panel.
|
||||
// b. If the requestFocus() for a lightweight descendant has
|
||||
// been recorded, but not handled, then 'hwFocusRequest'
|
||||
// will be non-null and 'hwFocusRequest.heavyweight' will
|
||||
// equal 'heavyweight'. Do *not* append 'heavyweight' to
|
||||
// hwFocusRequest.lightweightRequests.
|
||||
// c. If the requestFocus() for a lightweight descendant is
|
||||
// yet to be made, then post a new HeavyweightFocusRequest.
|
||||
// If no lightweight descendant ever requests focus, then
|
||||
// the Panel will get focus. If some descendant does, then
|
||||
// the descendant will get focus by either a synthetic
|
||||
// focus transfer, or a lightweightRequests focus transfer.
|
||||
|
||||
if (acceptDuplicates || heavyweight != currentNativeFocusOwner) {
|
||||
getCurrentKeyboardFocusManager
|
||||
(SunToolkit.targetToAppContext(heavyweight)).
|
||||
enqueueKeyEvents(time, heavyweight);
|
||||
heavyweightRequests.add
|
||||
(new HeavyweightFocusRequest(heavyweight, heavyweight,
|
||||
false, CausedFocusEvent.Cause.MOUSE_EVENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the Window which will be active after processing this request,
|
||||
* or null if this is a duplicate request. The active Window is useful
|
||||
@ -2542,7 +2497,7 @@ public abstract class KeyboardFocusManager
|
||||
(HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER);
|
||||
|
||||
Component activeWindow = ((hwFocusRequest != null)
|
||||
? Component.getContainingWindow(hwFocusRequest.heavyweight)
|
||||
? SunToolkit.getContainingWindow(hwFocusRequest.heavyweight)
|
||||
: nativeFocusedWindow);
|
||||
while (activeWindow != null &&
|
||||
!((activeWindow instanceof Frame) ||
|
||||
@ -3013,8 +2968,8 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
|
||||
private static boolean focusedWindowChanged(Component to, Component from) {
|
||||
Window wto = Component.getContainingWindow(to);
|
||||
Window wfrom = Component.getContainingWindow(from);
|
||||
Window wto = SunToolkit.getContainingWindow(to);
|
||||
Window wfrom = SunToolkit.getContainingWindow(from);
|
||||
if (wto == null && wfrom == null) {
|
||||
return true;
|
||||
}
|
||||
@ -3028,8 +2983,8 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
|
||||
private static boolean isTemporary(Component to, Component from) {
|
||||
Window wto = Component.getContainingWindow(to);
|
||||
Window wfrom = Component.getContainingWindow(from);
|
||||
Window wto = SunToolkit.getContainingWindow(to);
|
||||
Window wfrom = SunToolkit.getContainingWindow(from);
|
||||
if (wto == null && wfrom == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -398,9 +398,11 @@ public class MenuItem extends MenuComponent implements Accessible {
|
||||
boolean handleShortcut(KeyEvent e) {
|
||||
MenuShortcut s = new MenuShortcut(e.getKeyCode(),
|
||||
(e.getModifiers() & InputEvent.SHIFT_MASK) > 0);
|
||||
MenuShortcut sE = new MenuShortcut(e.getExtendedKeyCode(),
|
||||
(e.getModifiers() & InputEvent.SHIFT_MASK) > 0);
|
||||
// Fix For 6185151: Menu shortcuts of all menuitems within a menu
|
||||
// should be disabled when the menu itself is disabled
|
||||
if (s.equals(shortcut) && isItemEnabled()) {
|
||||
if ((s.equals(shortcut) || sE.equals(shortcut)) && isItemEnabled()) {
|
||||
// MenuShortcut match -- issue an event on keydown.
|
||||
if (e.getID() == KeyEvent.KEY_PRESSED) {
|
||||
doMenuEvent(e.getWhen(), e.getModifiers());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,21 @@ import java.awt.event.KeyEvent;
|
||||
* For example, a menu shortcut for Ctrl-a (assuming that Control is
|
||||
* the accelerator key) would be created with code like the following:
|
||||
* <p>
|
||||
* MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A, false);
|
||||
* <code>MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A, false);</code>
|
||||
* <p> or alternatively
|
||||
* <p>
|
||||
* <code>MenuShortcut ms = new MenuShortcut(KeyEvent.getExtendedKeyCodeForChar('A'), false);</code>
|
||||
* <p>
|
||||
* Menu shortcuts may also be constructed for a wider set of keycodes
|
||||
* using the <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code> call.
|
||||
* For example, a menu shortcut for "Ctrl+cyrillic ef" is created by
|
||||
* <p>
|
||||
* <code>MenuShortcut ms = new MenuShortcut(KeyEvent.getExtendedKeyCodeForChar('\u0444'), false);</code>
|
||||
* <p>
|
||||
* Note that shortcuts created with a keycode or an extended keycode defined as a constant in <code>KeyEvent</code>
|
||||
* work regardless of the current keyboard layout. However, a shortcut made of
|
||||
* an extended keycode not listed in <code>KeyEvent</code>
|
||||
* only work if the current keyboard layout produces a corresponding letter.
|
||||
* <p>
|
||||
* The accelerator key is platform-dependent and may be obtained
|
||||
* via {@link Toolkit#getMenuShortcutKeyMask}.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,8 +25,10 @@
|
||||
package java.awt;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.im.InputContext;
|
||||
import java.awt.image.BufferStrategy;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.awt.peer.WindowPeer;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@ -49,6 +51,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.accessibility.*;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.CausedFocusEvent;
|
||||
import sun.awt.SunToolkit;
|
||||
@ -291,6 +294,25 @@ public class Window extends Container implements Accessible {
|
||||
*/
|
||||
transient boolean isInShow = false;
|
||||
|
||||
/*
|
||||
* Opacity level of the window
|
||||
*
|
||||
* @see #setOpacity(float)
|
||||
* @see #getOpacity()
|
||||
* @since 1.7
|
||||
*/
|
||||
private float opacity = 1.0f;
|
||||
|
||||
/*
|
||||
* The shape assigned to this window. This field is set to null if
|
||||
* no shape is set (rectangular window).
|
||||
*
|
||||
* @see #getShape()
|
||||
* @see #setShape(Shape)
|
||||
* @since 1.7
|
||||
*/
|
||||
private Shape shape = null;
|
||||
|
||||
private static final String base = "win";
|
||||
private static int nameCounter = 0;
|
||||
|
||||
@ -305,6 +327,23 @@ public class Window extends Container implements Accessible {
|
||||
|
||||
transient boolean isTrayIconWindow = false;
|
||||
|
||||
/**
|
||||
* These fields are initialized in the native peer code
|
||||
* or via AWTAccessor's WindowAccessor.
|
||||
*/
|
||||
private transient volatile int securityWarningWidth = 0;
|
||||
private transient volatile int securityWarningHeight = 0;
|
||||
|
||||
/**
|
||||
* These fields represent the desired location for the security
|
||||
* warning if this window is untrusted.
|
||||
* See com.sun.awt.SecurityWarning for more details.
|
||||
*/
|
||||
private transient double securityWarningPointX = 2.0;
|
||||
private transient double securityWarningPointY = 0.0;
|
||||
private transient float securityWarningAlignmentX = RIGHT_ALIGNMENT;
|
||||
private transient float securityWarningAlignmentY = TOP_ALIGNMENT;
|
||||
|
||||
static {
|
||||
/* ensure that the necessary native libraries are loaded */
|
||||
Toolkit.loadLibraries();
|
||||
@ -373,6 +412,18 @@ public class Window extends Container implements Accessible {
|
||||
}
|
||||
}
|
||||
|
||||
private GraphicsConfiguration initGC(GraphicsConfiguration gc) {
|
||||
GraphicsEnvironment.checkHeadless();
|
||||
|
||||
if (gc == null) {
|
||||
gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
|
||||
getDefaultScreenDevice().getDefaultConfiguration();
|
||||
}
|
||||
setGraphicsConfiguration(gc);
|
||||
|
||||
return gc;
|
||||
}
|
||||
|
||||
private void init(GraphicsConfiguration gc) {
|
||||
GraphicsEnvironment.checkHeadless();
|
||||
|
||||
@ -384,14 +435,10 @@ public class Window extends Container implements Accessible {
|
||||
setWarningString();
|
||||
this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
||||
this.visible = false;
|
||||
if (gc == null) {
|
||||
this.graphicsConfig =
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment().
|
||||
getDefaultScreenDevice().getDefaultConfiguration();
|
||||
} else {
|
||||
this.graphicsConfig = gc;
|
||||
}
|
||||
if (graphicsConfig.getDevice().getType() !=
|
||||
|
||||
gc = initGC(gc);
|
||||
|
||||
if (gc.getDevice().getType() !=
|
||||
GraphicsDevice.TYPE_RASTER_SCREEN) {
|
||||
throw new IllegalArgumentException("not a screen device");
|
||||
}
|
||||
@ -399,8 +446,8 @@ public class Window extends Container implements Accessible {
|
||||
|
||||
/* offset the initial location with the original of the screen */
|
||||
/* and any insets */
|
||||
Rectangle screenBounds = graphicsConfig.getBounds();
|
||||
Insets screenInsets = getToolkit().getScreenInsets(graphicsConfig);
|
||||
Rectangle screenBounds = gc.getBounds();
|
||||
Insets screenInsets = getToolkit().getScreenInsets(gc);
|
||||
int x = getX() + screenBounds.x + screenInsets.left;
|
||||
int y = getY() + screenBounds.y + screenInsets.top;
|
||||
if (x != this.x || y != this.y) {
|
||||
@ -2744,7 +2791,7 @@ public class Window extends Container implements Accessible {
|
||||
sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this));
|
||||
|
||||
addToWindowList();
|
||||
|
||||
initGC(null);
|
||||
}
|
||||
|
||||
private void deserializeResources(ObjectInputStream s)
|
||||
@ -2849,6 +2896,15 @@ public class Window extends Container implements Accessible {
|
||||
if(aot) {
|
||||
setAlwaysOnTop(aot); // since 1.5; subject to permission check
|
||||
}
|
||||
shape = (Shape)f.get("shape", null);
|
||||
opacity = (Float)f.get("opacity", 1.0f);
|
||||
|
||||
this.securityWarningWidth = 0;
|
||||
this.securityWarningHeight = 0;
|
||||
this.securityWarningPointX = 2.0;
|
||||
this.securityWarningPointY = 0.0;
|
||||
this.securityWarningAlignmentX = RIGHT_ALIGNMENT;
|
||||
this.securityWarningAlignmentY = TOP_ALIGNMENT;
|
||||
|
||||
deserializeResources(s);
|
||||
}
|
||||
@ -2916,41 +2972,18 @@ public class Window extends Container implements Accessible {
|
||||
|
||||
} // inner class AccessibleAWTWindow
|
||||
|
||||
/**
|
||||
* This method returns the GraphicsConfiguration used by this Window.
|
||||
* @since 1.3
|
||||
*/
|
||||
public GraphicsConfiguration getGraphicsConfiguration() {
|
||||
//NOTE: for multiscreen, this will need to take into account
|
||||
//which screen the window is on/mostly on instead of returning the
|
||||
//default or constructor argument config.
|
||||
synchronized(getTreeLock()) {
|
||||
if (graphicsConfig == null && !GraphicsEnvironment.isHeadless()) {
|
||||
graphicsConfig =
|
||||
GraphicsEnvironment. getLocalGraphicsEnvironment().
|
||||
getDefaultScreenDevice().
|
||||
getDefaultConfiguration();
|
||||
}
|
||||
return graphicsConfig;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset this Window's GraphicsConfiguration to match its peer.
|
||||
*/
|
||||
void resetGC() {
|
||||
if (!GraphicsEnvironment.isHeadless()) {
|
||||
// use the peer's GC
|
||||
setGCFromPeer();
|
||||
// if it's still null, use the default
|
||||
if (graphicsConfig == null) {
|
||||
graphicsConfig = GraphicsEnvironment.
|
||||
@Override
|
||||
void setGraphicsConfiguration(GraphicsConfiguration gc) {
|
||||
if (gc == null) {
|
||||
gc = GraphicsEnvironment.
|
||||
getLocalGraphicsEnvironment().
|
||||
getDefaultScreenDevice().
|
||||
getDefaultConfiguration();
|
||||
}
|
||||
}
|
||||
synchronized (getTreeLock()) {
|
||||
super.setGraphicsConfiguration(gc);
|
||||
if (log.isLoggable(Level.FINER)) {
|
||||
log.finer("+ Window.resetGC(): new GC is \n+ " + graphicsConfig + "\n+ this is " + this);
|
||||
log.finer("+ Window.setGraphicsConfiguration(): new GC is \n+ " + getGraphicsConfiguration_NoClientCode() + "\n+ this is " + this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3010,13 +3043,13 @@ public class Window extends Container implements Accessible {
|
||||
// target location
|
||||
int dx = 0, dy = 0;
|
||||
// target GC
|
||||
GraphicsConfiguration gc = this.graphicsConfig;
|
||||
GraphicsConfiguration gc = getGraphicsConfiguration_NoClientCode();
|
||||
Rectangle gcBounds = gc.getBounds();
|
||||
|
||||
Dimension windowSize = getSize();
|
||||
|
||||
// search a top-level of c
|
||||
Window componentWindow = Component.getContainingWindow(c);
|
||||
Window componentWindow = SunToolkit.getContainingWindow(c);
|
||||
if ((c == null) || (componentWindow == null)) {
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
|
||||
@ -3304,6 +3337,225 @@ public class Window extends Container implements Accessible {
|
||||
}
|
||||
|
||||
|
||||
// ******************** SHAPES & TRANSPARENCY CODE ********************
|
||||
|
||||
/**
|
||||
* JavaDoc
|
||||
*/
|
||||
/*public */float getOpacity() {
|
||||
synchronized (getTreeLock()) {
|
||||
return opacity;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JavaDoc
|
||||
*/
|
||||
/*public */void setOpacity(float opacity) {
|
||||
synchronized (getTreeLock()) {
|
||||
if (opacity < 0.0f || opacity > 1.0f) {
|
||||
throw new IllegalArgumentException(
|
||||
"The value of opacity should be in the range [0.0f .. 1.0f].");
|
||||
}
|
||||
GraphicsConfiguration gc = getGraphicsConfiguration();
|
||||
GraphicsDevice gd = gc.getDevice();
|
||||
if (!gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
|
||||
throw new UnsupportedOperationException(
|
||||
"TRANSLUCENT translucency is not supported.");
|
||||
}
|
||||
if ((gc.getDevice().getFullScreenWindow() == this) && (opacity < 1.0f)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Setting opacity for full-screen window is not supported.");
|
||||
}
|
||||
this.opacity = opacity;
|
||||
WindowPeer peer = (WindowPeer)getPeer();
|
||||
if (peer != null) {
|
||||
peer.setOpacity(opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JavaDoc
|
||||
*/
|
||||
/*public */Shape getShape() {
|
||||
synchronized (getTreeLock()) {
|
||||
return shape;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JavaDoc
|
||||
*
|
||||
* @param window the window to set the shape to
|
||||
* @param shape the shape to set to the window
|
||||
* @throws IllegalArgumentException if the window is in full screen mode,
|
||||
* and the shape is not null
|
||||
*/
|
||||
/*public */void setShape(Shape shape) {
|
||||
synchronized (getTreeLock()) {
|
||||
GraphicsConfiguration gc = getGraphicsConfiguration();
|
||||
GraphicsDevice gd = gc.getDevice();
|
||||
if (!gd.isWindowTranslucencySupported(
|
||||
GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"PERPIXEL_TRANSPARENT translucency is not supported.");
|
||||
}
|
||||
if ((gc.getDevice().getFullScreenWindow() == this) && (shape != null)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Setting shape for full-screen window is not supported.");
|
||||
}
|
||||
this.shape = shape;
|
||||
WindowPeer peer = (WindowPeer)getPeer();
|
||||
if (peer != null) {
|
||||
peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JavaDoc
|
||||
*/
|
||||
/*
|
||||
@Override
|
||||
public void setBackground(Color bgColor) {
|
||||
int alpha = bgColor.getAlpha();
|
||||
if (alpha < 255) { // non-opaque window
|
||||
GraphicsConfiguration gc = getGraphicsConfiguration();
|
||||
GraphicsDevice gd = gc.getDevice();
|
||||
if (gc.getDevice().getFullScreenWindow() == this) {
|
||||
throw new IllegalArgumentException(
|
||||
"Making full-screen window non opaque is not supported.");
|
||||
}
|
||||
if (!gc.isTranslucencyCapable()) {
|
||||
GraphicsConfiguration capableGC = gd.getTranslucencyCapableGC();
|
||||
if (capableGC == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"PERPIXEL_TRANSLUCENT translucency is not supported");
|
||||
}
|
||||
// TODO: change GC
|
||||
}
|
||||
setLayersOpaque(this, false);
|
||||
}
|
||||
|
||||
super.setBackground(bgColor);
|
||||
|
||||
WindowPeer peer = (WindowPeer)getPeer();
|
||||
if (peer != null) {
|
||||
peer.setOpaque(alpha == 255);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private transient boolean opaque = true;
|
||||
|
||||
void setOpaque(boolean opaque) {
|
||||
synchronized (getTreeLock()) {
|
||||
GraphicsConfiguration gc = getGraphicsConfiguration();
|
||||
if (!opaque && !com.sun.awt.AWTUtilities.isTranslucencyCapable(gc)) {
|
||||
throw new IllegalArgumentException(
|
||||
"The window must use a translucency-compatible graphics configuration");
|
||||
}
|
||||
if (!com.sun.awt.AWTUtilities.isTranslucencySupported(
|
||||
com.sun.awt.AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT))
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"PERPIXEL_TRANSLUCENT translucency is not supported.");
|
||||
}
|
||||
if ((gc.getDevice().getFullScreenWindow() == this) && !opaque) {
|
||||
throw new IllegalArgumentException(
|
||||
"Making full-screen window non opaque is not supported.");
|
||||
}
|
||||
setLayersOpaque(this, opaque);
|
||||
this.opaque = opaque;
|
||||
WindowPeer peer = (WindowPeer)getPeer();
|
||||
if (peer != null) {
|
||||
peer.setOpaque(opaque);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWindow(BufferedImage backBuffer) {
|
||||
synchronized (getTreeLock()) {
|
||||
WindowPeer peer = (WindowPeer)getPeer();
|
||||
if (peer != null) {
|
||||
peer.updateWindow(backBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Color TRANSPARENT_BACKGROUND_COLOR = new Color(0, 0, 0, 0);
|
||||
|
||||
private static void setLayersOpaque(Component component, boolean isOpaque) {
|
||||
// Shouldn't use instanceof to avoid loading Swing classes
|
||||
// if it's a pure AWT application.
|
||||
if (Component.doesImplement(component, "javax.swing.RootPaneContainer")) {
|
||||
javax.swing.RootPaneContainer rpc = (javax.swing.RootPaneContainer)component;
|
||||
javax.swing.JRootPane root = rpc.getRootPane();
|
||||
javax.swing.JLayeredPane lp = root.getLayeredPane();
|
||||
Container c = root.getContentPane();
|
||||
javax.swing.JComponent content =
|
||||
(c instanceof javax.swing.JComponent) ? (javax.swing.JComponent)c : null;
|
||||
javax.swing.JComponent gp =
|
||||
(rpc.getGlassPane() instanceof javax.swing.JComponent) ?
|
||||
(javax.swing.JComponent)rpc.getGlassPane() : null;
|
||||
if (gp != null) {
|
||||
gp.setDoubleBuffered(isOpaque);
|
||||
}
|
||||
lp.setOpaque(isOpaque);
|
||||
root.setOpaque(isOpaque);
|
||||
root.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
|
||||
if (content != null) {
|
||||
content.setOpaque(isOpaque);
|
||||
content.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
|
||||
|
||||
// Iterate down one level to see whether we have a JApplet
|
||||
// (which is also a RootPaneContainer) which requires processing
|
||||
int numChildren = content.getComponentCount();
|
||||
if (numChildren > 0) {
|
||||
Component child = content.getComponent(0);
|
||||
// It's OK to use instanceof here because we've
|
||||
// already loaded the RootPaneContainer class by now
|
||||
if (child instanceof javax.swing.RootPaneContainer) {
|
||||
setLayersOpaque(child, isOpaque);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Color bg = component.getBackground();
|
||||
boolean hasTransparentBg = TRANSPARENT_BACKGROUND_COLOR.equals(bg);
|
||||
|
||||
Container container = null;
|
||||
if (component instanceof Container) {
|
||||
container = (Container) component;
|
||||
}
|
||||
|
||||
if (isOpaque) {
|
||||
if (hasTransparentBg) {
|
||||
// Note: we use the SystemColor.window color as the default.
|
||||
// This color is used in the WindowPeer implementations to
|
||||
// initialize the background color of the window if it is null.
|
||||
// (This might not be the right thing to do for other
|
||||
// RootPaneContainers we might be invoked with)
|
||||
Color newColor = null;
|
||||
if (container != null && container.preserveBackgroundColor != null) {
|
||||
newColor = container.preserveBackgroundColor;
|
||||
} else {
|
||||
newColor = SystemColor.window;
|
||||
}
|
||||
component.setBackground(newColor);
|
||||
}
|
||||
} else {
|
||||
if (!hasTransparentBg && container != null) {
|
||||
container.preserveBackgroundColor = bg;
|
||||
}
|
||||
component.setBackground(TRANSPARENT_BACKGROUND_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************** MIXING CODE *******************************
|
||||
|
||||
// A window has a parent, but it does NOT have a container
|
||||
@ -3341,6 +3593,87 @@ public class Window extends Container implements Accessible {
|
||||
|
||||
// ****************** END OF MIXING CODE ********************************
|
||||
|
||||
// This method gets the window location/size as reported by the native
|
||||
// system since the locally cached values may represent outdated data.
|
||||
// NOTE: this method is invoked on the toolkit thread, and therefore
|
||||
// is not supposed to become public/user-overridable.
|
||||
private Point2D calculateSecurityWarningPosition(double x, double y,
|
||||
double w, double h)
|
||||
{
|
||||
return new Point2D.Double(
|
||||
x + w * securityWarningAlignmentX + securityWarningPointX,
|
||||
y + h * securityWarningAlignmentY + securityWarningPointY);
|
||||
}
|
||||
|
||||
static {
|
||||
AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() {
|
||||
public float getOpacity(Window window) {
|
||||
return window.opacity;
|
||||
}
|
||||
public void setOpacity(Window window, float opacity) {
|
||||
window.setOpacity(opacity);
|
||||
}
|
||||
public Shape getShape(Window window) {
|
||||
return window.getShape();
|
||||
}
|
||||
public void setShape(Window window, Shape shape) {
|
||||
window.setShape(shape);
|
||||
}
|
||||
public boolean isOpaque(Window window) {
|
||||
/*
|
||||
return window.getBackground().getAlpha() < 255;
|
||||
*/
|
||||
synchronized (window.getTreeLock()) {
|
||||
return window.opaque;
|
||||
}
|
||||
}
|
||||
public void setOpaque(Window window, boolean opaque) {
|
||||
/*
|
||||
Color bg = window.getBackground();
|
||||
window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
|
||||
opaque ? 255 : 0));
|
||||
*/
|
||||
window.setOpaque(opaque);
|
||||
}
|
||||
public void updateWindow(Window window, BufferedImage backBuffer) {
|
||||
window.updateWindow(backBuffer);
|
||||
}
|
||||
|
||||
public Dimension getSecurityWarningSize(Window window) {
|
||||
return new Dimension(window.securityWarningWidth,
|
||||
window.securityWarningHeight);
|
||||
}
|
||||
|
||||
public void setSecurityWarningSize(Window window, int width, int height)
|
||||
{
|
||||
window.securityWarningWidth = width;
|
||||
window.securityWarningHeight = height;
|
||||
}
|
||||
|
||||
public void setSecurityWarningPosition(Window window,
|
||||
Point2D point, float alignmentX, float alignmentY)
|
||||
{
|
||||
window.securityWarningPointX = point.getX();
|
||||
window.securityWarningPointY = point.getY();
|
||||
window.securityWarningAlignmentX = alignmentX;
|
||||
window.securityWarningAlignmentY = alignmentY;
|
||||
|
||||
synchronized (window.getTreeLock()) {
|
||||
WindowPeer peer = (WindowPeer)window.getPeer();
|
||||
if (peer != null) {
|
||||
peer.repositionSecurityWarning();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Point2D calculateSecurityWarningPosition(Window window,
|
||||
double x, double y, double w, double h)
|
||||
{
|
||||
return window.calculateSecurityWarningPosition(x, y, w, h);
|
||||
}
|
||||
}); // WindowAccessor
|
||||
} // static
|
||||
|
||||
} // class Window
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -65,15 +65,16 @@ import java.io.ObjectInputStream;
|
||||
* <p>
|
||||
* For key pressed and key released events, the getKeyCode method returns
|
||||
* the event's keyCode. For key typed events, the getKeyCode method
|
||||
* always returns VK_UNDEFINED.
|
||||
* always returns {@code VK_UNDEFINED}. The {@code getExtendedKeyCode} method
|
||||
* may also be used with many international keyboard layouts.
|
||||
*
|
||||
* <p>
|
||||
* <em>"Key pressed" and "key released" events</em> are lower-level and depend
|
||||
* on the platform and keyboard layout. They are generated whenever a key is
|
||||
* pressed or released, and are the only way to find out about keys that don't
|
||||
* generate character input (e.g., action keys, modifier keys, etc.). The key
|
||||
* being pressed or released is indicated by the getKeyCode method, which returns
|
||||
* a virtual key code.
|
||||
* being pressed or released is indicated by the {@code getKeyCode} and {@code getExtendedKeyCode}
|
||||
* methods, which return a virtual key code.
|
||||
*
|
||||
* <p>
|
||||
* <em>Virtual key codes</em> are used to report which keyboard key has
|
||||
@ -111,6 +112,11 @@ import java.io.ObjectInputStream;
|
||||
* platform and keyboard layout. For example, the key that generates VK_Q
|
||||
* when using a U.S. keyboard layout will generate VK_A when using a French
|
||||
* keyboard layout.
|
||||
* <li>The key that generates {@code VK_Q} when using a U.S. keyboard layout also
|
||||
* generates a unique code for Russian or Hebrew layout. There is no a
|
||||
* {@code VK_} constant for these and many other codes in various layouts. These codes
|
||||
* may be obtained by using {@code getExtendedKeyCode} and are used whenever
|
||||
* a {@code VK_} constant is used.
|
||||
* <li>Not all characters have a keycode associated with them. For example,
|
||||
* there is no keycode for the question mark because there is no keyboard
|
||||
* for which it appears on the primary layer.
|
||||
@ -891,6 +897,12 @@ public class KeyEvent extends InputEvent {
|
||||
*/
|
||||
int keyLocation;
|
||||
|
||||
//set from native code.
|
||||
private transient long rawCode = 0;
|
||||
private transient long primaryLevelUnicode = 0;
|
||||
private transient long scancode = 0; // for MS Windows only
|
||||
private transient long extendedKeyCode = 0;
|
||||
|
||||
/*
|
||||
* JDK 1.1 serialVersionUID
|
||||
*/
|
||||
@ -1315,6 +1327,9 @@ public class KeyEvent extends InputEvent {
|
||||
return numpad + "-" + c;
|
||||
}
|
||||
|
||||
if ((keyCode & 0x01000000) != 0) {
|
||||
return String.valueOf((char)(keyCode ^ 0x01000000 ));
|
||||
}
|
||||
String unknown = Toolkit.getProperty("AWT.unknown", "Unknown");
|
||||
return unknown + " keyCode: 0x" + Integer.toString(keyCode, 16);
|
||||
}
|
||||
@ -1551,9 +1566,44 @@ public class KeyEvent extends InputEvent {
|
||||
str.append("KEY_LOCATION_UNKNOWN");
|
||||
break;
|
||||
}
|
||||
str.append(",rawCode=").append(rawCode);
|
||||
str.append(",primaryLevelUnicode=").append(primaryLevelUnicode);
|
||||
str.append(",scancode=").append(scancode);
|
||||
str.append(",extendedKeyCode=0x").append(Long.toHexString(extendedKeyCode));
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
/**
|
||||
* Returns an extended key code for the event.
|
||||
* The extended key code is a unique id assigned to a key on the keyboard
|
||||
* just like {@code keyCode}. However, unlike {@code keyCode}, this value depends on the
|
||||
* current keyboard layout. For instance, pressing the left topmost letter key
|
||||
* in a common English layout produces the same value as {@code keyCode}, {@code VK_Q}.
|
||||
* Pressing the same key in a regular Russian layout gives another code, unique for the
|
||||
* letter "Cyrillic I short".
|
||||
*
|
||||
* @since 1.7
|
||||
*
|
||||
*/
|
||||
public int getExtendedKeyCode() {
|
||||
return (int)extendedKeyCode;
|
||||
}
|
||||
/**
|
||||
* Returns an extended key code for a unicode character.
|
||||
*
|
||||
* @return for a unicode character with a corresponding {@code VK_} constant -- this
|
||||
* {@code VK_} constant; for a character appearing on the primary
|
||||
* level of a known keyboard layout -- a unique integer.
|
||||
* If a character does not appear on the primary level of a known keyboard,
|
||||
* {@code VK_UNDEFINED} is returned.
|
||||
*
|
||||
* @since 1.7
|
||||
*
|
||||
*/
|
||||
public static int getExtendedKeyCodeForChar(int c) {
|
||||
// Return a keycode (if any) associated with a character.
|
||||
return sun.awt.ExtendedKeyCodes.getExtendedKeyCodeForChar(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets new modifiers by the old ones. The key modifiers
|
||||
|
@ -25,6 +25,7 @@
|
||||
package java.awt.peer;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
|
||||
/**
|
||||
* The peer interface for {@link Canvas}.
|
||||
@ -36,4 +37,13 @@ import java.awt.Canvas;
|
||||
* instances.
|
||||
*/
|
||||
public interface CanvasPeer extends ComponentPeer {
|
||||
/**
|
||||
* Requests a GC that best suits this Canvas. The returned GC may differ
|
||||
* from the requested GC passed as the argument to this method. This method
|
||||
* must return a non-null value (given the argument is non-null as well).
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
GraphicsConfiguration getAppropriateGraphicsConfiguration(
|
||||
GraphicsConfiguration gc);
|
||||
}
|
||||
|
@ -539,4 +539,16 @@ public interface ComponentPeer {
|
||||
*/
|
||||
void applyShape(Region shape);
|
||||
|
||||
/**
|
||||
* Lowers this component at the bottom of the above HW peer. If the above parameter
|
||||
* is null then the method places this component at the top of the Z-order.
|
||||
*/
|
||||
void setZOrder(ComponentPeer above);
|
||||
|
||||
/**
|
||||
* Updates internal data structures related to the component's GC.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
void updateGraphicsData(GraphicsConfiguration gc);
|
||||
}
|
||||
|
@ -76,21 +76,4 @@ public interface ContainerPeer extends ComponentPeer {
|
||||
* @see Container#validateTree()
|
||||
*/
|
||||
void endLayout();
|
||||
|
||||
/**
|
||||
* Restacks native windows - children of this native window - according to
|
||||
* Java container order.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
void restack();
|
||||
|
||||
/**
|
||||
* Indicates availability of restacking operation in this container.
|
||||
*
|
||||
* @return Returns true if restack is supported, false otherwise
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
boolean isRestackSupported();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,8 @@ package java.awt.peer;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* The peer interface for {@link Window}.
|
||||
*
|
||||
@ -92,4 +94,31 @@ public interface WindowPeer extends ContainerPeer {
|
||||
* @see Window#setIconImages(java.util.List)
|
||||
*/
|
||||
void updateIconImages();
|
||||
|
||||
/**
|
||||
* Sets the level of opacity for the window.
|
||||
*
|
||||
* @see Window#setOpacity(float)
|
||||
*/
|
||||
void setOpacity(float opacity);
|
||||
|
||||
/**
|
||||
* Enables the per-pixel alpha support for the window.
|
||||
*
|
||||
* @see Window#setBackground(Color)
|
||||
*/
|
||||
void setOpaque(boolean isOpaque);
|
||||
|
||||
/**
|
||||
* Updates the native part of non-opaque window using
|
||||
* the given image with color+alpha values for each pixel.
|
||||
*
|
||||
* @see Window#setBackground(Color)
|
||||
*/
|
||||
void updateWindow(BufferedImage backBuffer);
|
||||
|
||||
/**
|
||||
* Instructs the peer to update the position of the security warning.
|
||||
*/
|
||||
void repositionSecurityWarning();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,26 +27,41 @@ package java.beans;
|
||||
|
||||
import com.sun.beans.finder.ClassFinder;
|
||||
|
||||
import java.applet.*;
|
||||
import java.applet.Applet;
|
||||
import java.applet.AppletContext;
|
||||
import java.applet.AppletStub;
|
||||
import java.applet.AudioClip;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import java.beans.AppletInitializer;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Image;
|
||||
|
||||
import java.beans.beancontext.BeanContext;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectStreamClass;
|
||||
import java.io.StreamCorruptedException;
|
||||
|
||||
import java.net.URL;
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import sun.awt.AppContext;
|
||||
|
||||
/**
|
||||
* This class provides some general purpose beans control methods.
|
||||
*/
|
||||
|
||||
public class Beans {
|
||||
private static final Object DESIGN_TIME = new Object();
|
||||
private static final Object GUI_AVAILABLE = new Object();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -59,12 +74,12 @@ public class Beans {
|
||||
* @param beanName the name of the bean within the class-loader.
|
||||
* For example "sun.beanbox.foobah"
|
||||
*
|
||||
* @exception java.lang.ClassNotFoundException if the class of a serialized
|
||||
* @exception ClassNotFoundException if the class of a serialized
|
||||
* object could not be found.
|
||||
* @exception java.io.IOException if an I/O error occurs.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
||||
public static Object instantiate(ClassLoader cls, String beanName) throws java.io.IOException, ClassNotFoundException {
|
||||
public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException {
|
||||
return Beans.instantiate(cls, beanName, null, null);
|
||||
}
|
||||
|
||||
@ -80,12 +95,12 @@ public class Beans {
|
||||
* For example "sun.beanbox.foobah"
|
||||
* @param beanContext The BeanContext in which to nest the new bean
|
||||
*
|
||||
* @exception java.lang.ClassNotFoundException if the class of a serialized
|
||||
* @exception ClassNotFoundException if the class of a serialized
|
||||
* object could not be found.
|
||||
* @exception java.io.IOException if an I/O error occurs.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
||||
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException {
|
||||
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
|
||||
return Beans.instantiate(cls, beanName, beanContext, null);
|
||||
}
|
||||
|
||||
@ -135,19 +150,19 @@ public class Beans {
|
||||
* @param beanContext The BeanContext in which to nest the new bean
|
||||
* @param initializer The AppletInitializer for the new bean
|
||||
*
|
||||
* @exception java.lang.ClassNotFoundException if the class of a serialized
|
||||
* @exception ClassNotFoundException if the class of a serialized
|
||||
* object could not be found.
|
||||
* @exception java.io.IOException if an I/O error occurs.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
|
||||
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
||||
java.io.InputStream ins;
|
||||
java.io.ObjectInputStream oins = null;
|
||||
InputStream ins;
|
||||
ObjectInputStream oins = null;
|
||||
Object result = null;
|
||||
boolean serialized = false;
|
||||
java.io.IOException serex = null;
|
||||
IOException serex = null;
|
||||
|
||||
// If the given classloader is null, we check if an
|
||||
// system classloader is available and (if so)
|
||||
@ -166,8 +181,8 @@ public class Beans {
|
||||
// Try to find a serialized object with this name
|
||||
final String serName = beanName.replace('.','/').concat(".ser");
|
||||
final ClassLoader loader = cls;
|
||||
ins = (InputStream)java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction() {
|
||||
ins = (InputStream)AccessController.doPrivileged
|
||||
(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
if (loader == null)
|
||||
return ClassLoader.getSystemResourceAsStream(serName);
|
||||
@ -185,7 +200,7 @@ public class Beans {
|
||||
result = oins.readObject();
|
||||
serialized = true;
|
||||
oins.close();
|
||||
} catch (java.io.IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
ins.close();
|
||||
// Drop through and try opening the class. But remember
|
||||
// the exception in case we can't find the class either.
|
||||
@ -264,8 +279,8 @@ public class Beans {
|
||||
|
||||
final ClassLoader cloader = cls;
|
||||
objectUrl = (URL)
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction() {
|
||||
AccessController.doPrivileged
|
||||
(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
if (cloader == null)
|
||||
return ClassLoader.getSystemResource
|
||||
@ -377,10 +392,11 @@ public class Beans {
|
||||
* @return True if we are running in an application construction
|
||||
* environment.
|
||||
*
|
||||
* @see java.beans.DesignMode
|
||||
* @see DesignMode
|
||||
*/
|
||||
public static boolean isDesignTime() {
|
||||
return designTime;
|
||||
Object value = AppContext.getAppContext().get(DESIGN_TIME);
|
||||
return (value instanceof Boolean) && (Boolean) value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -393,11 +409,12 @@ public class Beans {
|
||||
* false in a server environment or if an application is
|
||||
* running as part of a batch job.
|
||||
*
|
||||
* @see java.beans.Visibility
|
||||
* @see Visibility
|
||||
*
|
||||
*/
|
||||
public static boolean isGuiAvailable() {
|
||||
return guiAvailable;
|
||||
Object value = AppContext.getAppContext().get(GUI_AVAILABLE);
|
||||
return (value instanceof Boolean) ? (Boolean) value : !GraphicsEnvironment.isHeadless();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -423,7 +440,7 @@ public class Beans {
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
}
|
||||
designTime = isDesignTime;
|
||||
AppContext.getAppContext().put(DESIGN_TIME, Boolean.valueOf(isDesignTime));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -449,14 +466,7 @@ public class Beans {
|
||||
if (sm != null) {
|
||||
sm.checkPropertiesAccess();
|
||||
}
|
||||
guiAvailable = isGuiAvailable;
|
||||
}
|
||||
|
||||
|
||||
private static boolean designTime;
|
||||
private static boolean guiAvailable;
|
||||
static {
|
||||
guiAvailable = !GraphicsEnvironment.isHeadless();
|
||||
AppContext.getAppContext().put(GUI_AVAILABLE, Boolean.valueOf(isGuiAvailable));
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,7 +511,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream
|
||||
|
||||
class BeansAppletContext implements AppletContext {
|
||||
Applet target;
|
||||
java.util.Hashtable imageCache = new java.util.Hashtable();
|
||||
Hashtable imageCache = new Hashtable();
|
||||
|
||||
BeansAppletContext(Applet target) {
|
||||
this.target = target;
|
||||
@ -546,8 +556,8 @@ class BeansAppletContext implements AppletContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
public java.util.Enumeration getApplets() {
|
||||
java.util.Vector applets = new java.util.Vector();
|
||||
public Enumeration getApplets() {
|
||||
Vector applets = new Vector();
|
||||
applets.addElement(target);
|
||||
return applets.elements();
|
||||
}
|
||||
@ -573,7 +583,7 @@ class BeansAppletContext implements AppletContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
public java.util.Iterator getStreamKeys(){
|
||||
public Iterator getStreamKeys(){
|
||||
// We do nothing.
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,6 +41,7 @@ package java.beans;
|
||||
* @author Mark Davidson
|
||||
*/
|
||||
public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
|
||||
private static final long serialVersionUID = -320227448495806870L;
|
||||
|
||||
private int index;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,6 +36,7 @@ package java.beans;
|
||||
|
||||
public
|
||||
class IntrospectionException extends Exception {
|
||||
private static final long serialVersionUID = -3728150539969542619L;
|
||||
|
||||
/**
|
||||
* Constructs an <code>IntrospectionException</code> with a
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,6 +44,7 @@ package java.beans;
|
||||
*/
|
||||
|
||||
public class PropertyChangeEvent extends java.util.EventObject {
|
||||
private static final long serialVersionUID = 7042693688939648123L;
|
||||
|
||||
/**
|
||||
* Constructs a new <code>PropertyChangeEvent</code>.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,7 +33,7 @@ package java.beans;
|
||||
|
||||
public
|
||||
class PropertyVetoException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 129596057694162164L;
|
||||
|
||||
/**
|
||||
* Constructs a <code>PropertyVetoException</code> with a
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,6 +48,7 @@ import java.beans.beancontext.BeanContext;
|
||||
*/
|
||||
|
||||
public abstract class BeanContextEvent extends EventObject {
|
||||
private static final long serialVersionUID = 7267998073569045052L;
|
||||
|
||||
/**
|
||||
* Contruct a BeanContextEvent
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@ import java.util.Iterator;
|
||||
* @see java.beans.beancontext.BeanContextMembershipListener
|
||||
*/
|
||||
public class BeanContextMembershipEvent extends BeanContextEvent {
|
||||
private static final long serialVersionUID = 3499346510334590959L;
|
||||
|
||||
/**
|
||||
* Contruct a BeanContextMembershipEvent
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,6 +40,7 @@ import java.util.Iterator;
|
||||
*/
|
||||
|
||||
public class BeanContextServiceAvailableEvent extends BeanContextEvent {
|
||||
private static final long serialVersionUID = -5333985775656400778L;
|
||||
|
||||
/**
|
||||
* Construct a <code>BeanContextAvailableServiceEvent</code>.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,7 @@ import java.beans.beancontext.BeanContextServices;
|
||||
* </p>
|
||||
*/
|
||||
public class BeanContextServiceRevokedEvent extends BeanContextEvent {
|
||||
private static final long serialVersionUID = -1295543154724961754L;
|
||||
|
||||
/**
|
||||
* Construct a <code>BeanContextServiceEvent</code>.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -60,6 +60,7 @@ import java.util.Locale;
|
||||
|
||||
public class BeanContextServicesSupport extends BeanContextSupport
|
||||
implements BeanContextServices {
|
||||
private static final long serialVersionUID = -8494482757288719206L;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -594,6 +595,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
*/
|
||||
|
||||
protected static class BCSSServiceProvider implements Serializable {
|
||||
private static final long serialVersionUID = 861278251667444782L;
|
||||
|
||||
BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
|
||||
super();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -920,9 +920,9 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
*/
|
||||
public static final UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS =
|
||||
new UnicodeBlock("COMBINING_MARKS_FOR_SYMBOLS", new String[] {"Combining Diacritical Marks for Symbols",
|
||||
"CombiningDiacriticalMarksforSymbols",
|
||||
"Combining Marks for Symbols",
|
||||
"CombiningMarksforSymbols" });
|
||||
"CombiningDiacriticalMarksforSymbols",
|
||||
"Combining Marks for Symbols",
|
||||
"CombiningMarksforSymbols" });
|
||||
|
||||
/**
|
||||
* Constant for the "Letterlike Symbols" Unicode character block.
|
||||
@ -1332,8 +1332,11 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
* @since 1.5
|
||||
*/
|
||||
public static final UnicodeBlock CYRILLIC_SUPPLEMENTARY =
|
||||
new UnicodeBlock("CYRILLIC_SUPPLEMENTARY", new String[] {"Cyrillic Supplementary",
|
||||
"CyrillicSupplementary"});
|
||||
new UnicodeBlock("CYRILLIC_SUPPLEMENTARY",
|
||||
new String[] {"Cyrillic Supplementary",
|
||||
"CyrillicSupplementary",
|
||||
"Cyrillic Supplement",
|
||||
"CyrillicSupplement"});
|
||||
|
||||
/**
|
||||
* Constant for the "Tagalog" Unicode character block.
|
||||
@ -1641,157 +1644,579 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
public static final UnicodeBlock LOW_SURROGATES =
|
||||
new UnicodeBlock("LOW_SURROGATES", new String[] {"Low Surrogates", "LowSurrogates"});
|
||||
|
||||
/**
|
||||
* Constant for the "Arabic Supplement" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock ARABIC_SUPPLEMENT =
|
||||
new UnicodeBlock("ARABIC_SUPPLEMENT",
|
||||
new String[] { "Arabic Supplement",
|
||||
"ArabicSupplement"});
|
||||
|
||||
/**
|
||||
* Constant for the "NKo" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock NKO = new UnicodeBlock("NKO");
|
||||
|
||||
/**
|
||||
* Constant for the "Ethiopic Supplement" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock ETHIOPIC_SUPPLEMENT =
|
||||
new UnicodeBlock("ETHIOPIC_SUPPLEMENT",
|
||||
new String[] { "Ethiopic Supplement",
|
||||
"EthiopicSupplement"});
|
||||
|
||||
/**
|
||||
* Constant for the "New Tai Lue" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock NEW_TAI_LUE =
|
||||
new UnicodeBlock("NEW_TAI_LUE",
|
||||
new String[] { "New Tai Lue",
|
||||
"NewTaiLue"});
|
||||
|
||||
/**
|
||||
* Constant for the "Buginese" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock BUGINESE =
|
||||
new UnicodeBlock("BUGINESE");
|
||||
|
||||
/**
|
||||
* Constant for the "Balinese" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock BALINESE =
|
||||
new UnicodeBlock("BALINESE");
|
||||
|
||||
/**
|
||||
* Constant for the "Sundanese" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock SUNDANESE =
|
||||
new UnicodeBlock("SUNDANESE");
|
||||
|
||||
/**
|
||||
* Constant for the "Lepcha" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock LEPCHA = new UnicodeBlock("LEPCHA");
|
||||
|
||||
/**
|
||||
* Constant for the "Ol Chiki" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock OL_CHIKI =
|
||||
new UnicodeBlock("OL_CHIKI",
|
||||
new String[] { "Ol Chiki",
|
||||
"OlChiki"});
|
||||
|
||||
/**
|
||||
* Constant for the "Phonetic Extensions Supplement" Unicode character
|
||||
* block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock PHONETIC_EXTENSIONS_SUPPLEMENT =
|
||||
new UnicodeBlock("PHONETIC_EXTENSIONS_SUPPLEMENT",
|
||||
new String[] { "Phonetic Extensions Supplement",
|
||||
"PhoneticExtensionsSupplement"});
|
||||
|
||||
/**
|
||||
* Constant for the "Combining Diacritical Marks Supplement" Unicode
|
||||
* character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS_SUPPLEMENT =
|
||||
new UnicodeBlock("COMBINING_DIACRITICAL_MARKS_SUPPLEMENT",
|
||||
new String[] { "Combining Diacritical Marks Supplement",
|
||||
"CombiningDiacriticalMarksSupplement"});
|
||||
|
||||
/**
|
||||
* Constant for the "Glagolitic" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock GLAGOLITIC =
|
||||
new UnicodeBlock("GLAGOLITIC");
|
||||
|
||||
/**
|
||||
* Constant for the "Latin Extended-C" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock LATIN_EXTENDED_C =
|
||||
new UnicodeBlock("LATIN_EXTENDED_C",
|
||||
new String[] { "Latin Extended-C",
|
||||
"LatinExtended-C"});
|
||||
|
||||
/**
|
||||
* Constant for the "Coptic" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock COPTIC = new UnicodeBlock("COPTIC");
|
||||
|
||||
/**
|
||||
* Constant for the "Georgian Supplement" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock GEORGIAN_SUPPLEMENT =
|
||||
new UnicodeBlock("GEORGIAN_SUPPLEMENT",
|
||||
new String[] { "Georgian Supplement",
|
||||
"GeorgianSupplement"});
|
||||
|
||||
/**
|
||||
* Constant for the "Tifinagh" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock TIFINAGH =
|
||||
new UnicodeBlock("TIFINAGH");
|
||||
|
||||
/**
|
||||
* Constant for the "Ethiopic Extended" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock ETHIOPIC_EXTENDED =
|
||||
new UnicodeBlock("ETHIOPIC_EXTENDED",
|
||||
new String[] { "Ethiopic Extended",
|
||||
"EthiopicExtended"});
|
||||
|
||||
/**
|
||||
* Constant for the "Cyrillic Extended-A" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CYRILLIC_EXTENDED_A =
|
||||
new UnicodeBlock("CYRILLIC_EXTENDED_A",
|
||||
new String[] { "Cyrillic Extended-A",
|
||||
"CyrillicExtended-A"});
|
||||
|
||||
/**
|
||||
* Constant for the "Supplemental Punctuation" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock SUPPLEMENTAL_PUNCTUATION =
|
||||
new UnicodeBlock("SUPPLEMENTAL_PUNCTUATION",
|
||||
new String[] { "Supplemental Punctuation",
|
||||
"SupplementalPunctuation"});
|
||||
|
||||
/**
|
||||
* Constant for the "CJK Strokes" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CJK_STROKES =
|
||||
new UnicodeBlock("CJK_STROKES",
|
||||
new String[] { "CJK Strokes",
|
||||
"CJKStrokes"});
|
||||
|
||||
/**
|
||||
* Constant for the "Vai" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock VAI = new UnicodeBlock("VAI");
|
||||
|
||||
/**
|
||||
* Constant for the "Cyrillic Extended-B" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CYRILLIC_EXTENDED_B =
|
||||
new UnicodeBlock("CYRILLIC_EXTENDED_B",
|
||||
new String[] { "Cyrillic Extended-B",
|
||||
"CyrillicExtended-B"});
|
||||
|
||||
/**
|
||||
* Constant for the "Modifier Tone Letters" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock MODIFIER_TONE_LETTERS =
|
||||
new UnicodeBlock("MODIFIER_TONE_LETTERS",
|
||||
new String[] { "Modifier Tone Letters",
|
||||
"ModifierToneLetters"});
|
||||
|
||||
/**
|
||||
* Constant for the "Latin Extended-D" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock LATIN_EXTENDED_D =
|
||||
new UnicodeBlock("LATIN_EXTENDED_D",
|
||||
new String[] { "Latin Extended-D",
|
||||
"LatinExtended-D"});
|
||||
|
||||
/**
|
||||
* Constant for the "Syloti Nagri" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock SYLOTI_NAGRI =
|
||||
new UnicodeBlock("SYLOTI_NAGRI",
|
||||
new String[] { "Syloti Nagri",
|
||||
"SylotiNagri"});
|
||||
|
||||
/**
|
||||
* Constant for the "Phags-pa" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock PHAGS_PA =
|
||||
new UnicodeBlock("PHAGS_PA", new String[] { "Phags-pa"});
|
||||
|
||||
/**
|
||||
* Constant for the "Saurashtra" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock SAURASHTRA =
|
||||
new UnicodeBlock("SAURASHTRA");
|
||||
|
||||
/**
|
||||
* Constant for the "Kayah Li" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock KAYAH_LI =
|
||||
new UnicodeBlock("KAYAH_LI",
|
||||
new String[] { "Kayah Li",
|
||||
"KayahLi"});
|
||||
|
||||
/**
|
||||
* Constant for the "Rejang" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock REJANG = new UnicodeBlock("REJANG");
|
||||
|
||||
/**
|
||||
* Constant for the "Cham" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CHAM = new UnicodeBlock("CHAM");
|
||||
|
||||
/**
|
||||
* Constant for the "Vertical Forms" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock VERTICAL_FORMS =
|
||||
new UnicodeBlock("VERTICAL_FORMS",
|
||||
new String[] { "Vertical Forms",
|
||||
"VerticalForms"});
|
||||
|
||||
/**
|
||||
* Constant for the "Ancient Greek Numbers" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock ANCIENT_GREEK_NUMBERS =
|
||||
new UnicodeBlock("ANCIENT_GREEK_NUMBERS",
|
||||
new String[] { "Ancient Greek Numbers",
|
||||
"AncientGreekNumbers"});
|
||||
|
||||
/**
|
||||
* Constant for the "Ancient Symbols" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock ANCIENT_SYMBOLS =
|
||||
new UnicodeBlock("ANCIENT_SYMBOLS",
|
||||
new String[] { "Ancient Symbols",
|
||||
"AncientSymbols"});
|
||||
|
||||
/**
|
||||
* Constant for the "Phaistos Disc" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock PHAISTOS_DISC =
|
||||
new UnicodeBlock("PHAISTOS_DISC",
|
||||
new String[] { "Phaistos Disc",
|
||||
"PhaistosDisc"});
|
||||
|
||||
/**
|
||||
* Constant for the "Lycian" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock LYCIAN = new UnicodeBlock("LYCIAN");
|
||||
|
||||
/**
|
||||
* Constant for the "Carian" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CARIAN = new UnicodeBlock("CARIAN");
|
||||
|
||||
/**
|
||||
* Constant for the "Old Persian" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock OLD_PERSIAN =
|
||||
new UnicodeBlock("OLD_PERSIAN",
|
||||
new String[] { "Old Persian",
|
||||
"OldPersian"});
|
||||
|
||||
/**
|
||||
* Constant for the "Phoenician" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock PHOENICIAN =
|
||||
new UnicodeBlock("PHOENICIAN");
|
||||
|
||||
/**
|
||||
* Constant for the "Lydian" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock LYDIAN = new UnicodeBlock("LYDIAN");
|
||||
|
||||
/**
|
||||
* Constant for the "Kharoshthi" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock KHAROSHTHI =
|
||||
new UnicodeBlock("KHAROSHTHI");
|
||||
|
||||
/**
|
||||
* Constant for the "Cuneiform" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CUNEIFORM =
|
||||
new UnicodeBlock("CUNEIFORM");
|
||||
|
||||
/**
|
||||
* Constant for the "Cuneiform Numbers and Punctuation" Unicode
|
||||
* character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock CUNEIFORM_NUMBERS_AND_PUNCTUATION =
|
||||
new UnicodeBlock("CUNEIFORM_NUMBERS_AND_PUNCTUATION",
|
||||
new String[] { "Cuneiform Numbers and Punctuation",
|
||||
"CuneiformNumbersandPunctuation"});
|
||||
|
||||
/**
|
||||
* Constant for the "Ancient Greek Musical Notation" Unicode character
|
||||
* block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock ANCIENT_GREEK_MUSICAL_NOTATION =
|
||||
new UnicodeBlock("ANCIENT_GREEK_MUSICAL_NOTATION",
|
||||
new String[] { "Ancient Greek Musical Notation",
|
||||
"AncientGreekMusicalNotation"});
|
||||
|
||||
/**
|
||||
* Constant for the "Counting Rod Numerals" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock COUNTING_ROD_NUMERALS =
|
||||
new UnicodeBlock("COUNTING_ROD_NUMERALS",
|
||||
new String[] { "Counting Rod Numerals",
|
||||
"CountingRodNumerals"});
|
||||
|
||||
/**
|
||||
* Constant for the "Mahjong Tiles" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock MAHJONG_TILES =
|
||||
new UnicodeBlock("MAHJONG_TILES",
|
||||
new String[] { "Mahjong Tiles",
|
||||
"MahjongTiles"});
|
||||
|
||||
/**
|
||||
* Constant for the "Domino Tiles" Unicode character block.
|
||||
* @since 1.7
|
||||
*/
|
||||
public static final UnicodeBlock DOMINO_TILES =
|
||||
new UnicodeBlock("DOMINO_TILES",
|
||||
new String[] { "Domino Tiles",
|
||||
"DominoTiles"});
|
||||
|
||||
private static final int blockStarts[] = {
|
||||
0x0000, // Basic Latin
|
||||
0x0080, // Latin-1 Supplement
|
||||
0x0100, // Latin Extended-A
|
||||
0x0180, // Latin Extended-B
|
||||
0x0250, // IPA Extensions
|
||||
0x02B0, // Spacing Modifier Letters
|
||||
0x0300, // Combining Diacritical Marks
|
||||
0x0370, // Greek and Coptic
|
||||
0x0400, // Cyrillic
|
||||
0x0500, // Cyrillic Supplementary
|
||||
0x0530, // Armenian
|
||||
0x0590, // Hebrew
|
||||
0x0600, // Arabic
|
||||
0x0700, // Syriac
|
||||
0x0750, // unassigned
|
||||
0x0780, // Thaana
|
||||
0x07C0, // unassigned
|
||||
0x0900, // Devanagari
|
||||
0x0980, // Bengali
|
||||
0x0A00, // Gurmukhi
|
||||
0x0A80, // Gujarati
|
||||
0x0B00, // Oriya
|
||||
0x0B80, // Tamil
|
||||
0x0C00, // Telugu
|
||||
0x0C80, // Kannada
|
||||
0x0D00, // Malayalam
|
||||
0x0D80, // Sinhala
|
||||
0x0E00, // Thai
|
||||
0x0E80, // Lao
|
||||
0x0F00, // Tibetan
|
||||
0x1000, // Myanmar
|
||||
0x10A0, // Georgian
|
||||
0x1100, // Hangul Jamo
|
||||
0x1200, // Ethiopic
|
||||
0x1380, // unassigned
|
||||
0x13A0, // Cherokee
|
||||
0x1400, // Unified Canadian Aboriginal Syllabics
|
||||
0x1680, // Ogham
|
||||
0x16A0, // Runic
|
||||
0x1700, // Tagalog
|
||||
0x1720, // Hanunoo
|
||||
0x1740, // Buhid
|
||||
0x1760, // Tagbanwa
|
||||
0x1780, // Khmer
|
||||
0x1800, // Mongolian
|
||||
0x18B0, // unassigned
|
||||
0x1900, // Limbu
|
||||
0x1950, // Tai Le
|
||||
0x1980, // unassigned
|
||||
0x19E0, // Khmer Symbols
|
||||
0x1A00, // unassigned
|
||||
0x1D00, // Phonetic Extensions
|
||||
0x1D80, // unassigned
|
||||
0x1E00, // Latin Extended Additional
|
||||
0x1F00, // Greek Extended
|
||||
0x2000, // General Punctuation
|
||||
0x2070, // Superscripts and Subscripts
|
||||
0x20A0, // Currency Symbols
|
||||
0x20D0, // Combining Diacritical Marks for Symbols
|
||||
0x2100, // Letterlike Symbols
|
||||
0x2150, // Number Forms
|
||||
0x2190, // Arrows
|
||||
0x2200, // Mathematical Operators
|
||||
0x2300, // Miscellaneous Technical
|
||||
0x2400, // Control Pictures
|
||||
0x2440, // Optical Character Recognition
|
||||
0x2460, // Enclosed Alphanumerics
|
||||
0x2500, // Box Drawing
|
||||
0x2580, // Block Elements
|
||||
0x25A0, // Geometric Shapes
|
||||
0x2600, // Miscellaneous Symbols
|
||||
0x2700, // Dingbats
|
||||
0x27C0, // Miscellaneous Mathematical Symbols-A
|
||||
0x27F0, // Supplemental Arrows-A
|
||||
0x2800, // Braille Patterns
|
||||
0x2900, // Supplemental Arrows-B
|
||||
0x2980, // Miscellaneous Mathematical Symbols-B
|
||||
0x2A00, // Supplemental Mathematical Operators
|
||||
0x2B00, // Miscellaneous Symbols and Arrows
|
||||
0x2C00, // unassigned
|
||||
0x2E80, // CJK Radicals Supplement
|
||||
0x2F00, // Kangxi Radicals
|
||||
0x2FE0, // unassigned
|
||||
0x2FF0, // Ideographic Description Characters
|
||||
0x3000, // CJK Symbols and Punctuation
|
||||
0x3040, // Hiragana
|
||||
0x30A0, // Katakana
|
||||
0x3100, // Bopomofo
|
||||
0x3130, // Hangul Compatibility Jamo
|
||||
0x3190, // Kanbun
|
||||
0x31A0, // Bopomofo Extended
|
||||
0x31C0, // unassigned
|
||||
0x31F0, // Katakana Phonetic Extensions
|
||||
0x3200, // Enclosed CJK Letters and Months
|
||||
0x3300, // CJK Compatibility
|
||||
0x3400, // CJK Unified Ideographs Extension A
|
||||
0x4DC0, // Yijing Hexagram Symbols
|
||||
0x4E00, // CJK Unified Ideographs
|
||||
0xA000, // Yi Syllables
|
||||
0xA490, // Yi Radicals
|
||||
0xA4D0, // unassigned
|
||||
0xAC00, // Hangul Syllables
|
||||
0xD7B0, // unassigned
|
||||
0xD800, // High Surrogates
|
||||
0xDB80, // High Private Use Surrogates
|
||||
0xDC00, // Low Surrogates
|
||||
0xE000, // Private Use
|
||||
0xF900, // CJK Compatibility Ideographs
|
||||
0xFB00, // Alphabetic Presentation Forms
|
||||
0xFB50, // Arabic Presentation Forms-A
|
||||
0xFE00, // Variation Selectors
|
||||
0xFE10, // unassigned
|
||||
0xFE20, // Combining Half Marks
|
||||
0xFE30, // CJK Compatibility Forms
|
||||
0xFE50, // Small Form Variants
|
||||
0xFE70, // Arabic Presentation Forms-B
|
||||
0xFF00, // Halfwidth and Fullwidth Forms
|
||||
0xFFF0, // Specials
|
||||
0x10000, // Linear B Syllabary
|
||||
0x10080, // Linear B Ideograms
|
||||
0x10100, // Aegean Numbers
|
||||
0x10140, // unassigned
|
||||
0x10300, // Old Italic
|
||||
0x10330, // Gothic
|
||||
0x10350, // unassigned
|
||||
0x10380, // Ugaritic
|
||||
0x103A0, // unassigned
|
||||
0x10400, // Deseret
|
||||
0x10450, // Shavian
|
||||
0x10480, // Osmanya
|
||||
0x104B0, // unassigned
|
||||
0x10800, // Cypriot Syllabary
|
||||
0x10840, // unassigned
|
||||
0x1D000, // Byzantine Musical Symbols
|
||||
0x1D100, // Musical Symbols
|
||||
0x1D200, // unassigned
|
||||
0x1D300, // Tai Xuan Jing Symbols
|
||||
0x1D360, // unassigned
|
||||
0x1D400, // Mathematical Alphanumeric Symbols
|
||||
0x1D800, // unassigned
|
||||
0x20000, // CJK Unified Ideographs Extension B
|
||||
0x2A6E0, // unassigned
|
||||
0x2F800, // CJK Compatibility Ideographs Supplement
|
||||
0x2FA20, // unassigned
|
||||
0xE0000, // Tags
|
||||
0xE0080, // unassigned
|
||||
0xE0100, // Variation Selectors Supplement
|
||||
0xE01F0, // unassigned
|
||||
0xF0000, // Supplementary Private Use Area-A
|
||||
0x100000, // Supplementary Private Use Area-B
|
||||
0x0000, // 0000..007F; Basic Latin
|
||||
0x0080, // 0080..00FF; Latin-1 Supplement
|
||||
0x0100, // 0100..017F; Latin Extended-A
|
||||
0x0180, // 0180..024F; Latin Extended-B
|
||||
0x0250, // 0250..02AF; IPA Extensions
|
||||
0x02B0, // 02B0..02FF; Spacing Modifier Letters
|
||||
0x0300, // 0300..036F; Combining Diacritical Marks
|
||||
0x0370, // 0370..03FF; Greek and Coptic
|
||||
0x0400, // 0400..04FF; Cyrillic
|
||||
0x0500, // 0500..052F; Cyrillic Supplement
|
||||
0x0530, // 0530..058F; Armenian
|
||||
0x0590, // 0590..05FF; Hebrew
|
||||
0x0600, // 0600..06FF; Arabic
|
||||
0x0700, // 0700..074F; Syria
|
||||
0x0750, // 0750..077F; Arabic Supplement
|
||||
0x0780, // 0780..07BF; Thaana
|
||||
0x07C0, // 07C0..07FF; NKo
|
||||
0x0800, // unassigned
|
||||
0x0900, // 0900..097F; Devanagari
|
||||
0x0980, // 0980..09FF; Bengali
|
||||
0x0A00, // 0A00..0A7F; Gurmukhi
|
||||
0x0A80, // 0A80..0AFF; Gujarati
|
||||
0x0B00, // 0B00..0B7F; Oriya
|
||||
0x0B80, // 0B80..0BFF; Tamil
|
||||
0x0C00, // 0C00..0C7F; Telugu
|
||||
0x0C80, // 0C80..0CFF; Kannada
|
||||
0x0D00, // 0D00..0D7F; Malayalam
|
||||
0x0D80, // 0D80..0DFF; Sinhala
|
||||
0x0E00, // 0E00..0E7F; Thai
|
||||
0x0E80, // 0E80..0EFF; Lao
|
||||
0x0F00, // 0F00..0FFF; Tibetan
|
||||
0x1000, // 1000..109F; Myanmar
|
||||
0x10A0, // 10A0..10FF; Georgian
|
||||
0x1100, // 1100..11FF; Hangul Jamo
|
||||
0x1200, // 1200..137F; Ethiopic
|
||||
0x1380, // 1380..139F; Ethiopic Supplement
|
||||
0x13A0, // 13A0..13FF; Cherokee
|
||||
0x1400, // 1400..167F; Unified Canadian Aboriginal Syllabics
|
||||
0x1680, // 1680..169F; Ogham
|
||||
0x16A0, // 16A0..16FF; Runic
|
||||
0x1700, // 1700..171F; Tagalog
|
||||
0x1720, // 1720..173F; Hanunoo
|
||||
0x1740, // 1740..175F; Buhid
|
||||
0x1760, // 1760..177F; Tagbanwa
|
||||
0x1780, // 1780..17FF; Khmer
|
||||
0x1800, // 1800..18AF; Mongolian
|
||||
0x18B0, // unassigned
|
||||
0x1900, // 1900..194F; Limbu
|
||||
0x1950, // 1950..197F; Tai Le
|
||||
0x1980, // 1980..19DF; New Tai Lue
|
||||
0x19E0, // 19E0..19FF; Khmer Symbols
|
||||
0x1A00, // 1A00..1A1F; Buginese
|
||||
0x1A20, // unassigned
|
||||
0x1B00, // 1B00..1B7F; Balinese
|
||||
0x1B80, // 1B80..1BBF; Sundanese
|
||||
0x1BC0, // unassigned
|
||||
0x1C00, // 1C00..1C4F; Lepcha
|
||||
0x1C50, // 1C50..1C7F; Ol Chiki
|
||||
0x1C80, // unassigned
|
||||
0x1D00, // 1D00..1D7F; Phonetic Extensions
|
||||
0x1D80, // 1D80..1DBF; Phonetic Extensions Supplement
|
||||
0x1DC0, // 1DC0..1DFF; Combining Diacritical Marks Supplement
|
||||
0x1E00, // 1E00..1EFF; Latin Extended Additional
|
||||
0x1F00, // 1F00..1FFF; Greek Extended
|
||||
0x2000, // 2000..206F; General Punctuation
|
||||
0x2070, // 2070..209F; Superscripts and Subscripts
|
||||
0x20A0, // 20A0..20CF; Currency Symbols
|
||||
0x20D0, // 20D0..20FF; Combining Diacritical Marks for Symbols
|
||||
0x2100, // 2100..214F; Letterlike Symbols
|
||||
0x2150, // 2150..218F; Number Forms
|
||||
0x2190, // 2190..21FF; Arrows
|
||||
0x2200, // 2200..22FF; Mathematical Operators
|
||||
0x2300, // 2300..23FF; Miscellaneous Technical
|
||||
0x2400, // 2400..243F; Control Pictures
|
||||
0x2440, // 2440..245F; Optical Character Recognition
|
||||
0x2460, // 2460..24FF; Enclosed Alphanumerics
|
||||
0x2500, // 2500..257F; Box Drawing
|
||||
0x2580, // 2580..259F; Block Elements
|
||||
0x25A0, // 25A0..25FF; Geometric Shapes
|
||||
0x2600, // 2600..26FF; Miscellaneous Symbols
|
||||
0x2700, // 2700..27BF; Dingbats
|
||||
0x27C0, // 27C0..27EF; Miscellaneous Mathematical Symbols-A
|
||||
0x27F0, // 27F0..27FF; Supplemental Arrows-A
|
||||
0x2800, // 2800..28FF; Braille Patterns
|
||||
0x2900, // 2900..297F; Supplemental Arrows-B
|
||||
0x2980, // 2980..29FF; Miscellaneous Mathematical Symbols-B
|
||||
0x2A00, // 2A00..2AFF; Supplemental Mathematical Operators
|
||||
0x2B00, // 2B00..2BFF; Miscellaneous Symbols and Arrows
|
||||
0x2C00, // 2C00..2C5F; Glagolitic
|
||||
0x2C60, // 2C60..2C7F; Latin Extended-C
|
||||
0x2C80, // 2C80..2CFF; Coptic
|
||||
0x2D00, // 2D00..2D2F; Georgian Supplement
|
||||
0x2D30, // 2D30..2D7F; Tifinagh
|
||||
0x2D80, // 2D80..2DDF; Ethiopic Extended
|
||||
0x2DE0, // 2DE0..2DFF; Cyrillic Extended-A
|
||||
0x2E00, // 2E00..2E7F; Supplemental Punctuation
|
||||
0x2E80, // 2E80..2EFF; CJK Radicals Supplement
|
||||
0x2F00, // 2F00..2FDF; Kangxi Radicals
|
||||
0x2FE0, // unassigned
|
||||
0x2FF0, // 2FF0..2FFF; Ideographic Description Characters
|
||||
0x3000, // 3000..303F; CJK Symbols and Punctuation
|
||||
0x3040, // 3040..309F; Hiragana
|
||||
0x30A0, // 30A0..30FF; Katakana
|
||||
0x3100, // 3100..312F; Bopomofo
|
||||
0x3130, // 3130..318F; Hangul Compatibility Jamo
|
||||
0x3190, // 3190..319F; Kanbun
|
||||
0x31A0, // 31A0..31BF; Bopomofo Extended
|
||||
0x31C0, // 31C0..31EF; CJK Strokes
|
||||
0x31F0, // 31F0..31FF; Katakana Phonetic Extensions
|
||||
0x3200, // 3200..32FF; Enclosed CJK Letters and Months
|
||||
0x3300, // 3300..33FF; CJK Compatibility
|
||||
0x3400, // 3400..4DBF; CJK Unified Ideographs Extension A
|
||||
0x4DC0, // 4DC0..4DFF; Yijing Hexagram Symbols
|
||||
0x4E00, // 4E00..9FFF; CJK Unified Ideograph
|
||||
0xA000, // A000..A48F; Yi Syllables
|
||||
0xA490, // A490..A4CF; Yi Radicals
|
||||
0xA4D0, // unassigned
|
||||
0xA500, // A500..A63F; Vai
|
||||
0xA640, // A640..A69F; Cyrillic Extended-B
|
||||
0xA6A0, // unassigned
|
||||
0xA700, // A700..A71F; Modifier Tone Letters
|
||||
0xA720, // A720..A7FF; Latin Extended-D
|
||||
0xA800, // A800..A82F; Syloti Nagri
|
||||
0xA830, // unassigned
|
||||
0xA840, // A840..A87F; Phags-pa
|
||||
0xA880, // A880..A8DF; Saurashtra
|
||||
0xA8E0, // unassigned
|
||||
0xA900, // A900..A92F; Kayah Li
|
||||
0xA930, // A930..A95F; Rejang
|
||||
0xA960, // unassigned
|
||||
0xAA00, // AA00..AA5F; Cham
|
||||
0xAA60, // unassigned
|
||||
0xAC00, // AC00..D7AF; Hangul Syllables
|
||||
0xD7B0, // unassigned
|
||||
0xD800, // D800..DB7F; High Surrogates
|
||||
0xDB80, // DB80..DBFF; High Private Use Surrogates
|
||||
0xDC00, // DC00..DFFF; Low Surrogates
|
||||
0xE000, // E000..F8FF; Private Use Area
|
||||
0xF900, // F900..FAFF; CJK Compatibility Ideographs
|
||||
0xFB00, // FB00..FB4F; Alphabetic Presentation Forms
|
||||
0xFB50, // FB50..FDFF; Arabic Presentation Forms-A
|
||||
0xFE00, // FE00..FE0F; Variation Selectors
|
||||
0xFE10, // FE10..FE1F; Vertical Forms
|
||||
0xFE20, // FE20..FE2F; Combining Half Marks
|
||||
0xFE30, // FE30..FE4F; CJK Compatibility Forms
|
||||
0xFE50, // FE50..FE6F; Small Form Variants
|
||||
0xFE70, // FE70..FEFF; Arabic Presentation Forms-B
|
||||
0xFF00, // FF00..FFEF; Halfwidth and Fullwidth Forms
|
||||
0xFFF0, // FFF0..FFFF; Specials
|
||||
0x10000, // 10000..1007F; Linear B Syllabary
|
||||
0x10080, // 10080..100FF; Linear B Ideograms
|
||||
0x10100, // 10100..1013F; Aegean Numbers
|
||||
0x10140, // 10140..1018F; Ancient Greek Numbers
|
||||
0x10190, // 10190..101CF; Ancient Symbols
|
||||
0x101D0, // 101D0..101FF; Phaistos Disc
|
||||
0x10200, // unassigned
|
||||
0x10280, // 10280..1029F; Lycian
|
||||
0x102A0, // 102A0..102DF; Carian
|
||||
0x102E0, // unassigned
|
||||
0x10300, // 10300..1032F; Old Italic
|
||||
0x10330, // 10330..1034F; Gothic
|
||||
0x10350, // unassigned
|
||||
0x10380, // 10380..1039F; Ugaritic
|
||||
0x103A0, // 103A0..103DF; Old Persian
|
||||
0x103E0, // unassigned
|
||||
0x10400, // 10400..1044F; Desere
|
||||
0x10450, // 10450..1047F; Shavian
|
||||
0x10480, // 10480..104AF; Osmanya
|
||||
0x104B0, // unassigned
|
||||
0x10800, // 10800..1083F; Cypriot Syllabary
|
||||
0x10840, // unassigned
|
||||
0x10900, // 10900..1091F; Phoenician
|
||||
0x10920, // 10920..1093F; Lydian
|
||||
0x10940, // unassigned
|
||||
0x10A00, // 10A00..10A5F; Kharoshthi
|
||||
0x10A60, // unassigned
|
||||
0x12000, // 12000..123FF; Cuneiform
|
||||
0x12400, // 12400..1247F; Cuneiform Numbers and Punctuation
|
||||
0x12480, // unassigned
|
||||
0x1D000, // 1D000..1D0FF; Byzantine Musical Symbols
|
||||
0x1D100, // 1D100..1D1FF; Musical Symbols
|
||||
0x1D200, // 1D200..1D24F; Ancient Greek Musical Notation
|
||||
0x1D250, // unassigned
|
||||
0x1D300, // 1D300..1D35F; Tai Xuan Jing Symbols
|
||||
0x1D360, // 1D360..1D37F; Counting Rod Numerals
|
||||
0x1D380, // unassigned
|
||||
0x1D400, // 1D400..1D7FF; Mathematical Alphanumeric Symbols
|
||||
0x1D800, // unassigned
|
||||
0x1F000, // 1F000..1F02F; Mahjong Tiles
|
||||
0x1F030, // 1F030..1F09F; Domino Tiles
|
||||
0x1F0A0, // unassigned
|
||||
0x20000, // 20000..2A6DF; CJK Unified Ideographs Extension B
|
||||
0x2A6E0, // unassigned
|
||||
0x2F800, // 2F800..2FA1F; CJK Compatibility Ideographs Supplement
|
||||
0x2FA20, // unassigned
|
||||
0xE0000, // E0000..E007F; Tags
|
||||
0xE0080, // unassigned
|
||||
0xE0100, // E0100..E01EF; Variation Selectors Supplement
|
||||
0xE01F0, // unassigned
|
||||
0xF0000, // F0000..FFFFF; Supplementary Private Use Area-A
|
||||
0x100000, // 100000..10FFFF; Supplementary Private Use Area-B
|
||||
};
|
||||
|
||||
private static final UnicodeBlock[] blocks = {
|
||||
@ -1809,8 +2234,9 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
HEBREW,
|
||||
ARABIC,
|
||||
SYRIAC,
|
||||
null,
|
||||
ARABIC_SUPPLEMENT,
|
||||
THAANA,
|
||||
NKO,
|
||||
null,
|
||||
DEVANAGARI,
|
||||
BENGALI,
|
||||
@ -1829,7 +2255,7 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
GEORGIAN,
|
||||
HANGUL_JAMO,
|
||||
ETHIOPIC,
|
||||
null,
|
||||
ETHIOPIC_SUPPLEMENT,
|
||||
CHEROKEE,
|
||||
UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS,
|
||||
OGHAM,
|
||||
@ -1843,11 +2269,19 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
null,
|
||||
LIMBU,
|
||||
TAI_LE,
|
||||
null,
|
||||
NEW_TAI_LUE,
|
||||
KHMER_SYMBOLS,
|
||||
BUGINESE,
|
||||
null,
|
||||
BALINESE,
|
||||
SUNDANESE,
|
||||
null,
|
||||
LEPCHA,
|
||||
OL_CHIKI,
|
||||
null,
|
||||
PHONETIC_EXTENSIONS,
|
||||
null,
|
||||
PHONETIC_EXTENSIONS_SUPPLEMENT,
|
||||
COMBINING_DIACRITICAL_MARKS_SUPPLEMENT,
|
||||
LATIN_EXTENDED_ADDITIONAL,
|
||||
GREEK_EXTENDED,
|
||||
GENERAL_PUNCTUATION,
|
||||
@ -1874,7 +2308,14 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B,
|
||||
SUPPLEMENTAL_MATHEMATICAL_OPERATORS,
|
||||
MISCELLANEOUS_SYMBOLS_AND_ARROWS,
|
||||
null,
|
||||
GLAGOLITIC,
|
||||
LATIN_EXTENDED_C,
|
||||
COPTIC,
|
||||
GEORGIAN_SUPPLEMENT,
|
||||
TIFINAGH,
|
||||
ETHIOPIC_EXTENDED,
|
||||
CYRILLIC_EXTENDED_A,
|
||||
SUPPLEMENTAL_PUNCTUATION,
|
||||
CJK_RADICALS_SUPPLEMENT,
|
||||
KANGXI_RADICALS,
|
||||
null,
|
||||
@ -1886,7 +2327,7 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
HANGUL_COMPATIBILITY_JAMO,
|
||||
KANBUN,
|
||||
BOPOMOFO_EXTENDED,
|
||||
null,
|
||||
CJK_STROKES,
|
||||
KATAKANA_PHONETIC_EXTENSIONS,
|
||||
ENCLOSED_CJK_LETTERS_AND_MONTHS,
|
||||
CJK_COMPATIBILITY,
|
||||
@ -1896,6 +2337,21 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
YI_SYLLABLES,
|
||||
YI_RADICALS,
|
||||
null,
|
||||
VAI,
|
||||
CYRILLIC_EXTENDED_B,
|
||||
null,
|
||||
MODIFIER_TONE_LETTERS,
|
||||
LATIN_EXTENDED_D,
|
||||
SYLOTI_NAGRI,
|
||||
null,
|
||||
PHAGS_PA,
|
||||
SAURASHTRA,
|
||||
null,
|
||||
KAYAH_LI,
|
||||
REJANG,
|
||||
null,
|
||||
CHAM,
|
||||
null,
|
||||
HANGUL_SYLLABLES,
|
||||
null,
|
||||
HIGH_SURROGATES,
|
||||
@ -1906,7 +2362,7 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
ALPHABETIC_PRESENTATION_FORMS,
|
||||
ARABIC_PRESENTATION_FORMS_A,
|
||||
VARIATION_SELECTORS,
|
||||
null,
|
||||
VERTICAL_FORMS,
|
||||
COMBINING_HALF_MARKS,
|
||||
CJK_COMPATIBILITY_FORMS,
|
||||
SMALL_FORM_VARIANTS,
|
||||
@ -1916,11 +2372,18 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
LINEAR_B_SYLLABARY,
|
||||
LINEAR_B_IDEOGRAMS,
|
||||
AEGEAN_NUMBERS,
|
||||
ANCIENT_GREEK_NUMBERS,
|
||||
ANCIENT_SYMBOLS,
|
||||
PHAISTOS_DISC,
|
||||
null,
|
||||
LYCIAN,
|
||||
CARIAN,
|
||||
null,
|
||||
OLD_ITALIC,
|
||||
GOTHIC,
|
||||
null,
|
||||
UGARITIC,
|
||||
OLD_PERSIAN,
|
||||
null,
|
||||
DESERET,
|
||||
SHAVIAN,
|
||||
@ -1928,13 +2391,26 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
||||
null,
|
||||
CYPRIOT_SYLLABARY,
|
||||
null,
|
||||
PHOENICIAN,
|
||||
LYDIAN,
|
||||
null,
|
||||
KHAROSHTHI,
|
||||
null,
|
||||
CUNEIFORM,
|
||||
CUNEIFORM_NUMBERS_AND_PUNCTUATION,
|
||||
null,
|
||||
BYZANTINE_MUSICAL_SYMBOLS,
|
||||
MUSICAL_SYMBOLS,
|
||||
ANCIENT_GREEK_MUSICAL_NOTATION,
|
||||
null,
|
||||
TAI_XUAN_JING_SYMBOLS,
|
||||
COUNTING_ROD_NUMERALS,
|
||||
null,
|
||||
MATHEMATICAL_ALPHANUMERIC_SYMBOLS,
|
||||
null,
|
||||
MAHJONG_TILES,
|
||||
DOMINO_TILES,
|
||||
null,
|
||||
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B,
|
||||
null,
|
||||
CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1994-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1994-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2846,14 +2846,14 @@ public final
|
||||
if (loader == null)
|
||||
return desiredAssertionStatus0(this);
|
||||
|
||||
synchronized(loader) {
|
||||
// If the classloader has been initialized with
|
||||
// the assertion directives, ask it. Otherwise,
|
||||
// ask the VM.
|
||||
return (loader.classAssertionStatus == null ?
|
||||
desiredAssertionStatus0(this) :
|
||||
loader.desiredAssertionStatus(getName()));
|
||||
// If the classloader has been initialized with the assertion
|
||||
// directives, ask it. Otherwise, ask the VM.
|
||||
synchronized(loader.assertionLock) {
|
||||
if (loader.classAssertionStatus != null) {
|
||||
return loader.desiredAssertionStatus(getName());
|
||||
}
|
||||
}
|
||||
return desiredAssertionStatus0(this);
|
||||
}
|
||||
|
||||
// Retrieves the desired assertion status of this class from the VM
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1994-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1994-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,14 +40,17 @@ import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.security.cert.Certificate;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.Hashtable;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import sun.misc.ClassFileTransformer;
|
||||
import sun.misc.CompoundEnumeration;
|
||||
import sun.misc.Resource;
|
||||
@ -91,6 +94,17 @@ import sun.security.util.SecurityConstants;
|
||||
* called the "bootstrap class loader", does not itself have a parent but may
|
||||
* serve as the parent of a <tt>ClassLoader</tt> instance.
|
||||
*
|
||||
* <p> Class loaders that support concurrent loading of classes are known as
|
||||
* <em>parallel capable</em> class loaders and are required to register
|
||||
* themselves at their class initialization time by invoking the
|
||||
* {@link
|
||||
* #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
|
||||
* method. In environments in which the delegation model is not strictly
|
||||
* hierarchical, class loaders need to be parallel capable, otherise class
|
||||
* loading can lead to deadlocks because the loader lock is held for the
|
||||
* duration of the class loading process (see {@link #loadClass
|
||||
* <tt>loadClass</tt>} methods).
|
||||
*
|
||||
* <p> Normally, the Java virtual machine loads classes from the local file
|
||||
* system in a platform-dependent manner. For example, on UNIX systems, the
|
||||
* virtual machine loads classes from the directory defined by the
|
||||
@ -160,31 +174,51 @@ import sun.security.util.SecurityConstants;
|
||||
public abstract class ClassLoader {
|
||||
|
||||
private static native void registerNatives();
|
||||
|
||||
// Set of classes which are registered as parallel capable class loaders
|
||||
private static final Set<Class<? extends ClassLoader>> parallelLoaders
|
||||
= Collections.newSetFromMap(Collections.synchronizedMap
|
||||
(new WeakHashMap<Class<? extends ClassLoader>, Boolean>()));
|
||||
|
||||
static {
|
||||
registerNatives();
|
||||
parallelLoaders.add(ClassLoader.class);
|
||||
}
|
||||
|
||||
// If initialization succeed this is set to true and security checks will
|
||||
// succeed. Otherwise the object is not initialized and the object is
|
||||
// useless.
|
||||
private boolean initialized = false;
|
||||
private final boolean initialized;
|
||||
|
||||
// The parent class loader for delegation
|
||||
private ClassLoader parent;
|
||||
// Note: VM hardcoded the offset of this field, thus all new fields
|
||||
// must be added *after* it.
|
||||
private final ClassLoader parent;
|
||||
|
||||
// Maps class name to the corresponding lock object when the current
|
||||
// class loader is parallel capable.
|
||||
// Note: VM also uses this field to decide if the current class loader
|
||||
// is parallel capable and the appropriate lock object for class loading.
|
||||
private final ConcurrentHashMap<String, Object> parallelLockMap;
|
||||
|
||||
// Hashtable that maps packages to certs
|
||||
private Hashtable<String, Certificate[]> package2certs
|
||||
= new Hashtable<String, Certificate[]>(11);
|
||||
private final Map <String, Certificate[]> package2certs;
|
||||
|
||||
// Shared among all packages with unsigned classes
|
||||
Certificate[] nocerts;
|
||||
private static final Certificate[] nocerts = new Certificate[0];
|
||||
|
||||
// The classes loaded by this class loader. The only purpose of this table
|
||||
// The classes loaded by this class loader. The only purpose of this table
|
||||
// is to keep the classes from being GC'ed until the loader is GC'ed.
|
||||
private Vector<Class<?>> classes = new Vector<Class<?>>();
|
||||
private final Vector<Class<?>> classes = new Vector<Class<?>>();
|
||||
|
||||
// The "default" domain. Set as the default ProtectionDomain on newly
|
||||
// created classes.
|
||||
private final ProtectionDomain defaultDomain =
|
||||
new ProtectionDomain(new CodeSource(null, (Certificate[]) null),
|
||||
null, this, null);
|
||||
|
||||
// The initiating protection domains for all classes loaded by this loader
|
||||
private Set<ProtectionDomain> domains = new HashSet<ProtectionDomain>();
|
||||
private final Set<ProtectionDomain> domains;
|
||||
|
||||
// Invoked by the VM to record every loaded class with this loader.
|
||||
void addClass(Class c) {
|
||||
@ -193,7 +227,9 @@ public abstract class ClassLoader {
|
||||
|
||||
// The packages defined in this class loader. Each package name is mapped
|
||||
// to its corresponding Package object.
|
||||
private HashMap<String, Package> packages = new HashMap<String, Package>();
|
||||
// @GuardedBy("itself")
|
||||
private final HashMap<String, Package> packages =
|
||||
new HashMap<String, Package>();
|
||||
|
||||
/**
|
||||
* Creates a new class loader using the specified parent class loader for
|
||||
@ -220,6 +256,19 @@ public abstract class ClassLoader {
|
||||
security.checkCreateClassLoader();
|
||||
}
|
||||
this.parent = parent;
|
||||
if (parallelLoaders.contains(this.getClass())) {
|
||||
parallelLockMap = new ConcurrentHashMap<String, Object>();
|
||||
package2certs = new ConcurrentHashMap<String, Certificate[]>();
|
||||
domains =
|
||||
Collections.synchronizedSet(new HashSet<ProtectionDomain>());
|
||||
assertionLock = new Object();
|
||||
} else {
|
||||
// no finer-grained lock; lock on the classloader instance
|
||||
parallelLockMap = null;
|
||||
package2certs = new Hashtable<String, Certificate[]>();
|
||||
domains = new HashSet<ProtectionDomain>();
|
||||
assertionLock = this;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
@ -244,10 +293,22 @@ public abstract class ClassLoader {
|
||||
security.checkCreateClassLoader();
|
||||
}
|
||||
this.parent = getSystemClassLoader();
|
||||
if (parallelLoaders.contains(this.getClass())) {
|
||||
parallelLockMap = new ConcurrentHashMap<String, Object>();
|
||||
package2certs = new ConcurrentHashMap<String, Certificate[]>();
|
||||
domains =
|
||||
Collections.synchronizedSet(new HashSet<ProtectionDomain>());
|
||||
assertionLock = new Object();
|
||||
} else {
|
||||
// no finer-grained lock; lock on the classloader instance
|
||||
parallelLockMap = null;
|
||||
package2certs = new Hashtable<String, Certificate[]>();
|
||||
domains = new HashSet<ProtectionDomain>();
|
||||
assertionLock = this;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
// -- Class --
|
||||
|
||||
/**
|
||||
@ -296,6 +357,10 @@ public abstract class ClassLoader {
|
||||
* <p> Subclasses of <tt>ClassLoader</tt> are encouraged to override {@link
|
||||
* #findClass(String)}, rather than this method. </p>
|
||||
*
|
||||
* <p> Unless overridden, this method synchronizes on the result of
|
||||
* {@link #getClassLoadingLock <tt>getClassLoadingLock</tt>} method
|
||||
* during the entire class loading process.
|
||||
*
|
||||
* @param name
|
||||
* The <a href="#name">binary name</a> of the class
|
||||
*
|
||||
@ -307,37 +372,80 @@ public abstract class ClassLoader {
|
||||
* @throws ClassNotFoundException
|
||||
* If the class could not be found
|
||||
*/
|
||||
protected synchronized Class<?> loadClass(String name, boolean resolve)
|
||||
protected Class<?> loadClass(String name, boolean resolve)
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
// First, check if the class has already been loaded
|
||||
Class c = findLoadedClass(name);
|
||||
if (c == null) {
|
||||
try {
|
||||
if (parent != null) {
|
||||
c = parent.loadClass(name, false);
|
||||
} else {
|
||||
c = findBootstrapClass0(name);
|
||||
synchronized (getClassLoadingLock(name)) {
|
||||
// First, check if the class has already been loaded
|
||||
Class c = findLoadedClass(name);
|
||||
if (c == null) {
|
||||
try {
|
||||
if (parent != null) {
|
||||
c = parent.loadClass(name, false);
|
||||
} else {
|
||||
c = findBootstrapClass0(name);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
// If still not found, then invoke findClass in order
|
||||
// to find the class.
|
||||
c = findClass(name);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
// If still not found, then invoke findClass in order
|
||||
// to find the class.
|
||||
c = findClass(name);
|
||||
}
|
||||
if (resolve) {
|
||||
resolveClass(c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the lock object for class loading operations.
|
||||
* For backward compatibility, the default implementation of this method
|
||||
* behaves as follows. If this ClassLoader object is registered as
|
||||
* parallel capable, the method returns a dedicated object associated
|
||||
* with the specified class name. Otherwise, the method returns this
|
||||
* ClassLoader object. </p>
|
||||
*
|
||||
* @param className
|
||||
* The name of the to-be-loaded class
|
||||
*
|
||||
* @return the lock for class loading operations
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* If registered as parallel capable and <tt>className</tt> is null
|
||||
*
|
||||
* @see #loadClass(String, boolean)
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
protected Object getClassLoadingLock(String className) {
|
||||
Object lock = this;
|
||||
if (parallelLockMap != null) {
|
||||
Object newLock = new Object();
|
||||
lock = parallelLockMap.putIfAbsent(className, newLock);
|
||||
if (lock == null) {
|
||||
lock = newLock;
|
||||
}
|
||||
}
|
||||
if (resolve) {
|
||||
resolveClass(c);
|
||||
}
|
||||
return c;
|
||||
return lock;
|
||||
}
|
||||
|
||||
// This method is invoked by the virtual machine to load a class.
|
||||
private synchronized Class loadClassInternal(String name)
|
||||
private Class loadClassInternal(String name)
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
return loadClass(name);
|
||||
// For backward compatibility, explicitly lock on 'this' when
|
||||
// the current class loader is not parallel capable.
|
||||
if (parallelLockMap == null) {
|
||||
synchronized (this) {
|
||||
return loadClass(name);
|
||||
}
|
||||
} else {
|
||||
return loadClass(name);
|
||||
}
|
||||
}
|
||||
|
||||
// Invoked by the VM after loading class with this loader.
|
||||
private void checkPackageAccess(Class cls, ProtectionDomain pd) {
|
||||
final SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
@ -486,31 +594,32 @@ public abstract class ClassLoader {
|
||||
|
||||
/* Determine protection domain, and check that:
|
||||
- not define java.* class,
|
||||
- signer of this class matches signers for the rest of the classes in package.
|
||||
- signer of this class matches signers for the rest of the classes in
|
||||
package.
|
||||
*/
|
||||
private ProtectionDomain preDefineClass(String name,
|
||||
ProtectionDomain protectionDomain)
|
||||
ProtectionDomain pd)
|
||||
{
|
||||
if (!checkName(name))
|
||||
throw new NoClassDefFoundError("IllegalName: " + name);
|
||||
|
||||
if ((name != null) && name.startsWith("java.")) {
|
||||
throw new SecurityException("Prohibited package name: " +
|
||||
name.substring(0, name.lastIndexOf('.')));
|
||||
throw new SecurityException
|
||||
("Prohibited package name: " +
|
||||
name.substring(0, name.lastIndexOf('.')));
|
||||
}
|
||||
if (protectionDomain == null) {
|
||||
protectionDomain = getDefaultDomain();
|
||||
if (pd == null) {
|
||||
pd = defaultDomain;
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
checkCerts(name, protectionDomain.getCodeSource());
|
||||
if (name != null) checkCerts(name, pd.getCodeSource());
|
||||
|
||||
return protectionDomain;
|
||||
return pd;
|
||||
}
|
||||
|
||||
private String defineClassSourceLocation(ProtectionDomain protectionDomain)
|
||||
private String defineClassSourceLocation(ProtectionDomain pd)
|
||||
{
|
||||
CodeSource cs = protectionDomain.getCodeSource();
|
||||
CodeSource cs = pd.getCodeSource();
|
||||
String source = null;
|
||||
if (cs != null && cs.getLocation() != null) {
|
||||
source = cs.getLocation().toString();
|
||||
@ -519,14 +628,15 @@ public abstract class ClassLoader {
|
||||
}
|
||||
|
||||
private Class defineTransformedClass(String name, byte[] b, int off, int len,
|
||||
ProtectionDomain protectionDomain,
|
||||
ProtectionDomain pd,
|
||||
ClassFormatError cfe, String source)
|
||||
throws ClassFormatError
|
||||
{
|
||||
// Class format error - try to transform the bytecode and
|
||||
// define the class again
|
||||
//
|
||||
ClassFileTransformer[] transformers = ClassFileTransformer.getTransformers();
|
||||
ClassFileTransformer[] transformers =
|
||||
ClassFileTransformer.getTransformers();
|
||||
Class c = null;
|
||||
|
||||
if (transformers != null) {
|
||||
@ -535,7 +645,7 @@ public abstract class ClassLoader {
|
||||
// Transform byte code using transformer
|
||||
byte[] tb = transformer.transform(b, off, len);
|
||||
c = defineClass1(name, tb, 0, tb.length,
|
||||
protectionDomain, source);
|
||||
pd, source);
|
||||
break;
|
||||
} catch (ClassFormatError cfe2) {
|
||||
// If ClassFormatError occurs, try next transformer
|
||||
@ -552,11 +662,10 @@ public abstract class ClassLoader {
|
||||
return c;
|
||||
}
|
||||
|
||||
private void postDefineClass(Class c, ProtectionDomain protectionDomain)
|
||||
private void postDefineClass(Class c, ProtectionDomain pd)
|
||||
{
|
||||
if (protectionDomain.getCodeSource() != null) {
|
||||
Certificate certs[] =
|
||||
protectionDomain.getCodeSource().getCertificates();
|
||||
if (pd.getCodeSource() != null) {
|
||||
Certificate certs[] = pd.getCodeSource().getCertificates();
|
||||
if (certs != null)
|
||||
setSigners(c, certs);
|
||||
}
|
||||
@ -641,7 +750,8 @@ public abstract class ClassLoader {
|
||||
try {
|
||||
c = defineClass1(name, b, off, len, protectionDomain, source);
|
||||
} catch (ClassFormatError cfe) {
|
||||
c = defineTransformedClass(name, b, off, len, protectionDomain, cfe, source);
|
||||
c = defineTransformedClass(name, b, off, len, protectionDomain, cfe,
|
||||
source);
|
||||
}
|
||||
|
||||
postDefineClass(c, protectionDomain);
|
||||
@ -656,10 +766,10 @@ public abstract class ClassLoader {
|
||||
* specified in the documentation for {@link #defineClass(String, byte[],
|
||||
* int, int)}. Before the class can be used it must be resolved.
|
||||
*
|
||||
* <p>The rules about the first class defined in a package determining the set of
|
||||
* certificates for the package, and the restrictions on class names are identical
|
||||
* to those specified in the documentation for {@link #defineClass(String, byte[],
|
||||
* int, int, ProtectionDomain)}.
|
||||
* <p>The rules about the first class defined in a package determining the
|
||||
* set of certificates for the package, and the restrictions on class names
|
||||
* are identical to those specified in the documentation for {@link
|
||||
* #defineClass(String, byte[], int, int, ProtectionDomain)}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <i>cl</i><tt>.defineClass(</tt><i>name</i><tt>,</tt>
|
||||
@ -668,12 +778,13 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* <blockquote><tt>
|
||||
* ...<br>
|
||||
* byte[] temp = new byte[</tt><i>bBuffer</i><tt>.{@link java.nio.ByteBuffer#remaining
|
||||
* remaining}()];<br>
|
||||
* byte[] temp = new byte[</tt><i>bBuffer</i><tt>.{@link
|
||||
* java.nio.ByteBuffer#remaining remaining}()];<br>
|
||||
* </tt><i>bBuffer</i><tt>.{@link java.nio.ByteBuffer#get(byte[])
|
||||
* get}(temp);<br>
|
||||
* return {@link #defineClass(String, byte[], int, int, ProtectionDomain)
|
||||
* </tt><i>cl</i><tt>.defineClass}(</tt><i>name</i><tt>, temp, 0, temp.length, </tt><i>pd</i><tt>);<br>
|
||||
* </tt><i>cl</i><tt>.defineClass}(</tt><i>name</i><tt>, temp, 0,
|
||||
* temp.length, </tt><i>pd</i><tt>);<br>
|
||||
* </tt></blockquote>
|
||||
*
|
||||
* @param name
|
||||
@ -682,9 +793,9 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* @param b
|
||||
* The bytes that make up the class data. The bytes from positions
|
||||
* <tt>b.position()</tt> through <tt>b.position() + b.limit() -1 </tt>
|
||||
* should have the format of a valid class file as defined by the <a
|
||||
* href="http://java.sun.com/docs/books/vmspec/">Java Virtual
|
||||
* <tt>b.position()</tt> through <tt>b.position() + b.limit() -1
|
||||
* </tt> should have the format of a valid class file as defined by
|
||||
* the <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
|
||||
* Machine Specification</a>.
|
||||
*
|
||||
* @param protectionDomain
|
||||
@ -738,11 +849,13 @@ public abstract class ClassLoader {
|
||||
String source = defineClassSourceLocation(protectionDomain);
|
||||
|
||||
try {
|
||||
c = defineClass2(name, b, b.position(), len, protectionDomain, source);
|
||||
c = defineClass2(name, b, b.position(), len, protectionDomain,
|
||||
source);
|
||||
} catch (ClassFormatError cfe) {
|
||||
byte[] tb = new byte[len];
|
||||
b.get(tb); // get bytes out of byte buffer.
|
||||
c = defineTransformedClass(name, tb, 0, len, protectionDomain, cfe, source);
|
||||
c = defineTransformedClass(name, tb, 0, len, protectionDomain, cfe,
|
||||
source);
|
||||
}
|
||||
|
||||
postDefineClass(c, protectionDomain);
|
||||
@ -769,33 +882,29 @@ public abstract class ClassLoader {
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized void checkCerts(String name, CodeSource cs) {
|
||||
private void checkCerts(String name, CodeSource cs) {
|
||||
int i = name.lastIndexOf('.');
|
||||
String pname = (i == -1) ? "" : name.substring(0, i);
|
||||
Certificate[] pcerts = package2certs.get(pname);
|
||||
if (pcerts == null) {
|
||||
// first class in this package gets to define which
|
||||
// certificates must be the same for all other classes
|
||||
// in this package
|
||||
if (cs != null) {
|
||||
pcerts = cs.getCertificates();
|
||||
}
|
||||
if (pcerts == null) {
|
||||
if (nocerts == null)
|
||||
nocerts = new Certificate[0];
|
||||
pcerts = nocerts;
|
||||
}
|
||||
package2certs.put(pname, pcerts);
|
||||
} else {
|
||||
Certificate[] certs = null;
|
||||
if (cs != null) {
|
||||
certs = cs.getCertificates();
|
||||
}
|
||||
|
||||
if (!compareCerts(pcerts, certs)) {
|
||||
throw new SecurityException("class \""+ name +
|
||||
"\"'s signer information does not match signer information of other classes in the same package");
|
||||
Certificate[] certs = null;
|
||||
if (cs != null) {
|
||||
certs = cs.getCertificates();
|
||||
}
|
||||
Certificate[] pcerts = null;
|
||||
if (parallelLockMap == null) {
|
||||
synchronized (this) {
|
||||
pcerts = package2certs.get(pname);
|
||||
if (pcerts == null) {
|
||||
package2certs.put(pname, (certs == null? nocerts:certs));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pcerts = ((ConcurrentHashMap<String, Certificate[]>)package2certs).
|
||||
putIfAbsent(pname, (certs == null? nocerts:certs));
|
||||
}
|
||||
if (pcerts != null && !compareCerts(pcerts, certs)) {
|
||||
throw new SecurityException("class \""+ name +
|
||||
"\"'s signer information does not match signer information of other classes in the same package");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1075,6 +1184,47 @@ public abstract class ClassLoader {
|
||||
return java.util.Collections.emptyEnumeration();
|
||||
}
|
||||
|
||||
// index 0: java.lang.ClassLoader.class
|
||||
// index 1: the immediate caller of index 0.
|
||||
// index 2: the immediate caller of index 1.
|
||||
private static native Class<? extends ClassLoader> getCaller(int index);
|
||||
|
||||
/**
|
||||
* Registers the caller class loader as parallel capable.
|
||||
* In order for the registration to succeed, all super classes
|
||||
* of the caller class loader must also be registered as
|
||||
* parallel capable when this method is called. </p>
|
||||
* Note that once a class loader is registered as
|
||||
* parallel capable, there is no way to change it back.
|
||||
* In addition, registration should be done statically before
|
||||
* any instance of the caller classloader being constructed. </p>
|
||||
*
|
||||
* @return true if the caller is successfully registered as
|
||||
* parallel capable and false if otherwise.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
protected static boolean registerAsParallelCapable() {
|
||||
Class<? extends ClassLoader> caller = getCaller(1);
|
||||
Class superCls = caller.getSuperclass();
|
||||
boolean result = false;
|
||||
// Explicit synchronization needed for composite action
|
||||
synchronized (parallelLoaders) {
|
||||
if (!parallelLoaders.contains(caller)) {
|
||||
if (parallelLoaders.contains(superCls)) {
|
||||
// register the immediate caller as parallel capable
|
||||
// if and only if all of its super classes are.
|
||||
// Note: given current classloading sequence, if
|
||||
// the immediate super class is parallel capable,
|
||||
// all the super classes higher up must be too.
|
||||
result = true;
|
||||
parallelLoaders.add(caller);
|
||||
}
|
||||
} else result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a resource of the specified name from the search path used to load
|
||||
* classes. This method locates the resource through the system class
|
||||
@ -1141,7 +1291,8 @@ public abstract class ClassLoader {
|
||||
private static Enumeration<URL> getBootstrapResources(String name)
|
||||
throws IOException
|
||||
{
|
||||
final Enumeration<Resource> e = getBootstrapClassPath().getResources(name);
|
||||
final Enumeration<Resource> e =
|
||||
getBootstrapClassPath().getResources(name);
|
||||
return new Enumeration<URL> () {
|
||||
public URL nextElement() {
|
||||
return e.nextElement().getURL();
|
||||
@ -1377,9 +1528,11 @@ public abstract class ClassLoader {
|
||||
}
|
||||
|
||||
// The class loader for the system
|
||||
// @GuardedBy("ClassLoader.class")
|
||||
private static ClassLoader scl;
|
||||
|
||||
// Set to true once the system class loader has been set
|
||||
// @GuardedBy("ClassLoader.class")
|
||||
private static boolean sclSet;
|
||||
|
||||
|
||||
@ -1592,19 +1745,6 @@ public abstract class ClassLoader {
|
||||
}
|
||||
}
|
||||
|
||||
// The "default" domain. Set as the default ProtectionDomain on newly
|
||||
// created classes.
|
||||
private ProtectionDomain defaultDomain = null;
|
||||
|
||||
// Returns (and initializes) the default domain.
|
||||
private synchronized ProtectionDomain getDefaultDomain() {
|
||||
if (defaultDomain == null) {
|
||||
CodeSource cs = new CodeSource(null, (Certificate[]) null);
|
||||
defaultDomain = new ProtectionDomain(cs, null, this, null);
|
||||
}
|
||||
return defaultDomain;
|
||||
}
|
||||
|
||||
// All native library names we've loaded.
|
||||
private static Vector<String> loadedLibraryNames
|
||||
= new Vector<String>();
|
||||
@ -1622,8 +1762,8 @@ public abstract class ClassLoader {
|
||||
= new Stack<NativeLibrary>();
|
||||
|
||||
// The paths searched for libraries
|
||||
static private String usr_paths[];
|
||||
static private String sys_paths[];
|
||||
private static String usr_paths[];
|
||||
private static String sys_paths[];
|
||||
|
||||
private static String[] initializePath(String propname) {
|
||||
String ldpath = System.getProperty(propname, "");
|
||||
@ -1803,7 +1943,10 @@ public abstract class ClassLoader {
|
||||
|
||||
// -- Assertion management --
|
||||
|
||||
final Object assertionLock;
|
||||
|
||||
// The default toggle for assertion checking.
|
||||
// @GuardedBy("assertionLock")
|
||||
private boolean defaultAssertionStatus = false;
|
||||
|
||||
// Maps String packageName to Boolean package default assertion status Note
|
||||
@ -1811,12 +1954,14 @@ public abstract class ClassLoader {
|
||||
// is null then we are delegating assertion status queries to the VM, i.e.,
|
||||
// none of this ClassLoader's assertion status modification methods have
|
||||
// been invoked.
|
||||
// @GuardedBy("assertionLock")
|
||||
private Map<String, Boolean> packageAssertionStatus = null;
|
||||
|
||||
// Maps String fullyQualifiedClassName to Boolean assertionStatus If this
|
||||
// field is null then we are delegating assertion status queries to the VM,
|
||||
// i.e., none of this ClassLoader's assertion status modification methods
|
||||
// have been invoked.
|
||||
// @GuardedBy("assertionLock")
|
||||
Map<String, Boolean> classAssertionStatus = null;
|
||||
|
||||
/**
|
||||
@ -1834,11 +1979,13 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public synchronized void setDefaultAssertionStatus(boolean enabled) {
|
||||
if (classAssertionStatus == null)
|
||||
initializeJavaAssertionMaps();
|
||||
public void setDefaultAssertionStatus(boolean enabled) {
|
||||
synchronized (assertionLock) {
|
||||
if (classAssertionStatus == null)
|
||||
initializeJavaAssertionMaps();
|
||||
|
||||
defaultAssertionStatus = enabled;
|
||||
defaultAssertionStatus = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1878,13 +2025,14 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public synchronized void setPackageAssertionStatus(String packageName,
|
||||
boolean enabled)
|
||||
{
|
||||
if (packageAssertionStatus == null)
|
||||
initializeJavaAssertionMaps();
|
||||
public void setPackageAssertionStatus(String packageName,
|
||||
boolean enabled) {
|
||||
synchronized (assertionLock) {
|
||||
if (packageAssertionStatus == null)
|
||||
initializeJavaAssertionMaps();
|
||||
|
||||
packageAssertionStatus.put(packageName, enabled);
|
||||
packageAssertionStatus.put(packageName, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1909,13 +2057,13 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public synchronized void setClassAssertionStatus(String className,
|
||||
boolean enabled)
|
||||
{
|
||||
if (classAssertionStatus == null)
|
||||
initializeJavaAssertionMaps();
|
||||
public void setClassAssertionStatus(String className, boolean enabled) {
|
||||
synchronized (assertionLock) {
|
||||
if (classAssertionStatus == null)
|
||||
initializeJavaAssertionMaps();
|
||||
|
||||
classAssertionStatus.put(className, enabled);
|
||||
classAssertionStatus.put(className, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1928,15 +2076,16 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public synchronized void clearAssertionStatus() {
|
||||
public void clearAssertionStatus() {
|
||||
/*
|
||||
* Whether or not "Java assertion maps" are initialized, set
|
||||
* them to empty maps, effectively ignoring any present settings.
|
||||
*/
|
||||
classAssertionStatus = new HashMap<String, Boolean>();
|
||||
packageAssertionStatus = new HashMap<String, Boolean>();
|
||||
|
||||
defaultAssertionStatus = false;
|
||||
synchronized (assertionLock) {
|
||||
classAssertionStatus = new HashMap<String, Boolean>();
|
||||
packageAssertionStatus = new HashMap<String, Boolean>();
|
||||
defaultAssertionStatus = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1961,39 +2110,40 @@ public abstract class ClassLoader {
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
synchronized boolean desiredAssertionStatus(String className) {
|
||||
Boolean result;
|
||||
boolean desiredAssertionStatus(String className) {
|
||||
synchronized (assertionLock) {
|
||||
// assert classAssertionStatus != null;
|
||||
// assert packageAssertionStatus != null;
|
||||
|
||||
// assert classAssertionStatus != null;
|
||||
// assert packageAssertionStatus != null;
|
||||
|
||||
// Check for a class entry
|
||||
result = classAssertionStatus.get(className);
|
||||
if (result != null)
|
||||
return result.booleanValue();
|
||||
|
||||
// Check for most specific package entry
|
||||
int dotIndex = className.lastIndexOf(".");
|
||||
if (dotIndex < 0) { // default package
|
||||
result = packageAssertionStatus.get(null);
|
||||
// Check for a class entry
|
||||
Boolean result = classAssertionStatus.get(className);
|
||||
if (result != null)
|
||||
return result.booleanValue();
|
||||
}
|
||||
while(dotIndex > 0) {
|
||||
className = className.substring(0, dotIndex);
|
||||
result = packageAssertionStatus.get(className);
|
||||
if (result != null)
|
||||
return result.booleanValue();
|
||||
dotIndex = className.lastIndexOf(".", dotIndex-1);
|
||||
}
|
||||
|
||||
// Return the classloader default
|
||||
return defaultAssertionStatus;
|
||||
// Check for most specific package entry
|
||||
int dotIndex = className.lastIndexOf(".");
|
||||
if (dotIndex < 0) { // default package
|
||||
result = packageAssertionStatus.get(null);
|
||||
if (result != null)
|
||||
return result.booleanValue();
|
||||
}
|
||||
while(dotIndex > 0) {
|
||||
className = className.substring(0, dotIndex);
|
||||
result = packageAssertionStatus.get(className);
|
||||
if (result != null)
|
||||
return result.booleanValue();
|
||||
dotIndex = className.lastIndexOf(".", dotIndex-1);
|
||||
}
|
||||
|
||||
// Return the classloader default
|
||||
return defaultAssertionStatus;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the assertions with information provided by the VM.
|
||||
// Note: Should only be called inside a synchronized block
|
||||
private void initializeJavaAssertionMaps() {
|
||||
// assert Thread.holdsLock(this);
|
||||
// assert Thread.holdsLock(assertionLock);
|
||||
|
||||
classAssertionStatus = new HashMap<String, Boolean>();
|
||||
packageAssertionStatus = new HashMap<String, Boolean>();
|
||||
|
@ -74,6 +74,7 @@ final class ConditionalSpecialCasing {
|
||||
new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE
|
||||
new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE
|
||||
new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE
|
||||
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
|
||||
|
||||
//# ================================================================================
|
||||
//# Turkish and Azeri
|
||||
@ -84,7 +85,10 @@ final class ConditionalSpecialCasing {
|
||||
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
|
||||
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
|
||||
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I
|
||||
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0) // # LATIN SMALL LETTER I
|
||||
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I
|
||||
//# ================================================================================
|
||||
//# Other
|
||||
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE
|
||||
};
|
||||
|
||||
// A hash table that contains the above entries
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
package java.lang;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* The {@code Integer} class wraps a value of the primitive type
|
||||
* {@code int} in an object. An object of type {@code Integer}
|
||||
@ -442,6 +444,12 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
public static int parseInt(String s, int radix)
|
||||
throws NumberFormatException
|
||||
{
|
||||
/*
|
||||
* WARNING: This method may be invoked early during VM initialization
|
||||
* before IntegerCache is initialized. Care must be taken to not use
|
||||
* the valueOf method.
|
||||
*/
|
||||
|
||||
if (s == null) {
|
||||
throw new NumberFormatException("null");
|
||||
}
|
||||
@ -545,7 +553,7 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
* does not contain a parsable {@code int}.
|
||||
*/
|
||||
public static Integer valueOf(String s, int radix) throws NumberFormatException {
|
||||
return new Integer(parseInt(s,radix));
|
||||
return Integer.valueOf(parseInt(s,radix));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -570,20 +578,56 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
* @exception NumberFormatException if the string cannot be parsed
|
||||
* as an integer.
|
||||
*/
|
||||
public static Integer valueOf(String s) throws NumberFormatException
|
||||
{
|
||||
return new Integer(parseInt(s, 10));
|
||||
public static Integer valueOf(String s) throws NumberFormatException {
|
||||
return Integer.valueOf(parseInt(s, 10));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache to support the object identity semantics of autoboxing for values between
|
||||
* -128 and 127 (inclusive) as required by JLS.
|
||||
*
|
||||
* The cache is initialized on first usage. During VM initialization the
|
||||
* getAndRemoveCacheProperties method may be used to get and remove any system
|
||||
* properites that configure the cache size. At this time, the size of the
|
||||
* cache may be controlled by the -XX:AutoBoxCacheMax=<size> option.
|
||||
*/
|
||||
|
||||
// value of java.lang.Integer.IntegerCache.high property (obtained during VM init)
|
||||
private static String integerCacheHighPropValue;
|
||||
|
||||
static void getAndRemoveCacheProperties() {
|
||||
if (!sun.misc.VM.isBooted()) {
|
||||
Properties props = System.getProperties();
|
||||
integerCacheHighPropValue =
|
||||
(String)props.remove("java.lang.Integer.IntegerCache.high");
|
||||
if (integerCacheHighPropValue != null)
|
||||
System.setProperties(props); // remove from system props
|
||||
}
|
||||
}
|
||||
|
||||
private static class IntegerCache {
|
||||
private IntegerCache(){}
|
||||
|
||||
static final Integer cache[] = new Integer[-(-128) + 127 + 1];
|
||||
static final int low = -128;
|
||||
static final int high;
|
||||
static final Integer cache[];
|
||||
|
||||
static {
|
||||
for(int i = 0; i < cache.length; i++)
|
||||
cache[i] = new Integer(i - 128);
|
||||
// high value may be configured by property
|
||||
int h = 127;
|
||||
if (integerCacheHighPropValue != null) {
|
||||
int i = parseInt(integerCacheHighPropValue);
|
||||
i = Math.max(i, 127);
|
||||
// Maximum array size is Integer.MAX_VALUE
|
||||
h = Math.min(i, Integer.MAX_VALUE - (-low));
|
||||
}
|
||||
high = h;
|
||||
|
||||
cache = new Integer[(high - low) + 1];
|
||||
int j = low;
|
||||
for(int k = 0; k < cache.length; k++)
|
||||
cache[k] = new Integer(j++);
|
||||
}
|
||||
|
||||
private IntegerCache() {}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -599,10 +643,9 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
* @since 1.5
|
||||
*/
|
||||
public static Integer valueOf(int i) {
|
||||
final int offset = 128;
|
||||
if (i >= -128 && i <= 127) { // must cache
|
||||
return IntegerCache.cache[i + offset];
|
||||
}
|
||||
assert IntegerCache.high >= 127;
|
||||
if (i >= IntegerCache.low && i <= IntegerCache.high)
|
||||
return IntegerCache.cache[i + (-IntegerCache.low)];
|
||||
return new Integer(i);
|
||||
}
|
||||
|
||||
@ -806,7 +849,7 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
*/
|
||||
public static Integer getInteger(String nm, int val) {
|
||||
Integer result = getInteger(nm, null);
|
||||
return (result == null) ? new Integer(val) : result;
|
||||
return (result == null) ? Integer.valueOf(val) : result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -938,7 +981,7 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
|
||||
try {
|
||||
result = Integer.valueOf(nm.substring(index), radix);
|
||||
result = negative ? new Integer(-result.intValue()) : result;
|
||||
result = negative ? Integer.valueOf(-result.intValue()) : result;
|
||||
} catch (NumberFormatException e) {
|
||||
// If number is Integer.MIN_VALUE, we'll end up here. The next line
|
||||
// handles this case, and causes any genuine format error to be
|
||||
|
@ -510,7 +510,7 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
* contain a parsable {@code long}.
|
||||
*/
|
||||
public static Long valueOf(String s, int radix) throws NumberFormatException {
|
||||
return new Long(parseLong(s, radix));
|
||||
return Long.valueOf(parseLong(s, radix));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -537,7 +537,7 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
*/
|
||||
public static Long valueOf(String s) throws NumberFormatException
|
||||
{
|
||||
return new Long(parseLong(s, 10));
|
||||
return Long.valueOf(parseLong(s, 10));
|
||||
}
|
||||
|
||||
private static class LongCache {
|
||||
@ -650,7 +650,7 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
|
||||
try {
|
||||
result = Long.valueOf(nm.substring(index), radix);
|
||||
result = negative ? new Long(-result.longValue()) : result;
|
||||
result = negative ? Long.valueOf(-result.longValue()) : result;
|
||||
} catch (NumberFormatException e) {
|
||||
// If number is Long.MIN_VALUE, we'll end up here. The next line
|
||||
// handles this case, and causes any genuine format error to be
|
||||
@ -869,7 +869,7 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
*/
|
||||
public static Long getLong(String nm, long val) {
|
||||
Long result = Long.getLong(nm, null);
|
||||
return (result == null) ? new Long(val) : result;
|
||||
return (result == null) ? Long.valueOf(val) : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2451,14 +2451,21 @@ public final class String
|
||||
}
|
||||
if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
|
||||
lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
|
||||
} else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
|
||||
lowerChar = Character.ERROR;
|
||||
} else {
|
||||
lowerChar = Character.toLowerCase(srcChar);
|
||||
}
|
||||
if ((lowerChar == Character.ERROR) ||
|
||||
(lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
|
||||
if (lowerChar == Character.ERROR) {
|
||||
lowerCharArray =
|
||||
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
|
||||
if (!localeDependent && srcChar == '\u0130') {
|
||||
lowerCharArray =
|
||||
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
|
||||
} else {
|
||||
lowerCharArray =
|
||||
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
|
||||
}
|
||||
} else if (srcCount == 2) {
|
||||
resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
|
||||
continue;
|
||||
|
@ -1105,6 +1105,13 @@ public final class System {
|
||||
props = new Properties();
|
||||
initProperties(props);
|
||||
sun.misc.Version.init();
|
||||
|
||||
// Gets and removes system properties that configure the Integer
|
||||
// cache used to support the object identity semantics of autoboxing.
|
||||
// At this time, the size of the cache may be controlled by the
|
||||
// -XX:AutoBoxCacheMax=<size> option.
|
||||
Integer.getAndRemoveCacheProperties();
|
||||
|
||||
FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
|
||||
FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
|
||||
FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
|
||||
|
@ -51,7 +51,7 @@ public class ReferenceQueue<T> {
|
||||
|
||||
static private class Lock { };
|
||||
private Lock lock = new Lock();
|
||||
private Reference<? extends T> head = null;
|
||||
private volatile Reference<? extends T> head = null;
|
||||
private long queueLength = 0;
|
||||
|
||||
boolean enqueue(Reference<? extends T> r) { /* Called only by Reference class */
|
||||
@ -95,6 +95,8 @@ public class ReferenceQueue<T> {
|
||||
* otherwise <code>null</code>
|
||||
*/
|
||||
public Reference<? extends T> poll() {
|
||||
if (head == null)
|
||||
return null;
|
||||
synchronized (lock) {
|
||||
return reallyPoll();
|
||||
}
|
||||
|
@ -63,11 +63,13 @@ package java.lang.ref;
|
||||
|
||||
public class SoftReference<T> extends Reference<T> {
|
||||
|
||||
/* Timestamp clock, updated by the garbage collector
|
||||
/**
|
||||
* Timestamp clock, updated by the garbage collector
|
||||
*/
|
||||
static private long clock;
|
||||
|
||||
/* Timestamp updated by each invocation of the get method. The VM may use
|
||||
/**
|
||||
* Timestamp updated by each invocation of the get method. The VM may use
|
||||
* this field when selecting soft references to be cleared, but it is not
|
||||
* required to do so.
|
||||
*/
|
||||
@ -108,7 +110,8 @@ public class SoftReference<T> extends Reference<T> {
|
||||
*/
|
||||
public T get() {
|
||||
T o = super.get();
|
||||
if (o != null) this.timestamp = clock;
|
||||
if (o != null && this.timestamp != clock)
|
||||
this.timestamp = clock;
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ import java.io.FileDescriptor;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import sun.net.ConnectionResetException;
|
||||
import sun.net.NetHooks;
|
||||
|
||||
/**
|
||||
* Default Socket Implementation. This implementation does
|
||||
@ -304,6 +305,11 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
|
||||
*/
|
||||
|
||||
synchronized void doConnect(InetAddress address, int port, int timeout) throws IOException {
|
||||
synchronized (fdLock) {
|
||||
if (!closePending && (socket == null || !socket.isBound())) {
|
||||
NetHooks.beforeTcpConnect(fd, address, port);
|
||||
}
|
||||
}
|
||||
try {
|
||||
FileDescriptor fd = acquireFD();
|
||||
try {
|
||||
@ -339,6 +345,11 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
|
||||
protected synchronized void bind(InetAddress address, int lport)
|
||||
throws IOException
|
||||
{
|
||||
synchronized (fdLock) {
|
||||
if (!closePending && (socket == null || !socket.isBound())) {
|
||||
NetHooks.beforeTcpBind(fd, address, lport);
|
||||
}
|
||||
}
|
||||
socketBind(address, lport);
|
||||
if (socket != null)
|
||||
socket.setBound();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -74,10 +74,10 @@ import sun.security.util.SecurityConstants;
|
||||
*/
|
||||
public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
/* The search path for classes and resources */
|
||||
URLClassPath ucp;
|
||||
private final URLClassPath ucp;
|
||||
|
||||
/* The context to be used when loading classes and resources */
|
||||
private AccessControlContext acc;
|
||||
private final AccessControlContext acc;
|
||||
|
||||
/**
|
||||
* Constructs a new URLClassLoader for the given URLs. The URLs will be
|
||||
@ -105,7 +105,19 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
security.checkCreateClassLoader();
|
||||
}
|
||||
ucp = new URLClassPath(urls);
|
||||
acc = AccessController.getContext();
|
||||
this.acc = AccessController.getContext();
|
||||
}
|
||||
|
||||
URLClassLoader(URL[] urls, ClassLoader parent,
|
||||
AccessControlContext acc) {
|
||||
super(parent);
|
||||
// this is to make the stack depth consistent with 1.1
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkCreateClassLoader();
|
||||
}
|
||||
ucp = new URLClassPath(urls);
|
||||
this.acc = acc;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +148,18 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
security.checkCreateClassLoader();
|
||||
}
|
||||
ucp = new URLClassPath(urls);
|
||||
acc = AccessController.getContext();
|
||||
this.acc = AccessController.getContext();
|
||||
}
|
||||
|
||||
URLClassLoader(URL[] urls, AccessControlContext acc) {
|
||||
super();
|
||||
// this is to make the stack depth consistent with 1.1
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkCreateClassLoader();
|
||||
}
|
||||
ucp = new URLClassPath(urls);
|
||||
this.acc = acc;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -599,17 +622,14 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
public static URLClassLoader newInstance(final URL[] urls,
|
||||
final ClassLoader parent) {
|
||||
// Save the caller's context
|
||||
AccessControlContext acc = AccessController.getContext();
|
||||
final AccessControlContext acc = AccessController.getContext();
|
||||
// Need a privileged block to create the class loader
|
||||
URLClassLoader ucl = AccessController.doPrivileged(
|
||||
new PrivilegedAction<URLClassLoader>() {
|
||||
public URLClassLoader run() {
|
||||
return new FactoryURLClassLoader(urls, parent);
|
||||
return new FactoryURLClassLoader(urls, parent, acc);
|
||||
}
|
||||
});
|
||||
// Now set the context on the loader using the one we saved,
|
||||
// not the one inside the privileged block...
|
||||
ucl.acc = acc;
|
||||
return ucl;
|
||||
}
|
||||
|
||||
@ -626,18 +646,14 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
*/
|
||||
public static URLClassLoader newInstance(final URL[] urls) {
|
||||
// Save the caller's context
|
||||
AccessControlContext acc = AccessController.getContext();
|
||||
final AccessControlContext acc = AccessController.getContext();
|
||||
// Need a privileged block to create the class loader
|
||||
URLClassLoader ucl = AccessController.doPrivileged(
|
||||
new PrivilegedAction<URLClassLoader>() {
|
||||
public URLClassLoader run() {
|
||||
return new FactoryURLClassLoader(urls);
|
||||
return new FactoryURLClassLoader(urls, acc);
|
||||
}
|
||||
});
|
||||
|
||||
// Now set the context on the loader using the one we saved,
|
||||
// not the one inside the privileged block...
|
||||
ucl.acc = acc;
|
||||
return ucl;
|
||||
}
|
||||
|
||||
@ -649,20 +665,26 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
}
|
||||
}
|
||||
);
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
}
|
||||
}
|
||||
|
||||
final class FactoryURLClassLoader extends URLClassLoader {
|
||||
|
||||
FactoryURLClassLoader(URL[] urls, ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
}
|
||||
|
||||
FactoryURLClassLoader(URL[] urls) {
|
||||
super(urls);
|
||||
FactoryURLClassLoader(URL[] urls, ClassLoader parent,
|
||||
AccessControlContext acc) {
|
||||
super(urls, parent, acc);
|
||||
}
|
||||
|
||||
public final synchronized Class loadClass(String name, boolean resolve)
|
||||
FactoryURLClassLoader(URL[] urls, AccessControlContext acc) {
|
||||
super(urls, acc);
|
||||
}
|
||||
|
||||
public final Class loadClass(String name, boolean resolve)
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
// First check if we have permission to access the package. This
|
||||
|
@ -261,7 +261,10 @@ public abstract class DatagramChannel
|
||||
*
|
||||
* <p> This method may be invoked at any time. It will not have any effect
|
||||
* on read or write operations that are already in progress at the moment
|
||||
* that it is invoked. </p>
|
||||
* that it is invoked. If this channel's socket is not bound then this method
|
||||
* will first cause the socket to be bound to an address that is assigned
|
||||
* automatically, as if invoking the {@link #bind bind} method with a
|
||||
* parameter of {@code null}. </p>
|
||||
*
|
||||
* @param remote
|
||||
* The remote address to which this channel is to be connected
|
||||
@ -356,7 +359,10 @@ public abstract class DatagramChannel
|
||||
* <p> This method may be invoked at any time. If another thread has
|
||||
* already initiated a read operation upon this channel, however, then an
|
||||
* invocation of this method will block until the first operation is
|
||||
* complete. </p>
|
||||
* complete. If this channel's socket is not bound then this method will
|
||||
* first cause the socket to be bound to an address that is assigned
|
||||
* automatically, as if invoking the {@link #bind bind} method with a
|
||||
* parameter of {@code null}. </p>
|
||||
*
|
||||
* @param dst
|
||||
* The buffer into which the datagram is to be transferred
|
||||
@ -413,7 +419,10 @@ public abstract class DatagramChannel
|
||||
* <p> This method may be invoked at any time. If another thread has
|
||||
* already initiated a write operation upon this channel, however, then an
|
||||
* invocation of this method will block until the first operation is
|
||||
* complete. </p>
|
||||
* complete. If this channel's socket is not bound then this method will
|
||||
* first cause the socket to be bound to an address that is assigned
|
||||
* automatically, as if by invoking the {@link #bind bind) method with a
|
||||
* parameter of {@code null}. </p>
|
||||
*
|
||||
* @param src
|
||||
* The buffer containing the datagram to be sent
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,14 +45,19 @@ public class SecureClassLoader extends ClassLoader {
|
||||
* succeed. Otherwise the object is not initialized and the object is
|
||||
* useless.
|
||||
*/
|
||||
private boolean initialized = false;
|
||||
private final boolean initialized;
|
||||
|
||||
// HashMap that maps CodeSource to ProtectionDomain
|
||||
private HashMap<CodeSource, ProtectionDomain> pdcache =
|
||||
// @GuardedBy("pdcache")
|
||||
private final HashMap<CodeSource, ProtectionDomain> pdcache =
|
||||
new HashMap<CodeSource, ProtectionDomain>(11);
|
||||
|
||||
private static final Debug debug = Debug.getInstance("scl");
|
||||
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SecureClassLoader using the specified parent
|
||||
* class loader for delegation.
|
||||
@ -136,10 +141,7 @@ public class SecureClassLoader extends ClassLoader {
|
||||
byte[] b, int off, int len,
|
||||
CodeSource cs)
|
||||
{
|
||||
if (cs == null)
|
||||
return defineClass(name, b, off, len);
|
||||
else
|
||||
return defineClass(name, b, off, len, getProtectionDomain(cs));
|
||||
return defineClass(name, b, off, len, getProtectionDomain(cs));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,10 +174,7 @@ public class SecureClassLoader extends ClassLoader {
|
||||
protected final Class<?> defineClass(String name, java.nio.ByteBuffer b,
|
||||
CodeSource cs)
|
||||
{
|
||||
if (cs == null)
|
||||
return defineClass(name, b, (ProtectionDomain)null);
|
||||
else
|
||||
return defineClass(name, b, getProtectionDomain(cs));
|
||||
return defineClass(name, b, getProtectionDomain(cs));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,12 +208,10 @@ public class SecureClassLoader extends ClassLoader {
|
||||
if (pd == null) {
|
||||
PermissionCollection perms = getPermissions(cs);
|
||||
pd = new ProtectionDomain(cs, perms, this, null);
|
||||
if (pd != null) {
|
||||
pdcache.put(cs, pd);
|
||||
if (debug != null) {
|
||||
debug.println(" getPermissions "+ pd);
|
||||
debug.println("");
|
||||
}
|
||||
pdcache.put(cs, pd);
|
||||
if (debug != null) {
|
||||
debug.println(" getPermissions "+ pd);
|
||||
debug.println("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1068,14 +1068,14 @@ public class TreeMap<K,V>
|
||||
}
|
||||
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
|
||||
E toElement, boolean toInclusive) {
|
||||
return new TreeSet<E>(m.subMap(fromElement, fromInclusive,
|
||||
toElement, toInclusive));
|
||||
return new KeySet<E>(m.subMap(fromElement, fromInclusive,
|
||||
toElement, toInclusive));
|
||||
}
|
||||
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||
return new TreeSet<E>(m.headMap(toElement, inclusive));
|
||||
return new KeySet<E>(m.headMap(toElement, inclusive));
|
||||
}
|
||||
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||
return new TreeSet<E>(m.tailMap(fromElement, inclusive));
|
||||
return new KeySet<E>(m.tailMap(fromElement, inclusive));
|
||||
}
|
||||
public SortedSet<E> subSet(E fromElement, E toElement) {
|
||||
return subSet(fromElement, true, toElement, false);
|
||||
@ -1087,7 +1087,7 @@ public class TreeMap<K,V>
|
||||
return tailSet(fromElement, true);
|
||||
}
|
||||
public NavigableSet<E> descendingSet() {
|
||||
return new TreeSet(m.descendingMap());
|
||||
return new KeySet(m.descendingMap());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2394,15 +2394,14 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
boolean fromInclusive,
|
||||
E toElement,
|
||||
boolean toInclusive) {
|
||||
return new ConcurrentSkipListSet<E>
|
||||
(m.subMap(fromElement, fromInclusive,
|
||||
toElement, toInclusive));
|
||||
return new KeySet<E>(m.subMap(fromElement, fromInclusive,
|
||||
toElement, toInclusive));
|
||||
}
|
||||
public NavigableSet<E> headSet(E toElement, boolean inclusive) {
|
||||
return new ConcurrentSkipListSet<E>(m.headMap(toElement, inclusive));
|
||||
return new KeySet<E>(m.headMap(toElement, inclusive));
|
||||
}
|
||||
public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
|
||||
return new ConcurrentSkipListSet<E>(m.tailMap(fromElement, inclusive));
|
||||
return new KeySet<E>(m.tailMap(fromElement, inclusive));
|
||||
}
|
||||
public NavigableSet<E> subSet(E fromElement, E toElement) {
|
||||
return subSet(fromElement, true, toElement, false);
|
||||
@ -2414,7 +2413,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
return tailSet(fromElement, true);
|
||||
}
|
||||
public NavigableSet<E> descendingSet() {
|
||||
return new ConcurrentSkipListSet(m.descendingMap());
|
||||
return new KeySet(m.descendingMap());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,11 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
static final int SIGNAL = -1;
|
||||
/** waitStatus value to indicate thread is waiting on condition */
|
||||
static final int CONDITION = -2;
|
||||
/**
|
||||
* waitStatus value to indicate the next acquireShared should
|
||||
* unconditionally propagate
|
||||
*/
|
||||
static final int PROPAGATE = -3;
|
||||
|
||||
/**
|
||||
* Status field, taking on only the values:
|
||||
@ -180,10 +185,16 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
* Nodes never leave this state. In particular,
|
||||
* a thread with cancelled node never again blocks.
|
||||
* CONDITION: This node is currently on a condition queue.
|
||||
* It will not be used as a sync queue node until
|
||||
* transferred. (Use of this value here
|
||||
* has nothing to do with the other uses
|
||||
* of the field, but simplifies mechanics.)
|
||||
* It will not be used as a sync queue node
|
||||
* until transferred, at which time the status
|
||||
* will be set to 0. (Use of this value here has
|
||||
* nothing to do with the other uses of the
|
||||
* field, but simplifies mechanics.)
|
||||
* PROPAGATE: A releaseShared should be propagated to other
|
||||
* nodes. This is set (for head node only) in
|
||||
* doReleaseShared to ensure propagation
|
||||
* continues, even if other operations have
|
||||
* since intervened.
|
||||
* 0: None of the above
|
||||
*
|
||||
* The values are arranged numerically to simplify use.
|
||||
@ -403,10 +414,13 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
*/
|
||||
private void unparkSuccessor(Node node) {
|
||||
/*
|
||||
* Try to clear status in anticipation of signalling. It is
|
||||
* OK if this fails or if status is changed by waiting thread.
|
||||
* If status is negative (i.e., possibly needing signal) try
|
||||
* to clear in anticipation of signalling. It is OK if this
|
||||
* fails or if status is changed by waiting thread.
|
||||
*/
|
||||
compareAndSetWaitStatus(node, Node.SIGNAL, 0);
|
||||
int ws = node.waitStatus;
|
||||
if (ws < 0)
|
||||
compareAndSetWaitStatus(node, ws, 0);
|
||||
|
||||
/*
|
||||
* Thread to unpark is held in successor, which is normally
|
||||
@ -425,24 +439,71 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
LockSupport.unpark(s.thread);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release action for shared mode -- signal successor and ensure
|
||||
* propagation. (Note: For exclusive mode, release just amounts
|
||||
* to calling unparkSuccessor of head if it needs signal.)
|
||||
*/
|
||||
private void doReleaseShared() {
|
||||
/*
|
||||
* Ensure that a release propagates, even if there are other
|
||||
* in-progress acquires/releases. This proceeds in the usual
|
||||
* way of trying to unparkSuccessor of head if it needs
|
||||
* signal. But if it does not, status is set to PROPAGATE to
|
||||
* ensure that upon release, propagation continues.
|
||||
* Additionally, we must loop in case a new node is added
|
||||
* while we are doing this. Also, unlike other uses of
|
||||
* unparkSuccessor, we need to know if CAS to reset status
|
||||
* fails, if so rechecking.
|
||||
*/
|
||||
for (;;) {
|
||||
Node h = head;
|
||||
if (h != null && h != tail) {
|
||||
int ws = h.waitStatus;
|
||||
if (ws == Node.SIGNAL) {
|
||||
if (!compareAndSetWaitStatus(h, Node.SIGNAL, 0))
|
||||
continue; // loop to recheck cases
|
||||
unparkSuccessor(h);
|
||||
}
|
||||
else if (ws == 0 &&
|
||||
!compareAndSetWaitStatus(h, 0, Node.PROPAGATE))
|
||||
continue; // loop on failed CAS
|
||||
}
|
||||
if (h == head) // loop if head changed
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets head of queue, and checks if successor may be waiting
|
||||
* in shared mode, if so propagating if propagate > 0.
|
||||
* in shared mode, if so propagating if either propagate > 0 or
|
||||
* PROPAGATE status was set.
|
||||
*
|
||||
* @param pred the node holding waitStatus for node
|
||||
* @param node the node
|
||||
* @param propagate the return value from a tryAcquireShared
|
||||
*/
|
||||
private void setHeadAndPropagate(Node node, long propagate) {
|
||||
Node h = head; // Record old head for check below
|
||||
setHead(node);
|
||||
if (propagate > 0 && node.waitStatus != 0) {
|
||||
/*
|
||||
* Don't bother fully figuring out successor. If it
|
||||
* looks null, call unparkSuccessor anyway to be safe.
|
||||
*/
|
||||
/*
|
||||
* Try to signal next queued node if:
|
||||
* Propagation was indicated by caller,
|
||||
* or was recorded (as h.waitStatus) by a previous operation
|
||||
* (note: this uses sign-check of waitStatus because
|
||||
* PROPAGATE status may transition to SIGNAL.)
|
||||
* and
|
||||
* The next node is waiting in shared mode,
|
||||
* or we don't know, because it appears null
|
||||
*
|
||||
* The conservatism in both of these checks may cause
|
||||
* unnecessary wake-ups, but only when there are multiple
|
||||
* racing acquires/releases, so most need signals now or soon
|
||||
* anyway.
|
||||
*/
|
||||
if (propagate > 0 || h == null || h.waitStatus < 0) {
|
||||
Node s = node.next;
|
||||
if (s == null || s.isShared())
|
||||
unparkSuccessor(node);
|
||||
doReleaseShared();
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,23 +526,27 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
while (pred.waitStatus > 0)
|
||||
node.prev = pred = pred.prev;
|
||||
|
||||
// Getting this before setting waitStatus ensures staleness
|
||||
// predNext is the apparent node to unsplice. CASes below will
|
||||
// fail if not, in which case, we lost race vs another cancel
|
||||
// or signal, so no further action is necessary.
|
||||
Node predNext = pred.next;
|
||||
|
||||
// Can use unconditional write instead of CAS here
|
||||
// Can use unconditional write instead of CAS here.
|
||||
// After this atomic step, other Nodes can skip past us.
|
||||
// Before, we are free of interference from other threads.
|
||||
node.waitStatus = Node.CANCELLED;
|
||||
|
||||
// If we are the tail, remove ourselves
|
||||
// If we are the tail, remove ourselves.
|
||||
if (node == tail && compareAndSetTail(node, pred)) {
|
||||
compareAndSetNext(pred, predNext, null);
|
||||
} else {
|
||||
// If "active" predecessor found...
|
||||
if (pred != head
|
||||
&& (pred.waitStatus == Node.SIGNAL
|
||||
|| compareAndSetWaitStatus(pred, 0, Node.SIGNAL))
|
||||
&& pred.thread != null) {
|
||||
|
||||
// If successor is active, set predecessor's next link
|
||||
// If successor needs signal, try to set pred's next-link
|
||||
// so it will get one. Otherwise wake it up to propagate.
|
||||
int ws;
|
||||
if (pred != head &&
|
||||
((ws = pred.waitStatus) == Node.SIGNAL ||
|
||||
(ws <= 0 && compareAndSetWaitStatus(pred, ws, Node.SIGNAL))) &&
|
||||
pred.thread != null) {
|
||||
Node next = node.next;
|
||||
if (next != null && next.waitStatus <= 0)
|
||||
compareAndSetNext(pred, predNext, next);
|
||||
@ -503,14 +568,14 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
* @return {@code true} if thread should block
|
||||
*/
|
||||
private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) {
|
||||
int s = pred.waitStatus;
|
||||
if (s < 0)
|
||||
int ws = pred.waitStatus;
|
||||
if (ws == Node.SIGNAL)
|
||||
/*
|
||||
* This node has already set status asking a release
|
||||
* to signal it, so it can safely park.
|
||||
*/
|
||||
return true;
|
||||
if (s > 0) {
|
||||
if (ws > 0) {
|
||||
/*
|
||||
* Predecessor was cancelled. Skip over predecessors and
|
||||
* indicate retry.
|
||||
@ -519,14 +584,14 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
node.prev = pred = pred.prev;
|
||||
} while (pred.waitStatus > 0);
|
||||
pred.next = node;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
/*
|
||||
* Indicate that we need a signal, but don't park yet. Caller
|
||||
* will need to retry to make sure it cannot acquire before
|
||||
* parking.
|
||||
* waitStatus must be 0 or PROPAGATE. Indicate that we
|
||||
* need a signal, but don't park yet. Caller will need to
|
||||
* retry to make sure it cannot acquire before parking.
|
||||
*/
|
||||
compareAndSetWaitStatus(pred, 0, Node.SIGNAL);
|
||||
compareAndSetWaitStatus(pred, ws, Node.SIGNAL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1046,9 +1111,7 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
*/
|
||||
public final boolean releaseShared(long arg) {
|
||||
if (tryReleaseShared(arg)) {
|
||||
Node h = head;
|
||||
if (h != null && h.waitStatus != 0)
|
||||
unparkSuccessor(h);
|
||||
doReleaseShared();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1390,8 +1453,8 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
* case the waitStatus can be transiently and harmlessly wrong).
|
||||
*/
|
||||
Node p = enq(node);
|
||||
int c = p.waitStatus;
|
||||
if (c > 0 || !compareAndSetWaitStatus(p, c, Node.SIGNAL))
|
||||
int ws = p.waitStatus;
|
||||
if (ws > 0 || !compareAndSetWaitStatus(p, ws, Node.SIGNAL))
|
||||
LockSupport.unpark(node.thread);
|
||||
return true;
|
||||
}
|
||||
|
@ -389,6 +389,11 @@ public abstract class AbstractQueuedSynchronizer
|
||||
static final int SIGNAL = -1;
|
||||
/** waitStatus value to indicate thread is waiting on condition */
|
||||
static final int CONDITION = -2;
|
||||
/**
|
||||
* waitStatus value to indicate the next acquireShared should
|
||||
* unconditionally propagate
|
||||
*/
|
||||
static final int PROPAGATE = -3;
|
||||
|
||||
/**
|
||||
* Status field, taking on only the values:
|
||||
@ -403,10 +408,16 @@ public abstract class AbstractQueuedSynchronizer
|
||||
* Nodes never leave this state. In particular,
|
||||
* a thread with cancelled node never again blocks.
|
||||
* CONDITION: This node is currently on a condition queue.
|
||||
* It will not be used as a sync queue node until
|
||||
* transferred. (Use of this value here
|
||||
* has nothing to do with the other uses
|
||||
* of the field, but simplifies mechanics.)
|
||||
* It will not be used as a sync queue node
|
||||
* until transferred, at which time the status
|
||||
* will be set to 0. (Use of this value here has
|
||||
* nothing to do with the other uses of the
|
||||
* field, but simplifies mechanics.)
|
||||
* PROPAGATE: A releaseShared should be propagated to other
|
||||
* nodes. This is set (for head node only) in
|
||||
* doReleaseShared to ensure propagation
|
||||
* continues, even if other operations have
|
||||
* since intervened.
|
||||
* 0: None of the above
|
||||
*
|
||||
* The values are arranged numerically to simplify use.
|
||||
@ -626,10 +637,13 @@ public abstract class AbstractQueuedSynchronizer
|
||||
*/
|
||||
private void unparkSuccessor(Node node) {
|
||||
/*
|
||||
* Try to clear status in anticipation of signalling. It is
|
||||
* OK if this fails or if status is changed by waiting thread.
|
||||
* If status is negative (i.e., possibly needing signal) try
|
||||
* to clear in anticipation of signalling. It is OK if this
|
||||
* fails or if status is changed by waiting thread.
|
||||
*/
|
||||
compareAndSetWaitStatus(node, Node.SIGNAL, 0);
|
||||
int ws = node.waitStatus;
|
||||
if (ws < 0)
|
||||
compareAndSetWaitStatus(node, ws, 0);
|
||||
|
||||
/*
|
||||
* Thread to unpark is held in successor, which is normally
|
||||
@ -648,24 +662,71 @@ public abstract class AbstractQueuedSynchronizer
|
||||
LockSupport.unpark(s.thread);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release action for shared mode -- signal successor and ensure
|
||||
* propagation. (Note: For exclusive mode, release just amounts
|
||||
* to calling unparkSuccessor of head if it needs signal.)
|
||||
*/
|
||||
private void doReleaseShared() {
|
||||
/*
|
||||
* Ensure that a release propagates, even if there are other
|
||||
* in-progress acquires/releases. This proceeds in the usual
|
||||
* way of trying to unparkSuccessor of head if it needs
|
||||
* signal. But if it does not, status is set to PROPAGATE to
|
||||
* ensure that upon release, propagation continues.
|
||||
* Additionally, we must loop in case a new node is added
|
||||
* while we are doing this. Also, unlike other uses of
|
||||
* unparkSuccessor, we need to know if CAS to reset status
|
||||
* fails, if so rechecking.
|
||||
*/
|
||||
for (;;) {
|
||||
Node h = head;
|
||||
if (h != null && h != tail) {
|
||||
int ws = h.waitStatus;
|
||||
if (ws == Node.SIGNAL) {
|
||||
if (!compareAndSetWaitStatus(h, Node.SIGNAL, 0))
|
||||
continue; // loop to recheck cases
|
||||
unparkSuccessor(h);
|
||||
}
|
||||
else if (ws == 0 &&
|
||||
!compareAndSetWaitStatus(h, 0, Node.PROPAGATE))
|
||||
continue; // loop on failed CAS
|
||||
}
|
||||
if (h == head) // loop if head changed
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets head of queue, and checks if successor may be waiting
|
||||
* in shared mode, if so propagating if propagate > 0.
|
||||
* in shared mode, if so propagating if either propagate > 0 or
|
||||
* PROPAGATE status was set.
|
||||
*
|
||||
* @param pred the node holding waitStatus for node
|
||||
* @param node the node
|
||||
* @param propagate the return value from a tryAcquireShared
|
||||
*/
|
||||
private void setHeadAndPropagate(Node node, int propagate) {
|
||||
Node h = head; // Record old head for check below
|
||||
setHead(node);
|
||||
if (propagate > 0 && node.waitStatus != 0) {
|
||||
/*
|
||||
* Don't bother fully figuring out successor. If it
|
||||
* looks null, call unparkSuccessor anyway to be safe.
|
||||
*/
|
||||
/*
|
||||
* Try to signal next queued node if:
|
||||
* Propagation was indicated by caller,
|
||||
* or was recorded (as h.waitStatus) by a previous operation
|
||||
* (note: this uses sign-check of waitStatus because
|
||||
* PROPAGATE status may transition to SIGNAL.)
|
||||
* and
|
||||
* The next node is waiting in shared mode,
|
||||
* or we don't know, because it appears null
|
||||
*
|
||||
* The conservatism in both of these checks may cause
|
||||
* unnecessary wake-ups, but only when there are multiple
|
||||
* racing acquires/releases, so most need signals now or soon
|
||||
* anyway.
|
||||
*/
|
||||
if (propagate > 0 || h == null || h.waitStatus < 0) {
|
||||
Node s = node.next;
|
||||
if (s == null || s.isShared())
|
||||
unparkSuccessor(node);
|
||||
doReleaseShared();
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,23 +749,27 @@ public abstract class AbstractQueuedSynchronizer
|
||||
while (pred.waitStatus > 0)
|
||||
node.prev = pred = pred.prev;
|
||||
|
||||
// Getting this before setting waitStatus ensures staleness
|
||||
// predNext is the apparent node to unsplice. CASes below will
|
||||
// fail if not, in which case, we lost race vs another cancel
|
||||
// or signal, so no further action is necessary.
|
||||
Node predNext = pred.next;
|
||||
|
||||
// Can use unconditional write instead of CAS here
|
||||
// Can use unconditional write instead of CAS here.
|
||||
// After this atomic step, other Nodes can skip past us.
|
||||
// Before, we are free of interference from other threads.
|
||||
node.waitStatus = Node.CANCELLED;
|
||||
|
||||
// If we are the tail, remove ourselves
|
||||
// If we are the tail, remove ourselves.
|
||||
if (node == tail && compareAndSetTail(node, pred)) {
|
||||
compareAndSetNext(pred, predNext, null);
|
||||
} else {
|
||||
// If "active" predecessor found...
|
||||
if (pred != head
|
||||
&& (pred.waitStatus == Node.SIGNAL
|
||||
|| compareAndSetWaitStatus(pred, 0, Node.SIGNAL))
|
||||
&& pred.thread != null) {
|
||||
|
||||
// If successor is active, set predecessor's next link
|
||||
// If successor needs signal, try to set pred's next-link
|
||||
// so it will get one. Otherwise wake it up to propagate.
|
||||
int ws;
|
||||
if (pred != head &&
|
||||
((ws = pred.waitStatus) == Node.SIGNAL ||
|
||||
(ws <= 0 && compareAndSetWaitStatus(pred, ws, Node.SIGNAL))) &&
|
||||
pred.thread != null) {
|
||||
Node next = node.next;
|
||||
if (next != null && next.waitStatus <= 0)
|
||||
compareAndSetNext(pred, predNext, next);
|
||||
@ -726,14 +791,14 @@ public abstract class AbstractQueuedSynchronizer
|
||||
* @return {@code true} if thread should block
|
||||
*/
|
||||
private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) {
|
||||
int s = pred.waitStatus;
|
||||
if (s < 0)
|
||||
int ws = pred.waitStatus;
|
||||
if (ws == Node.SIGNAL)
|
||||
/*
|
||||
* This node has already set status asking a release
|
||||
* to signal it, so it can safely park.
|
||||
*/
|
||||
return true;
|
||||
if (s > 0) {
|
||||
if (ws > 0) {
|
||||
/*
|
||||
* Predecessor was cancelled. Skip over predecessors and
|
||||
* indicate retry.
|
||||
@ -742,14 +807,14 @@ public abstract class AbstractQueuedSynchronizer
|
||||
node.prev = pred = pred.prev;
|
||||
} while (pred.waitStatus > 0);
|
||||
pred.next = node;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
/*
|
||||
* Indicate that we need a signal, but don't park yet. Caller
|
||||
* will need to retry to make sure it cannot acquire before
|
||||
* parking.
|
||||
* waitStatus must be 0 or PROPAGATE. Indicate that we
|
||||
* need a signal, but don't park yet. Caller will need to
|
||||
* retry to make sure it cannot acquire before parking.
|
||||
*/
|
||||
compareAndSetWaitStatus(pred, 0, Node.SIGNAL);
|
||||
compareAndSetWaitStatus(pred, ws, Node.SIGNAL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1269,9 +1334,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
*/
|
||||
public final boolean releaseShared(int arg) {
|
||||
if (tryReleaseShared(arg)) {
|
||||
Node h = head;
|
||||
if (h != null && h.waitStatus != 0)
|
||||
unparkSuccessor(h);
|
||||
doReleaseShared();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1613,8 +1676,8 @@ public abstract class AbstractQueuedSynchronizer
|
||||
* case the waitStatus can be transiently and harmlessly wrong).
|
||||
*/
|
||||
Node p = enq(node);
|
||||
int c = p.waitStatus;
|
||||
if (c > 0 || !compareAndSetWaitStatus(p, c, Node.SIGNAL))
|
||||
int ws = p.waitStatus;
|
||||
if (ws > 0 || !compareAndSetWaitStatus(p, ws, Node.SIGNAL))
|
||||
LockSupport.unpark(node.thread);
|
||||
return true;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
* Maintained as a ThreadLocal; cached in cachedHoldCounter
|
||||
*/
|
||||
static final class HoldCounter {
|
||||
int count;
|
||||
int count = 0;
|
||||
// Use id, not reference, to avoid garbage retention
|
||||
final long tid = Thread.currentThread().getId();
|
||||
}
|
||||
@ -293,8 +293,9 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of read locks held by current thread.
|
||||
* The number of reentrant read locks held by current thread.
|
||||
* Initialized only in constructor and readObject.
|
||||
* Removed whenever a thread's read hold count drops to 0.
|
||||
*/
|
||||
private transient ThreadLocalHoldCounter readHolds;
|
||||
|
||||
@ -304,17 +305,35 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
* where the next thread to release is the last one to
|
||||
* acquire. This is non-volatile since it is just used
|
||||
* as a heuristic, and would be great for threads to cache.
|
||||
*
|
||||
* <p>Can outlive the Thread for which it is caching the read
|
||||
* hold count, but avoids garbage retention by not retaining a
|
||||
* reference to the Thread.
|
||||
*
|
||||
* <p>Accessed via a benign data race; relies on the memory
|
||||
* model's final field and out-of-thin-air guarantees.
|
||||
*/
|
||||
private transient HoldCounter cachedHoldCounter;
|
||||
|
||||
/**
|
||||
* firstReader is the first thread to have acquired the read lock.
|
||||
* firstReaderHoldCount is firstReader's hold count.
|
||||
* This allows tracking of read holds for uncontended read
|
||||
*
|
||||
* <p>More precisely, firstReader is the unique thread that last
|
||||
* changed the shared count from 0 to 1, and has not released the
|
||||
* read lock since then; null if there is no such thread.
|
||||
*
|
||||
* <p>Cannot cause garbage retention unless the thread terminated
|
||||
* without relinquishing its read locks, since tryReleaseShared
|
||||
* sets it to null.
|
||||
*
|
||||
* <p>Accessed via a benign data race; relies on the memory
|
||||
* model's out-of-thin-air guarantees for references.
|
||||
*
|
||||
* <p>This allows tracking of read holds for uncontended read
|
||||
* locks to be very cheap.
|
||||
*/
|
||||
private final static long INVALID_THREAD_ID = -1;
|
||||
private transient long firstReader = INVALID_THREAD_ID;
|
||||
private transient Thread firstReader = null;
|
||||
private transient int firstReaderHoldCount;
|
||||
|
||||
Sync() {
|
||||
@ -393,16 +412,16 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
}
|
||||
|
||||
protected final boolean tryReleaseShared(int unused) {
|
||||
long tid = Thread.currentThread().getId();
|
||||
if (firstReader == tid) {
|
||||
Thread current = Thread.currentThread();
|
||||
if (firstReader == current) {
|
||||
// assert firstReaderHoldCount > 0;
|
||||
if (firstReaderHoldCount == 1)
|
||||
firstReader = INVALID_THREAD_ID;
|
||||
firstReader = null;
|
||||
else
|
||||
firstReaderHoldCount--;
|
||||
} else {
|
||||
HoldCounter rh = cachedHoldCounter;
|
||||
if (rh == null || rh.tid != tid)
|
||||
if (rh == null || rh.tid != current.getId())
|
||||
rh = readHolds.get();
|
||||
int count = rh.count;
|
||||
if (count <= 1) {
|
||||
@ -416,6 +435,9 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
int c = getState();
|
||||
int nextc = c - SHARED_UNIT;
|
||||
if (compareAndSetState(c, nextc))
|
||||
// Releasing the read lock has no effect on readers,
|
||||
// but it may allow waiting writers to proceed if
|
||||
// both read and write locks are now free.
|
||||
return nextc == 0;
|
||||
}
|
||||
}
|
||||
@ -450,15 +472,14 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
if (!readerShouldBlock() &&
|
||||
r < MAX_COUNT &&
|
||||
compareAndSetState(c, c + SHARED_UNIT)) {
|
||||
long tid = current.getId();
|
||||
if (r == 0) {
|
||||
firstReader = tid;
|
||||
firstReader = current;
|
||||
firstReaderHoldCount = 1;
|
||||
} else if (firstReader == tid) {
|
||||
} else if (firstReader == current) {
|
||||
firstReaderHoldCount++;
|
||||
} else {
|
||||
HoldCounter rh = cachedHoldCounter;
|
||||
if (rh == null || rh.tid != tid)
|
||||
if (rh == null || rh.tid != current.getId())
|
||||
cachedHoldCounter = rh = readHolds.get();
|
||||
else if (rh.count == 0)
|
||||
readHolds.set(rh);
|
||||
@ -485,19 +506,17 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
int c = getState();
|
||||
if (exclusiveCount(c) != 0) {
|
||||
if (getExclusiveOwnerThread() != current)
|
||||
//if (removeNeeded) readHolds.remove();
|
||||
return -1;
|
||||
// else we hold the exclusive lock; blocking here
|
||||
// would cause deadlock.
|
||||
} else if (readerShouldBlock()) {
|
||||
// Make sure we're not acquiring read lock reentrantly
|
||||
long tid = current.getId();
|
||||
if (firstReader == tid) {
|
||||
if (firstReader == current) {
|
||||
// assert firstReaderHoldCount > 0;
|
||||
} else {
|
||||
if (rh == null) {
|
||||
rh = cachedHoldCounter;
|
||||
if (rh == null || rh.tid != tid) {
|
||||
if (rh == null || rh.tid != current.getId()) {
|
||||
rh = readHolds.get();
|
||||
if (rh.count == 0)
|
||||
readHolds.remove();
|
||||
@ -510,25 +529,20 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
if (sharedCount(c) == MAX_COUNT)
|
||||
throw new Error("Maximum lock count exceeded");
|
||||
if (compareAndSetState(c, c + SHARED_UNIT)) {
|
||||
long tid = current.getId();
|
||||
if (sharedCount(c) == 0) {
|
||||
firstReader = tid;
|
||||
firstReader = current;
|
||||
firstReaderHoldCount = 1;
|
||||
} else if (firstReader == tid) {
|
||||
} else if (firstReader == current) {
|
||||
firstReaderHoldCount++;
|
||||
} else {
|
||||
if (rh == null) {
|
||||
if (rh == null)
|
||||
rh = cachedHoldCounter;
|
||||
if (rh != null && rh.tid == tid) {
|
||||
if (rh.count == 0)
|
||||
readHolds.set(rh);
|
||||
} else {
|
||||
rh = readHolds.get();
|
||||
}
|
||||
} else if (rh.count == 0)
|
||||
if (rh == null || rh.tid != current.getId())
|
||||
rh = readHolds.get();
|
||||
else if (rh.count == 0)
|
||||
readHolds.set(rh);
|
||||
cachedHoldCounter = rh; // cache for release
|
||||
rh.count++;
|
||||
cachedHoldCounter = rh; // cache for release
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -572,15 +586,14 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
if (r == MAX_COUNT)
|
||||
throw new Error("Maximum lock count exceeded");
|
||||
if (compareAndSetState(c, c + SHARED_UNIT)) {
|
||||
long tid = current.getId();
|
||||
if (r == 0) {
|
||||
firstReader = tid;
|
||||
firstReader = current;
|
||||
firstReaderHoldCount = 1;
|
||||
} else if (firstReader == tid) {
|
||||
} else if (firstReader == current) {
|
||||
firstReaderHoldCount++;
|
||||
} else {
|
||||
HoldCounter rh = cachedHoldCounter;
|
||||
if (rh == null || rh.tid != tid)
|
||||
if (rh == null || rh.tid != current.getId())
|
||||
cachedHoldCounter = rh = readHolds.get();
|
||||
else if (rh.count == 0)
|
||||
readHolds.set(rh);
|
||||
@ -626,12 +639,12 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
if (getReadLockCount() == 0)
|
||||
return 0;
|
||||
|
||||
long tid = Thread.currentThread().getId();
|
||||
if (firstReader == tid)
|
||||
Thread current = Thread.currentThread();
|
||||
if (firstReader == current)
|
||||
return firstReaderHoldCount;
|
||||
|
||||
HoldCounter rh = cachedHoldCounter;
|
||||
if (rh != null && rh.tid == tid)
|
||||
if (rh != null && rh.tid == current.getId())
|
||||
return rh.count;
|
||||
|
||||
int count = readHolds.get().count;
|
||||
@ -647,7 +660,6 @@ public class ReentrantReadWriteLock implements ReadWriteLock, java.io.Serializab
|
||||
throws java.io.IOException, ClassNotFoundException {
|
||||
s.defaultReadObject();
|
||||
readHolds = new ThreadLocalHoldCounter();
|
||||
firstReader = INVALID_THREAD_ID;
|
||||
setState(0); // reset to unlocked state
|
||||
}
|
||||
|
||||
|
77
jdk/src/share/classes/java/util/zip/ZipConstants64.java
Normal file
77
jdk/src/share/classes/java/util/zip/ZipConstants64.java
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 1995-1996 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Sun designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Sun in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*/
|
||||
|
||||
package java.util.zip;
|
||||
|
||||
/*
|
||||
* This class defines the constants that are used by the classes
|
||||
* which manipulate Zip64 files.
|
||||
*/
|
||||
|
||||
class ZipConstants64 {
|
||||
|
||||
/*
|
||||
* ZIP64 constants
|
||||
*/
|
||||
static final long ZIP64_ENDSIG = 0x06064b50L; // "PK\006\006"
|
||||
static final long ZIP64_LOCSIG = 0x07064b50L; // "PK\006\007"
|
||||
static final int ZIP64_ENDHDR = 56; // ZIP64 end header size
|
||||
static final int ZIP64_LOCHDR = 20; // ZIP64 end loc header size
|
||||
static final int ZIP64_EXTHDR = 24; // EXT header size
|
||||
static final int ZIP64_EXTID = 0x0001; // Extra field Zip64 header ID
|
||||
|
||||
static final int ZIP64_MAGICCOUNT = 0xFFFF;
|
||||
static final long ZIP64_MAGICVAL = 0xFFFFFFFFL;
|
||||
|
||||
/*
|
||||
* Zip64 End of central directory (END) header field offsets
|
||||
*/
|
||||
static final int ZIP64_ENDLEN = 4; // size of zip64 end of central dir
|
||||
static final int ZIP64_ENDVEM = 12; // version made by
|
||||
static final int ZIP64_ENDVER = 14; // version needed to extract
|
||||
static final int ZIP64_ENDNMD = 16; // number of this disk
|
||||
static final int ZIP64_ENDDSK = 20; // disk number of start
|
||||
static final int ZIP64_ENDTOD = 24; // total number of entries on this disk
|
||||
static final int ZIP64_ENDTOT = 32; // total number of entries
|
||||
static final int ZIP64_ENDSIZ = 40; // central directory size in bytes
|
||||
static final int ZIP64_ENDOFF = 48; // offset of first CEN header
|
||||
static final int ZIP64_ENDEXT = 56; // zip64 extensible data sector
|
||||
|
||||
/*
|
||||
* Zip64 End of central directory locator field offsets
|
||||
*/
|
||||
static final int ZIP64_LOCDSK = 4; // disk number start
|
||||
static final int ZIP64_LOCOFF = 8; // offset of zip64 end
|
||||
static final int ZIP64_LOCTOT = 16; // total number of disks
|
||||
|
||||
/*
|
||||
* Zip64 Extra local (EXT) header field offsets
|
||||
*/
|
||||
static final int ZIP64_EXTCRC = 4; // uncompressed file crc-32 value
|
||||
static final int ZIP64_EXTSIZ = 8; // compressed size, 8-byte
|
||||
static final int ZIP64_EXTLEN = 16; // uncompressed size, 8-byte
|
||||
|
||||
private ZipConstants64() {}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2005 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -144,11 +144,13 @@ class ZipEntry implements ZipConstants, Cloneable {
|
||||
* Sets the uncompressed size of the entry data.
|
||||
* @param size the uncompressed size in bytes
|
||||
* @exception IllegalArgumentException if the specified size is less
|
||||
* than 0 or greater than 0xFFFFFFFF bytes
|
||||
* than 0, is greater than 0xFFFFFFFF when
|
||||
* <a href="package-summary.html#zip64">ZIP64 format</a> is not supported,
|
||||
* or is less than 0 when ZIP64 is supported
|
||||
* @see #getSize()
|
||||
*/
|
||||
public void setSize(long size) {
|
||||
if (size < 0 || size > 0xFFFFFFFFL) {
|
||||
if (size < 0) {
|
||||
throw new IllegalArgumentException("invalid entry size");
|
||||
}
|
||||
this.size = size;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@ import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.EOFException;
|
||||
import java.io.PushbackInputStream;
|
||||
import static java.util.zip.ZipConstants64.*;
|
||||
|
||||
/**
|
||||
* This class implements an input stream filter for reading files in the
|
||||
@ -285,6 +286,29 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
byte[] bb = new byte[len];
|
||||
readFully(bb, 0, len);
|
||||
e.setExtra(bb);
|
||||
// extra fields are in "HeaderID(2)DataSize(2)Data... format
|
||||
if (e.csize == ZIP64_MAGICVAL || e.size == ZIP64_MAGICVAL) {
|
||||
int off = 0;
|
||||
while (off + 4 < len) {
|
||||
int sz = get16(bb, off + 2);
|
||||
if (get16(bb, off) == ZIP64_EXTID) {
|
||||
off += 4;
|
||||
// LOC extra zip64 entry MUST include BOTH original and
|
||||
// compressed file size fields
|
||||
if (sz < 16 || (off + sz) > len ) {
|
||||
// Invalid zip64 extra fields, simply skip. Even it's
|
||||
// rare, it's possible the entry size happens to be
|
||||
// the magic value and it "accidnetly" has some bytes
|
||||
// in extra match the id.
|
||||
return e;
|
||||
}
|
||||
e.size = get64(bb, off);
|
||||
e.csize = get64(bb, off + 8);
|
||||
break;
|
||||
}
|
||||
off += (sz + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
@ -375,18 +399,36 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
}
|
||||
if ((flag & 8) == 8) {
|
||||
/* "Data Descriptor" present */
|
||||
readFully(tmpbuf, 0, EXTHDR);
|
||||
long sig = get32(tmpbuf, 0);
|
||||
if (sig != EXTSIG) { // no EXTSIG present
|
||||
e.crc = sig;
|
||||
e.csize = get32(tmpbuf, EXTSIZ - EXTCRC);
|
||||
e.size = get32(tmpbuf, EXTLEN - EXTCRC);
|
||||
((PushbackInputStream)in).unread(
|
||||
tmpbuf, EXTHDR - EXTCRC - 1, EXTCRC);
|
||||
if (inf.getBytesWritten() > ZIP64_MAGICVAL ||
|
||||
inf.getBytesRead() > ZIP64_MAGICVAL) {
|
||||
// ZIP64 format
|
||||
readFully(tmpbuf, 0, ZIP64_EXTHDR);
|
||||
long sig = get32(tmpbuf, 0);
|
||||
if (sig != EXTSIG) { // no EXTSIG present
|
||||
e.crc = sig;
|
||||
e.csize = get64(tmpbuf, ZIP64_EXTSIZ - ZIP64_EXTCRC);
|
||||
e.size = get64(tmpbuf, ZIP64_EXTLEN - ZIP64_EXTCRC);
|
||||
((PushbackInputStream)in).unread(
|
||||
tmpbuf, ZIP64_EXTHDR - ZIP64_EXTCRC - 1, ZIP64_EXTCRC);
|
||||
} else {
|
||||
e.crc = get32(tmpbuf, ZIP64_EXTCRC);
|
||||
e.csize = get64(tmpbuf, ZIP64_EXTSIZ);
|
||||
e.size = get64(tmpbuf, ZIP64_EXTLEN);
|
||||
}
|
||||
} else {
|
||||
e.crc = get32(tmpbuf, EXTCRC);
|
||||
e.csize = get32(tmpbuf, EXTSIZ);
|
||||
e.size = get32(tmpbuf, EXTLEN);
|
||||
readFully(tmpbuf, 0, EXTHDR);
|
||||
long sig = get32(tmpbuf, 0);
|
||||
if (sig != EXTSIG) { // no EXTSIG present
|
||||
e.crc = sig;
|
||||
e.csize = get32(tmpbuf, EXTSIZ - EXTCRC);
|
||||
e.size = get32(tmpbuf, EXTLEN - EXTCRC);
|
||||
((PushbackInputStream)in).unread(
|
||||
tmpbuf, EXTHDR - EXTCRC - 1, EXTCRC);
|
||||
} else {
|
||||
e.crc = get32(tmpbuf, EXTCRC);
|
||||
e.csize = get32(tmpbuf, EXTSIZ);
|
||||
e.size = get32(tmpbuf, EXTLEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.size != inf.getBytesWritten()) {
|
||||
@ -433,6 +475,14 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
|
||||
* The bytes are assumed to be in Intel (little-endian) byte order.
|
||||
*/
|
||||
private static final long get32(byte b[], int off) {
|
||||
return get16(b, off) | ((long)get16(b, off+2) << 16);
|
||||
return (get16(b, off) | ((long)get16(b, off+2) << 16)) & 0xffffffffL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetches signed 64-bit value from byte array at specified offset.
|
||||
* The bytes are assumed to be in Intel (little-endian) byte order.
|
||||
*/
|
||||
private static final long get64(byte b[], int off) {
|
||||
return get32(b, off) | (get32(b, off+4) << 32);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1996-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@ import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
import java.util.HashSet;
|
||||
import static java.util.zip.ZipConstants64.*;
|
||||
|
||||
/**
|
||||
* This class implements an output stream filter for writing files in the
|
||||
@ -343,26 +344,52 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
private void writeLOC(XEntry xentry) throws IOException {
|
||||
ZipEntry e = xentry.entry;
|
||||
int flag = xentry.flag;
|
||||
int elen = (e.extra != null) ? e.extra.length : 0;
|
||||
boolean hasZip64 = false;
|
||||
|
||||
writeInt(LOCSIG); // LOC header signature
|
||||
writeShort(version(e)); // version needed to extract
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(e.time); // last modification time
|
||||
|
||||
if ((flag & 8) == 8) {
|
||||
writeShort(version(e)); // version needed to extract
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(e.time); // last modification time
|
||||
|
||||
// store size, uncompressed size, and crc-32 in data descriptor
|
||||
// immediately following compressed entry data
|
||||
writeInt(0);
|
||||
writeInt(0);
|
||||
writeInt(0);
|
||||
} else {
|
||||
writeInt(e.crc); // crc-32
|
||||
writeInt(e.csize); // compressed size
|
||||
writeInt(e.size); // uncompressed size
|
||||
if (e.csize >= ZIP64_MAGICVAL || e.size >= ZIP64_MAGICVAL) {
|
||||
hasZip64 = true;
|
||||
writeShort(45); // ver 4.5 for zip64
|
||||
} else {
|
||||
writeShort(version(e)); // version needed to extract
|
||||
}
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(e.time); // last modification time
|
||||
writeInt(e.crc); // crc-32
|
||||
if (hasZip64) {
|
||||
writeInt(ZIP64_MAGICVAL);
|
||||
writeInt(ZIP64_MAGICVAL);
|
||||
elen += 20; //headid(2) + size(2) + size(8) + csize(8)
|
||||
} else {
|
||||
writeInt(e.csize); // compressed size
|
||||
writeInt(e.size); // uncompressed size
|
||||
}
|
||||
}
|
||||
byte[] nameBytes = getUTF8Bytes(e.name);
|
||||
writeShort(nameBytes.length);
|
||||
writeShort(e.extra != null ? e.extra.length : 0);
|
||||
writeShort(elen);
|
||||
writeBytes(nameBytes, 0, nameBytes.length);
|
||||
if (hasZip64) {
|
||||
writeShort(ZIP64_EXTID);
|
||||
writeShort(16);
|
||||
writeLong(e.size);
|
||||
writeLong(e.csize);
|
||||
}
|
||||
if (e.extra != null) {
|
||||
writeBytes(e.extra, 0, e.extra.length);
|
||||
}
|
||||
@ -375,8 +402,13 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
private void writeEXT(ZipEntry e) throws IOException {
|
||||
writeInt(EXTSIG); // EXT header signature
|
||||
writeInt(e.crc); // crc-32
|
||||
writeInt(e.csize); // compressed size
|
||||
writeInt(e.size); // uncompressed size
|
||||
if (e.csize >= ZIP64_MAGICVAL || e.size >= ZIP64_MAGICVAL) {
|
||||
writeLong(e.csize);
|
||||
writeLong(e.size);
|
||||
} else {
|
||||
writeInt(e.csize); // compressed size
|
||||
writeInt(e.size); // uncompressed size
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -387,18 +419,49 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
ZipEntry e = xentry.entry;
|
||||
int flag = xentry.flag;
|
||||
int version = version(e);
|
||||
|
||||
long csize = e.csize;
|
||||
long size = e.size;
|
||||
long offset = xentry.offset;
|
||||
int e64len = 0;
|
||||
boolean hasZip64 = false;
|
||||
if (e.csize >= ZIP64_MAGICVAL) {
|
||||
csize = ZIP64_MAGICVAL;
|
||||
e64len += 8; // csize(8)
|
||||
hasZip64 = true;
|
||||
}
|
||||
if (e.size >= ZIP64_MAGICVAL) {
|
||||
size = ZIP64_MAGICVAL; // size(8)
|
||||
e64len += 8;
|
||||
hasZip64 = true;
|
||||
}
|
||||
if (xentry.offset >= ZIP64_MAGICVAL) {
|
||||
offset = ZIP64_MAGICVAL;
|
||||
e64len += 8; // offset(8)
|
||||
hasZip64 = true;
|
||||
}
|
||||
writeInt(CENSIG); // CEN header signature
|
||||
writeShort(version); // version made by
|
||||
writeShort(version); // version needed to extract
|
||||
if (hasZip64) {
|
||||
writeShort(45); // ver 4.5 for zip64
|
||||
writeShort(45);
|
||||
} else {
|
||||
writeShort(version); // version made by
|
||||
writeShort(version); // version needed to extract
|
||||
}
|
||||
writeShort(flag); // general purpose bit flag
|
||||
writeShort(e.method); // compression method
|
||||
writeInt(e.time); // last modification time
|
||||
writeInt(e.crc); // crc-32
|
||||
writeInt(e.csize); // compressed size
|
||||
writeInt(e.size); // uncompressed size
|
||||
writeInt(csize); // compressed size
|
||||
writeInt(size); // uncompressed size
|
||||
byte[] nameBytes = getUTF8Bytes(e.name);
|
||||
writeShort(nameBytes.length);
|
||||
writeShort(e.extra != null ? e.extra.length : 0);
|
||||
if (hasZip64) {
|
||||
// + headid(2) + datasize(2)
|
||||
writeShort(e64len + 4 + (e.extra != null ? e.extra.length : 0));
|
||||
} else {
|
||||
writeShort(e.extra != null ? e.extra.length : 0);
|
||||
}
|
||||
byte[] commentBytes;
|
||||
if (e.comment != null) {
|
||||
commentBytes = getUTF8Bytes(e.comment);
|
||||
@ -410,8 +473,18 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
writeShort(0); // starting disk number
|
||||
writeShort(0); // internal file attributes (unused)
|
||||
writeInt(0); // external file attributes (unused)
|
||||
writeInt(xentry.offset); // relative offset of local header
|
||||
writeInt(offset); // relative offset of local header
|
||||
writeBytes(nameBytes, 0, nameBytes.length);
|
||||
if (hasZip64) {
|
||||
writeShort(ZIP64_EXTID);// Zip64 extra
|
||||
writeShort(e64len);
|
||||
if (size == ZIP64_MAGICVAL)
|
||||
writeLong(e.size);
|
||||
if (csize == ZIP64_MAGICVAL)
|
||||
writeLong(e.csize);
|
||||
if (offset == ZIP64_MAGICVAL)
|
||||
writeLong(xentry.offset);
|
||||
}
|
||||
if (e.extra != null) {
|
||||
writeBytes(e.extra, 0, e.extra.length);
|
||||
}
|
||||
@ -424,15 +497,50 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
* Writes end of central directory (END) header.
|
||||
*/
|
||||
private void writeEND(long off, long len) throws IOException {
|
||||
boolean hasZip64 = false;
|
||||
long xlen = len;
|
||||
long xoff = off;
|
||||
if (xlen >= ZIP64_MAGICVAL) {
|
||||
xlen = ZIP64_MAGICVAL;
|
||||
hasZip64 = true;
|
||||
}
|
||||
if (xoff >= ZIP64_MAGICVAL) {
|
||||
xoff = ZIP64_MAGICVAL;
|
||||
hasZip64 = true;
|
||||
}
|
||||
int count = xentries.size();
|
||||
writeInt(ENDSIG); // END record signature
|
||||
writeShort(0); // number of this disk
|
||||
writeShort(0); // central directory start disk
|
||||
writeShort(count); // number of directory entries on disk
|
||||
writeShort(count); // total number of directory entries
|
||||
writeInt(len); // length of central directory
|
||||
writeInt(off); // offset of central directory
|
||||
if (comment != null) { // zip file comment
|
||||
if (count >= ZIP64_MAGICCOUNT) {
|
||||
count = ZIP64_MAGICCOUNT;
|
||||
hasZip64 = true;
|
||||
}
|
||||
if (hasZip64) {
|
||||
long off64 = written;
|
||||
//zip64 end of central directory record
|
||||
writeInt(ZIP64_ENDSIG); // zip64 END record signature
|
||||
writeLong(ZIP64_ENDHDR - 12); // size of zip64 end
|
||||
writeShort(45); // version made by
|
||||
writeShort(45); // version needed to extract
|
||||
writeInt(0); // number of this disk
|
||||
writeInt(0); // central directory start disk
|
||||
writeLong(xentries.size()); // number of directory entires on disk
|
||||
writeLong(xentries.size()); // number of directory entires
|
||||
writeLong(len); // length of central directory
|
||||
writeLong(off); // offset of central directory
|
||||
|
||||
//zip64 end of central directory locator
|
||||
writeInt(ZIP64_LOCSIG); // zip64 END locator signature
|
||||
writeInt(0); // zip64 END start disk
|
||||
writeLong(off64); // offset of zip64 END
|
||||
writeInt(1); // total number of disks (?)
|
||||
}
|
||||
writeInt(ENDSIG); // END record signature
|
||||
writeShort(0); // number of this disk
|
||||
writeShort(0); // central directory start disk
|
||||
writeShort(count); // number of directory entries on disk
|
||||
writeShort(count); // total number of directory entries
|
||||
writeInt(xlen); // length of central directory
|
||||
writeInt(xoff); // offset of central directory
|
||||
if (comment != null) { // zip file comment
|
||||
byte[] b = getUTF8Bytes(comment);
|
||||
writeShort(b.length);
|
||||
writeBytes(b, 0, b.length);
|
||||
@ -463,6 +571,22 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
|
||||
written += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes a 64-bit int to the output stream in little-endian byte order.
|
||||
*/
|
||||
private void writeLong(long v) throws IOException {
|
||||
OutputStream out = this.out;
|
||||
out.write((int)((v >>> 0) & 0xff));
|
||||
out.write((int)((v >>> 8) & 0xff));
|
||||
out.write((int)((v >>> 16) & 0xff));
|
||||
out.write((int)((v >>> 24) & 0xff));
|
||||
out.write((int)((v >>> 32) & 0xff));
|
||||
out.write((int)((v >>> 40) & 0xff));
|
||||
out.write((int)((v >>> 48) & 0xff));
|
||||
out.write((int)((v >>> 56) & 0xff));
|
||||
written += 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* Writes an array of bytes to the output stream.
|
||||
*/
|
||||
|
@ -45,6 +45,13 @@ input streams.
|
||||
Info-ZIP Application Note 970311
|
||||
</a> - a detailed description of the Info-ZIP format upon which
|
||||
the <code>java.util.zip</code> classes are based.
|
||||
<p>
|
||||
<a name="zip64">
|
||||
<li>An implementation may optionally support the ZIP64(tm) format extensions
|
||||
defined by the
|
||||
<a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
|
||||
PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format extensions
|
||||
are used to overcome the size limitations of the original ZIP format.
|
||||
<p>
|
||||
<li><a href="http://www.isi.edu/in-notes/rfc1950.txt">
|
||||
ZLIB Compressed Data Format Specification version 3.3</a>
|
||||
@ -70,7 +77,6 @@ input streams.
|
||||
<li>CRC-32 checksum is described in RFC 1952 (above)
|
||||
<p>
|
||||
<li>Adler-32 checksum is described in RFC 1950 (above)
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1545,6 +1545,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
|
||||
* A mnemonic must correspond to a single key on the keyboard
|
||||
* and should be specified using one of the <code>VK_XXX</code>
|
||||
* keycodes defined in <code>java.awt.event.KeyEvent</code>.
|
||||
* These codes and the wider array of codes for international
|
||||
* keyboards may be obtained through
|
||||
* <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
|
||||
* Mnemonics are case-insensitive, therefore a key event
|
||||
* with the corresponding keycode would cause the button to be
|
||||
* activated whether or not the Shift modifier was pressed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -272,7 +272,9 @@ public interface Action extends ActionListener {
|
||||
* one of the <code>KeyEvent</code> key codes. The value is
|
||||
* commonly used to specify a mnemonic. For example:
|
||||
* <code>myAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A)</code>
|
||||
* sets the mnemonic of <code>myAction</code> to 'a'.
|
||||
* sets the mnemonic of <code>myAction</code> to 'a', while
|
||||
* <code>myAction.putValue(Action.MNEMONIC_KEY, KeyEvent.getExtendedKeyCodeForChar('\u0444'))</code>
|
||||
* sets the mnemonic of <code>myAction</code> to Cyrillic letter "Ef".
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2888,7 +2888,10 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
return false;
|
||||
}
|
||||
// Get the KeyStroke
|
||||
// There may be two keystrokes associated with a low-level key event;
|
||||
// in this case a keystroke made of an extended key code has a priority.
|
||||
KeyStroke ks;
|
||||
KeyStroke ksE = null;
|
||||
|
||||
if (e.getID() == KeyEvent.KEY_TYPED) {
|
||||
ks = KeyStroke.getKeyStroke(e.getKeyChar());
|
||||
@ -2896,9 +2899,18 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
else {
|
||||
ks = KeyStroke.getKeyStroke(e.getKeyCode(),e.getModifiers(),
|
||||
(pressed ? false:true));
|
||||
if (e.getKeyCode() != e.getExtendedKeyCode()) {
|
||||
ksE = KeyStroke.getKeyStroke(e.getExtendedKeyCode(),e.getModifiers(),
|
||||
(pressed ? false:true));
|
||||
}
|
||||
}
|
||||
|
||||
/* Do we have a key binding for e? */
|
||||
// Do we have a key binding for e?
|
||||
// If we have a binding by an extended code, use it.
|
||||
// If not, check for regular code binding.
|
||||
if(ksE != null && processKeyBinding(ksE, e, WHEN_FOCUSED, pressed)) {
|
||||
return true;
|
||||
}
|
||||
if(processKeyBinding(ks, e, WHEN_FOCUSED, pressed))
|
||||
return true;
|
||||
|
||||
@ -2910,6 +2922,9 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
while (parent != null && !(parent instanceof Window) &&
|
||||
!(parent instanceof Applet)) {
|
||||
if(parent instanceof JComponent) {
|
||||
if(ksE != null && ((JComponent)parent).processKeyBinding(ksE, e,
|
||||
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
|
||||
return true;
|
||||
if(((JComponent)parent).processKeyBinding(ks, e,
|
||||
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -503,10 +503,10 @@ public class JLabel extends JComponent implements SwingConstants, Accessible
|
||||
* @see #setDisplayedMnemonic(int)
|
||||
*/
|
||||
public void setDisplayedMnemonic(char aChar) {
|
||||
int vk = (int) aChar;
|
||||
if(vk >= 'a' && vk <='z')
|
||||
vk -= ('a' - 'A');
|
||||
setDisplayedMnemonic(vk);
|
||||
int vk = java.awt.event.KeyEvent.getExtendedKeyCodeForChar(aChar);
|
||||
if (vk != java.awt.event.KeyEvent.VK_UNDEFINED) {
|
||||
setDisplayedMnemonic(vk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1628,7 +1628,9 @@ public class JTabbedPane extends JComponent
|
||||
* <p>
|
||||
* A mnemonic must correspond to a single key on the keyboard
|
||||
* and should be specified using one of the <code>VK_XXX</code>
|
||||
* keycodes defined in <code>java.awt.event.KeyEvent</code>.
|
||||
* keycodes defined in <code>java.awt.event.KeyEvent</code>
|
||||
* or one of the extended keycodes obtained through
|
||||
* <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
|
||||
* Mnemonics are case-insensitive, therefore a key event
|
||||
* with the corresponding keycode would cause the button to be
|
||||
* activated whether or not the Shift modifier was pressed.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -162,6 +162,9 @@ public class KeyStroke extends AWTKeyStroke {
|
||||
* <li>java.awt.event.KeyEvent.VK_TAB
|
||||
* <li>java.awt.event.KeyEvent.VK_SPACE
|
||||
* </ul>
|
||||
* Alternatively, the key code may be obtained by calling
|
||||
* <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
|
||||
*
|
||||
* The modifiers consist of any combination of:<ul>
|
||||
* <li>java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||
* <li>java.awt.event.InputEvent.CTRL_DOWN_MASK
|
||||
@ -210,6 +213,9 @@ public class KeyStroke extends AWTKeyStroke {
|
||||
* <li>java.awt.event.KeyEvent.VK_TAB
|
||||
* <li>java.awt.event.KeyEvent.VK_SPACE
|
||||
* </ul>
|
||||
* Alternatively, the key code may be obtained by calling
|
||||
* <code>java.awt.event.KeyEvent.getExtendedKeyCodeForChar</code>.
|
||||
*
|
||||
* The modifiers consist of any combination of:<ul>
|
||||
* <li>java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||
* <li>java.awt.event.InputEvent.CTRL_DOWN_MASK
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -212,19 +212,35 @@ class KeyboardManager {
|
||||
Thread.dumpStack();
|
||||
}
|
||||
|
||||
// There may be two keystrokes associated with a low-level key event;
|
||||
// in this case a keystroke made of an extended key code has a priority.
|
||||
KeyStroke ks;
|
||||
KeyStroke ksE = null;
|
||||
|
||||
|
||||
if(e.getID() == KeyEvent.KEY_TYPED) {
|
||||
ks=KeyStroke.getKeyStroke(e.getKeyChar());
|
||||
} else {
|
||||
if(e.getKeyCode() != e.getExtendedKeyCode()) {
|
||||
ksE=KeyStroke.getKeyStroke(e.getExtendedKeyCode(), e.getModifiers(), !pressed);
|
||||
}
|
||||
ks=KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers(), !pressed);
|
||||
}
|
||||
|
||||
Hashtable keyMap = containerMap.get(topAncestor);
|
||||
if (keyMap != null) { // this container isn't registered, so bail
|
||||
|
||||
Object tmp = keyMap.get(ks);
|
||||
Object tmp = null;
|
||||
// extended code has priority
|
||||
if( ksE != null ) {
|
||||
tmp = keyMap.get(ksE);
|
||||
if( tmp != null ) {
|
||||
ks = ksE;
|
||||
}
|
||||
}
|
||||
if( tmp == null ) {
|
||||
tmp = keyMap.get(ks);
|
||||
}
|
||||
|
||||
if (tmp == null) {
|
||||
// don't do anything
|
||||
@ -269,7 +285,12 @@ class KeyboardManager {
|
||||
while (iter.hasMoreElements()) {
|
||||
JMenuBar mb = (JMenuBar)iter.nextElement();
|
||||
if ( mb.isShowing() && mb.isEnabled() ) { // don't want to give these out
|
||||
fireBinding(mb, ks, e, pressed);
|
||||
if( !(ks.equals(ksE)) ) {
|
||||
fireBinding(mb, ksE, e, pressed);
|
||||
}
|
||||
if(ks.equals(ksE) || !e.isConsumed()) {
|
||||
fireBinding(mb, ks, e, pressed);
|
||||
}
|
||||
if (e.isConsumed()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -552,14 +552,15 @@ public class PopupFactory {
|
||||
boolean result = false;
|
||||
Component component = getComponent();
|
||||
if (owner != null && component != null) {
|
||||
Container parent = (Container) SwingUtilities.getRoot(owner);
|
||||
int popupWidth = component.getWidth();
|
||||
int popupHeight = component.getHeight();
|
||||
Rectangle parentBounds = parent.getBounds();
|
||||
|
||||
Container parent = (Container) SwingUtilities.getRoot(owner);
|
||||
if (parent instanceof JFrame ||
|
||||
parent instanceof JDialog ||
|
||||
parent instanceof JWindow) {
|
||||
|
||||
Rectangle parentBounds = parent.getBounds();
|
||||
Insets i = parent.getInsets();
|
||||
parentBounds.x += i.left;
|
||||
parentBounds.y += i.top;
|
||||
@ -577,11 +578,11 @@ public class PopupFactory {
|
||||
.contains(x, y, popupWidth, popupHeight);
|
||||
}
|
||||
} else if (parent instanceof JApplet) {
|
||||
Rectangle parentBounds = parent.getBounds();
|
||||
Point p = parent.getLocationOnScreen();
|
||||
parentBounds.x = p.x;
|
||||
parentBounds.y = p.y;
|
||||
result = parentBounds
|
||||
.contains(x, y, popupWidth, popupHeight);
|
||||
result = parentBounds.contains(x, y, popupWidth, popupHeight);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.security.AccessController;
|
||||
import java.util.*;
|
||||
import java.applet.*;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.DisplayChangedListener;
|
||||
import sun.awt.SunToolkit;
|
||||
@ -716,6 +717,44 @@ public class RepaintManager
|
||||
}
|
||||
}
|
||||
|
||||
private Map<Component,Rectangle>
|
||||
updateWindows(Map<Component,Rectangle> dirtyComponents)
|
||||
{
|
||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
if (!(toolkit instanceof SunToolkit &&
|
||||
((SunToolkit)toolkit).needUpdateWindow()))
|
||||
{
|
||||
return dirtyComponents;
|
||||
}
|
||||
|
||||
Set<Window> windows = new HashSet<Window>();
|
||||
Set<Component> dirtyComps = dirtyComponents.keySet();
|
||||
for (Iterator<Component> it = dirtyComps.iterator(); it.hasNext();) {
|
||||
Component dirty = it.next();
|
||||
Window window = dirty instanceof Window ?
|
||||
(Window)dirty :
|
||||
SwingUtilities.getWindowAncestor(dirty);
|
||||
|
||||
if (window != null &&
|
||||
!AWTAccessor.getWindowAccessor().isOpaque(window))
|
||||
{
|
||||
// if this component's toplevel is perpixel translucent, it will
|
||||
// be repainted below
|
||||
it.remove();
|
||||
// add to the set of windows to update (so that we don't update
|
||||
// the window many times for each component to be repainted that
|
||||
// belongs to this window)
|
||||
windows.add(window);
|
||||
}
|
||||
}
|
||||
|
||||
for (Window window : windows) {
|
||||
AWTAccessor.getWindowAccessor().updateWindow(window, null);
|
||||
}
|
||||
|
||||
return dirtyComponents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paint all of the components that have been marked dirty.
|
||||
*
|
||||
@ -749,6 +788,10 @@ public class RepaintManager
|
||||
int localBoundsW;
|
||||
Enumeration keys;
|
||||
|
||||
// the components belonging to perpixel-translucent windows will be
|
||||
// removed from the list
|
||||
tmpDirtyComponents = updateWindows(tmpDirtyComponents);
|
||||
|
||||
roots = new ArrayList<Component>(count);
|
||||
|
||||
for (Component dirty : tmpDirtyComponents.keySet()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1589,15 +1589,6 @@ public class SwingUtilities implements SwingConstants
|
||||
* processing the key bindings associated with JComponents.
|
||||
*/
|
||||
static boolean isValidKeyEventForKeyBindings(KeyEvent e) {
|
||||
if (e.getID() == KeyEvent.KEY_TYPED) {
|
||||
int mod = e.getModifiers();
|
||||
if (((mod & ActionEvent.ALT_MASK) != 0) &&
|
||||
((mod & ActionEvent.CTRL_MASK) == 0)) {
|
||||
// filter out typed "alt-?" keys, but not those created
|
||||
// with AltGr, and not control characters
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -778,35 +778,33 @@ public abstract class SwingWorker<T, V> implements RunnableFuture<T> {
|
||||
threadFactory);
|
||||
appContext.put(SwingWorker.class, executorService);
|
||||
|
||||
//register shutdown hook for this executor service
|
||||
// Don't use ShutdownHook here as it's not enough. We should track
|
||||
// AppContext disposal instead of JVM shutdown, see 6799345 for details
|
||||
final ExecutorService es = executorService;
|
||||
final Runnable shutdownHook =
|
||||
new Runnable() {
|
||||
final WeakReference<ExecutorService> executorServiceRef =
|
||||
new WeakReference<ExecutorService>(es);
|
||||
public void run() {
|
||||
final ExecutorService executorService =
|
||||
executorServiceRef.get();
|
||||
if (executorService != null) {
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
executorService.shutdown();
|
||||
return null;
|
||||
appContext.addPropertyChangeListener(AppContext.DISPOSED_PROPERTY_NAME,
|
||||
new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent pce) {
|
||||
boolean disposed = (Boolean)pce.getNewValue();
|
||||
if (disposed) {
|
||||
final WeakReference<ExecutorService> executorServiceRef =
|
||||
new WeakReference<ExecutorService>(es);
|
||||
final ExecutorService executorService =
|
||||
executorServiceRef.get();
|
||||
if (executorService != null) {
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
executorService.shutdown();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
Runtime.getRuntime().addShutdownHook(
|
||||
new Thread(shutdownHook));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
return executorService;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -191,7 +191,12 @@ class TimerQueue implements Runnable
|
||||
} finally {
|
||||
timer.getLock().unlock();
|
||||
}
|
||||
} catch (InterruptedException ignore) {
|
||||
} catch (InterruptedException ie) {
|
||||
// Shouldn't ignore InterruptedExceptions here, so AppContext
|
||||
// is disposed gracefully, see 6799345 for details
|
||||
if (AppContext.getAppContext().isDisposed()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ import sun.awt.OSInfo;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.swing.SwingUtilities2;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import sun.awt.AppContext;
|
||||
|
||||
|
||||
/**
|
||||
@ -1323,19 +1325,29 @@ public class UIManager implements Serializable
|
||||
return;
|
||||
}
|
||||
|
||||
String metalLnf = getCrossPlatformLookAndFeelClassName();
|
||||
String lnfDefault = metalLnf;
|
||||
// Try to get default LAF from system property, then from AppContext
|
||||
// (6653395), then use cross-platform one by default.
|
||||
String lafName = null;
|
||||
HashMap lafData =
|
||||
(HashMap) AppContext.getAppContext().remove("swing.lafdata");
|
||||
if (lafData != null) {
|
||||
lafName = (String) lafData.remove("defaultlaf");
|
||||
}
|
||||
if (lafName == null) {
|
||||
lafName = getCrossPlatformLookAndFeelClassName();
|
||||
}
|
||||
lafName = swingProps.getProperty(defaultLAFKey, lafName);
|
||||
|
||||
String lnfName = "<undefined>" ;
|
||||
try {
|
||||
lnfName = swingProps.getProperty(defaultLAFKey, lnfDefault);
|
||||
setLookAndFeel(lnfName);
|
||||
setLookAndFeel(lafName);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
lnfName = swingProps.getProperty(defaultLAFKey, metalLnf);
|
||||
setLookAndFeel(lnfName);
|
||||
} catch (Exception e2) {
|
||||
throw new Error("can't load " + lnfName);
|
||||
throw new Error("Cannot load " + lafName);
|
||||
}
|
||||
|
||||
// Set any properties passed through AppContext (6653395).
|
||||
if (lafData != null) {
|
||||
for (Object key: lafData.keySet()) {
|
||||
UIManager.put(key, lafData.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user