mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-12 06:29:37 +00:00
Merge
This commit is contained in:
commit
86292086b7
@ -60,16 +60,28 @@ ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy msvcrXX.dll on windows
|
||||
|
||||
# Copy the microsoft runtime libraries on windows
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
MSVCR_TARGET := $(LIB_DST_DIR)/$(notdir $(MSVCR_DLL))
|
||||
# Chmod to avoid permission issues if bundles are unpacked on unix platforms.
|
||||
$(MSVCR_TARGET): $(MSVCR_DLL)
|
||||
$(call install-file)
|
||||
$(CHMOD) a+rx $@
|
||||
|
||||
TARGETS += $(MSVCR_TARGET)
|
||||
# Chmod to avoid permission issues if bundles are unpacked on unix platforms.
|
||||
define copy-and-chmod
|
||||
$(install-file)
|
||||
$(CHMOD) a+rx $@
|
||||
endef
|
||||
|
||||
# Use separate macro calls in case the source files are not in the same
|
||||
# directory.
|
||||
$(eval $(call SetupCopyFiles,COPY_MSVCR, \
|
||||
DEST := $(LIB_DST_DIR), \
|
||||
FILES := $(MSVCR_DLL), \
|
||||
MACRO := copy-and-chmod))
|
||||
|
||||
$(eval $(call SetupCopyFiles,COPY_MSVCP, \
|
||||
DEST := $(LIB_DST_DIR), \
|
||||
FILES := $(MSVCP_DLL), \
|
||||
MACRO := copy-and-chmod))
|
||||
|
||||
TARGETS += $(COPY_MSVCR) $(COPY_MSVCP)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -32,7 +32,8 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.ext.DoubleByte;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.*;
|
||||
|
||||
public class $NAME_CLZ$ extends Charset
|
||||
$IMPLEMENTS$
|
||||
|
||||
1818
jdk/make/data/charsetmapping/charsets
Normal file
1818
jdk/make/data/charsetmapping/charsets
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
|
||||
MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
SJIS Shift_JIS SJIS basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
PCK x-PCK PCK basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
IBM1364 x-IBM1364 Cp1364 ebcdic sun.nio.cs.ext false 0x40 0xde 0x40 0xfe
|
||||
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
|
||||
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
IBM300 x-IBM300 Cp300 dbcsonly sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM933 x-IBM933 Cp933 ebcdic sun.nio.cs.ext false 0x40 0xdd 0x40 0xfe
|
||||
IBM935 x-IBM935 Cp935 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM937 x-IBM937 Cp937 ebcdic sun.nio.cs.ext false 0x40 0xe2 0x40 0xfe
|
||||
IBM939 x-IBM939 Cp939 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM942 x-IBM942 Cp942 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM943 x-IBM943 Cp943 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM948 x-IBM948 Cp948 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfc
|
||||
IBM949 x-IBM949 Cp949 basic sun.nio.cs.ext false 0x8f 0xfe 0xa1 0xfe
|
||||
IBM950 x-IBM950 Cp950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
IBM970 x-IBM970 Cp970 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
JIS_X_0208 x-JIS0208 JIS0208 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212 JIS_X0212-1990 JIS0212 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_Solaris x-JIS0208_Solaris JIS0208_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x9e 0x21 0x7e
|
||||
JIS_X_0208_MS5022X x-JIS0208_MS5022X JIS0208_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_MS932 x-JIS0208_MS932 JIS0208_MS932 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_Solaris x-JIS0212_Solaris JIS0212_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_MS5022X x-JIS0212_MS5022X JIS0212_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
@ -1,76 +0,0 @@
|
||||
# clzName csName hisName containASCII pkg
|
||||
IBM037 IBM037 Cp037 false sun.nio.cs.ext
|
||||
IBM1006 x-IBM1006 Cp1006 false sun.nio.cs.ext
|
||||
IBM1025 x-IBM1025 Cp1025 false sun.nio.cs.ext
|
||||
IBM1026 IBM1026 Cp1026 false sun.nio.cs.ext
|
||||
IBM1046 x-IBM1046 Cp1046 false sun.nio.cs.ext
|
||||
IBM1047 IBM1047 Cp1047 false sun.nio.cs.ext
|
||||
IBM1097 x-IBM1097 Cp1097 false sun.nio.cs.ext
|
||||
IBM1098 x-IBM1098 Cp1098 false sun.nio.cs.ext
|
||||
IBM1112 x-IBM1112 Cp1112 false sun.nio.cs.ext
|
||||
IBM1122 x-IBM1122 Cp1122 false sun.nio.cs.ext
|
||||
IBM1123 x-IBM1123 Cp1123 false sun.nio.cs.ext
|
||||
IBM1124 x-IBM1124 Cp1124 false sun.nio.cs.ext
|
||||
# map tables for 1140-1149 are updated manualy with the u+20ac entry
|
||||
IBM1140 IBM01140 Cp1140 false sun.nio.cs.ext
|
||||
IBM1141 IBM01141 Cp1141 false sun.nio.cs.ext
|
||||
IBM1142 IBM01142 Cp1142 false sun.nio.cs.ext
|
||||
IBM1143 IBM01143 Cp1143 false sun.nio.cs.ext
|
||||
IBM1144 IBM01144 Cp1144 false sun.nio.cs.ext
|
||||
IBM1145 IBM01145 Cp1145 false sun.nio.cs.ext
|
||||
IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext
|
||||
IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
|
||||
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
|
||||
IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext
|
||||
IBM273 IBM273 Cp273 false sun.nio.cs.ext
|
||||
IBM277 IBM277 Cp277 false sun.nio.cs.ext
|
||||
IBM278 IBM278 Cp278 false sun.nio.cs.ext
|
||||
IBM280 IBM280 Cp280 false sun.nio.cs.ext
|
||||
IBM284 IBM284 Cp284 false sun.nio.cs.ext
|
||||
IBM285 IBM285 Cp285 false sun.nio.cs.ext
|
||||
IBM290 IBM290 Cp290 false sun.nio.cs.ext
|
||||
IBM297 IBM297 Cp297 false sun.nio.cs.ext
|
||||
IBM420 IBM420 Cp420 false sun.nio.cs.ext
|
||||
IBM424 IBM424 Cp424 false sun.nio.cs.ext
|
||||
IBM500 IBM500 Cp500 false sun.nio.cs.ext
|
||||
IBM833 x-IBM833 Cp833 false sun.nio.cs.ext
|
||||
IBM838 IBM-Thai Cp838 false sun.nio.cs.ext
|
||||
IBM856 x-IBM856 Cp856 false sun.nio.cs.ext
|
||||
IBM860 IBM860 Cp860 false sun.nio.cs.ext
|
||||
IBM861 IBM861 Cp861 false sun.nio.cs.ext
|
||||
IBM863 IBM863 Cp863 false sun.nio.cs.ext
|
||||
IBM864 IBM864 Cp864 false sun.nio.cs.ext
|
||||
IBM865 IBM865 Cp865 false sun.nio.cs.ext
|
||||
IBM868 IBM868 Cp868 false sun.nio.cs.ext
|
||||
IBM869 IBM869 Cp869 false sun.nio.cs.ext
|
||||
IBM870 IBM870 Cp870 false sun.nio.cs.ext
|
||||
IBM871 IBM871 Cp871 false sun.nio.cs.ext
|
||||
IBM875 x-IBM875 Cp875 false sun.nio.cs.ext
|
||||
IBM918 IBM918 Cp918 false sun.nio.cs.ext
|
||||
IBM921 x-IBM921 Cp921 false sun.nio.cs.ext
|
||||
IBM922 x-IBM922 Cp922 false sun.nio.cs.ext
|
||||
# use name as hisname as well, cs did not support hisname prevously
|
||||
ISO_8859_11 x-iso-8859-11 x-iso-8859-11 true sun.nio.cs.ext
|
||||
ISO_8859_3 ISO-8859-3 ISO8859_3 true sun.nio.cs.ext
|
||||
ISO_8859_6 ISO-8859-6 ISO8859_6 true sun.nio.cs.ext
|
||||
ISO_8859_8 ISO-8859-8 ISO8859_8 true sun.nio.cs.ext
|
||||
JIS_X_0201 JIS_X0201 JIS_X0201 true sun.nio.cs.ext
|
||||
MS1255 windows-1255 Cp1255 true sun.nio.cs.ext
|
||||
MS1256 windows-1256 Cp1256 true sun.nio.cs.ext
|
||||
MS1258 windows-1258 Cp1258 true sun.nio.cs.ext
|
||||
MS874 x-windows-874 MS874 true sun.nio.cs.ext
|
||||
MacArabic x-MacArabic MacArabic false sun.nio.cs.ext
|
||||
MacCentralEurope x-MacCentralEurope MacCentralEurope false sun.nio.cs.ext
|
||||
MacCroatian x-MacCroatian MacCroatian false sun.nio.cs.ext
|
||||
MacCyrillic x-MacCyrillic MacCyrillic false sun.nio.cs.ext
|
||||
MacDingbat x-MacDingbat MacDingbat false sun.nio.cs.ext
|
||||
MacGreek x-MacGreek MacGreek false sun.nio.cs.ext
|
||||
MacHebrew x-MacHebrew MacHebrew false sun.nio.cs.ext
|
||||
MacIceland x-MacIceland MacIceland false sun.nio.cs.ext
|
||||
MacRoman x-MacRoman MacRoman false sun.nio.cs.ext
|
||||
MacRomania x-MacRomania MacRomania false sun.nio.cs.ext
|
||||
MacSymbol x-MacSymbol MacSymbol false sun.nio.cs.ext
|
||||
MacThai x-MacThai MacThai false sun.nio.cs.ext
|
||||
MacTurkish x-MacTurkish MacTurkish false sun.nio.cs.ext
|
||||
MacUkraine x-MacUkraine MacUkraine false sun.nio.cs.ext
|
||||
TIS_620 TIS-620 TIS620 true sun.nio.cs.ext
|
||||
149
jdk/make/data/charsetmapping/list_old
Normal file
149
jdk/make/data/charsetmapping/list_old
Normal file
@ -0,0 +1,149 @@
|
||||
#
|
||||
# This is the copy of the old configuration files sbcs, dbcs and extsbcs
|
||||
# used in jdk8.
|
||||
############################### sbcs #########################################
|
||||
#
|
||||
# clzName csName hisName containASCII pkg
|
||||
#
|
||||
IBM437 IBM437 Cp437 false sun.nio.cs
|
||||
IBM737 x-IBM737 Cp737 false sun.nio.cs
|
||||
IBM775 IBM775 Cp775 false sun.nio.cs
|
||||
IBM850 IBM850 Cp850 false sun.nio.cs
|
||||
IBM852 IBM852 Cp852 false sun.nio.cs
|
||||
IBM855 IBM855 Cp855 false sun.nio.cs
|
||||
IBM857 IBM857 Cp857 false sun.nio.cs
|
||||
IBM858 IBM00858 Cp858 false sun.nio.cs
|
||||
IBM862 IBM862 Cp862 false sun.nio.cs
|
||||
IBM866 IBM866 Cp866 false sun.nio.cs
|
||||
IBM874 x-IBM874 Cp874 false sun.nio.cs
|
||||
ISO_8859_2 ISO-8859-2 ISO8859_2 true sun.nio.cs
|
||||
ISO_8859_4 ISO-8859-4 ISO8859_4 true sun.nio.cs
|
||||
ISO_8859_5 ISO-8859-5 ISO8859_5 true sun.nio.cs
|
||||
ISO_8859_7 ISO-8859-7 ISO8859_7 true sun.nio.cs
|
||||
ISO_8859_9 ISO-8859-9 ISO8859_9 true sun.nio.cs
|
||||
ISO_8859_13 ISO-8859-13 ISO8859_13 true sun.nio.cs
|
||||
ISO_8859_15 ISO-8859-15 ISO8859_15 true sun.nio.cs
|
||||
KOI8_R KOI8-R KOI8_R true sun.nio.cs
|
||||
KOI8_U KOI8-U KOI8_U true sun.nio.cs
|
||||
MS1250 windows-1250 Cp1250 true sun.nio.cs
|
||||
MS1251 windows-1251 Cp1251 true sun.nio.cs
|
||||
MS1252 windows-1252 Cp1252 true sun.nio.cs
|
||||
MS1253 windows-1253 Cp1253 true sun.nio.cs
|
||||
MS1254 windows-1254 Cp1254 true sun.nio.cs
|
||||
MS1257 windows-1257 Cp1257 true sun.nio.cs
|
||||
#
|
||||
############################### extsbcs #######################################
|
||||
#
|
||||
IBM037 IBM037 Cp037 false sun.nio.cs.ext
|
||||
IBM1006 x-IBM1006 Cp1006 false sun.nio.cs.ext
|
||||
IBM1025 x-IBM1025 Cp1025 false sun.nio.cs.ext
|
||||
IBM1026 IBM1026 Cp1026 false sun.nio.cs.ext
|
||||
IBM1046 x-IBM1046 Cp1046 false sun.nio.cs.ext
|
||||
IBM1047 IBM1047 Cp1047 false sun.nio.cs.ext
|
||||
IBM1097 x-IBM1097 Cp1097 false sun.nio.cs.ext
|
||||
IBM1098 x-IBM1098 Cp1098 false sun.nio.cs.ext
|
||||
IBM1112 x-IBM1112 Cp1112 false sun.nio.cs.ext
|
||||
IBM1122 x-IBM1122 Cp1122 false sun.nio.cs.ext
|
||||
IBM1123 x-IBM1123 Cp1123 false sun.nio.cs.ext
|
||||
IBM1124 x-IBM1124 Cp1124 false sun.nio.cs.ext
|
||||
# map tables for 1140-1149 are updated manualy with the u+20ac entry
|
||||
IBM1140 IBM01140 Cp1140 false sun.nio.cs.ext
|
||||
IBM1141 IBM01141 Cp1141 false sun.nio.cs.ext
|
||||
IBM1142 IBM01142 Cp1142 false sun.nio.cs.ext
|
||||
IBM1143 IBM01143 Cp1143 false sun.nio.cs.ext
|
||||
IBM1144 IBM01144 Cp1144 false sun.nio.cs.ext
|
||||
IBM1145 IBM01145 Cp1145 false sun.nio.cs.ext
|
||||
IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext
|
||||
IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
|
||||
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
|
||||
IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext
|
||||
IBM273 IBM273 Cp273 false sun.nio.cs.ext
|
||||
IBM277 IBM277 Cp277 false sun.nio.cs.ext
|
||||
IBM278 IBM278 Cp278 false sun.nio.cs.ext
|
||||
IBM280 IBM280 Cp280 false sun.nio.cs.ext
|
||||
IBM284 IBM284 Cp284 false sun.nio.cs.ext
|
||||
IBM285 IBM285 Cp285 false sun.nio.cs.ext
|
||||
IBM290 IBM290 Cp290 false sun.nio.cs.ext
|
||||
IBM297 IBM297 Cp297 false sun.nio.cs.ext
|
||||
IBM420 IBM420 Cp420 false sun.nio.cs.ext
|
||||
IBM424 IBM424 Cp424 false sun.nio.cs.ext
|
||||
IBM500 IBM500 Cp500 false sun.nio.cs.ext
|
||||
IBM833 x-IBM833 Cp833 false sun.nio.cs.ext
|
||||
IBM838 IBM-Thai Cp838 false sun.nio.cs.ext
|
||||
IBM856 x-IBM856 Cp856 false sun.nio.cs.ext
|
||||
IBM860 IBM860 Cp860 false sun.nio.cs.ext
|
||||
IBM861 IBM861 Cp861 false sun.nio.cs.ext
|
||||
IBM863 IBM863 Cp863 false sun.nio.cs.ext
|
||||
IBM864 IBM864 Cp864 false sun.nio.cs.ext
|
||||
IBM865 IBM865 Cp865 false sun.nio.cs.ext
|
||||
IBM868 IBM868 Cp868 false sun.nio.cs.ext
|
||||
IBM869 IBM869 Cp869 false sun.nio.cs.ext
|
||||
IBM870 IBM870 Cp870 false sun.nio.cs.ext
|
||||
IBM871 IBM871 Cp871 false sun.nio.cs.ext
|
||||
IBM875 x-IBM875 Cp875 false sun.nio.cs.ext
|
||||
IBM918 IBM918 Cp918 false sun.nio.cs.ext
|
||||
IBM921 x-IBM921 Cp921 false sun.nio.cs.ext
|
||||
IBM922 x-IBM922 Cp922 false sun.nio.cs.ext
|
||||
# use name as hisname as well, cs did not support hisname prevously
|
||||
ISO_8859_11 x-iso-8859-11 x-iso-8859-11 true sun.nio.cs.ext
|
||||
ISO_8859_3 ISO-8859-3 ISO8859_3 true sun.nio.cs.ext
|
||||
ISO_8859_6 ISO-8859-6 ISO8859_6 true sun.nio.cs.ext
|
||||
ISO_8859_8 ISO-8859-8 ISO8859_8 true sun.nio.cs.ext
|
||||
JIS_X_0201 JIS_X0201 JIS_X0201 true sun.nio.cs.ext
|
||||
MS1255 windows-1255 Cp1255 true sun.nio.cs.ext
|
||||
MS1256 windows-1256 Cp1256 true sun.nio.cs.ext
|
||||
MS1258 windows-1258 Cp1258 true sun.nio.cs.ext
|
||||
MS874 x-windows-874 MS874 true sun.nio.cs.ext
|
||||
MacArabic x-MacArabic MacArabic false sun.nio.cs.ext
|
||||
MacCentralEurope x-MacCentralEurope MacCentralEurope false sun.nio.cs.ext
|
||||
MacCroatian x-MacCroatian MacCroatian false sun.nio.cs.ext
|
||||
MacCyrillic x-MacCyrillic MacCyrillic false sun.nio.cs.ext
|
||||
MacDingbat x-MacDingbat MacDingbat false sun.nio.cs.ext
|
||||
MacGreek x-MacGreek MacGreek false sun.nio.cs.ext
|
||||
MacHebrew x-MacHebrew MacHebrew false sun.nio.cs.ext
|
||||
MacIceland x-MacIceland MacIceland false sun.nio.cs.ext
|
||||
MacRoman x-MacRoman MacRoman false sun.nio.cs.ext
|
||||
MacRomania x-MacRomania MacRomania false sun.nio.cs.ext
|
||||
MacSymbol x-MacSymbol MacSymbol false sun.nio.cs.ext
|
||||
MacThai x-MacThai MacThai false sun.nio.cs.ext
|
||||
MacTurkish x-MacTurkish MacTurkish false sun.nio.cs.ext
|
||||
MacUkraine x-MacUkraine MacUkraine false sun.nio.cs.ext
|
||||
TIS_620 TIS-620 TIS620 true sun.nio.cs.ext
|
||||
#
|
||||
############################### dbcs #########################################
|
||||
#
|
||||
#clzName csName hisName dbtype pkg ascii b1min b1max b2min b2max
|
||||
#
|
||||
Big5 Big5 Big5 basic sun.nio.cs.ext true 0xa1 0xf9 0x40 0xfe
|
||||
Johab x-Johab x-Johab basic sun.nio.cs.ext true 0x84 0xf9 0x31 0xfe
|
||||
EUC_CN GB2312 EUC_CN basic sun.nio.cs.ext true 0xa1 0xf7 0xa1 0xfe
|
||||
EUC_KR EUC-KR EUC_KR basic sun.nio.cs.ext true 0xa1 0xfd 0xa1 0xfe
|
||||
MS932 windows-31j MS932 basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
MS936 x-mswin-936 MS936 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
MS949 x-windows-949 MS949 basic sun.nio.cs.ext true 0x81 0xfe 0x41 0xfe
|
||||
MS950 x-windows-950 MS950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
GBK GBK GBK basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
SJIS Shift_JIS SJIS basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
PCK x-PCK PCK basic sun.nio.cs.ext true 0x81 0xfc 0x40 0xfc
|
||||
IBM1364 x-IBM1364 Cp1364 ebcdic sun.nio.cs.ext false 0x40 0xde 0x40 0xfe
|
||||
IBM1381 x-IBM1381 Cp1381 basic sun.nio.cs.ext true 0x8c 0xf7 0xa1 0xfe
|
||||
IBM1383 x-IBM1383 Cp1383 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
IBM300 x-IBM300 Cp300 dbcsonly sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM930 x-IBM930 Cp930 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM933 x-IBM933 Cp933 ebcdic sun.nio.cs.ext false 0x40 0xdd 0x40 0xfe
|
||||
IBM935 x-IBM935 Cp935 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM937 x-IBM937 Cp937 ebcdic sun.nio.cs.ext false 0x40 0xe2 0x40 0xfe
|
||||
IBM939 x-IBM939 Cp939 ebcdic sun.nio.cs.ext false 0x40 0x7f 0x40 0xfe
|
||||
IBM942 x-IBM942 Cp942 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM943 x-IBM943 Cp943 basic sun.nio.cs.ext false 0x81 0xfc 0x40 0xfc
|
||||
IBM948 x-IBM948 Cp948 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfc
|
||||
IBM949 x-IBM949 Cp949 basic sun.nio.cs.ext false 0x8f 0xfe 0xa1 0xfe
|
||||
IBM950 x-IBM950 Cp950 basic sun.nio.cs.ext true 0x81 0xfe 0x40 0xfe
|
||||
IBM970 x-IBM970 Cp970 euc_sim sun.nio.cs.ext true 0xa1 0xfe 0xa1 0xfe
|
||||
JIS_X_0208 x-JIS0208 JIS0208 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212 JIS_X0212-1990 JIS0212 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_Solaris x-JIS0208_Solaris JIS0208_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x9e 0x21 0x7e
|
||||
JIS_X_0208_MS5022X x-JIS0208_MS5022X JIS0208_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0208_MS932 x-JIS0208_MS932 JIS0208_MS932 dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_Solaris x-JIS0212_Solaris JIS0212_Solaris dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
JIS_X_0212_MS5022X x-JIS0212_MS5022X JIS0212_MS5022X dbcsonly sun.nio.cs.ext false 0x21 0x7e 0x21 0x7e
|
||||
@ -1,28 +0,0 @@
|
||||
# clzName csName hisName containASCII pkg
|
||||
IBM437 IBM437 Cp437 false sun.nio.cs
|
||||
IBM737 x-IBM737 Cp737 false sun.nio.cs
|
||||
IBM775 IBM775 Cp775 false sun.nio.cs
|
||||
IBM850 IBM850 Cp850 false sun.nio.cs
|
||||
IBM852 IBM852 Cp852 false sun.nio.cs
|
||||
IBM855 IBM855 Cp855 false sun.nio.cs
|
||||
IBM857 IBM857 Cp857 false sun.nio.cs
|
||||
IBM858 IBM00858 Cp858 false sun.nio.cs
|
||||
IBM862 IBM862 Cp862 false sun.nio.cs
|
||||
IBM866 IBM866 Cp866 false sun.nio.cs
|
||||
IBM874 x-IBM874 Cp874 false sun.nio.cs
|
||||
ISO_8859_2 ISO-8859-2 ISO8859_2 true sun.nio.cs
|
||||
ISO_8859_4 ISO-8859-4 ISO8859_4 true sun.nio.cs
|
||||
ISO_8859_5 ISO-8859-5 ISO8859_5 true sun.nio.cs
|
||||
ISO_8859_7 ISO-8859-7 ISO8859_7 true sun.nio.cs
|
||||
ISO_8859_9 ISO-8859-9 ISO8859_9 true sun.nio.cs
|
||||
ISO_8859_13 ISO-8859-13 ISO8859_13 true sun.nio.cs
|
||||
ISO_8859_15 ISO-8859-15 ISO8859_15 true sun.nio.cs
|
||||
KOI8_R KOI8-R KOI8_R true sun.nio.cs
|
||||
KOI8_U KOI8-U KOI8_U true sun.nio.cs
|
||||
MS1250 windows-1250 Cp1250 true sun.nio.cs
|
||||
MS1251 windows-1251 Cp1251 true sun.nio.cs
|
||||
MS1252 windows-1252 Cp1252 true sun.nio.cs
|
||||
MS1253 windows-1253 Cp1253 true sun.nio.cs
|
||||
MS1254 windows-1254 Cp1254 true sun.nio.cs
|
||||
MS1257 windows-1257 Cp1257 true sun.nio.cs
|
||||
|
||||
@ -1,337 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation. Oracle designates this
|
||||
# particular file as subject to the "Classpath" exception as provided
|
||||
# by Oracle in the LICENSE file that accompanied this code.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# Standard charsets provided by StandardCharsets provider.
|
||||
#
|
||||
# Note that these "standard" charsets listed here are not
|
||||
# necessary to be the "Standard charsets" defined in the
|
||||
# specification of java.nio.charset.Charset. Instead these
|
||||
# are the charsets that this implementation believes should
|
||||
# be packaged into the charsets provider class "StandardCharsets"
|
||||
# which is initialized at startup time by java.nio.charset.Charset,
|
||||
# compared to the charsets packaged in "ExtendedCharsets" provider,
|
||||
# which is lazy initialized.
|
||||
|
||||
charset US-ASCII US_ASCII
|
||||
|
||||
# IANA aliases
|
||||
alias iso-ir-6
|
||||
alias ANSI_X3.4-1986
|
||||
alias ISO_646.irv:1991
|
||||
alias ASCII
|
||||
alias ISO646-US
|
||||
alias us
|
||||
alias IBM367
|
||||
alias cp367
|
||||
alias csASCII
|
||||
alias default
|
||||
|
||||
# Other aliases
|
||||
alias 646 # Solaris POSIX locale
|
||||
alias iso_646.irv:1983
|
||||
alias ANSI_X3.4-1968 # Linux POSIX locale (RedHat)
|
||||
alias ascii7
|
||||
|
||||
charset UTF-8 UTF_8
|
||||
alias UTF8 # JDK historical
|
||||
alias unicode-1-1-utf-8
|
||||
|
||||
charset CESU-8 CESU_8
|
||||
alias CESU8
|
||||
alias csCESU-8
|
||||
|
||||
charset UTF-16 UTF_16
|
||||
alias UTF_16 # JDK historical
|
||||
alias utf16
|
||||
alias unicode
|
||||
alias UnicodeBig
|
||||
|
||||
charset UTF-16BE UTF_16BE
|
||||
alias UTF_16BE
|
||||
alias ISO-10646-UCS-2
|
||||
alias X-UTF-16BE
|
||||
alias UnicodeBigUnmarked
|
||||
|
||||
charset UTF-16LE UTF_16LE
|
||||
alias UTF_16LE
|
||||
alias X-UTF-16LE
|
||||
alias UnicodeLittleUnmarked
|
||||
|
||||
charset x-UTF-16LE-BOM UTF_16LE_BOM
|
||||
alias UnicodeLittle
|
||||
|
||||
charset UTF-32 UTF_32
|
||||
alias UTF_32
|
||||
alias UTF32
|
||||
|
||||
charset UTF-32LE UTF_32LE
|
||||
alias UTF_32LE
|
||||
alias X-UTF-32LE
|
||||
|
||||
charset UTF-32BE UTF_32BE
|
||||
alias UTF_32BE
|
||||
alias X-UTF-32BE
|
||||
|
||||
charset X-UTF-32LE-BOM UTF_32LE_BOM
|
||||
alias UTF_32LE_BOM
|
||||
alias UTF-32LE-BOM
|
||||
|
||||
charset X-UTF-32BE-BOM UTF_32BE_BOM
|
||||
alias UTF_32BE_BOM
|
||||
alias UTF-32BE-BOM
|
||||
|
||||
charset ISO-8859-1 ISO_8859_1
|
||||
|
||||
# IANA aliases
|
||||
alias iso-ir-100
|
||||
alias ISO_8859-1
|
||||
alias latin1
|
||||
alias l1
|
||||
alias IBM819
|
||||
alias cp819
|
||||
alias csISOLatin1
|
||||
|
||||
# Other aliases
|
||||
alias 819
|
||||
alias IBM-819
|
||||
alias ISO8859_1
|
||||
alias ISO_8859-1:1987
|
||||
alias ISO_8859_1
|
||||
alias 8859_1
|
||||
alias ISO8859-1
|
||||
|
||||
charset ISO-8859-2 ISO_8859_2
|
||||
alias iso8859_2 # JDK historical
|
||||
alias 8859_2
|
||||
alias iso-ir-101
|
||||
alias ISO_8859-2
|
||||
alias ISO_8859-2:1987
|
||||
alias ISO8859-2
|
||||
alias latin2
|
||||
alias l2
|
||||
alias ibm912
|
||||
alias ibm-912
|
||||
alias cp912
|
||||
alias 912
|
||||
alias csISOLatin2
|
||||
|
||||
charset ISO-8859-4 ISO_8859_4
|
||||
alias iso8859_4 # JDK historical
|
||||
alias iso8859-4
|
||||
alias 8859_4
|
||||
alias iso-ir-110
|
||||
alias ISO_8859-4
|
||||
alias ISO_8859-4:1988
|
||||
alias latin4
|
||||
alias l4
|
||||
alias ibm914
|
||||
alias ibm-914
|
||||
alias cp914
|
||||
alias 914
|
||||
alias csISOLatin4
|
||||
|
||||
charset ISO-8859-5 ISO_8859_5
|
||||
alias iso8859_5 # JDK historical
|
||||
alias 8859_5
|
||||
alias iso-ir-144
|
||||
alias ISO_8859-5
|
||||
alias ISO_8859-5:1988
|
||||
alias ISO8859-5
|
||||
alias cyrillic
|
||||
alias ibm915
|
||||
alias ibm-915
|
||||
alias cp915
|
||||
alias 915
|
||||
alias csISOLatinCyrillic
|
||||
|
||||
charset ISO-8859-7 ISO_8859_7
|
||||
alias iso8859_7 # JDK historical
|
||||
alias 8859_7
|
||||
alias iso-ir-126
|
||||
alias ISO_8859-7
|
||||
alias ISO_8859-7:1987
|
||||
alias ELOT_928
|
||||
alias ECMA-118
|
||||
alias greek
|
||||
alias greek8
|
||||
alias csISOLatinGreek
|
||||
alias sun_eu_greek # Solaris 7/8 compatibility
|
||||
alias ibm813
|
||||
alias ibm-813
|
||||
alias 813
|
||||
alias cp813
|
||||
alias iso8859-7 # Solaris 9 compatibility
|
||||
|
||||
charset ISO-8859-9 ISO_8859_9
|
||||
alias iso8859_9 # JDK historical
|
||||
alias 8859_9
|
||||
alias iso-ir-148
|
||||
alias ISO_8859-9
|
||||
alias ISO_8859-9:1989
|
||||
alias ISO8859-9
|
||||
alias latin5
|
||||
alias l5
|
||||
alias ibm920
|
||||
alias ibm-920
|
||||
alias 920
|
||||
alias cp920
|
||||
alias csISOLatin5
|
||||
|
||||
charset ISO-8859-13 ISO_8859_13
|
||||
alias iso8859_13 # JDK historical
|
||||
alias 8859_13
|
||||
alias iso_8859-13
|
||||
alias ISO8859-13
|
||||
|
||||
charset ISO-8859-15 ISO_8859_15
|
||||
|
||||
# IANA alias
|
||||
alias ISO_8859-15
|
||||
|
||||
# Other aliases
|
||||
alias 8859_15
|
||||
alias ISO-8859-15
|
||||
alias ISO8859_15
|
||||
alias ISO8859-15
|
||||
alias IBM923
|
||||
alias IBM-923
|
||||
alias cp923
|
||||
alias 923
|
||||
alias LATIN0
|
||||
alias LATIN9
|
||||
alias L9
|
||||
alias csISOlatin0
|
||||
alias csISOlatin9
|
||||
alias ISO8859_15_FDIS
|
||||
|
||||
charset KOI8-R KOI8_R
|
||||
alias koi8_r # JDK historical
|
||||
alias koi8
|
||||
alias cskoi8r
|
||||
|
||||
charset KOI8-U KOI8_U
|
||||
alias koi8_u
|
||||
|
||||
charset windows-1250 MS1250
|
||||
alias cp1250 # JDK historical
|
||||
alias cp5346 # Euro IBM CCSID
|
||||
|
||||
charset windows-1251 MS1251
|
||||
alias cp1251 # JDK historical
|
||||
alias cp5347 # Euro IBM CCSID
|
||||
alias ansi-1251 # Solaris compatibility
|
||||
|
||||
charset windows-1252 MS1252
|
||||
alias cp1252 # JDK historical
|
||||
alias cp5348 # Euro IBM CCSID
|
||||
|
||||
charset windows-1253 MS1253
|
||||
alias cp1253 # JDK historical
|
||||
alias cp5349 # Euro IBM CCSID
|
||||
|
||||
charset windows-1254 MS1254
|
||||
alias cp1254 # JDK historical
|
||||
alias cp5350 # Euro IBM CCSID
|
||||
|
||||
charset windows-1257 MS1257
|
||||
alias cp1257 # JDK historical
|
||||
alias cp5353 # Euro IBM CCSID
|
||||
|
||||
|
||||
charset IBM437 IBM437
|
||||
alias cp437 #JDK historical
|
||||
alias ibm437
|
||||
alias ibm-437
|
||||
alias 437
|
||||
alias cspc8codepage437
|
||||
alias windows-437
|
||||
|
||||
charset x-IBM737 IBM737
|
||||
alias cp737 #JDK historical
|
||||
alias ibm737
|
||||
alias ibm-737
|
||||
alias 737
|
||||
|
||||
charset IBM775 IBM775
|
||||
alias cp775 #JDK historical
|
||||
alias ibm775
|
||||
alias ibm-775
|
||||
alias 775
|
||||
|
||||
charset IBM850 IBM850
|
||||
alias cp850 #JDK historical
|
||||
alias ibm-850
|
||||
alias ibm850
|
||||
alias 850
|
||||
alias cspc850multilingual
|
||||
|
||||
charset IBM852 IBM852
|
||||
alias cp852 #JDK historical
|
||||
alias ibm852
|
||||
alias ibm-852
|
||||
alias 852
|
||||
alias csPCp852
|
||||
|
||||
charset IBM855 IBM855
|
||||
alias cp855 #JDK historical
|
||||
alias ibm-855
|
||||
alias ibm855
|
||||
alias 855
|
||||
alias cspcp855
|
||||
|
||||
charset IBM857 IBM857
|
||||
alias cp857 #JDK historical
|
||||
alias ibm857
|
||||
alias ibm-857
|
||||
alias 857
|
||||
alias csIBM857
|
||||
|
||||
charset IBM00858 IBM858
|
||||
alias cp858 #JDK historical
|
||||
alias ccsid00858
|
||||
alias cp00858
|
||||
alias 858
|
||||
alias PC-Multilingual-850+euro
|
||||
|
||||
charset IBM862 IBM862
|
||||
alias cp862 #JDK historical
|
||||
alias ibm862
|
||||
alias ibm-862
|
||||
alias 862
|
||||
alias csIBM862
|
||||
alias cspc862latinhebrew
|
||||
|
||||
charset IBM866 IBM866
|
||||
alias cp866 #JDK historical
|
||||
alias ibm866
|
||||
alias ibm-866
|
||||
alias 866
|
||||
alias csIBM866
|
||||
|
||||
charset x-IBM874 IBM874
|
||||
alias cp874 #JDK historical
|
||||
alias ibm874
|
||||
alias ibm-874
|
||||
alias 874
|
||||
19
jdk/make/data/charsetmapping/stdcs-linux
Normal file
19
jdk/make/data/charsetmapping/stdcs-linux
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
Big5
|
||||
Big5_Solaris
|
||||
Big5_HKSCS
|
||||
EUC_CN
|
||||
EUC_KR
|
||||
EUC_JP
|
||||
EUC_JP_LINUX
|
||||
EUC_JP_Open
|
||||
GBK
|
||||
Johab
|
||||
PCK
|
||||
JIS_X_0201
|
||||
JIS_X_0208
|
||||
JIS_X_0212
|
||||
JIS_X_0208_Solaris
|
||||
JIS_X_0212_Solaris
|
||||
23
jdk/make/data/charsetmapping/stdcs-solaris
Normal file
23
jdk/make/data/charsetmapping/stdcs-solaris
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
Big5
|
||||
Big5_Solaris
|
||||
Big5_HKSCS # always together with Big5
|
||||
EUC_CN
|
||||
EUC_KR
|
||||
EUC_JP
|
||||
EUC_JP_LINUX
|
||||
EUC_JP_Open
|
||||
GBK
|
||||
ISO_8859_11
|
||||
ISO_8859_3
|
||||
ISO_8859_6
|
||||
ISO_8859_8
|
||||
Johab
|
||||
PCK
|
||||
JIS_X_0201
|
||||
JIS_X_0208
|
||||
JIS_X_0212
|
||||
JIS_X_0208_Solaris
|
||||
JIS_X_0212_Solaris
|
||||
16
jdk/make/data/charsetmapping/stdcs-windows
Normal file
16
jdk/make/data/charsetmapping/stdcs-windows
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# generate these charsets into sun.nio.cs
|
||||
#
|
||||
GBK
|
||||
Johab
|
||||
MS1255
|
||||
MS1256
|
||||
MS1258
|
||||
MS874
|
||||
MS932
|
||||
JIS_X_0201 # JIS_X_0201 is used by MS932 in its contains() method
|
||||
SJIS # SJIS must go together with MS932 to support sun.nio.cs.map
|
||||
MS936
|
||||
MS949
|
||||
MS950
|
||||
MS950_HKSCS_XP
|
||||
@ -30,23 +30,27 @@ include GensrcCommon.gmk
|
||||
# Generate files using the charsetmapping tool
|
||||
#
|
||||
CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
|
||||
|
||||
CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
|
||||
CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping
|
||||
CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
|
||||
CHARSET_TEMPLATES := \
|
||||
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \
|
||||
$(CHARSET_DATA_DIR)/DoubleByte-X.java.template
|
||||
CHARSET_EXTENDED_JAVA_TEMPLATES := \
|
||||
$(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext/ExtendedCharsets.java.template
|
||||
CHARSET_EXTENDED_JAVA_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
|
||||
CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
|
||||
|
||||
$(CHARSET_DONE_CS)-extsbcs: $(CHARSET_DATA_DIR)/extsbcs \
|
||||
$(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
|
||||
$(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \
|
||||
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
|
||||
$(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
|
||||
$(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) extsbcs
|
||||
$(TOUCH) '$@'
|
||||
|
||||
$(CHARSET_DONE_CS)-dbcs: $(CHARSET_DATA_DIR)/dbcs \
|
||||
$(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) dbcs
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
|
||||
extcs charsets $(CHARSET_STANDARD_OS) \
|
||||
$(CHARSET_EXTENDED_JAVA_TEMPLATES) \
|
||||
$(CHARSET_EXTENDED_JAVA_DIR) $(LOG_INFO)
|
||||
$(TOUCH) '$@'
|
||||
|
||||
$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
|
||||
@ -67,8 +71,7 @@ $(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
|
||||
$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
|
||||
|
||||
GENSRC_JDK_CHARSETS += \
|
||||
$(CHARSET_DONE_CS)-extsbcs \
|
||||
$(CHARSET_DONE_CS)-dbcs \
|
||||
$(CHARSET_DONE_CS)-extcs \
|
||||
$(CHARSET_DONE_CS)-hkscs \
|
||||
$(CHARSET_DONE_CS)-euctw \
|
||||
$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat \
|
||||
|
||||
@ -25,112 +25,29 @@
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Generate files using the charsetmapping tool
|
||||
# Generate StandardCharsets.java and individul sun.nio.cs charset class using
|
||||
# the charsetmapping tool
|
||||
#
|
||||
CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
|
||||
CHARSET_EXTSRC_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
|
||||
CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
|
||||
CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
|
||||
CHARSET_TEMPLATES := \
|
||||
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \
|
||||
$(CHARSET_DATA_DIR)/DoubleByte-X.java.template
|
||||
CHARSET_STANDARD_JAVA_TEMPLATES := \
|
||||
$(JDK_TOPDIR)/src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template
|
||||
CHARSET_STANDARD_OS := stdcs-$(OPENJDK_TARGET_OS)
|
||||
|
||||
$(CHARSET_DONE_BASE)-sbcs: $(CHARSET_DATA_DIR)/sbcs \
|
||||
$(CHARSET_TEMPLATES) $(BUILD_TOOLS_JDK)
|
||||
$(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
|
||||
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
|
||||
$(CHARSET_TEMPLATES) $(CHARSET_STANDARD_JAVA_TEMPLATES) \
|
||||
$(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) sbcs
|
||||
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
|
||||
stdcs charsets $(CHARSET_STANDARD_OS) \
|
||||
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) $(LOG_INFO)
|
||||
$(TOUCH) '$@'
|
||||
|
||||
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-sbcs
|
||||
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Generate the sun/nio/cs/StandardCharsets.java file
|
||||
#
|
||||
CHARSET_STANDARD_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_standardcharsets
|
||||
CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
|
||||
CHARSET_STANDARD_JAVA := sun/nio/cs/StandardCharsets.java
|
||||
|
||||
CHARSET_ALIASES_TABLES_AWK := ' \
|
||||
BEGIN { n = 1; m = 1; } \
|
||||
/^[ \t]*charset / { \
|
||||
csn = $$2; cln = $$3; \
|
||||
lcsn = tolower(csn); \
|
||||
lcsns[n++] = lcsn; \
|
||||
csns[lcsn] = csn; \
|
||||
classMap[lcsn] = cln; \
|
||||
if (n > 2) \
|
||||
printf " };\n\n"; \
|
||||
printf " static final String[] aliases_%s = new String[] {\n", cln; \
|
||||
} \
|
||||
/^[ \t]*alias / { \
|
||||
acsns[m++] = tolower($$2); \
|
||||
aliasMap[tolower($$2)] = lcsn; \
|
||||
printf " \"%s\",\n", $$2; \
|
||||
} \
|
||||
END { \
|
||||
printf " };\n\n"; \
|
||||
} '
|
||||
|
||||
CHARSET_ALIASES_MAP_AWK := ' \
|
||||
/^[ \t]*charset / { \
|
||||
csn = $$2; \
|
||||
lcsn = tolower(csn); \
|
||||
} \
|
||||
/^[ \t]*alias / { \
|
||||
an = tolower($$2); \
|
||||
printf "%-20s \"%s\"\n", an, lcsn; \
|
||||
} '
|
||||
|
||||
CHARSET_CLASSES_MAP_AWK := ' \
|
||||
/^[ \t]*charset / { \
|
||||
csn = $$2; cln = $$3; \
|
||||
lcsn = tolower(csn); \
|
||||
printf "%-20s \"%s\"\n", lcsn, cln; \
|
||||
} '
|
||||
|
||||
# This target should be referenced using the order-only operator (|)
|
||||
$(CHARSET_STANDARD_GENSRC_DIR):
|
||||
$(MKDIR) -p '$@'
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet: $(CHARSET_STANDARD_DATA) \
|
||||
| $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_TABLES_AWK)
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map: $(CHARSET_STANDARD_DATA) \
|
||||
| $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(NAWK) < '$<' > '$@' $(CHARSET_ALIASES_MAP_AWK)
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/classes-map: $(CHARSET_STANDARD_DATA) \
|
||||
| $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(NAWK) < '$<' > '$@' $(CHARSET_CLASSES_MAP_AWK)
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map \
|
||||
$(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(TOOL_HASHER) -i Aliases < '$<' > '$@'
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
|
||||
$(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(TOOL_HASHER) -i Classes < '$<' > '$@'
|
||||
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet: $(CHARSET_STANDARD_GENSRC_DIR)/classes-map \
|
||||
$(BUILD_TOOLS_JDK) | $(CHARSET_STANDARD_GENSRC_DIR)
|
||||
$(TOOL_HASHER) -i -e Cache -t Charset < '$<' > '$@'
|
||||
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
|
||||
SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/$(CHARSET_STANDARD_JAVA).template, \
|
||||
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
|
||||
INCLUDES := \
|
||||
_INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
|
||||
_INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
|
||||
_INCLUDE_CLASSES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet ; \
|
||||
_INCLUDE_CACHE_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet ; , \
|
||||
))
|
||||
|
||||
# Processing of template depends on the snippets being generated first
|
||||
$(BUILD_CHARSET_STANDARD): \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/classes-map.java.snippet \
|
||||
$(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet
|
||||
|
||||
GENSRC_JAVA_BASE += $(BUILD_CHARSET_STANDARD)
|
||||
|
||||
@ -31,6 +31,12 @@ $(eval $(call SetupLauncher,jar, \
|
||||
$(eval $(call SetupLauncher,jarsigner, \
|
||||
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
|
||||
|
||||
ifndef BUILD_HEADLESS_ONLY
|
||||
$(eval $(call SetupLauncher,policytool, \
|
||||
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
|
||||
$(XLIBS)))
|
||||
endif
|
||||
|
||||
$(eval $(call SetupLauncher,jdeps, \
|
||||
-DEXPAND_CLASSPATH_WILDCARDS \
|
||||
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
|
||||
|
||||
@ -25,12 +25,6 @@
|
||||
|
||||
include LauncherCommon.gmk
|
||||
|
||||
ifndef BUILD_HEADLESS_ONLY
|
||||
$(eval $(call SetupLauncher,policytool, \
|
||||
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
|
||||
$(XLIBS)))
|
||||
endif
|
||||
|
||||
$(eval $(call SetupLauncher,pack200, \
|
||||
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }'))
|
||||
|
||||
|
||||
@ -515,6 +515,77 @@ TARGETS += $(BUILD_LIBJAVAJPEG)
|
||||
|
||||
################################################################################
|
||||
|
||||
ifeq ($(BUILD_HEADLESS), true)
|
||||
# Mac and Windows only use the native AWT lib, do not build libawt_headless
|
||||
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
|
||||
|
||||
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
|
||||
$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
|
||||
$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
|
||||
#
|
||||
|
||||
LIBAWT_HEADLESS_EXCLUDES := medialib
|
||||
LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
|
||||
$(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
|
||||
$(LIBJAVA_HEADER_FLAGS) \
|
||||
#
|
||||
|
||||
LIBAWT_HEADLESS_REORDER :=
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
|
||||
LIBRARY := awt_headless, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(LIBAWT_HEADLESS_DIRS), \
|
||||
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
-DHEADLESS=true \
|
||||
-DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
|
||||
$(CUPS_CFLAGS) \
|
||||
$(X_CFLAGS) \
|
||||
$(LIBAWT_HEADLESS_CFLAGS), \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
|
||||
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
|
||||
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
|
||||
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
|
||||
REORDER := $(LIBAWT_HEADLESS_REORDER), \
|
||||
LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
|
||||
LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
|
||||
LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
|
||||
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
|
||||
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
|
||||
|
||||
TARGETS += $(BUILD_LIBAWT_HEADLESS)
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
|
||||
LIBFONTMANAGER_CFLAGS := \
|
||||
@ -562,10 +633,6 @@ ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
|
||||
endif
|
||||
|
||||
# Libfontmanager doesn't actually need X_LIBS to link, but if building
|
||||
# on a Solaris machine without X installed, using a devkit, linking
|
||||
# to libawt_xawt will fail without the -L parameters from X_LIBS. Filter
|
||||
# out the -R parameters since they aren't needed.
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
|
||||
LIBRARY := fontmanager, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
@ -583,9 +650,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
|
||||
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
|
||||
LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
|
||||
LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
|
||||
LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
|
||||
-lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
|
||||
LDFLAGS_SUFFIX_aix := -lawt -lawt_xawt $(LIBM) $(LIBCXX) -ljava -ljvm,\
|
||||
LDFLAGS_SUFFIX_solaris := -lawt -lawt_headless -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
|
||||
LDFLAGS_SUFFIX_aix := -lawt -lawt_headless $(LIBM) $(LIBCXX) -ljava -ljvm,\
|
||||
LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
|
||||
-ljava -ljvm, \
|
||||
LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
|
||||
@ -601,7 +667,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
|
||||
|
||||
ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
|
||||
endif
|
||||
|
||||
TARGETS += $(BUILD_LIBFONTMANAGER)
|
||||
@ -723,77 +789,6 @@ TARGETS += $(BUILD_LIBJAWT)
|
||||
|
||||
################################################################################
|
||||
|
||||
ifeq ($(BUILD_HEADLESS), true)
|
||||
# Mac and Windows only use the native AWT lib, do not build libawt_headless
|
||||
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
|
||||
|
||||
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
|
||||
$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
|
||||
$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
|
||||
$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
|
||||
#
|
||||
|
||||
LIBAWT_HEADLESS_EXCLUDES := medialib
|
||||
LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
|
||||
$(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
|
||||
-I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
|
||||
$(LIBJAVA_HEADER_FLAGS) \
|
||||
#
|
||||
|
||||
LIBAWT_HEADLESS_REORDER :=
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
|
||||
LIBRARY := awt_headless, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(LIBAWT_HEADLESS_DIRS), \
|
||||
EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
-DHEADLESS=true \
|
||||
-DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
|
||||
$(CUPS_CFLAGS) \
|
||||
$(X_CFLAGS) \
|
||||
$(LIBAWT_HEADLESS_CFLAGS), \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
|
||||
LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
|
||||
LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
|
||||
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
|
||||
REORDER := $(LIBAWT_HEADLESS_REORDER), \
|
||||
LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
|
||||
LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
|
||||
LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
|
||||
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
|
||||
|
||||
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
|
||||
|
||||
TARGETS += $(BUILD_LIBAWT_HEADLESS)
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifndef BUILD_HEADLESS_ONLY
|
||||
|
||||
LIBSPLASHSCREEN_DIRS := \
|
||||
|
||||
@ -271,6 +271,11 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
# Staticically link with c runtime on windows.
|
||||
LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
|
||||
LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
|
||||
# Supply the name of the C runtime lib.
|
||||
LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
|
||||
ifneq ($(MSVCP_DLL), )
|
||||
LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
|
||||
endif
|
||||
else
|
||||
LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
|
||||
endif
|
||||
|
||||
@ -59,37 +59,3 @@ $(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
|
||||
TARGETS += $(BUILD_LIBUNPACK)
|
||||
|
||||
################################################################################
|
||||
|
||||
LIBJSDT_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libjsdt \
|
||||
$(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_TYPE)/native/libjsdt
|
||||
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
|
||||
LIBRARY := jsdt, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(LIBJSDT_SRC), \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := LOW, \
|
||||
CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
|
||||
$(addprefix -I, $(LIBJSDT_SRC)) \
|
||||
$(LIBJAVA_HEADER_FLAGS) \
|
||||
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.runtime, \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_SUFFIX_linux := $(LIBDL), \
|
||||
LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL), \
|
||||
LDFLAGS_SUFFIX_macosx := $(LIBDL), \
|
||||
LDFLAGS_SUFFIX_solaris := -lc, \
|
||||
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=jsdt.dll" \
|
||||
-D "JDK_INTERNAL_NAME=jsdt" \
|
||||
-D "JDK_FTYPE=0x2L", \
|
||||
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsdt, \
|
||||
DEBUG_SYMBOLS := true))
|
||||
|
||||
$(BUILD_LIBJSDT): $(call FindLib, java.base, java)
|
||||
|
||||
TARGETS += $(BUILD_LIBJSDT)
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,25 +23,20 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tracing.dtrace;
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
* An annotation used to specify the {@code module} field for a DTrace probe.
|
||||
*
|
||||
* This annotation can be added to a method in a user-defined Provider
|
||||
* specification interface to set the {@code module} field that will be used
|
||||
* for the generated DTrace probe associated with that method.
|
||||
* <p>
|
||||
* @since 1.7
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface ModuleName {
|
||||
String value();
|
||||
class Charset {
|
||||
String pkgName;
|
||||
String clzName;
|
||||
String csName;
|
||||
String hisName;
|
||||
String type;
|
||||
boolean isASCII;
|
||||
int b1Min;
|
||||
int b1Max;
|
||||
int b2Min;
|
||||
int b2Max;
|
||||
String[] aliases;
|
||||
boolean isGenSrc = false;
|
||||
boolean isInternal = false;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,71 +24,32 @@
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.regex.Pattern;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class DBCS {
|
||||
// pattern used by this class to read in mapping table
|
||||
static Pattern mPattern = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.startsWith("#") || line.length() == 0)
|
||||
continue;
|
||||
String[] fields = line.split("\\s+");
|
||||
if (fields.length < 10) {
|
||||
System.err.println("Misconfiged sbcs line <" + line + ">?");
|
||||
continue;
|
||||
}
|
||||
String clzName = fields[0];
|
||||
String csName = fields[1];
|
||||
String hisName = ("null".equals(fields[2]))?null:fields[2];
|
||||
String type = fields[3].toUpperCase();
|
||||
if ("BASIC".equals(type))
|
||||
type = "";
|
||||
else
|
||||
type = "_" + type;
|
||||
String pkgName = fields[4];
|
||||
boolean isASCII = Boolean.valueOf(fields[5]);
|
||||
int b1Min = toInteger(fields[6]);
|
||||
int b1Max = toInteger(fields[7]);
|
||||
int b2Min = toInteger(fields[8]);
|
||||
int b2Max = toInteger(fields[9]);
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
genClass0(args[0], args[1], "DoubleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName,
|
||||
isASCII, type,
|
||||
b1Min, b1Max, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
|
||||
static int toInteger(String s) {
|
||||
if (s.startsWith("0x") || s.startsWith("0X"))
|
||||
return Integer.valueOf(s.substring(2), 16);
|
||||
else
|
||||
return Integer.valueOf(s);
|
||||
}
|
||||
|
||||
private static void genClass0(String srcDir, String dstDir, String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII,
|
||||
String type,
|
||||
int b1Min, int b1Max,
|
||||
int b2Min, int b2Max)
|
||||
public static void genClass(String type, Charset cs,
|
||||
String srcDir, String dstDir, String template)
|
||||
throws Exception
|
||||
{
|
||||
String clzName = cs.clzName;
|
||||
String csName = cs.csName;
|
||||
String hisName = cs.hisName;
|
||||
String pkgName = cs.pkgName;
|
||||
boolean isASCII = cs.isASCII;
|
||||
int b1Min = cs.b1Min;
|
||||
int b1Max = cs.b1Max;
|
||||
int b2Min = cs.b2Min;
|
||||
int b2Max = cs.b2Max;
|
||||
|
||||
StringBuilder b2cSB = new StringBuilder();
|
||||
StringBuilder b2cNRSB = new StringBuilder();
|
||||
|
||||
@ -42,38 +42,51 @@ public class HKSCS {
|
||||
private static Pattern hkscs =
|
||||
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
|
||||
|
||||
static void genClass(String args[]) throws Exception {
|
||||
|
||||
static void genClass2008(String srcDir, String dstDir, String pkgName)
|
||||
throws Exception
|
||||
{
|
||||
// hkscs2008
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2008.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2008.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCSMapping.java"),
|
||||
genClass0(new FileInputStream(new File(srcDir, "HKSCS2008.map")),
|
||||
new FileInputStream(new File(srcDir, "HKSCS2008.c2b")),
|
||||
new PrintStream(new File(dstDir, "HKSCSMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
pkgName,
|
||||
"HKSCSMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
true,
|
||||
"");
|
||||
}
|
||||
|
||||
|
||||
// xp2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS_XP.map")),
|
||||
static void genClassXP(String srcDir, String dstDir, String pkgName)
|
||||
throws Exception
|
||||
{
|
||||
genClass0(new FileInputStream(new File(srcDir, "HKSCS_XP.map")),
|
||||
null,
|
||||
new PrintStream(new File(args[1], "HKSCS_XPMapping.java"),
|
||||
new PrintStream(new File(dstDir, "HKSCS_XPMapping.java"),
|
||||
"ISO-8859-1"),
|
||||
pkgName,
|
||||
"HKSCS_XPMapping",
|
||||
getCopyright(new File(args[3])));
|
||||
false,
|
||||
"");
|
||||
}
|
||||
|
||||
static void genClass2001(String args[]) throws Exception {
|
||||
// hkscs2001
|
||||
genClass0(new FileInputStream(new File(args[0], "HKSCS2001.map")),
|
||||
new FileInputStream(new File(args[0], "HKSCS2001.c2b")),
|
||||
new PrintStream(new File(args[1], "HKSCS2001Mapping.java"),
|
||||
"ISO-8859-1"),
|
||||
"sun.nio.cs.ext",
|
||||
"HKSCS2001Mapping",
|
||||
false,
|
||||
getCopyright(new File(args[3])));
|
||||
}
|
||||
|
||||
static void genClass0(InputStream isB2C,
|
||||
InputStream isC2B,
|
||||
PrintStream ps,
|
||||
String pkgName,
|
||||
String clzName,
|
||||
boolean isPublic,
|
||||
String copyright)
|
||||
throws Exception
|
||||
{
|
||||
@ -132,8 +145,8 @@ public class HKSCS {
|
||||
|
||||
out.format(copyright);
|
||||
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
|
||||
out.format("package sun.nio.cs.ext;%n%n");
|
||||
out.format("class %s {%n%n", clzName);
|
||||
out.format("package %s;%n%n", pkgName);
|
||||
out.format("%sclass %s {%n%n", isPublic ? "public " : "", clzName);
|
||||
|
||||
/* hardcoded in sun.nio.cs.ext.HKSCS.java
|
||||
out.format(" final static int b1Min = 0x%x;%n", b1Min);
|
||||
@ -143,7 +156,8 @@ public class HKSCS {
|
||||
*/
|
||||
|
||||
// bmp tables
|
||||
out.format("%n static final String[] b2cBmpStr = new String[] {%n");
|
||||
out.format("%n %sstatic final String[] b2cBmpStr = new String[] {%n",
|
||||
isPublic ? "public " : "");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
if (b2cBmp[i])
|
||||
out.format(bmp, i, b2Min, b2Max, ",");
|
||||
@ -153,7 +167,8 @@ public class HKSCS {
|
||||
out.format(" };%n");
|
||||
|
||||
// supp tables
|
||||
out.format("%n static final String[] b2cSuppStr =");
|
||||
out.format("%n %sstatic final String[] b2cSuppStr =",
|
||||
isPublic ? "public " : "");
|
||||
if (hasSupp) {
|
||||
out.format(" new String[] {%n");
|
||||
for (int i = 0; i < 0x100; i++) {
|
||||
@ -168,7 +183,8 @@ public class HKSCS {
|
||||
}
|
||||
|
||||
// private area tables
|
||||
out.format("%n final static String pua =");
|
||||
out.format("%n %sfinal static String pua =",
|
||||
isPublic ? "public " : "");
|
||||
if (hasPua) {
|
||||
out.format("%n");
|
||||
out.format(pua, 0, pua.length, ";");
|
||||
|
||||
265
jdk/make/src/classes/build/tools/charsetmapping/Hasher.java
Normal file
265
jdk/make/src/classes/build/tools/charsetmapping/Hasher.java
Normal file
@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* Reads a map in the form of a sequence of key/value-expression pairs from the
|
||||
* standard input, attempts to construct a hash map that fits within the given
|
||||
* table-size and chain-depth constraints, and, if successful, writes source
|
||||
* code to the standard output for a subclass of sun.util.PreHashedMap that
|
||||
* implements the map.
|
||||
*
|
||||
* @see sun.util.PreHashedMap
|
||||
*
|
||||
* @author Mark Reinhold
|
||||
*/
|
||||
|
||||
public class Hasher {
|
||||
|
||||
private PrintStream err = System.err;
|
||||
|
||||
boolean verbose = false;
|
||||
List<String> keys = new ArrayList<>(); // Key strings
|
||||
List<String> values = new ArrayList<>(); // Value expressions
|
||||
String pkg = null; // Package prefix for generated class
|
||||
String cln = null; // Name of generated class
|
||||
String vtype = null; // Value type
|
||||
int maxBits = 11; // lg table size
|
||||
int maxDepth = 3; // Max chain depth
|
||||
boolean inner = false; // Generating an inner class?
|
||||
boolean empty = false; // Generating an empty table?
|
||||
|
||||
Object[] ht; // Hash table itself
|
||||
int nb; // Number of bits (lg table size)
|
||||
int md; // Maximum chain depth
|
||||
int mask; // Hash-code mask
|
||||
int shift; // Hash-code shift size
|
||||
|
||||
int hash(String w) {
|
||||
return (w.hashCode() >> shift) & mask;
|
||||
}
|
||||
|
||||
// Build a hash table of size 2^nb, shifting the hash code by s bits
|
||||
//
|
||||
void build(int nb, int s) {
|
||||
|
||||
this.nb = nb;
|
||||
this.shift = s;
|
||||
int n = 1 << nb;
|
||||
this.mask = n - 1;
|
||||
ht = new Object[n];
|
||||
int nw = keys.size();
|
||||
|
||||
for (int i = 0; i < nw; i++) {
|
||||
String w = keys.get(i);
|
||||
String v = values.get(i);
|
||||
int h = hash(w);
|
||||
if (ht[h] == null)
|
||||
ht[h] = new Object[] { w, v };
|
||||
else
|
||||
ht[h] = new Object[] { w, v, ht[h] };
|
||||
}
|
||||
|
||||
this.md = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int d = 1;
|
||||
for (Object[] a = (Object[])ht[i];
|
||||
a != null && a.length > 2;
|
||||
a = (Object[])a[2], d++);
|
||||
this.md = Math.max(md, d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Hasher build() {
|
||||
// Iterate through acceptable table sizes
|
||||
for (int nb = 2; nb < maxBits; nb++) {
|
||||
// Iterate through possible shift sizes
|
||||
for (int s = 0; s < (32 - nb); s++) {
|
||||
build(nb, s);
|
||||
if (verbose)
|
||||
err.println("nb=" + nb + " s=" + s + " md=" + md);
|
||||
if (md <= maxDepth) {
|
||||
// Success
|
||||
if (verbose) {
|
||||
if (cln != null)
|
||||
err.print(cln + ": ");
|
||||
err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
|
||||
+ ", shift " + shift
|
||||
+ ", max chain depth " + md);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Cannot find a suitable size"
|
||||
+ " within given constraints");
|
||||
}
|
||||
|
||||
// Look for the given key in the hash table
|
||||
//
|
||||
String get(String k) {
|
||||
int h = hash(k);
|
||||
Object[] a = (Object[])ht[h];
|
||||
for (;;) {
|
||||
if (a[0].equals(k))
|
||||
return (String)a[1];
|
||||
if (a.length < 3)
|
||||
return null;
|
||||
a = (Object[])a[2];
|
||||
}
|
||||
}
|
||||
|
||||
// Test that all input keys can be found in the table
|
||||
//
|
||||
Hasher test() {
|
||||
if (verbose)
|
||||
err.println();
|
||||
for (int i = 0, n = keys.size(); i < n; i++) {
|
||||
String w = keys.get(i);
|
||||
String v = get(w);
|
||||
if (verbose)
|
||||
err.println(hash(w) + "\t" + w);
|
||||
if (!v.equals(values.get(i)))
|
||||
throw new Error("Incorrect value: " + w + " --> "
|
||||
+ v + ", should be " + values.get(i));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
String ind = ""; // Indent prefix
|
||||
|
||||
// Generate code for a single table entry
|
||||
//
|
||||
void genEntry(Object[] a, int depth, PrintStream out) {
|
||||
Object v = empty ? null : a[1];
|
||||
out.print("new Object[] { \"" + a[0] + "\", " + v);
|
||||
if (a.length < 3) {
|
||||
out.print(" }");
|
||||
return;
|
||||
}
|
||||
out.println(",");
|
||||
out.print(ind + " ");
|
||||
for (int i = 0; i < depth; i++)
|
||||
out.print(" ");
|
||||
genEntry((Object[])a[2], depth + 1, out);
|
||||
out.print(" }");
|
||||
}
|
||||
|
||||
// Generate a PreHashedMap subclass from the computed hash table
|
||||
//
|
||||
Hasher generate(PrintStream out) throws IOException {
|
||||
if (cln == null)
|
||||
return this;
|
||||
|
||||
if (inner)
|
||||
ind = " ";
|
||||
|
||||
if (!inner && pkg != null) {
|
||||
out.println();
|
||||
out.println("package " + pkg + ";");
|
||||
out.println();
|
||||
}
|
||||
|
||||
if (inner) {
|
||||
out.println(ind + "private static final class " + cln);
|
||||
} else {
|
||||
out.println();
|
||||
out.println("public final class " + cln);
|
||||
}
|
||||
out.println(ind + " extends sun.util.PreHashedMap<" + vtype +">");
|
||||
out.println(ind + "{");
|
||||
|
||||
out.println();
|
||||
out.println(ind + " private static final int ROWS = "
|
||||
+ ht.length + ";");
|
||||
out.println(ind + " private static final int SIZE = "
|
||||
+ keys.size() + ";");
|
||||
out.println(ind + " private static final int SHIFT = "
|
||||
+ shift + ";");
|
||||
out.println(ind + " private static final int MASK = 0x"
|
||||
+ Integer.toHexString(mask) + ";");
|
||||
out.println();
|
||||
|
||||
out.println(ind + " " + (inner ? "private " : "public ")
|
||||
+ cln + "() {");
|
||||
out.println(ind + " super(ROWS, SIZE, SHIFT, MASK);");
|
||||
out.println(ind + " }");
|
||||
out.println();
|
||||
|
||||
out.println(ind + " protected void init(Object[] ht) {");
|
||||
for (int i = 0; i < ht.length; i++) {
|
||||
if (ht[i] == null)
|
||||
continue;
|
||||
Object[] a = (Object[])ht[i];
|
||||
out.print(ind + " ht[" + i + "] = ");
|
||||
genEntry(a, 0, out);
|
||||
out.println(";");
|
||||
}
|
||||
out.println(ind + " }");
|
||||
out.println();
|
||||
|
||||
out.println(ind + "}");
|
||||
if (inner)
|
||||
out.println();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private Hasher(List<String> keys, List<String> values,
|
||||
String pkg, String cln, String vtype,
|
||||
int maxBits, int maxDepth,
|
||||
boolean inner, boolean empty,
|
||||
boolean verbose) {
|
||||
this.keys = keys;
|
||||
this.values = values;
|
||||
this.pkg = pkg;
|
||||
this.cln = cln;
|
||||
this.vtype = vtype;
|
||||
this.maxBits = maxBits;
|
||||
this.maxDepth = maxDepth;
|
||||
this.inner = inner;
|
||||
this.empty = empty;
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
public static void genClass(PrintStream out,
|
||||
List<String> keys, List<String> values,
|
||||
String pkg, String cln, String vtype,
|
||||
int maxBits, int maxDepth,
|
||||
boolean inner, boolean empty, boolean verbose)
|
||||
throws IOException {
|
||||
new Hasher(keys, values, pkg, cln, vtype,
|
||||
maxBits, maxDepth, inner, empty, verbose)
|
||||
.build()
|
||||
.test()
|
||||
.generate(out);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,25 +26,193 @@
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
public static void main(String args[]) throws Throwable {
|
||||
int SRC_DIR = 0;
|
||||
int DST_DIR = 1;
|
||||
int TYPE = 2;
|
||||
int CHARSETS = 3;
|
||||
int OS = 4;
|
||||
int TEMPLATE = 5;
|
||||
int EXT_SRC = 6;
|
||||
|
||||
if (args.length < 3 ) {
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst mType [copyrightSrc]");
|
||||
System.out.println("Usage: java -jar charsetmapping.jar src dst spiType charsets os [template]");
|
||||
System.exit(1);
|
||||
}
|
||||
if ("sbcs".equals(args[2]) || "extsbcs".equals(args[2])) {
|
||||
SBCS.genClass(args);
|
||||
} else if ("dbcs".equals(args[2])) {
|
||||
DBCS.genClass(args);
|
||||
} else if ("euctw".equals(args[2])) {
|
||||
boolean isStandard = "stdcs".equals(args[TYPE]);
|
||||
boolean isExtended = "extcs".equals(args[TYPE]);
|
||||
if (isStandard || isExtended) {
|
||||
LinkedHashMap<String, Charset> charsets = getCharsets(
|
||||
new File(args[SRC_DIR], args[CHARSETS]));
|
||||
String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
|
||||
boolean hasBig5_HKSCS = false;
|
||||
boolean hasMS950_HKSCS_XP = false;
|
||||
for (String name : osStdcs) {
|
||||
Charset cs = charsets.get(name);
|
||||
if (cs != null) {
|
||||
cs.pkgName = "sun.nio.cs";
|
||||
}
|
||||
if (name.equals("Big5_HKSCS")) {
|
||||
hasBig5_HKSCS = true;
|
||||
} else if (name.equals("MS950_HKSCS_XP")) {
|
||||
hasMS950_HKSCS_XP = true;
|
||||
}
|
||||
}
|
||||
for (Charset cs : charsets.values()) {
|
||||
if (isStandard && cs.pkgName.equals("sun.nio.cs.ext") ||
|
||||
isExtended && cs.pkgName.equals("sun.nio.cs")) {
|
||||
continue;
|
||||
}
|
||||
verbose(cs);
|
||||
switch (cs.type) {
|
||||
case "template":
|
||||
SRC.genClass(cs, args[EXT_SRC], args[DST_DIR]);
|
||||
break;
|
||||
case "sbcs":
|
||||
SBCS.genClass(cs, args[SRC_DIR], args[DST_DIR],
|
||||
"SingleByte-X.java.template");
|
||||
break;
|
||||
case "source":
|
||||
break; // source file, do nothing
|
||||
default: // dbcs
|
||||
DBCS.genClass("dbcs".equals(cs.type) ?
|
||||
"" : "_" + cs.type.toUpperCase(Locale.ENGLISH),
|
||||
cs, args[SRC_DIR], args[DST_DIR],
|
||||
"DoubleByte-X.java.template");
|
||||
}
|
||||
}
|
||||
// provider StandardCharsets.java / ExtendedCharsets.java
|
||||
SPI.genClass(args[TYPE], charsets, args[SRC_DIR], args[DST_DIR], args[TEMPLATE]);
|
||||
|
||||
// HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
|
||||
if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
|
||||
HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
|
||||
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
|
||||
}
|
||||
if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
|
||||
HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
|
||||
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
|
||||
}
|
||||
} else if ("euctw".equals(args[TYPE])) {
|
||||
EUC_TW.genClass(args);
|
||||
} else if ("sjis0213".equals(args[2])) {
|
||||
} else if ("sjis0213".equals(args[TYPE])) {
|
||||
JIS0213.genClass(args);
|
||||
} else if ("hkscs".equals(args[2])) {
|
||||
HKSCS.genClass(args);
|
||||
} else if ("hkscs".equals(args[TYPE])) {
|
||||
HKSCS.genClass2001(args);
|
||||
}
|
||||
}
|
||||
|
||||
private static LinkedHashMap<String, Charset> getCharsets(File cslist)
|
||||
throws Throwable
|
||||
{
|
||||
LinkedHashMap<String, Charset> charsets = new LinkedHashMap<>();
|
||||
try (Scanner s = new Scanner(cslist)) {
|
||||
Charset cs = null;
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.startsWith("#") || line.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
String[] tokens = line.split("\\s+");
|
||||
if (tokens.length < 2) {
|
||||
continue;
|
||||
}
|
||||
if ("charset".equals(tokens[0])) {
|
||||
if (cs != null) {
|
||||
cs.aliases = names.toArray(new String[names.size()]);
|
||||
charsets.put(cs.clzName, cs);
|
||||
cs = null;
|
||||
names.clear();
|
||||
}
|
||||
if (tokens.length < 3) {
|
||||
throw new RuntimeException("Error: incorrect charset line [" + line + "]");
|
||||
}
|
||||
if ((cs = charsets.get(tokens[2])) != null) {
|
||||
throw new RuntimeException("Error: deplicate charset line [" + line + "]");
|
||||
}
|
||||
cs = new Charset();
|
||||
cs.csName = tokens[1];
|
||||
cs.clzName = tokens[2];
|
||||
} else {
|
||||
String key = tokens[1]; // leading empty str
|
||||
switch (key) {
|
||||
case "alias":
|
||||
if (tokens.length < 3) {
|
||||
throw new RuntimeException("Error: incorrect alias line [" + line + "]");
|
||||
} else if (names != null) {
|
||||
names.add(tokens[2]); // ALIAS_NAME
|
||||
}
|
||||
break;
|
||||
case "package":
|
||||
cs.pkgName = tokens[2];
|
||||
break;
|
||||
case "type":
|
||||
cs.type = tokens[2];
|
||||
break;
|
||||
case "hisname":
|
||||
cs.hisName = tokens[2];
|
||||
break;
|
||||
case "ascii":
|
||||
cs.isASCII = Boolean.parseBoolean(tokens[2]);
|
||||
break;
|
||||
case "minmax":
|
||||
cs.b1Min = toInteger(tokens[2]);
|
||||
cs.b1Max = toInteger(tokens[3]);
|
||||
cs.b2Min = toInteger(tokens[4]);
|
||||
cs.b2Max = toInteger(tokens[5]);
|
||||
break;
|
||||
case "internal":
|
||||
cs.isInternal = Boolean.parseBoolean(tokens[2]);
|
||||
break;
|
||||
default: // ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cs != null) {
|
||||
cs.aliases = names.toArray(new String[names.size()]);
|
||||
charsets.put(cs.clzName, cs);
|
||||
}
|
||||
}
|
||||
return charsets;
|
||||
}
|
||||
|
||||
private static String[] getOSStdCSList(File stdcsos) throws Throwable
|
||||
{
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
if (stdcsos.exists()) {
|
||||
try (Scanner s = new Scanner(stdcsos)) {
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
int i = line.indexOf('#');
|
||||
if (i != -1) {
|
||||
line = line.substring(0, i);
|
||||
}
|
||||
line = line.trim();
|
||||
if (line.length() != 0) {
|
||||
names.add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return names.toArray(new String[names.size()]);
|
||||
}
|
||||
|
||||
static void verbose(Charset cs) {
|
||||
System.out.printf("%s, %s, %s, %s, %s %b%n",
|
||||
cs.clzName, cs.csName, cs.hisName, cs.pkgName, cs.type, cs.isASCII);
|
||||
}
|
||||
|
||||
static int toInteger(String s) {
|
||||
return (s.startsWith("0x") || s.startsWith("0X"))
|
||||
? Integer.valueOf(s.substring(2), 16)
|
||||
: Integer.valueOf(s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,93 +30,23 @@ import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
import java.util.Formatter;
|
||||
import java.util.regex.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.regex.Pattern;
|
||||
import static build.tools.charsetmapping.Utils.*;
|
||||
|
||||
public class SBCS {
|
||||
|
||||
public static void genClass(String args[]) throws Exception {
|
||||
|
||||
Scanner s = new Scanner(new File(args[0], args[2]));
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.startsWith("#") || line.length() == 0)
|
||||
continue;
|
||||
String[] fields = line.split("\\s+");
|
||||
if (fields.length < 5) {
|
||||
System.err.println("Misconfiged sbcs line <" + line + ">?");
|
||||
continue;
|
||||
}
|
||||
String clzName = fields[0];
|
||||
String csName = fields[1];
|
||||
String hisName = fields[2];
|
||||
boolean isASCII = Boolean.valueOf(fields[3]);
|
||||
String pkgName = fields[4];
|
||||
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
|
||||
|
||||
genClass0(args[0], args[1], "SingleByte-X.java.template",
|
||||
clzName, csName, hisName, pkgName, isASCII);
|
||||
}
|
||||
}
|
||||
|
||||
private static void toString(char[] sb, int off, int end,
|
||||
Formatter out, String closure,
|
||||
boolean comment) {
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
char c = sb[off++];
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format("\\u%04X", c & 0xffff);
|
||||
}
|
||||
}
|
||||
if (comment) {
|
||||
if (off == end)
|
||||
out.format("\" %s // 0x%02x - 0x%02x%n",
|
||||
closure, off-8, off-1);
|
||||
else
|
||||
out.format("\" + // 0x%02x - 0x%02x%n",
|
||||
off-8, off-1);
|
||||
} else {
|
||||
if (off == end)
|
||||
out.format("\"%s%n", closure);
|
||||
else
|
||||
out.format("\" +%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++(?:U\\+|0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
|
||||
private static void genClass0(String srcDir, String dstDir,
|
||||
String template,
|
||||
String clzName,
|
||||
String csName,
|
||||
String hisName,
|
||||
String pkgName,
|
||||
boolean isASCII)
|
||||
public static void genClass(Charset cs,
|
||||
String srcDir, String dstDir, String template)
|
||||
throws Exception
|
||||
{
|
||||
String clzName = cs.clzName;
|
||||
String csName = cs.csName;
|
||||
String hisName = cs.hisName;
|
||||
String pkgName = cs.pkgName;
|
||||
boolean isASCII = cs.isASCII;
|
||||
|
||||
StringBuilder b2cSB = new StringBuilder();
|
||||
StringBuilder b2cNRSB = new StringBuilder();
|
||||
StringBuilder c2bNRSB = new StringBuilder();
|
||||
@ -266,4 +196,50 @@ public class SBCS {
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
private static void toString(char[] sb, int off, int end,
|
||||
Formatter out, String closure, boolean comment)
|
||||
{
|
||||
while (off < end) {
|
||||
out.format(" \"");
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (off == end)
|
||||
break;
|
||||
char c = sb[off++];
|
||||
switch (c) {
|
||||
case '\b':
|
||||
out.format("\\b"); break;
|
||||
case '\t':
|
||||
out.format("\\t"); break;
|
||||
case '\n':
|
||||
out.format("\\n"); break;
|
||||
case '\f':
|
||||
out.format("\\f"); break;
|
||||
case '\r':
|
||||
out.format("\\r"); break;
|
||||
case '\"':
|
||||
out.format("\\\""); break;
|
||||
case '\'':
|
||||
out.format("\\'"); break;
|
||||
case '\\':
|
||||
out.format("\\\\"); break;
|
||||
default:
|
||||
out.format("\\u%04X", c & 0xffff);
|
||||
}
|
||||
}
|
||||
if (comment) {
|
||||
if (off == end)
|
||||
out.format("\" %s // 0x%02x - 0x%02x%n",
|
||||
closure, off-8, off-1);
|
||||
else
|
||||
out.format("\" + // 0x%02x - 0x%02x%n",
|
||||
off-8, off-1);
|
||||
} else {
|
||||
if (off == end)
|
||||
out.format("\"%s%n", closure);
|
||||
else
|
||||
out.format("\" +%n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
141
jdk/make/src/classes/build/tools/charsetmapping/SPI.java
Normal file
141
jdk/make/src/classes/build/tools/charsetmapping/SPI.java
Normal file
@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Locale;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SPI {
|
||||
|
||||
public static void genClass(String type, LinkedHashMap<String, Charset> charsets,
|
||||
String srcDir, String dstDir, String template)
|
||||
throws Exception
|
||||
{
|
||||
try (Scanner s = new Scanner(new File(template));
|
||||
PrintStream out = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, new File(
|
||||
template.replace(".template", "")).getName()))); ) {
|
||||
if (type.startsWith("extcs")) { // ExtendedCharsets.java
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("_CHARSETS_DEF_LIST_") == -1) {
|
||||
out.println(line);
|
||||
} else {
|
||||
charsets.values()
|
||||
.stream()
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") &&
|
||||
!cs.isInternal)
|
||||
.forEach( cs -> {
|
||||
out.printf(" charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName);
|
||||
out.printf(" new String[] {%n");
|
||||
for (String alias : cs.aliases) {
|
||||
out.printf(" \"%s\",%n", alias);
|
||||
}
|
||||
out.printf(" });%n%n");
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (type.startsWith("stdcs")) { // StandardCharsets.java
|
||||
ArrayList<String> aliasKeys = new ArrayList<>();
|
||||
ArrayList<String> aliasValues = new ArrayList<>();
|
||||
ArrayList<String> clzKeys = new ArrayList<>();
|
||||
ArrayList<String> clzValues = new ArrayList<>();
|
||||
charsets.values()
|
||||
.stream()
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs") &&
|
||||
!cs.isInternal)
|
||||
.forEach( cs -> {
|
||||
String csname = cs.csName.toLowerCase(Locale.ENGLISH);
|
||||
clzKeys.add(csname);
|
||||
clzValues.add("\"" + cs.clzName + "\"");
|
||||
if (cs.aliases != null) {
|
||||
csname = "\"" + csname + "\"";
|
||||
for (String alias : cs.aliases) {
|
||||
aliasKeys.add(alias.toLowerCase(Locale.ENGLISH));
|
||||
aliasValues.add(csname);
|
||||
}
|
||||
}
|
||||
});
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("_INCLUDE_ALIASES_TABLES_") != -1) {
|
||||
charsets.values()
|
||||
.stream()
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs"))
|
||||
.forEach( cs -> {
|
||||
if (cs.aliases == null || cs.aliases.length == 0) {
|
||||
out.printf(" static final String[] aliases_%s = null;%n%n",
|
||||
cs.clzName);
|
||||
} else {
|
||||
// non-final for SJIS and MS932 to support sun.nio.cs.map
|
||||
if (cs.clzName.equals("SJIS") || cs.clzName.equals("MS932")) {
|
||||
out.printf(" static String[] aliases_%s = new String[] {%n",
|
||||
cs.clzName);
|
||||
} else {
|
||||
out.printf(" static final String[] aliases_%s = new String[] {%n",
|
||||
cs.clzName);
|
||||
}
|
||||
for (String alias : cs.aliases) {
|
||||
out.printf(" \"%s\",%n", alias);
|
||||
}
|
||||
out.printf(" };%n%n");
|
||||
}
|
||||
});
|
||||
Charset cs = charsets.get("SJIS");
|
||||
if (cs == null || cs.pkgName.equals("sun.nio.cs.ext")) {
|
||||
// StandardCharsets.java has explicit reference
|
||||
// to aliases_SJIS/MS932. If we don't have these
|
||||
// two in std, just put a pair of dummy fields to
|
||||
// make the compiler happy.
|
||||
out.printf(" static String[] aliases_SJIS = null;%n%n");
|
||||
out.printf(" static String[] aliases_MS932 = null;%n%n");
|
||||
}
|
||||
} else if (line.indexOf("_INCLUDE_ALIASES_MAP_") != -1) {
|
||||
Hasher.genClass(out, aliasKeys, aliasValues,
|
||||
null, "Aliases", "String",
|
||||
11, 3, true, false, false);
|
||||
} else if (line.indexOf("_INCLUDE_CLASSES_MAP_") != -1) {
|
||||
Hasher.genClass(out, clzKeys, clzValues,
|
||||
null, "Classes", "String",
|
||||
11, 3, true, false, false);
|
||||
} else if (line.indexOf("_INCLUDE_CACHE_MAP_") != -1) {
|
||||
Hasher.genClass(out, clzKeys, clzValues,
|
||||
null, "Cache", "Charset",
|
||||
11, 3, true, true, false);
|
||||
} else {
|
||||
out.println(line);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Unknown type:" + type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
64
jdk/make/src/classes/build/tools/charsetmapping/SRC.java
Normal file
64
jdk/make/src/classes/build/tools/charsetmapping/SRC.java
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package build.tools.charsetmapping;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SRC {
|
||||
|
||||
public static void genClass(Charset cs, String srcDir, String dstDir)
|
||||
throws Exception
|
||||
{
|
||||
String clzName = cs.clzName;
|
||||
String csName = cs.csName;
|
||||
String pkgName = cs.pkgName;
|
||||
|
||||
try (Scanner s = new Scanner(new File(srcDir, clzName + ".java.template"));
|
||||
PrintStream out = new PrintStream(new FileOutputStream(
|
||||
new File(dstDir, clzName + ".java")));) {
|
||||
while (s.hasNextLine()) {
|
||||
String line = s.nextLine();
|
||||
if (line.indexOf("$") < 0) {
|
||||
out.println(line);
|
||||
continue;
|
||||
}
|
||||
if (line.indexOf("$PACKAGE$") != -1) {
|
||||
out.println(line.replace("$PACKAGE$", pkgName));
|
||||
} else if (line.indexOf("$ALIASES$") != -1) {
|
||||
if ("sun.nio.cs".equals(pkgName))
|
||||
out.println(line.replace("$ALIASES$",
|
||||
"StandardCharsets.aliases_" + clzName));
|
||||
else
|
||||
out.println(line.replace("$ALIASES$",
|
||||
"ExtendedCharsets.aliasesFor(\"" + csName + "\")"));
|
||||
} else {
|
||||
out.println(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
java.base
|
||||
java.desktop
|
||||
java.compiler
|
||||
java.corba
|
||||
java.datatransfer
|
||||
java.desktop
|
||||
java.instrument
|
||||
java.logging
|
||||
java.management
|
||||
@ -14,7 +14,6 @@ java.security.sasl
|
||||
java.smartcardio
|
||||
java.sql
|
||||
java.sql.rowset
|
||||
java.transaction
|
||||
java.xml
|
||||
java.xml.crypto
|
||||
jdk.charsets
|
||||
@ -22,9 +21,9 @@ jdk.deploy
|
||||
jdk.deploy.osx
|
||||
jdk.hprof.agent
|
||||
jdk.httpserver
|
||||
jdk.jfr
|
||||
jdk.naming.rmi
|
||||
jdk.sctp
|
||||
jdk.security.auth
|
||||
jdk.security.jgss
|
||||
jdk.jfr
|
||||
jdk.snmp
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
java.activation
|
||||
java.annotations.common
|
||||
java.corba
|
||||
java.transaction
|
||||
java.xml.bind
|
||||
java.xml.ws
|
||||
jdk.accessbridge
|
||||
jdk.crypto.ec
|
||||
jdk.crypto.mscapi
|
||||
jdk.crypto.pkcs11
|
||||
@ -10,4 +13,3 @@ jdk.localedata
|
||||
jdk.naming.dns
|
||||
jdk.scripting.nashorn
|
||||
jdk.zipfs
|
||||
jdk.accessbridge
|
||||
|
||||
@ -31,7 +31,6 @@ import java.util.Arrays;
|
||||
import sun.invoke.util.VerifyAccess;
|
||||
import static java.lang.invoke.MethodHandleNatives.Constants.*;
|
||||
import static java.lang.invoke.LambdaForm.*;
|
||||
import static java.lang.invoke.LambdaForm.BasicType.*;
|
||||
import static java.lang.invoke.MethodTypeForm.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.*;
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -693,4 +692,10 @@ class DirectMethodHandle extends MethodHandle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void customize() {
|
||||
assert(form.customized == null);
|
||||
// No need to customize DMHs.
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,6 +285,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
// Forward the SAM method
|
||||
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, samMethodName,
|
||||
samMethodType.toMethodDescriptorString(), null, null);
|
||||
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
|
||||
new ForwardingMethodGenerator(mv).generate(samMethodType);
|
||||
|
||||
// Forward the bridges
|
||||
@ -292,6 +293,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
for (MethodType mt : additionalBridges) {
|
||||
mv = cw.visitMethod(ACC_PUBLIC|ACC_BRIDGE, samMethodName,
|
||||
mt.toMethodDescriptorString(), null, null);
|
||||
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
|
||||
new ForwardingMethodGenerator(mv).generate(mt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,9 +56,11 @@ class InvokerBytecodeGenerator {
|
||||
private static final String OBJ = "java/lang/Object";
|
||||
private static final String OBJARY = "[Ljava/lang/Object;";
|
||||
|
||||
private static final String MH_SIG = "L" + MH + ";";
|
||||
private static final String LF_SIG = "L" + LF + ";";
|
||||
private static final String LFN_SIG = "L" + LFN + ";";
|
||||
private static final String LL_SIG = "(L" + OBJ + ";)L" + OBJ + ";";
|
||||
private static final String LLV_SIG = "(L" + OBJ + ";L" + OBJ + ";)V";
|
||||
private static final String CLL_SIG = "(L" + CLS + ";L" + OBJ + ";)L" + OBJ + ";";
|
||||
|
||||
/** Name of its super class*/
|
||||
@ -616,6 +618,15 @@ class InvokerBytecodeGenerator {
|
||||
return g.loadMethod(g.generateCustomizedCodeBytes());
|
||||
}
|
||||
|
||||
/** Generates code to check that actual receiver and LambdaForm matches */
|
||||
private boolean checkActualReceiver() {
|
||||
// Expects MethodHandle on the stack and actual receiver MethodHandle in slot #0
|
||||
mv.visitInsn(Opcodes.DUP);
|
||||
mv.visitVarInsn(Opcodes.ALOAD, localsMap[0]);
|
||||
mv.visitMethodInsn(Opcodes.INVOKESTATIC, MHI, "assertSame", LLV_SIG, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an invoker method for the passed {@link LambdaForm}.
|
||||
*/
|
||||
@ -635,6 +646,16 @@ class InvokerBytecodeGenerator {
|
||||
mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
|
||||
}
|
||||
|
||||
if (lambdaForm.customized != null) {
|
||||
// Since LambdaForm is customized for a particular MethodHandle, it's safe to substitute
|
||||
// receiver MethodHandle (at slot #0) with an embedded constant and use it instead.
|
||||
// It enables more efficient code generation in some situations, since embedded constants
|
||||
// are compile-time constants for JIT compiler.
|
||||
mv.visitLdcInsn(constantPlaceholder(lambdaForm.customized));
|
||||
mv.visitTypeInsn(Opcodes.CHECKCAST, MH);
|
||||
assert(checkActualReceiver()); // expects MethodHandle on top of the stack
|
||||
mv.visitVarInsn(Opcodes.ASTORE, localsMap[0]);
|
||||
}
|
||||
|
||||
// iterate over the form's names, generating bytecode instructions for each
|
||||
// start iterating at the first name following the arguments
|
||||
|
||||
@ -247,6 +247,7 @@ class Invokers {
|
||||
int nameCursor = OUTARG_LIMIT;
|
||||
final int MTYPE_ARG = customized ? -1 : nameCursor++; // might be last in-argument
|
||||
final int CHECK_TYPE = nameCursor++;
|
||||
final int CHECK_CUSTOM = (CUSTOMIZE_THRESHOLD >= 0) ? nameCursor++ : -1;
|
||||
final int LINKER_CALL = nameCursor++;
|
||||
MethodType invokerFormType = mtype.invokerType();
|
||||
if (isLinker) {
|
||||
@ -279,6 +280,9 @@ class Invokers {
|
||||
// mh.invokeGeneric(a*):R => checkGenericType(mh, TYPEOF(a*:R)).invokeBasic(a*)
|
||||
outArgs[0] = names[CHECK_TYPE];
|
||||
}
|
||||
if (CHECK_CUSTOM != -1) {
|
||||
names[CHECK_CUSTOM] = new Name(NF_checkCustomized, names[CALL_MH]);
|
||||
}
|
||||
names[LINKER_CALL] = new Name(outCallType, outArgs);
|
||||
lform = new LambdaForm(debugName, INARG_LIMIT, names);
|
||||
if (isLinker)
|
||||
@ -386,11 +390,32 @@ class Invokers {
|
||||
return ((CallSite)site).getTarget();
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
@ForceInline
|
||||
void checkCustomized(Object o) {
|
||||
MethodHandle mh = (MethodHandle)o;
|
||||
if (mh.form.customized == null) {
|
||||
maybeCustomize(mh);
|
||||
}
|
||||
}
|
||||
|
||||
/*non-public*/ static
|
||||
@DontInline
|
||||
void maybeCustomize(MethodHandle mh) {
|
||||
byte count = mh.customizationCount;
|
||||
if (count >= CUSTOMIZE_THRESHOLD) {
|
||||
mh.customize();
|
||||
} else {
|
||||
mh.customizationCount = (byte)(count+1);
|
||||
}
|
||||
}
|
||||
|
||||
// Local constant functions:
|
||||
private static final NamedFunction
|
||||
NF_checkExactType,
|
||||
NF_checkGenericType,
|
||||
NF_getCallSiteTarget;
|
||||
NF_getCallSiteTarget,
|
||||
NF_checkCustomized;
|
||||
static {
|
||||
try {
|
||||
NamedFunction nfs[] = {
|
||||
@ -399,7 +424,9 @@ class Invokers {
|
||||
NF_checkGenericType = new NamedFunction(Invokers.class
|
||||
.getDeclaredMethod("checkGenericType", Object.class, Object.class)),
|
||||
NF_getCallSiteTarget = new NamedFunction(Invokers.class
|
||||
.getDeclaredMethod("getCallSiteTarget", Object.class))
|
||||
.getDeclaredMethod("getCallSiteTarget", Object.class)),
|
||||
NF_checkCustomized = new NamedFunction(Invokers.class
|
||||
.getDeclaredMethod("checkCustomized", Object.class))
|
||||
};
|
||||
for (NamedFunction nf : nfs) {
|
||||
// Each nf must be statically invocable or we get tied up in our bootstraps.
|
||||
|
||||
@ -120,12 +120,14 @@ class LambdaForm {
|
||||
final int arity;
|
||||
final int result;
|
||||
final boolean forceInline;
|
||||
final MethodHandle customized;
|
||||
@Stable final Name[] names;
|
||||
final String debugName;
|
||||
MemberName vmentry; // low-level behavior, or null if not yet prepared
|
||||
private boolean isCompiled;
|
||||
|
||||
volatile Object transformCache; // managed by LambdaFormEditor
|
||||
// Either a LambdaForm cache (managed by LambdaFormEditor) or a link to uncustomized version (for customized LF)
|
||||
volatile Object transformCache;
|
||||
|
||||
public static final int VOID_RESULT = -1, LAST_RESULT = -2;
|
||||
|
||||
@ -244,16 +246,17 @@ class LambdaForm {
|
||||
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, int result) {
|
||||
this(debugName, arity, names, result, true);
|
||||
this(debugName, arity, names, result, /*forceInline=*/true, /*customized=*/null);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, int result, boolean forceInline) {
|
||||
int arity, Name[] names, int result, boolean forceInline, MethodHandle customized) {
|
||||
assert(namesOK(arity, names));
|
||||
this.arity = arity;
|
||||
this.result = fixResult(result, names);
|
||||
this.names = names.clone();
|
||||
this.debugName = fixDebugName(debugName);
|
||||
this.forceInline = forceInline;
|
||||
this.customized = customized;
|
||||
int maxOutArity = normalize();
|
||||
if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
|
||||
// Cannot use LF interpreter on very high arity expressions.
|
||||
@ -263,21 +266,21 @@ class LambdaForm {
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names) {
|
||||
this(debugName, arity, names, LAST_RESULT, true);
|
||||
this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
int arity, Name[] names, boolean forceInline) {
|
||||
this(debugName, arity, names, LAST_RESULT, forceInline);
|
||||
this(debugName, arity, names, LAST_RESULT, forceInline, /*customized=*/null);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
Name[] formals, Name[] temps, Name result) {
|
||||
this(debugName,
|
||||
formals.length, buildNames(formals, temps, result), LAST_RESULT, true);
|
||||
formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
|
||||
}
|
||||
LambdaForm(String debugName,
|
||||
Name[] formals, Name[] temps, Name result, boolean forceInline) {
|
||||
this(debugName,
|
||||
formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline);
|
||||
formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline, /*customized=*/null);
|
||||
}
|
||||
|
||||
private static Name[] buildNames(Name[] formals, Name[] temps, Name result) {
|
||||
@ -291,10 +294,6 @@ class LambdaForm {
|
||||
}
|
||||
|
||||
private LambdaForm(String sig) {
|
||||
this(sig, true);
|
||||
}
|
||||
|
||||
private LambdaForm(String sig, boolean forceInline) {
|
||||
// Make a blank lambda form, which returns a constant zero or null.
|
||||
// It is used as a template for managing the invocation of similar forms that are non-empty.
|
||||
// Called only from getPreparedForm.
|
||||
@ -303,7 +302,8 @@ class LambdaForm {
|
||||
this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
|
||||
this.names = buildEmptyNames(arity, sig);
|
||||
this.debugName = "LF.zero";
|
||||
this.forceInline = forceInline;
|
||||
this.forceInline = true;
|
||||
this.customized = null;
|
||||
assert(nameRefsAreLegal());
|
||||
assert(isEmpty());
|
||||
assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
|
||||
@ -375,6 +375,31 @@ class LambdaForm {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Customize LambdaForm for a particular MethodHandle */
|
||||
LambdaForm customize(MethodHandle mh) {
|
||||
LambdaForm customForm = new LambdaForm(debugName, arity, names, result, forceInline, mh);
|
||||
if (COMPILE_THRESHOLD > 0 && isCompiled) {
|
||||
// If shared LambdaForm has been compiled, compile customized version as well.
|
||||
customForm.compileToBytecode();
|
||||
}
|
||||
customForm.transformCache = this; // LambdaFormEditor should always use uncustomized form.
|
||||
return customForm;
|
||||
}
|
||||
|
||||
/** Get uncustomized flavor of the LambdaForm */
|
||||
LambdaForm uncustomize() {
|
||||
if (customized == null) {
|
||||
return this;
|
||||
}
|
||||
assert(transformCache != null); // Customized LambdaForm should always has a link to uncustomized version.
|
||||
LambdaForm uncustomizedForm = (LambdaForm)transformCache;
|
||||
if (COMPILE_THRESHOLD > 0 && isCompiled) {
|
||||
// If customized LambdaForm has been compiled, compile uncustomized version as well.
|
||||
uncustomizedForm.compileToBytecode();
|
||||
}
|
||||
return uncustomizedForm;
|
||||
}
|
||||
|
||||
/** Renumber and/or replace params so that they are interned and canonically numbered.
|
||||
* @return maximum argument list length among the names (since we have to pass over them anyway)
|
||||
*/
|
||||
@ -417,8 +442,8 @@ class LambdaForm {
|
||||
for (int i = arity; i < names.length; i++) {
|
||||
names[i].internArguments();
|
||||
}
|
||||
assert(nameRefsAreLegal());
|
||||
}
|
||||
assert(nameRefsAreLegal());
|
||||
return maxOutArity;
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,10 @@ class LambdaFormEditor {
|
||||
static LambdaFormEditor lambdaFormEditor(LambdaForm lambdaForm) {
|
||||
// TO DO: Consider placing intern logic here, to cut down on duplication.
|
||||
// lambdaForm = findPreexistingEquivalent(lambdaForm)
|
||||
return new LambdaFormEditor(lambdaForm);
|
||||
|
||||
// Always use uncustomized version for editing.
|
||||
// It helps caching and customized LambdaForms reuse transformCache field to keep a link to uncustomized version.
|
||||
return new LambdaFormEditor(lambdaForm.uncustomize());
|
||||
}
|
||||
|
||||
/** A description of a cached transform, possibly associated with the result of the transform.
|
||||
|
||||
@ -434,6 +434,8 @@ public abstract class MethodHandle {
|
||||
// form is not private so that invokers can easily fetch it
|
||||
/*private*/ MethodHandle asTypeCache;
|
||||
// asTypeCache is not private so that invokers can easily fetch it
|
||||
/*non-public*/ byte customizationCount;
|
||||
// customizationCount should be accessible from invokers
|
||||
|
||||
/**
|
||||
* Reports the type of this method handle.
|
||||
@ -454,9 +456,9 @@ public abstract class MethodHandle {
|
||||
type.getClass(); // explicit NPE
|
||||
form.getClass(); // explicit NPE
|
||||
this.type = type;
|
||||
this.form = form;
|
||||
this.form = form.uncustomize();
|
||||
|
||||
form.prepare(); // TO DO: Try to delay this step until just before invocation.
|
||||
this.form.prepare(); // TO DO: Try to delay this step until just before invocation.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1425,12 +1427,24 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
||||
*/
|
||||
/*non-public*/
|
||||
void updateForm(LambdaForm newForm) {
|
||||
assert(newForm.customized == null || newForm.customized == this);
|
||||
if (form == newForm) return;
|
||||
newForm.prepare(); // as in MethodHandle.<init>
|
||||
UNSAFE.putObject(this, FORM_OFFSET, newForm);
|
||||
UNSAFE.fullFence();
|
||||
}
|
||||
|
||||
/** Craft a LambdaForm customized for this particular MethodHandle */
|
||||
/*non-public*/
|
||||
void customize() {
|
||||
if (form.customized == null) {
|
||||
LambdaForm newForm = form.customize(this);
|
||||
updateForm(newForm);
|
||||
} else {
|
||||
assert(form.customized == this);
|
||||
}
|
||||
}
|
||||
|
||||
private static final long FORM_OFFSET;
|
||||
static {
|
||||
try {
|
||||
|
||||
@ -597,6 +597,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
static final NamedFunction NF_checkSpreadArgument;
|
||||
static final NamedFunction NF_guardWithCatch;
|
||||
static final NamedFunction NF_throwException;
|
||||
static final NamedFunction NF_profileBoolean;
|
||||
|
||||
static final MethodHandle MH_castReference;
|
||||
static final MethodHandle MH_selectAlternative;
|
||||
@ -614,10 +615,12 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
NF_guardWithCatch = new NamedFunction(MHI.getDeclaredMethod("guardWithCatch", MethodHandle.class, Class.class,
|
||||
MethodHandle.class, Object[].class));
|
||||
NF_throwException = new NamedFunction(MHI.getDeclaredMethod("throwException", Throwable.class));
|
||||
NF_profileBoolean = new NamedFunction(MHI.getDeclaredMethod("profileBoolean", boolean.class, int[].class));
|
||||
|
||||
NF_checkSpreadArgument.resolve();
|
||||
NF_guardWithCatch.resolve();
|
||||
NF_throwException.resolve();
|
||||
NF_profileBoolean.resolve();
|
||||
|
||||
MH_castReference = IMPL_LOOKUP.findStatic(MHI, "castReference",
|
||||
MethodType.methodType(Object.class, Class.class, Object.class));
|
||||
@ -697,7 +700,26 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
@LambdaForm.Hidden
|
||||
static
|
||||
MethodHandle selectAlternative(boolean testResult, MethodHandle target, MethodHandle fallback) {
|
||||
return testResult ? target : fallback;
|
||||
if (testResult) {
|
||||
return target;
|
||||
} else {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
// Intrinsified by C2. Counters are used during parsing to calculate branch frequencies.
|
||||
@LambdaForm.Hidden
|
||||
static
|
||||
boolean profileBoolean(boolean result, int[] counters) {
|
||||
// Profile is int[2] where [0] and [1] correspond to false and true occurrences respectively.
|
||||
int idx = result ? 1 : 0;
|
||||
try {
|
||||
counters[idx] = Math.addExact(counters[idx], 1);
|
||||
} catch (ArithmeticException e) {
|
||||
// Avoid continuous overflow by halving the problematic count.
|
||||
counters[idx] = counters[idx] / 2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
@ -708,13 +730,18 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
assert(test.type().equals(type.changeReturnType(boolean.class)) && fallback.type().equals(type));
|
||||
MethodType basicType = type.basicType();
|
||||
LambdaForm form = makeGuardWithTestForm(basicType);
|
||||
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
|
||||
BoundMethodHandle mh;
|
||||
|
||||
try {
|
||||
mh = (BoundMethodHandle)
|
||||
data.constructor().invokeBasic(type, form,
|
||||
(Object) test, (Object) profile(target), (Object) profile(fallback));
|
||||
if (PROFILE_GWT) {
|
||||
int[] counts = new int[2];
|
||||
mh = (BoundMethodHandle)
|
||||
BoundMethodHandle.speciesData_LLLL().constructor().invokeBasic(type, form,
|
||||
(Object) test, (Object) profile(target), (Object) profile(fallback), counts);
|
||||
} else {
|
||||
mh = (BoundMethodHandle)
|
||||
BoundMethodHandle.speciesData_LLL().constructor().invokeBasic(type, form,
|
||||
(Object) test, (Object) profile(target), (Object) profile(fallback));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
throw uncaughtException(ex);
|
||||
}
|
||||
@ -726,7 +753,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
static
|
||||
MethodHandle profile(MethodHandle target) {
|
||||
if (DONT_INLINE_THRESHOLD >= 0) {
|
||||
return makeBlockInlningWrapper(target);
|
||||
return makeBlockInliningWrapper(target);
|
||||
} else {
|
||||
return target;
|
||||
}
|
||||
@ -737,8 +764,13 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
* Corresponding LambdaForm has @DontInline when compiled into bytecode.
|
||||
*/
|
||||
static
|
||||
MethodHandle makeBlockInlningWrapper(MethodHandle target) {
|
||||
LambdaForm lform = PRODUCE_BLOCK_INLINING_FORM.apply(target);
|
||||
MethodHandle makeBlockInliningWrapper(MethodHandle target) {
|
||||
LambdaForm lform;
|
||||
if (DONT_INLINE_THRESHOLD > 0) {
|
||||
lform = PRODUCE_BLOCK_INLINING_FORM.apply(target);
|
||||
} else {
|
||||
lform = PRODUCE_REINVOKER_FORM.apply(target);
|
||||
}
|
||||
return new CountingWrapper(target, lform,
|
||||
PRODUCE_BLOCK_INLINING_FORM, PRODUCE_REINVOKER_FORM,
|
||||
DONT_INLINE_THRESHOLD);
|
||||
@ -800,7 +832,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
MethodHandle wrapper;
|
||||
if (isCounting) {
|
||||
LambdaForm lform;
|
||||
lform = countingFormProducer.apply(target);
|
||||
lform = countingFormProducer.apply(newTarget);
|
||||
wrapper = new CountingWrapper(newTarget, lform, countingFormProducer, nonCountingFormProducer, DONT_INLINE_THRESHOLD);
|
||||
} else {
|
||||
wrapper = newTarget; // no need for a counting wrapper anymore
|
||||
@ -809,7 +841,8 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
}
|
||||
|
||||
boolean countDown() {
|
||||
if (count <= 0) {
|
||||
int c = count;
|
||||
if (c <= 1) {
|
||||
// Try to limit number of updates. MethodHandle.updateForm() doesn't guarantee LF update visibility.
|
||||
if (isCounting) {
|
||||
isCounting = false;
|
||||
@ -818,7 +851,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
--count;
|
||||
count = c - 1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -856,7 +889,10 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
final int GET_TEST = nameCursor++;
|
||||
final int GET_TARGET = nameCursor++;
|
||||
final int GET_FALLBACK = nameCursor++;
|
||||
final int GET_COUNTERS = PROFILE_GWT ? nameCursor++ : -1;
|
||||
final int CALL_TEST = nameCursor++;
|
||||
final int PROFILE = (GET_COUNTERS != -1) ? nameCursor++ : -1;
|
||||
final int TEST = nameCursor-1; // previous statement: either PROFILE or CALL_TEST
|
||||
final int SELECT_ALT = nameCursor++;
|
||||
final int CALL_TARGET = nameCursor++;
|
||||
assert(CALL_TARGET == SELECT_ALT+1); // must be true to trigger IBG.emitSelectAlternative
|
||||
@ -864,12 +900,16 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
MethodType lambdaType = basicType.invokerType();
|
||||
Name[] names = arguments(nameCursor - ARG_LIMIT, lambdaType);
|
||||
|
||||
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
|
||||
BoundMethodHandle.SpeciesData data =
|
||||
(GET_COUNTERS != -1) ? BoundMethodHandle.speciesData_LLLL()
|
||||
: BoundMethodHandle.speciesData_LLL();
|
||||
names[THIS_MH] = names[THIS_MH].withConstraint(data);
|
||||
names[GET_TEST] = new Name(data.getterFunction(0), names[THIS_MH]);
|
||||
names[GET_TARGET] = new Name(data.getterFunction(1), names[THIS_MH]);
|
||||
names[GET_FALLBACK] = new Name(data.getterFunction(2), names[THIS_MH]);
|
||||
|
||||
if (GET_COUNTERS != -1) {
|
||||
names[GET_COUNTERS] = new Name(data.getterFunction(3), names[THIS_MH]);
|
||||
}
|
||||
Object[] invokeArgs = Arrays.copyOfRange(names, 0, ARG_LIMIT, Object[].class);
|
||||
|
||||
// call test
|
||||
@ -877,15 +917,18 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
invokeArgs[0] = names[GET_TEST];
|
||||
names[CALL_TEST] = new Name(testType, invokeArgs);
|
||||
|
||||
// profile branch
|
||||
if (PROFILE != -1) {
|
||||
names[PROFILE] = new Name(Lazy.NF_profileBoolean, names[CALL_TEST], names[GET_COUNTERS]);
|
||||
}
|
||||
// call selectAlternative
|
||||
names[SELECT_ALT] = new Name(Lazy.MH_selectAlternative, names[CALL_TEST],
|
||||
names[GET_TARGET], names[GET_FALLBACK]);
|
||||
names[SELECT_ALT] = new Name(Lazy.MH_selectAlternative, names[TEST], names[GET_TARGET], names[GET_FALLBACK]);
|
||||
|
||||
// call target or fallback
|
||||
invokeArgs[0] = names[SELECT_ALT];
|
||||
names[CALL_TARGET] = new Name(basicType, invokeArgs);
|
||||
|
||||
lform = new LambdaForm("guard", lambdaType.parameterCount(), names);
|
||||
lform = new LambdaForm("guard", lambdaType.parameterCount(), names, /*forceInline=*/true);
|
||||
|
||||
return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWT, lform);
|
||||
}
|
||||
@ -1629,4 +1672,13 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||
assert(elemType.isPrimitive());
|
||||
return Lazy.MH_copyAsPrimitiveArray.bindTo(Wrapper.forPrimitiveType(elemType));
|
||||
}
|
||||
|
||||
/*non-public*/ static void assertSame(Object mh1, Object mh2) {
|
||||
if (mh1 != mh2) {
|
||||
String msg = String.format("mh1 != mh2: mh1 = %s (form: %s); mh2 = %s (form: %s)",
|
||||
mh1, ((MethodHandle)mh1).form,
|
||||
mh2, ((MethodHandle)mh2).form);
|
||||
throw newInternalError(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,9 +48,11 @@ import sun.misc.Unsafe;
|
||||
static final int COMPILE_THRESHOLD;
|
||||
static final int DONT_INLINE_THRESHOLD;
|
||||
static final int PROFILE_LEVEL;
|
||||
static final boolean PROFILE_GWT;
|
||||
static final int CUSTOMIZE_THRESHOLD;
|
||||
|
||||
static {
|
||||
final Object[] values = new Object[7];
|
||||
final Object[] values = new Object[9];
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
|
||||
@ -60,6 +62,8 @@ import sun.misc.Unsafe;
|
||||
values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0);
|
||||
values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
|
||||
values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
|
||||
values[7] = Boolean.parseBoolean(System.getProperty("java.lang.invoke.MethodHandle.PROFILE_GWT", "true"));
|
||||
values[8] = Integer.getInteger("java.lang.invoke.MethodHandle.CUSTOMIZE_THRESHOLD", 127);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -70,6 +74,12 @@ import sun.misc.Unsafe;
|
||||
COMPILE_THRESHOLD = (Integer) values[4];
|
||||
DONT_INLINE_THRESHOLD = (Integer) values[5];
|
||||
PROFILE_LEVEL = (Integer) values[6];
|
||||
PROFILE_GWT = (Boolean) values[7];
|
||||
CUSTOMIZE_THRESHOLD = (Integer) values[8];
|
||||
|
||||
if (CUSTOMIZE_THRESHOLD < -1 || CUSTOMIZE_THRESHOLD > 127) {
|
||||
throw newInternalError("CUSTOMIZE_THRESHOLD should be in [-1...127] range");
|
||||
}
|
||||
}
|
||||
|
||||
/** Tell if any of the debugging switches are turned on.
|
||||
|
||||
@ -35,7 +35,7 @@ import java.nio.channels.spi.*;
|
||||
* <p> A pipe consists of a pair of channels: A writable {@link
|
||||
* Pipe.SinkChannel sink} channel and a readable {@link Pipe.SourceChannel source}
|
||||
* channel. Once some bytes are written to the sink channel they can be read
|
||||
* from source channel in exactlyAthe order in which they were written.
|
||||
* from the source channel in exactly the order in which they were written.
|
||||
*
|
||||
* <p> Whether or not a thread writing bytes to a pipe will block until another
|
||||
* thread reads those bytes, or some previously-written bytes, from the pipe is
|
||||
|
||||
@ -172,9 +172,24 @@ public final class AccessControlContext {
|
||||
public AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner) {
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
|
||||
this(acc, combiner, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* package private to allow calls from ProtectionDomain without performing
|
||||
* the security check for {@linkplain SecurityConstants.CREATE_ACC_PERMISSION}
|
||||
* permission
|
||||
*/
|
||||
AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner,
|
||||
boolean preauthorized) {
|
||||
if (!preauthorized) {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
|
||||
this.isAuthorized = true;
|
||||
}
|
||||
} else {
|
||||
this.isAuthorized = true;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,6 @@ package java.security;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -60,35 +59,44 @@ import sun.misc.SharedSecrets;
|
||||
*/
|
||||
|
||||
public class ProtectionDomain {
|
||||
private static class JavaSecurityAccessImpl implements JavaSecurityAccess {
|
||||
|
||||
private JavaSecurityAccessImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
final AccessControlContext stack,
|
||||
final AccessControlContext context) {
|
||||
if (action == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
return AccessController.doPrivileged(
|
||||
action,
|
||||
getCombinedACC(context, stack)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
AccessControlContext context) {
|
||||
return doIntersectionPrivilege(action,
|
||||
AccessController.getContext(), context);
|
||||
}
|
||||
|
||||
private static AccessControlContext getCombinedACC(AccessControlContext context, AccessControlContext stack) {
|
||||
AccessControlContext acc = new AccessControlContext(context, stack.getCombiner(), true);
|
||||
|
||||
return new AccessControlContext(stack.getContext(), acc).optimize();
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
// Set up JavaSecurityAccess in SharedSecrets
|
||||
SharedSecrets.setJavaSecurityAccess(
|
||||
new JavaSecurityAccess() {
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
final AccessControlContext stack,
|
||||
final AccessControlContext context)
|
||||
{
|
||||
if (action == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
return AccessController.doPrivileged(
|
||||
action,
|
||||
new AccessControlContext(
|
||||
stack.getContext(), context).optimize()
|
||||
);
|
||||
}
|
||||
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
AccessControlContext context)
|
||||
{
|
||||
return doIntersectionPrivilege(action,
|
||||
AccessController.getContext(), context);
|
||||
}
|
||||
}
|
||||
);
|
||||
SharedSecrets.setJavaSecurityAccess(new JavaSecurityAccessImpl());
|
||||
}
|
||||
|
||||
/* CodeSource */
|
||||
|
||||
@ -144,6 +144,10 @@ class ComparableTimSort {
|
||||
* large) stack lengths for smaller arrays. The "magic numbers" in the
|
||||
* computation below must be changed if MIN_MERGE is decreased. See
|
||||
* the MIN_MERGE declaration above for more information.
|
||||
* The maximum value of 49 allows for an array up to length
|
||||
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
|
||||
* increasing scenario. More explanations are given in section 4 of:
|
||||
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
|
||||
*/
|
||||
int stackLen = (len < 120 ? 5 :
|
||||
len < 1542 ? 10 :
|
||||
|
||||
@ -36,14 +36,14 @@ import java.io.IOException;
|
||||
* For example, the following class prints out different representations of a
|
||||
* stock's name depending on the flags and length constraints:
|
||||
*
|
||||
* {@code
|
||||
* <pre> {@code
|
||||
* import java.nio.CharBuffer;
|
||||
* import java.util.Formatter;
|
||||
* import java.util.Formattable;
|
||||
* import java.util.Locale;
|
||||
* import static java.util.FormattableFlags.*;
|
||||
*
|
||||
* ...
|
||||
* ...
|
||||
*
|
||||
* public class StockName implements Formattable {
|
||||
* private String symbol, companyName, frenchCompanyName;
|
||||
@ -89,12 +89,12 @@ import java.io.IOException;
|
||||
* return String.format("%s - %s", symbol, companyName);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* <p> When used in conjunction with the {@link java.util.Formatter}, the above
|
||||
* class produces the following output for various format strings.
|
||||
*
|
||||
* {@code
|
||||
* <pre> {@code
|
||||
* Formatter fmt = new Formatter();
|
||||
* StockName sn = new StockName("HUGE", "Huge Fruit, Inc.",
|
||||
* "Fruit Titanesque, Inc.");
|
||||
@ -104,7 +104,7 @@ import java.io.IOException;
|
||||
* fmt.format("%-10.8s", sn); // -> "HUGE "
|
||||
* fmt.format("%.12s", sn); // -> "Huge Fruit,*"
|
||||
* fmt.format(Locale.FRANCE, "%25s", sn); // -> " Fruit Titanesque, Inc."
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* <p> Formattables are not necessarily safe for multithreaded access. Thread
|
||||
* safety is optional and may be enforced by classes that extend and implement
|
||||
|
||||
@ -38,8 +38,8 @@ import java.util.stream.Stream;
|
||||
* <p>Additional methods that depend on the presence or absence of a contained
|
||||
* value are provided, such as {@link #orElse(java.lang.Object) orElse()}
|
||||
* (return a default value if value not present) and
|
||||
* {@link #ifPresent(java.util.function.Consumer) ifPresent()} (execute a block
|
||||
* of code if the value is present).
|
||||
* {@link #ifPresent(java.util.function.Consumer) ifPresent()} (perform an
|
||||
* action if the value is present).
|
||||
*
|
||||
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
|
||||
* class; use of identity-sensitive operations (including reference equality
|
||||
@ -148,16 +148,35 @@ public final class Optional<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* If a value is present, invoke the specified consumer with the value,
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise do nothing.
|
||||
*
|
||||
* @param consumer block to be executed if a value is present
|
||||
* @throws NullPointerException if value is present and {@code consumer} is
|
||||
* @param action the action to be performed if a value is present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null
|
||||
*/
|
||||
public void ifPresent(Consumer<? super T> consumer) {
|
||||
public void ifPresent(Consumer<? super T> action) {
|
||||
if (value != null) {
|
||||
consumer.accept(value);
|
||||
action.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise perform the given empty-based action.
|
||||
*
|
||||
* @param action the action to be performed if a value is present
|
||||
* @param emptyAction the empty-based action to be performed if a value is
|
||||
* not present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null, or a value is not present and {@code emptyAction} is null.
|
||||
* @since 1.9
|
||||
*/
|
||||
public void ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction) {
|
||||
if (value != null) {
|
||||
action.accept(value);
|
||||
} else {
|
||||
emptyAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ import java.util.stream.DoubleStream;
|
||||
* <p>Additional methods that depend on the presence or absence of a contained
|
||||
* value are provided, such as {@link #orElse(double) orElse()}
|
||||
* (return a default value if value not present) and
|
||||
* {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (execute a block
|
||||
* of code if the value is present).
|
||||
* {@link #ifPresent(java.util.function.DoubleConsumer) ifPresent()} (perform an
|
||||
* action if the value is present).
|
||||
*
|
||||
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
|
||||
* class; use of identity-sensitive operations (including reference equality
|
||||
@ -131,16 +131,35 @@ public final class OptionalDouble {
|
||||
}
|
||||
|
||||
/**
|
||||
* Have the specified consumer accept the value if a value is present,
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise do nothing.
|
||||
*
|
||||
* @param consumer block to be executed if a value is present
|
||||
* @throws NullPointerException if value is present and {@code consumer} is
|
||||
* @param action the action to be performed if a value is present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null
|
||||
*/
|
||||
public void ifPresent(DoubleConsumer consumer) {
|
||||
public void ifPresent(DoubleConsumer action) {
|
||||
if (isPresent) {
|
||||
consumer.accept(value);
|
||||
action.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise perform the given empty-based action.
|
||||
*
|
||||
* @param action the action to be performed if a value is present
|
||||
* @param emptyAction the empty-based action to be performed if a value is
|
||||
* not present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null, or a value is not present and {@code emptyAction} is null.
|
||||
* @since 1.9
|
||||
*/
|
||||
public void ifPresentOrElse(DoubleConsumer action, Runnable emptyAction) {
|
||||
if (isPresent) {
|
||||
action.accept(value);
|
||||
} else {
|
||||
emptyAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ import java.util.stream.IntStream;
|
||||
* <p>Additional methods that depend on the presence or absence of a contained
|
||||
* value are provided, such as {@link #orElse(int) orElse()}
|
||||
* (return a default value if value not present) and
|
||||
* {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (execute a block
|
||||
* of code if the value is present).
|
||||
* {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (perform an
|
||||
* action if the value is present).
|
||||
*
|
||||
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
|
||||
* class; use of identity-sensitive operations (including reference equality
|
||||
@ -131,16 +131,35 @@ public final class OptionalInt {
|
||||
}
|
||||
|
||||
/**
|
||||
* Have the specified consumer accept the value if a value is present,
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise do nothing.
|
||||
*
|
||||
* @param consumer block to be executed if a value is present
|
||||
* @throws NullPointerException if value is present and {@code consumer} is
|
||||
* @param action the action to be performed if a value is present
|
||||
* @throws NullPointerException if value is present and {@code action} is
|
||||
* null
|
||||
*/
|
||||
public void ifPresent(IntConsumer consumer) {
|
||||
public void ifPresent(IntConsumer action) {
|
||||
if (isPresent) {
|
||||
consumer.accept(value);
|
||||
action.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise perform the given empty-based action.
|
||||
*
|
||||
* @param action the action to be performed if a value is present
|
||||
* @param emptyAction the empty-based action to be performed if a value is
|
||||
* not present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null, or a value is not present and {@code emptyAction} is null.
|
||||
* @since 1.9
|
||||
*/
|
||||
public void ifPresentOrElse(IntConsumer action, Runnable emptyAction) {
|
||||
if (isPresent) {
|
||||
action.accept(value);
|
||||
} else {
|
||||
emptyAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,8 +37,8 @@ import java.util.stream.LongStream;
|
||||
* <p>Additional methods that depend on the presence or absence of a contained
|
||||
* value are provided, such as {@link #orElse(long) orElse()}
|
||||
* (return a default value if value not present) and
|
||||
* {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (execute a block
|
||||
* of code if the value is present).
|
||||
* {@link #ifPresent(java.util.function.LongConsumer) ifPresent()} (perform an
|
||||
* action if the value is present).
|
||||
*
|
||||
* <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
|
||||
* class; use of identity-sensitive operations (including reference equality
|
||||
@ -131,16 +131,35 @@ public final class OptionalLong {
|
||||
}
|
||||
|
||||
/**
|
||||
* Have the specified consumer accept the value if a value is present,
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise do nothing.
|
||||
*
|
||||
* @param consumer block to be executed if a value is present
|
||||
* @throws NullPointerException if value is present and {@code consumer} is
|
||||
* @param action the action to be performed if a value is present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null
|
||||
*/
|
||||
public void ifPresent(LongConsumer consumer) {
|
||||
public void ifPresent(LongConsumer action) {
|
||||
if (isPresent) {
|
||||
consumer.accept(value);
|
||||
action.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If a value is present, perform the given action with the value,
|
||||
* otherwise perform the given empty-based action.
|
||||
*
|
||||
* @param action the action to be performed if a value is present
|
||||
* @param emptyAction the empty-based action to be performed if a value is
|
||||
* not present
|
||||
* @throws NullPointerException if a value is present and {@code action} is
|
||||
* null, or a value is not present and {@code emptyAction} is null.
|
||||
* @since 1.9
|
||||
*/
|
||||
public void ifPresentOrElse(LongConsumer action, Runnable emptyAction) {
|
||||
if (isPresent) {
|
||||
action.accept(value);
|
||||
} else {
|
||||
emptyAction.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,6 +174,10 @@ class TimSort<T> {
|
||||
* large) stack lengths for smaller arrays. The "magic numbers" in the
|
||||
* computation below must be changed if MIN_MERGE is decreased. See
|
||||
* the MIN_MERGE declaration above for more information.
|
||||
* The maximum value of 49 allows for an array up to length
|
||||
* Integer.MAX_VALUE-4, if array is filled by the worst case stack size
|
||||
* increasing scenario. More explanations are given in section 4 of:
|
||||
* http://envisage-project.eu/wp-content/uploads/2015/02/sorting.pdf
|
||||
*/
|
||||
int stackLen = (len < 120 ? 5 :
|
||||
len < 1542 ? 10 :
|
||||
|
||||
@ -5819,6 +5819,10 @@ NEXT: while (i <= last) {
|
||||
|
||||
MatcherIterator() {
|
||||
this.matcher = matcher(input);
|
||||
// If the input is an empty string then the result can only be a
|
||||
// stream of the input. Induce that by setting the empty
|
||||
// element count to 1
|
||||
this.emptyElementCount = input.length() == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
public String next() {
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
|
||||
package sun.misc;
|
||||
|
||||
import java.security.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.Reflection;
|
||||
@ -189,205 +189,39 @@ public final class Unsafe {
|
||||
* If the reference <code>o</code> is non-null, car marks or
|
||||
* other store barriers for that object (if the VM requires them)
|
||||
* are updated.
|
||||
* @see #putInt(Object, int, int)
|
||||
* @see #putInt(Object, long, int)
|
||||
*/
|
||||
public native void putObject(Object o, long offset, Object x);
|
||||
|
||||
/** @see #getInt(Object, long) */
|
||||
public native boolean getBoolean(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putBoolean(Object o, long offset, boolean x);
|
||||
/** @see #getInt(Object, long) */
|
||||
public native byte getByte(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putByte(Object o, long offset, byte x);
|
||||
/** @see #getInt(Object, long) */
|
||||
public native short getShort(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putShort(Object o, long offset, short x);
|
||||
/** @see #getInt(Object, long) */
|
||||
public native char getChar(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putChar(Object o, long offset, char x);
|
||||
/** @see #getInt(Object, long) */
|
||||
public native long getLong(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putLong(Object o, long offset, long x);
|
||||
/** @see #getInt(Object, long) */
|
||||
public native float getFloat(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putFloat(Object o, long offset, float x);
|
||||
/** @see #getInt(Object, long) */
|
||||
public native double getDouble(Object o, long offset);
|
||||
/** @see #putInt(Object, int, int) */
|
||||
/** @see #putInt(Object, long, int) */
|
||||
public native void putDouble(Object o, long offset, double x);
|
||||
|
||||
/**
|
||||
* This method, like all others with 32-bit offsets, was native
|
||||
* in a previous release but is now a wrapper which simply casts
|
||||
* the offset to a long value. It provides backward compatibility
|
||||
* with bytecodes compiled against 1.4.
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getInt(Object o, int offset) {
|
||||
return getInt(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putInt(Object o, int offset, int x) {
|
||||
putInt(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object getObject(Object o, int offset) {
|
||||
return getObject(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putObject(Object o, int offset, Object x) {
|
||||
putObject(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getBoolean(Object o, int offset) {
|
||||
return getBoolean(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putBoolean(Object o, int offset, boolean x) {
|
||||
putBoolean(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public byte getByte(Object o, int offset) {
|
||||
return getByte(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putByte(Object o, int offset, byte x) {
|
||||
putByte(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public short getShort(Object o, int offset) {
|
||||
return getShort(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putShort(Object o, int offset, short x) {
|
||||
putShort(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public char getChar(Object o, int offset) {
|
||||
return getChar(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putChar(Object o, int offset, char x) {
|
||||
putChar(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public long getLong(Object o, int offset) {
|
||||
return getLong(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putLong(Object o, int offset, long x) {
|
||||
putLong(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public float getFloat(Object o, int offset) {
|
||||
return getFloat(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putFloat(Object o, int offset, float x) {
|
||||
putFloat(o, (long)offset, x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public double getDouble(Object o, int offset) {
|
||||
return getDouble(o, (long)offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of 1.4.1, cast the 32-bit offset argument to a long.
|
||||
* See {@link #staticFieldOffset}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putDouble(Object o, int offset, double x) {
|
||||
putDouble(o, (long)offset, x);
|
||||
}
|
||||
|
||||
// These work on values in the C heap.
|
||||
|
||||
/**
|
||||
@ -578,58 +412,6 @@ public final class Unsafe {
|
||||
*/
|
||||
public static final int INVALID_FIELD_OFFSET = -1;
|
||||
|
||||
/**
|
||||
* Returns the offset of a field, truncated to 32 bits.
|
||||
* This method is implemented as follows:
|
||||
* <blockquote><pre>
|
||||
* public int fieldOffset(Field f) {
|
||||
* if (Modifier.isStatic(f.getModifiers()))
|
||||
* return (int) staticFieldOffset(f);
|
||||
* else
|
||||
* return (int) objectFieldOffset(f);
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
* @deprecated As of 1.4.1, use {@link #staticFieldOffset} for static
|
||||
* fields and {@link #objectFieldOffset} for non-static fields.
|
||||
*/
|
||||
@Deprecated
|
||||
public int fieldOffset(Field f) {
|
||||
if (Modifier.isStatic(f.getModifiers()))
|
||||
return (int) staticFieldOffset(f);
|
||||
else
|
||||
return (int) objectFieldOffset(f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base address for accessing some static field
|
||||
* in the given class. This method is implemented as follows:
|
||||
* <blockquote><pre>
|
||||
* public Object staticFieldBase(Class c) {
|
||||
* Field[] fields = c.getDeclaredFields();
|
||||
* for (int i = 0; i < fields.length; i++) {
|
||||
* if (Modifier.isStatic(fields[i].getModifiers())) {
|
||||
* return staticFieldBase(fields[i]);
|
||||
* }
|
||||
* }
|
||||
* return null;
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
* @deprecated As of 1.4.1, use {@link #staticFieldBase(Field)}
|
||||
* to obtain the base pertaining to a specific {@link Field}.
|
||||
* This method works only for JVMs which store all statics
|
||||
* for a given class in one place.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object staticFieldBase(Class<?> c) {
|
||||
Field[] fields = c.getDeclaredFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (Modifier.isStatic(fields[i].getModifiers())) {
|
||||
return staticFieldBase(fields[i]);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report the location of a given field in the storage allocation of its
|
||||
* class. Do not expect to perform any sort of arithmetic on this offset;
|
||||
@ -648,7 +430,7 @@ public final class Unsafe {
|
||||
* must preserve all bits of static field offsets.
|
||||
* @see #getInt(Object, long)
|
||||
*/
|
||||
public native long staticFieldOffset(Field f);
|
||||
public native long objectFieldOffset(Field f);
|
||||
|
||||
/**
|
||||
* Report the location of a given static field, in conjunction with {@link
|
||||
@ -667,7 +449,7 @@ public final class Unsafe {
|
||||
* this method reports its result as a long value.
|
||||
* @see #getInt(Object, long)
|
||||
*/
|
||||
public native long objectFieldOffset(Field f);
|
||||
public native long staticFieldOffset(Field f);
|
||||
|
||||
/**
|
||||
* Report the location of a given static field, in conjunction with {@link
|
||||
@ -748,7 +530,7 @@ public final class Unsafe {
|
||||
* Report the scale factor for addressing elements in the storage
|
||||
* allocation of a given array class. However, arrays of "narrow" types
|
||||
* will generally not work properly with accessors like {@link
|
||||
* #getByte(Object, int)}, so the scale factor for such classes is reported
|
||||
* #getByte(Object, long)}, so the scale factor for such classes is reported
|
||||
* as zero.
|
||||
*
|
||||
* @see #arrayBaseOffset
|
||||
@ -1136,11 +918,11 @@ public final class Unsafe {
|
||||
public native void fullFence();
|
||||
|
||||
/**
|
||||
* Throws IllegalAccessError; for use by the VM.
|
||||
* Throws IllegalAccessError; for use by the VM for access control
|
||||
* error support.
|
||||
* @since 1.8
|
||||
*/
|
||||
private static void throwIllegalAccessError() {
|
||||
throw new IllegalAccessError();
|
||||
throw new IllegalAccessError();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -111,6 +111,12 @@ public class AbstractCharsetProvider
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasCharset(String name) {
|
||||
synchronized (this) {
|
||||
return classMap.containsKey(name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Late initialization hook, needed by some providers
|
||||
*/
|
||||
protected void init() { }
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -34,7 +34,7 @@ import java.nio.charset.CoderResult;
|
||||
* when normal inheritance cannot be used.
|
||||
* Used by autodecting decoders.
|
||||
*/
|
||||
interface DelegatableDecoder {
|
||||
public interface DelegatableDecoder {
|
||||
CoderResult decodeLoop(ByteBuffer src, CharBuffer dst);
|
||||
void implReset();
|
||||
CoderResult implFlush(CharBuffer out);
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -130,9 +130,9 @@ public class DoubleByte {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
|
||||
Decoder(Charset cs, float avgcpb, float maxcpb,
|
||||
char[][] b2c, char[] b2cSB,
|
||||
int b2Min, int b2Max) {
|
||||
public Decoder(Charset cs, float avgcpb, float maxcpb,
|
||||
char[][] b2c, char[] b2cSB,
|
||||
int b2Min, int b2Max) {
|
||||
super(cs, avgcpb, maxcpb);
|
||||
this.b2c = b2c;
|
||||
this.b2cSB = b2cSB;
|
||||
@ -140,7 +140,7 @@ public class DoubleByte {
|
||||
this.b2Max = b2Max;
|
||||
}
|
||||
|
||||
Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
public Decoder(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
this(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ public class DoubleByte {
|
||||
private static final int SI = 0x0f;
|
||||
private int currentState;
|
||||
|
||||
Decoder_EBCDIC(Charset cs,
|
||||
public Decoder_EBCDIC(Charset cs,
|
||||
char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
@ -451,7 +451,7 @@ public class DoubleByte {
|
||||
b2cSB_UNMAPPABLE = new char[0x100];
|
||||
Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
|
||||
}
|
||||
Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
public Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max);
|
||||
}
|
||||
}
|
||||
@ -463,7 +463,7 @@ public class DoubleByte {
|
||||
private final int SS2 = 0x8E;
|
||||
private final int SS3 = 0x8F;
|
||||
|
||||
Decoder_EUC_SIM(Charset cs,
|
||||
public Decoder_EUC_SIM(Charset cs,
|
||||
char[][] b2c, char[] b2cSB, int b2Min, int b2Max) {
|
||||
super(cs, b2c, b2cSB, b2Min, b2Max);
|
||||
}
|
||||
@ -511,18 +511,18 @@ public class DoubleByte {
|
||||
public static class Encoder extends CharsetEncoder
|
||||
implements ArrayEncoder
|
||||
{
|
||||
final int MAX_SINGLEBYTE = 0xff;
|
||||
protected final int MAX_SINGLEBYTE = 0xff;
|
||||
private final char[] c2b;
|
||||
private final char[] c2bIndex;
|
||||
Surrogate.Parser sgp;
|
||||
protected Surrogate.Parser sgp;
|
||||
|
||||
protected Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
public Encoder(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 2.0f, 2.0f);
|
||||
this.c2b = c2b;
|
||||
this.c2bIndex = c2bIndex;
|
||||
}
|
||||
|
||||
Encoder(Charset cs, float avg, float max, byte[] repl, char[] c2b, char[] c2bIndex) {
|
||||
public Encoder(Charset cs, float avg, float max, byte[] repl, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, avg, max, repl);
|
||||
this.c2b = c2b;
|
||||
this.c2bIndex = c2bIndex;
|
||||
@ -532,7 +532,7 @@ public class DoubleByte {
|
||||
return encodeChar(c) != UNMAPPABLE_ENCODING;
|
||||
}
|
||||
|
||||
Surrogate.Parser sgp() {
|
||||
protected Surrogate.Parser sgp() {
|
||||
if (sgp == null)
|
||||
sgp = new Surrogate.Parser();
|
||||
return sgp;
|
||||
@ -657,7 +657,7 @@ public class DoubleByte {
|
||||
}
|
||||
|
||||
// init the c2b and c2bIndex tables from b2c.
|
||||
static void initC2B(String[] b2c, String b2cSB, String b2cNR, String c2bNR,
|
||||
public static void initC2B(String[] b2c, String b2cSB, String b2cNR, String c2bNR,
|
||||
int b2Min, int b2Max,
|
||||
char[] c2b, char[] c2bIndex)
|
||||
{
|
||||
@ -741,7 +741,7 @@ public class DoubleByte {
|
||||
}
|
||||
|
||||
public static class Encoder_DBCSONLY extends Encoder {
|
||||
Encoder_DBCSONLY(Charset cs, byte[] repl,
|
||||
public Encoder_DBCSONLY(Charset cs, byte[] repl,
|
||||
char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 2.0f, 2.0f, repl, c2b, c2bIndex);
|
||||
}
|
||||
@ -764,7 +764,7 @@ public class DoubleByte {
|
||||
|
||||
protected int currentState = SBCS;
|
||||
|
||||
Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
public Encoder_EBCDIC(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, 4.0f, 5.0f, new byte[] {(byte)0x6f}, c2b, c2bIndex);
|
||||
}
|
||||
|
||||
@ -921,7 +921,7 @@ public class DoubleByte {
|
||||
|
||||
// EUC_SIMPLE
|
||||
public static class Encoder_EUC_SIM extends Encoder {
|
||||
Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
public Encoder_EUC_SIM(Charset cs, char[] c2b, char[] c2bIndex) {
|
||||
super(cs, c2b, c2bIndex);
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.nio.cs.ext;
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
@ -32,6 +32,7 @@ import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import sun.nio.cs.DoubleByte;
|
||||
import sun.nio.cs.Surrogate;
|
||||
import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
@ -216,7 +217,7 @@ public class HKSCS {
|
||||
return decodeBufferLoop(src, dst);
|
||||
}
|
||||
|
||||
static void initb2c(char[][]b2c, String[] b2cStr)
|
||||
public static void initb2c(char[][]b2c, String[] b2cStr)
|
||||
{
|
||||
for (int i = 0; i < b2cStr.length; i++) {
|
||||
if (b2cStr[i] == null)
|
||||
@ -395,7 +396,7 @@ public class HKSCS {
|
||||
Arrays.fill(C2B_UNMAPPABLE, (char)UNMAPPABLE_ENCODING);
|
||||
}
|
||||
|
||||
static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
|
||||
public static void initc2b(char[][] c2b, String[] b2cStr, String pua) {
|
||||
// init c2b/c2bSupp from b2cStr and supp
|
||||
int b2Min = 0x40;
|
||||
Arrays.fill(c2b, C2B_UNMAPPABLE);
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -29,20 +29,188 @@
|
||||
|
||||
package sun.nio.cs;
|
||||
|
||||
import java.nio.charset.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.spi.CharsetProvider;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
|
||||
public class StandardCharsets
|
||||
extends FastCharsetProvider
|
||||
{
|
||||
public class StandardCharsets extends CharsetProvider {
|
||||
|
||||
_INCLUDE_ALIASES_TABLES_
|
||||
_INCLUDE_ALIASES_MAP_
|
||||
_INCLUDE_CLASSES_MAP_
|
||||
_INCLUDE_CACHE_MAP_
|
||||
|
||||
// Maps canonical names to class names
|
||||
private Map<String,String> classMap;
|
||||
// Maps alias names to canonical names
|
||||
private Map<String,String> aliasMap;
|
||||
// Maps canonical names to cached instances
|
||||
private Map<String,Charset> cache;
|
||||
|
||||
private String packagePrefix = "sun.nio.cs";
|
||||
|
||||
public StandardCharsets() {
|
||||
super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
|
||||
this.aliasMap = new Aliases();
|
||||
this.classMap = new Classes();
|
||||
this.cache = new Cache();
|
||||
}
|
||||
|
||||
private String canonicalize(String csn) {
|
||||
String acn = aliasMap.get(csn);
|
||||
return (acn != null) ? acn : csn;
|
||||
}
|
||||
|
||||
// Private ASCII-only version, optimized for interpretation during startup
|
||||
//
|
||||
private static String toLower(String s) {
|
||||
int n = s.length();
|
||||
boolean allLower = true;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int c = s.charAt(i);
|
||||
if (((c - 'A') | ('Z' - c)) >= 0) {
|
||||
allLower = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allLower)
|
||||
return s;
|
||||
char[] ca = new char[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
int c = s.charAt(i);
|
||||
if (((c - 'A') | ('Z' - c)) >= 0)
|
||||
ca[i] = (char)(c + 0x20);
|
||||
else
|
||||
ca[i] = (char)c;
|
||||
}
|
||||
return new String(ca);
|
||||
}
|
||||
|
||||
private Charset lookup(String charsetName) {
|
||||
init();
|
||||
String csn = canonicalize(toLower(charsetName));
|
||||
|
||||
// Check cache first
|
||||
Charset cs = cache.get(csn);
|
||||
if (cs != null)
|
||||
return cs;
|
||||
|
||||
// Do we even support this charset?
|
||||
String cln = classMap.get(csn);
|
||||
if (cln == null)
|
||||
return null;
|
||||
|
||||
if (cln.equals("US_ASCII")) {
|
||||
cs = new US_ASCII();
|
||||
cache.put(csn, cs);
|
||||
return cs;
|
||||
}
|
||||
|
||||
// Instantiate the charset and cache it
|
||||
try {
|
||||
Class<?> c = Class.forName(packagePrefix + "." + cln,
|
||||
true,
|
||||
this.getClass().getClassLoader());
|
||||
cs = (Charset)c.newInstance();
|
||||
cache.put(csn, cs);
|
||||
return cs;
|
||||
} catch (ClassNotFoundException |
|
||||
IllegalAccessException |
|
||||
InstantiationException x) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final Charset charsetForName(String charsetName) {
|
||||
synchronized (this) {
|
||||
return lookup(canonicalize(charsetName));
|
||||
}
|
||||
}
|
||||
|
||||
public final Iterator<Charset> charsets() {
|
||||
synchronized (this) {
|
||||
init();
|
||||
}
|
||||
return new Iterator<Charset>() {
|
||||
|
||||
Iterator<String> i = classMap.keySet().iterator();
|
||||
|
||||
public boolean hasNext() {
|
||||
return i.hasNext();
|
||||
}
|
||||
|
||||
public Charset next() {
|
||||
String csn = i.next();
|
||||
return lookup(csn);
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
/* provider the sun.nio.cs.map property fir sjis/ms932 mapping hack
|
||||
*/
|
||||
private void init() {
|
||||
if (initialized)
|
||||
return;
|
||||
if (!sun.misc.VM.isBooted())
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
String map = getProperty("sun.nio.cs.map");
|
||||
if (map != null) {
|
||||
String[] maps = map.split(",");
|
||||
for (int i = 0; i < maps.length; i++) {
|
||||
if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
|
||||
// if we dont have both sjis and ms932, do nothing
|
||||
if (classMap.get("shift_jis") == null ||
|
||||
classMap.get("windows-31j") == null) {
|
||||
break;
|
||||
}
|
||||
aliases_MS932 = new String[] {
|
||||
"MS932", // JDK historical
|
||||
"windows-932",
|
||||
"csWindows31J",
|
||||
"shift-jis",
|
||||
"ms_kanji",
|
||||
"x-sjis",
|
||||
"csShiftJIS",
|
||||
// This alias takes precedence over the actual
|
||||
// Shift_JIS charset itself since aliases are always
|
||||
// resolved first, before looking up canonical names.
|
||||
"shift_jis"
|
||||
};
|
||||
aliases_SJIS = new String[] { "sjis" };
|
||||
|
||||
for (String alias : aliases_MS932) {
|
||||
aliasMap.put(toLower(alias), "windows-31j");
|
||||
}
|
||||
cache.put("shift_jis", null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getProperty(String key) {
|
||||
// this method may be called during initialization of
|
||||
// system class loader and thus not using lambda
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,14 +33,11 @@ import java.nio.ByteBuffer;
|
||||
import java.security.*;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.interfaces.*;
|
||||
import java.security.spec.DSAParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.DerValue;
|
||||
import sun.security.util.DerInputStream;
|
||||
import sun.security.util.DerOutputStream;
|
||||
import sun.security.x509.AlgIdDSA;
|
||||
import sun.security.jca.JCAUtil;
|
||||
|
||||
/**
|
||||
@ -85,13 +82,28 @@ abstract class DSA extends SignatureSpi {
|
||||
/* The message digest object used */
|
||||
private final MessageDigest md;
|
||||
|
||||
/* The format. true for the IEEE P1363 format. false (default) for ASN.1 */
|
||||
private final boolean p1363Format;
|
||||
|
||||
/**
|
||||
* Construct a blank DSA object. It must be
|
||||
* initialized before being usable for signing or verifying.
|
||||
*/
|
||||
DSA(MessageDigest md) {
|
||||
this(md, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a blank DSA object that will use the specified
|
||||
* signature format. {@code p1363Format} should be {@code true} to
|
||||
* use the IEEE P1363 format. If {@code p1363Format} is {@code false},
|
||||
* the DER-encoded ASN.1 format will used. The DSA object must be
|
||||
* initialized before being usable for signing or verifying.
|
||||
*/
|
||||
DSA(MessageDigest md, boolean p1363Format) {
|
||||
super();
|
||||
this.md = md;
|
||||
this.p1363Format = p1363Format;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,12 +190,16 @@ abstract class DSA extends SignatureSpi {
|
||||
|
||||
|
||||
/**
|
||||
* Sign all the data thus far updated. The signature is formatted
|
||||
* Sign all the data thus far updated. The signature format is
|
||||
* determined by {@code p1363Format}. If {@code p1363Format} is
|
||||
* {@code false} (the default), then the signature is formatted
|
||||
* according to the Canonical Encoding Rules, returned as a DER
|
||||
* sequence of Integer, r and s.
|
||||
* sequence of Integers, r and s. If {@code p1363Format} is
|
||||
* {@code false}, the signature is returned in the IEEE P1363
|
||||
* format, which is the concatenation or r and s.
|
||||
*
|
||||
* @return a signature block formatted according to the Canonical
|
||||
* Encoding Rules.
|
||||
* @return a signature block formatted according to the format
|
||||
* indicated by {@code p1363Format}
|
||||
*
|
||||
* @exception SignatureException if the signature object was not
|
||||
* properly initialized, or if another exception occurs.
|
||||
@ -196,24 +212,48 @@ abstract class DSA extends SignatureSpi {
|
||||
BigInteger r = generateR(presetP, presetQ, presetG, k);
|
||||
BigInteger s = generateS(presetX, presetQ, r, k);
|
||||
|
||||
try {
|
||||
DerOutputStream outseq = new DerOutputStream(100);
|
||||
outseq.putInteger(r);
|
||||
outseq.putInteger(s);
|
||||
DerValue result = new DerValue(DerValue.tag_Sequence,
|
||||
outseq.toByteArray());
|
||||
if (p1363Format) {
|
||||
// Return the concatenation of r and s
|
||||
byte[] rBytes = r.toByteArray();
|
||||
byte[] sBytes = s.toByteArray();
|
||||
|
||||
return result.toByteArray();
|
||||
int size = presetQ.bitLength() / 8;
|
||||
byte[] outseq = new byte[size * 2];
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new SignatureException("error encoding signature");
|
||||
int rLength = rBytes.length;
|
||||
int sLength = sBytes.length;
|
||||
int i;
|
||||
for (i = rLength; i > 0 && rBytes[rLength - i] == 0; i--);
|
||||
|
||||
int j;
|
||||
for (j = sLength;
|
||||
j > 0 && sBytes[sLength - j] == 0; j--);
|
||||
|
||||
System.arraycopy(rBytes, rLength - i, outseq, size - i, i);
|
||||
System.arraycopy(sBytes, sLength - j, outseq, size * 2 - j, j);
|
||||
|
||||
return outseq;
|
||||
} else {
|
||||
// Return the DER-encoded ASN.1 form
|
||||
try {
|
||||
DerOutputStream outseq = new DerOutputStream(100);
|
||||
outseq.putInteger(r);
|
||||
outseq.putInteger(s);
|
||||
DerValue result = new DerValue(DerValue.tag_Sequence,
|
||||
outseq.toByteArray());
|
||||
|
||||
return result.toByteArray();
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new SignatureException("error encoding signature");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify all the data thus far updated.
|
||||
*
|
||||
* @param signature the alledged signature, encoded using the
|
||||
* @param signature the alleged signature, encoded using the
|
||||
* Canonical Encoding Rules, as a sequence of integers, r and s.
|
||||
*
|
||||
* @exception SignatureException if the signature object was not
|
||||
@ -230,8 +270,13 @@ abstract class DSA extends SignatureSpi {
|
||||
/**
|
||||
* Verify all the data thus far updated.
|
||||
*
|
||||
* @param signature the alledged signature, encoded using the
|
||||
* Canonical Encoding Rules, as a sequence of integers, r and s.
|
||||
* @param signature the alleged signature, encoded using the
|
||||
* format indicated by {@code p1363Format}. If {@code p1363Format}
|
||||
* is {@code false} (the default), then the signature is formatted
|
||||
* according to the Canonical Encoding Rules, as a DER sequence of
|
||||
* Integers, r and s. If {@code p1363Format} is {@code false},
|
||||
* the signature is in the IEEE P1363 format, which is the
|
||||
* concatenation or r and s.
|
||||
*
|
||||
* @param offset the offset to start from in the array of bytes.
|
||||
*
|
||||
@ -248,16 +293,28 @@ abstract class DSA extends SignatureSpi {
|
||||
|
||||
BigInteger r = null;
|
||||
BigInteger s = null;
|
||||
// first decode the signature.
|
||||
try {
|
||||
DerInputStream in = new DerInputStream(signature, offset, length);
|
||||
DerValue[] values = in.getSequence(2);
|
||||
|
||||
r = values[0].getBigInteger();
|
||||
s = values[1].getBigInteger();
|
||||
if (p1363Format) {
|
||||
if ((length & 1) == 1) {
|
||||
// length of signature byte array should be even
|
||||
throw new SignatureException("invalid signature format");
|
||||
}
|
||||
int mid = length/2;
|
||||
r = new BigInteger(Arrays.copyOfRange(signature, 0, mid));
|
||||
s = new BigInteger(Arrays.copyOfRange(signature, mid, length));
|
||||
} else {
|
||||
// first decode the signature.
|
||||
try {
|
||||
DerInputStream in = new DerInputStream(signature, offset,
|
||||
length);
|
||||
DerValue[] values = in.getSequence(2);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new SignatureException("invalid encoding for signature");
|
||||
r = values[0].getBigInteger();
|
||||
s = values[1].getBigInteger();
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new SignatureException("invalid encoding for signature");
|
||||
}
|
||||
}
|
||||
|
||||
// some implementations do not correctly encode values in the ASN.1
|
||||
@ -420,6 +477,15 @@ abstract class DSA extends SignatureSpi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SHA224withDSA implementation that uses the IEEE P1363 format.
|
||||
*/
|
||||
public static final class SHA224withDSAinP1363Format extends DSA {
|
||||
public SHA224withDSAinP1363Format() throws NoSuchAlgorithmException {
|
||||
super(MessageDigest.getInstance("SHA-224"), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard SHA256withDSA implementation as defined in FIPS186-3.
|
||||
*/
|
||||
@ -429,6 +495,15 @@ abstract class DSA extends SignatureSpi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SHA256withDSA implementation that uses the IEEE P1363 format.
|
||||
*/
|
||||
public static final class SHA256withDSAinP1363Format extends DSA {
|
||||
public SHA256withDSAinP1363Format() throws NoSuchAlgorithmException {
|
||||
super(MessageDigest.getInstance("SHA-256"), true);
|
||||
}
|
||||
}
|
||||
|
||||
static class LegacyDSA extends DSA {
|
||||
/* The random seed used to generate k */
|
||||
private int[] kSeed;
|
||||
@ -441,7 +516,12 @@ abstract class DSA extends SignatureSpi {
|
||||
private int[] kSeedLast;
|
||||
|
||||
public LegacyDSA(MessageDigest md) throws NoSuchAlgorithmException {
|
||||
super(md);
|
||||
this(md, false);
|
||||
}
|
||||
|
||||
private LegacyDSA(MessageDigest md, boolean p1363Format)
|
||||
throws NoSuchAlgorithmException {
|
||||
super(md, p1363Format);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -636,6 +716,9 @@ abstract class DSA extends SignatureSpi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard SHA1withDSA implementation.
|
||||
*/
|
||||
public static final class SHA1withDSA extends LegacyDSA {
|
||||
public SHA1withDSA() throws NoSuchAlgorithmException {
|
||||
super(MessageDigest.getInstance("SHA-1"));
|
||||
@ -643,13 +726,22 @@ abstract class DSA extends SignatureSpi {
|
||||
}
|
||||
|
||||
/**
|
||||
* RawDSA implementation.
|
||||
* SHA1withDSA implementation that uses the IEEE P1363 format.
|
||||
*/
|
||||
public static final class SHA1withDSAinP1363Format extends LegacyDSA {
|
||||
public SHA1withDSAinP1363Format() throws NoSuchAlgorithmException {
|
||||
super(MessageDigest.getInstance("SHA-1"), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw DSA.
|
||||
*
|
||||
* RawDSA requires the data to be exactly 20 bytes long. If it is
|
||||
* Raw DSA requires the data to be exactly 20 bytes long. If it is
|
||||
* not, a SignatureException is thrown when sign()/verify() is called
|
||||
* per JCA spec.
|
||||
*/
|
||||
public static final class RawDSA extends LegacyDSA {
|
||||
static class Raw extends LegacyDSA {
|
||||
// Internal special-purpose MessageDigest impl for RawDSA
|
||||
// Only override whatever methods used
|
||||
// NOTE: no clone support
|
||||
@ -719,8 +811,27 @@ abstract class DSA extends SignatureSpi {
|
||||
}
|
||||
}
|
||||
|
||||
private Raw(boolean p1363Format) throws NoSuchAlgorithmException {
|
||||
super(new NullDigest20(), p1363Format);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard Raw DSA implementation.
|
||||
*/
|
||||
public static final class RawDSA extends Raw {
|
||||
public RawDSA() throws NoSuchAlgorithmException {
|
||||
super(new NullDigest20());
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw DSA implementation that uses the IEEE P1363 format.
|
||||
*/
|
||||
public static final class RawDSAinP1363Format extends Raw {
|
||||
public RawDSAinP1363Format() throws NoSuchAlgorithmException {
|
||||
super(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -130,6 +130,15 @@ final class SunEntries {
|
||||
map.put("Signature.SHA256withDSA",
|
||||
"sun.security.provider.DSA$SHA256withDSA");
|
||||
|
||||
map.put("Signature.SHA1withDSAinP1363Format",
|
||||
"sun.security.provider.DSA$SHA1withDSAinP1363Format");
|
||||
map.put("Signature.NONEwithDSAinP1363Format",
|
||||
"sun.security.provider.DSA$RawDSAinP1363Format");
|
||||
map.put("Signature.SHA224withDSAinP1363Format",
|
||||
"sun.security.provider.DSA$SHA224withDSAinP1363Format");
|
||||
map.put("Signature.SHA256withDSAinP1363Format",
|
||||
"sun.security.provider.DSA$SHA256withDSAinP1363Format");
|
||||
|
||||
String dsaKeyClasses = "java.security.interfaces.DSAPublicKey" +
|
||||
"|java.security.interfaces.DSAPrivateKey";
|
||||
map.put("Signature.SHA1withDSA SupportedKeyClasses", dsaKeyClasses);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -171,8 +171,9 @@ public class DisabledAlgorithmConstraints implements AlgorithmConstraints {
|
||||
// OAEPWith<digest>And<mgf>Padding
|
||||
// <digest>with<encryption>
|
||||
// <digest>with<encryption>and<mgf>
|
||||
// <digest>with<encryption>in<format>
|
||||
Pattern pattern =
|
||||
Pattern.compile("with|and", Pattern.CASE_INSENSITIVE);
|
||||
Pattern.compile("with|and|in", Pattern.CASE_INSENSITIVE);
|
||||
String[] tokens = pattern.split(transTocken);
|
||||
|
||||
for (String token : tokens) {
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
// permissions required by each component
|
||||
grant codeBase "jrt:/java.corba" {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
|
||||
grant codeBase "jrt:/jdk.zipfs" {
|
||||
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
|
||||
permission java.lang.RuntimePermission "fileSystemProvider";
|
||||
|
||||
@ -265,26 +265,17 @@ LoadMSVCRT()
|
||||
* assumed to be present in the "JRE path" directory. If it is not found
|
||||
* there (or "JRE path" fails to resolve), skip the explicit load and let
|
||||
* nature take its course, which is likely to be a failure to execute.
|
||||
* This is clearly completely specific to the exact compiler version
|
||||
* which isn't very nice, but its hardly the only place.
|
||||
* No attempt to look for compiler versions in between 2003 and 2010
|
||||
* as we aren't supporting building with those.
|
||||
* The makefiles will provide the correct lib contained in quotes in the
|
||||
* macro MSVCR_DLL_NAME.
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER < 1400
|
||||
#define CRT_DLL "msvcr71.dll"
|
||||
#endif
|
||||
#if _MSC_VER >= 1600
|
||||
#define CRT_DLL "msvcr100.dll"
|
||||
#endif
|
||||
#ifdef CRT_DLL
|
||||
#ifdef MSVCR_DLL_NAME
|
||||
if (GetJREPath(crtpath, MAXPATHLEN)) {
|
||||
if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") +
|
||||
JLI_StrLen(CRT_DLL) >= MAXPATHLEN) {
|
||||
JLI_StrLen(MSVCR_DLL_NAME) >= MAXPATHLEN) {
|
||||
JLI_ReportErrorMessage(JRE_ERROR11);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(void)JLI_StrCat(crtpath, "\\bin\\" CRT_DLL); /* Add crt dll */
|
||||
(void)JLI_StrCat(crtpath, "\\bin\\" MSVCR_DLL_NAME); /* Add crt dll */
|
||||
JLI_TraceLauncher("CRT path is %s\n", crtpath);
|
||||
if (_access(crtpath, 0) == 0) {
|
||||
if (LoadLibrary(crtpath) == 0) {
|
||||
@ -293,8 +284,24 @@ LoadMSVCRT()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CRT_DLL */
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* MSVCR_DLL_NAME */
|
||||
#ifdef MSVCP_DLL_NAME
|
||||
if (GetJREPath(crtpath, MAXPATHLEN)) {
|
||||
if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") +
|
||||
JLI_StrLen(MSVCP_DLL_NAME) >= MAXPATHLEN) {
|
||||
JLI_ReportErrorMessage(JRE_ERROR11);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
(void)JLI_StrCat(crtpath, "\\bin\\" MSVCP_DLL_NAME); /* Add prt dll */
|
||||
JLI_TraceLauncher("PRT path is %s\n", crtpath);
|
||||
if (_access(crtpath, 0) == 0) {
|
||||
if (LoadLibrary(crtpath) == 0) {
|
||||
JLI_ReportErrorMessage(DLL_ERROR4, crtpath);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* MSVCP_DLL_NAME */
|
||||
loaded = 1;
|
||||
}
|
||||
return JNI_TRUE;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -46,8 +46,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
|
||||
|
||||
/**
|
||||
* A {@code DataFlavor} provides meta information about data. {@code DataFlavor}
|
||||
* is typically used to access data on the clipboard, or during
|
||||
@ -137,7 +135,7 @@ public class DataFlavor implements Externalizable, Cloneable {
|
||||
try {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(GET_CLASSLOADER_PERMISSION);
|
||||
sm.checkPermission(new RuntimePermission("getClassLoader"));
|
||||
}
|
||||
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
||||
try {
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -215,7 +215,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable {
|
||||
line = line.substring(0, line.length() - 1) + reader.readLine().trim();
|
||||
}
|
||||
int delimiterPosition = line.indexOf('=');
|
||||
String key = line.substring(0, delimiterPosition).replaceAll("\\ ", " ");
|
||||
String key = line.substring(0, delimiterPosition).replace("\\ ", " ");
|
||||
String[] values = line.substring(delimiterPosition + 1, line.length()).split(",");
|
||||
for (String value : values) {
|
||||
try {
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -68,8 +68,9 @@ public abstract class AquaBorder implements Border, UIResource {
|
||||
painter.state.set(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
return sizeVariant.margins;
|
||||
return (Insets) sizeVariant.margins.clone();
|
||||
}
|
||||
|
||||
protected AquaBorder deriveBorderForSize(final Size size) {
|
||||
@ -130,8 +131,10 @@ public abstract class AquaBorder implements Border, UIResource {
|
||||
return (focusable != null && focusable instanceof JComponent && ((JComponent)focusable).hasFocus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() { return false; }
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
painter.paint(g, c, x, y, w, h);
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
|
||||
actionMap.put("aquaSelectNext", highlightNextAction);
|
||||
actionMap.put("aquaSelectPrevious", highlightPreviousAction);
|
||||
actionMap.put("aquaEnterPressed", triggerSelectionAction);
|
||||
actionMap.put("enterPressed", triggerSelectionAction);
|
||||
actionMap.put("aquaSpacePressed", toggleSelectionAction);
|
||||
|
||||
actionMap.put("aquaSelectHome", highlightFirstAction);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1098,8 +1098,15 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
super(f);
|
||||
}
|
||||
|
||||
public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
|
||||
super.getTableCellRendererComponent(list, value, isSelected, false, index, col); // No focus border, thanks
|
||||
public Component getTableCellRendererComponent(final JTable list,
|
||||
final Object value,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus,
|
||||
final int index,
|
||||
final int col) {
|
||||
super.getTableCellRendererComponent(list, value, isSelected, false,
|
||||
index,
|
||||
col); // No focus border, thanks
|
||||
final File file = (File)value;
|
||||
final JFileChooser fc = getFileChooser();
|
||||
setText(fc.getName(file));
|
||||
@ -1115,8 +1122,14 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
super(f);
|
||||
}
|
||||
|
||||
public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
|
||||
super.getTableCellRendererComponent(list, value, isSelected, false, index, col);
|
||||
public Component getTableCellRendererComponent(final JTable list,
|
||||
final Object value,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus,
|
||||
final int index,
|
||||
final int col) {
|
||||
super.getTableCellRendererComponent(list, value, isSelected, false,
|
||||
index, col);
|
||||
final File file = (File)fFileList.getValueAt(index, 0);
|
||||
setEnabled(isSelectableInList(file));
|
||||
final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT);
|
||||
@ -1132,14 +1145,17 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
return PREF_SIZE;
|
||||
return new Dimension(PREF_WIDTH, PREF_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
return MIN_SIZE;
|
||||
return new Dimension(MIN_WIDTH, MIN_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(final JComponent c) {
|
||||
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
@ -1819,12 +1835,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
private static final int PREF_WIDTH = 550;
|
||||
private static final int PREF_HEIGHT = 400;
|
||||
private static final Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
|
||||
|
||||
private static final int MIN_WIDTH = 400;
|
||||
private static final int MIN_HEIGHT = 250;
|
||||
private static final Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
|
||||
|
||||
private static final int LIST_MIN_WIDTH = 400;
|
||||
private static final int LIST_MIN_HEIGHT = 100;
|
||||
private static final Dimension LIST_MIN_SIZE = new Dimension(LIST_MIN_WIDTH, LIST_MIN_HEIGHT);
|
||||
|
||||
@ -214,7 +214,7 @@ public class AquaKeyBindings {
|
||||
"PAGE_DOWN", "aquaSelectPageDown",
|
||||
"HOME", "aquaSelectHome",
|
||||
"END", "aquaSelectEnd",
|
||||
"ENTER", "aquaEnterPressed",
|
||||
"ENTER", "enterPressed",
|
||||
"UP", "aquaSelectPrevious",
|
||||
"KP_UP", "aquaSelectPrevious",
|
||||
"DOWN", "aquaSelectNext",
|
||||
|
||||
@ -77,14 +77,72 @@ public final class CFont extends PhysicalFont {
|
||||
}
|
||||
|
||||
private static native long createNativeFont(final String nativeFontName,
|
||||
final int style,
|
||||
final boolean isFakeItalic);
|
||||
final int style);
|
||||
private static native void disposeNativeFont(final long nativeFontPtr);
|
||||
|
||||
private boolean isFakeItalic;
|
||||
private String nativeFontName;
|
||||
private long nativeFontPtr;
|
||||
|
||||
private native float getWidthNative(final long nativeFontPtr);
|
||||
private native float getWeightNative(final long nativeFontPtr);
|
||||
|
||||
private int fontWidth = -1;
|
||||
private int fontWeight = -1;
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
if (fontWidth == -1) {
|
||||
// Apple use a range of -1 -> +1, where 0.0 is normal
|
||||
// OpenType uses a % range from 50% -> 200% where 100% is normal
|
||||
// and maps these onto the integer values 1->9.
|
||||
// Since that is what Font2D.getWidth() expects, remap to that.
|
||||
float fw = getWidthNative(getNativeFontPtr());
|
||||
if (fw == 0.0) { // short cut the common case
|
||||
fontWidth = Font2D.FWIDTH_NORMAL;
|
||||
return fontWidth;
|
||||
}
|
||||
fw += 1.0; fw *= 100.0;
|
||||
if (fw <= 50.0) {
|
||||
fontWidth = 1;
|
||||
} else if (fw <= 62.5) {
|
||||
fontWidth = 2;
|
||||
} else if (fw <= 75.0) {
|
||||
fontWidth = 3;
|
||||
} else if (fw <= 87.5) {
|
||||
fontWidth = 4;
|
||||
} else if (fw <= 100.0) {
|
||||
fontWidth = 5;
|
||||
} else if (fw <= 112.5) {
|
||||
fontWidth = 6;
|
||||
} else if (fw <= 125.0) {
|
||||
fontWidth = 7;
|
||||
} else if (fw <= 150.0) {
|
||||
fontWidth = 8;
|
||||
} else {
|
||||
fontWidth = 9;
|
||||
}
|
||||
}
|
||||
return fontWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight() {
|
||||
if (fontWeight == -1) {
|
||||
// Apple use a range of -1 -> +1, where 0 is medium/regular
|
||||
// Map this on to the OpenType range of 100->900 where
|
||||
// 500 is medium/regular.
|
||||
// We'll actually map to 0->1000 but that's close enough.
|
||||
float fw = getWeightNative(getNativeFontPtr());
|
||||
if (fw == 0) {
|
||||
return Font2D.FWEIGHT_NORMAL;
|
||||
}
|
||||
fw += 1.0; fw *= 500;
|
||||
fontWeight = (int)fw;
|
||||
}
|
||||
return fontWeight;
|
||||
}
|
||||
|
||||
// this constructor is called from CFontWrapper.m
|
||||
public CFont(String name) {
|
||||
this(name, name);
|
||||
@ -94,10 +152,11 @@ public final class CFont extends PhysicalFont {
|
||||
handle = new Font2DHandle(this);
|
||||
fullName = name;
|
||||
familyName = inFamilyName;
|
||||
nativeFontName = inFamilyName;
|
||||
nativeFontName = fullName;
|
||||
setStyle();
|
||||
}
|
||||
|
||||
/* Called from CFontManager too */
|
||||
public CFont(CFont other, String logicalFamilyName) {
|
||||
handle = new Font2DHandle(this);
|
||||
fullName = logicalFamilyName;
|
||||
@ -109,6 +168,7 @@ public final class CFont extends PhysicalFont {
|
||||
|
||||
public CFont createItalicVariant() {
|
||||
CFont font = new CFont(this, familyName);
|
||||
font.nativeFontName = fullName;
|
||||
font.fullName =
|
||||
fullName + (style == Font.BOLD ? "" : "-") + "Italic-Derived";
|
||||
font.style |= Font.ITALIC;
|
||||
@ -118,7 +178,7 @@ public final class CFont extends PhysicalFont {
|
||||
|
||||
protected synchronized long getNativeFontPtr() {
|
||||
if (nativeFontPtr == 0L) {
|
||||
nativeFontPtr = createNativeFont(nativeFontName, style, isFakeItalic);
|
||||
nativeFontPtr = createNativeFont(nativeFontName, style);
|
||||
}
|
||||
return nativeFontPtr;
|
||||
}
|
||||
|
||||
@ -252,13 +252,42 @@ public final class CFontManager extends SunFontManager {
|
||||
final CFont font = new CFont(fontName, fontFamilyName);
|
||||
|
||||
registerGenericFont(font);
|
||||
}
|
||||
|
||||
if ((font.getStyle() & Font.ITALIC) == 0) {
|
||||
registerGenericFont(font.createItalicVariant(), true);
|
||||
void registerItalicDerived() {
|
||||
FontFamily[] famArr = FontFamily.getAllFontFamilies();
|
||||
for (int i=0; i<famArr.length; i++) {
|
||||
FontFamily family = famArr[i];
|
||||
|
||||
Font2D f2dPlain = family.getFont(Font.PLAIN);
|
||||
if (f2dPlain != null && !(f2dPlain instanceof CFont)) continue;
|
||||
Font2D f2dBold = family.getFont(Font.BOLD);
|
||||
if (f2dBold != null && !(f2dBold instanceof CFont)) continue;
|
||||
Font2D f2dItalic = family.getFont(Font.ITALIC);
|
||||
if (f2dItalic != null && !(f2dItalic instanceof CFont)) continue;
|
||||
Font2D f2dBoldItalic = family.getFont(Font.BOLD|Font.ITALIC);
|
||||
if (f2dBoldItalic != null && !(f2dBoldItalic instanceof CFont)) continue;
|
||||
|
||||
CFont plain = (CFont)f2dPlain;
|
||||
CFont bold = (CFont)f2dBold;
|
||||
CFont italic = (CFont)f2dItalic;
|
||||
CFont boldItalic = (CFont)f2dBoldItalic;
|
||||
|
||||
if (bold == null) bold = plain;
|
||||
if (plain == null && bold == null) continue;
|
||||
if (italic != null && boldItalic != null) continue;
|
||||
if (plain != null && italic == null) {
|
||||
registerGenericFont(plain.createItalicVariant(), true);
|
||||
}
|
||||
if (bold != null && boldItalic == null) {
|
||||
registerGenericFont(bold.createItalicVariant(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object waitForFontsToBeLoaded = new Object();
|
||||
private boolean loadedAllFonts = false;
|
||||
|
||||
public void loadFonts()
|
||||
{
|
||||
synchronized(waitForFontsToBeLoaded)
|
||||
@ -267,7 +296,11 @@ public final class CFontManager extends SunFontManager {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
loadNativeFonts();
|
||||
if (!loadedAllFonts) {
|
||||
loadNativeFonts();
|
||||
registerItalicDerived();
|
||||
loadedAllFonts = true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -890,9 +890,9 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod");
|
||||
// text, or 'text in progress'. We also need to send the event if we get an insert text out of the blue!
|
||||
// (i.e., when the user uses the Character palette or Inkwell), or when the string to insert is a complex
|
||||
// Unicode value.
|
||||
NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
NSUInteger utf16Length = [aString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
|
||||
|
||||
if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) {
|
||||
if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) {
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
|
||||
static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");
|
||||
|
||||
@ -35,15 +35,11 @@
|
||||
#import "AWTStrike.h"
|
||||
#import "CoreTextSupport.h"
|
||||
|
||||
|
||||
#define DEBUG
|
||||
|
||||
@implementation AWTFont
|
||||
|
||||
- (id) initWithFont:(NSFont *)font isFakeItalic:(BOOL)isFakeItalic {
|
||||
- (id) initWithFont:(NSFont *)font {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
fIsFakeItalic = isFakeItalic;
|
||||
fFont = [font retain];
|
||||
fNativeCGFont = CTFontCopyGraphicsFont((CTFontRef)font, NULL);
|
||||
}
|
||||
@ -72,7 +68,6 @@
|
||||
|
||||
+ (AWTFont *) awtFontForName:(NSString *)name
|
||||
style:(int)style
|
||||
isFakeItalic:(BOOL)isFakeItalic
|
||||
{
|
||||
// create font with family & size
|
||||
NSFont *nsFont = [NSFont fontWithName:name size:1.0];
|
||||
@ -95,7 +90,7 @@
|
||||
nsFont = [[NSFontManager sharedFontManager] convertFont:nsFont toHaveTrait:NSBoldFontMask];
|
||||
}
|
||||
|
||||
return [[[AWTFont alloc] initWithFont:nsFont isFakeItalic:isFakeItalic] autorelease];
|
||||
return [[[AWTFont alloc] initWithFont:nsFont] autorelease];
|
||||
}
|
||||
|
||||
+ (NSFont *) nsFontForJavaFont:(jobject)javaFont env:(JNIEnv *)env {
|
||||
@ -354,7 +349,7 @@ JNF_COCOA_EXIT(env);
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_sun_font_CFont_createNativeFont
|
||||
(JNIEnv *env, jclass clazz,
|
||||
jstring nativeFontName, jint style, jboolean isFakeItalic)
|
||||
jstring nativeFontName, jint style)
|
||||
{
|
||||
AWTFont *awtFont = nil;
|
||||
|
||||
@ -362,8 +357,7 @@ JNF_COCOA_ENTER(env);
|
||||
|
||||
awtFont =
|
||||
[AWTFont awtFontForName:JNFJavaToNSString(env, nativeFontName)
|
||||
style:style
|
||||
isFakeItalic:isFakeItalic]; // autoreleased
|
||||
style:style]; // autoreleased
|
||||
|
||||
if (awtFont) {
|
||||
CFRetain(awtFont); // GC
|
||||
@ -374,6 +368,52 @@ JNF_COCOA_EXIT(env);
|
||||
return ptr_to_jlong(awtFont);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_CFont
|
||||
* Method: getWidthNative
|
||||
* Signature: (J)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL
|
||||
Java_sun_font_CFont_getWidthNative
|
||||
(JNIEnv *env, jobject cfont, jlong awtFontPtr)
|
||||
{
|
||||
float widthVal;
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
AWTFont *awtFont = (AWTFont *)jlong_to_ptr(awtFontPtr);
|
||||
NSFont* nsFont = awtFont->fFont;
|
||||
NSFontDescriptor *fontDescriptor = nsFont.fontDescriptor;
|
||||
NSDictionary *fontTraits = [fontDescriptor objectForKey : NSFontTraitsAttribute];
|
||||
NSNumber *width = [fontTraits objectForKey : NSFontWidthTrait];
|
||||
widthVal = (float)[width floatValue];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
return (jfloat)widthVal;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_CFont
|
||||
* Method: getWeightNative
|
||||
* Signature: (J)F
|
||||
*/
|
||||
JNIEXPORT jfloat JNICALL
|
||||
Java_sun_font_CFont_getWeightNative
|
||||
(JNIEnv *env, jobject cfont, jlong awtFontPtr)
|
||||
{
|
||||
float weightVal;
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
AWTFont *awtFont = (AWTFont *)jlong_to_ptr(awtFontPtr);
|
||||
NSFont* nsFont = awtFont->fFont;
|
||||
NSFontDescriptor *fontDescriptor = nsFont.fontDescriptor;
|
||||
NSDictionary *fontTraits = [fontDescriptor objectForKey : NSFontTraitsAttribute];
|
||||
NSNumber *weight = [fontTraits objectForKey : NSFontWeightTrait];
|
||||
weightVal = (float)[weight floatValue];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
return (jfloat)weightVal;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_font_CFont
|
||||
* Method: disposeNativeFont
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,8 +43,6 @@ import org.w3c.dom.Node;
|
||||
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.awt.image.SampleModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.DataBufferByte;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.IndexColorModel;
|
||||
@ -1048,7 +1046,13 @@ public class JPEGImageWriter extends ImageWriter {
|
||||
|
||||
// Call the writer, who will call back for every scanline
|
||||
|
||||
processImageStarted(currentImage);
|
||||
clearAbortRequest();
|
||||
cbLock.lock();
|
||||
try {
|
||||
processImageStarted(currentImage);
|
||||
} finally {
|
||||
cbLock.unlock();
|
||||
}
|
||||
|
||||
boolean aborted = false;
|
||||
|
||||
@ -1225,6 +1229,23 @@ public class JPEGImageWriter extends ImageWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void clearAbortRequest() {
|
||||
setThreadLock();
|
||||
try {
|
||||
cbLock.check();
|
||||
if (abortRequested()) {
|
||||
super.clearAbortRequest();
|
||||
// reset C structures
|
||||
resetWriter(structPointer);
|
||||
// reset the native destination
|
||||
setDest(structPointer);
|
||||
}
|
||||
} finally {
|
||||
clearThreadLock();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetInternalState() {
|
||||
// reset C structures
|
||||
resetWriter(structPointer);
|
||||
@ -1652,7 +1673,7 @@ public class JPEGImageWriter extends ImageWriter {
|
||||
int vsamp0 = specs[0].VsamplingFactor;
|
||||
for (int i = 1; i < specs.length; i++) {
|
||||
if ((specs[i].HsamplingFactor != hsamp0) ||
|
||||
(specs[i].HsamplingFactor != hsamp0))
|
||||
(specs[i].VsamplingFactor != vsamp0))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -100,7 +100,8 @@ class GTKFileChooserUI extends SynthFileChooserUI {
|
||||
private static Dimension prefListSize = new Dimension(75, 150);
|
||||
|
||||
private static Dimension PREF_SIZE = new Dimension(435, 360);
|
||||
private static Dimension MIN_SIZE = new Dimension(200, 300);
|
||||
private static final int MIN_WIDTH = 200;
|
||||
private static final int MIN_HEIGHT = 300;
|
||||
|
||||
private static Dimension ZERO_ACC_SIZE = new Dimension(1, 1);
|
||||
|
||||
@ -1052,6 +1053,7 @@ class GTKFileChooserUI extends SynthFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(JComponent c) {
|
||||
Dimension prefSize = new Dimension(PREF_SIZE);
|
||||
JComponent accessory = getFileChooser().getAccessory();
|
||||
@ -1067,10 +1069,12 @@ class GTKFileChooserUI extends SynthFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize(JComponent x) {
|
||||
return new Dimension(MIN_SIZE);
|
||||
@Override
|
||||
public Dimension getMinimumSize(JComponent x) {
|
||||
return new Dimension(MIN_WIDTH, MIN_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(JComponent x) {
|
||||
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -65,8 +65,8 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
|
||||
private static Dimension WITH_ACCELERATOR_PREF_SIZE = new Dimension(650, 450);
|
||||
private static Dimension PREF_SIZE = new Dimension(350, 450);
|
||||
private static Dimension MIN_SIZE = new Dimension(200, 300);
|
||||
|
||||
private static final int MIN_WIDTH = 200;
|
||||
private static final int MIN_HEIGHT = 300;
|
||||
private static Dimension PREF_ACC_SIZE = new Dimension(10, 10);
|
||||
private static Dimension ZERO_ACC_SIZE = new Dimension(1, 1);
|
||||
|
||||
@ -628,6 +628,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
return scrollpane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(JComponent c) {
|
||||
Dimension prefSize =
|
||||
(getFileChooser().getAccessory() != null) ? WITH_ACCELERATOR_PREF_SIZE : PREF_SIZE;
|
||||
@ -640,10 +641,12 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize(JComponent x) {
|
||||
return MIN_SIZE;
|
||||
@Override
|
||||
public Dimension getMinimumSize(JComponent x) {
|
||||
return new Dimension(MIN_WIDTH, MIN_HEIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(JComponent x) {
|
||||
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@ -93,7 +93,6 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
|
||||
|
||||
private static int MIN_WIDTH = 425;
|
||||
private static int MIN_HEIGHT = 245;
|
||||
private static Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
|
||||
|
||||
private static int LIST_PREF_WIDTH = 444;
|
||||
private static int LIST_PREF_HEIGHT = 138;
|
||||
@ -642,6 +641,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
|
||||
* @return a <code>Dimension</code> specifying the preferred
|
||||
* width and height of the file chooser
|
||||
*/
|
||||
@Override
|
||||
public Dimension getPreferredSize(JComponent c) {
|
||||
int prefWidth = PREF_SIZE.width;
|
||||
Dimension d = c.getLayout().preferredLayoutSize(c);
|
||||
@ -660,8 +660,9 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
|
||||
* @return a <code>Dimension</code> specifying the minimum
|
||||
* width and height of the file chooser
|
||||
*/
|
||||
@Override
|
||||
public Dimension getMinimumSize(JComponent c) {
|
||||
return MIN_SIZE;
|
||||
return new Dimension(MIN_WIDTH, MIN_HEIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -671,6 +672,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
|
||||
* @return a <code>Dimension</code> specifying the maximum
|
||||
* width and height of the file chooser
|
||||
*/
|
||||
@Override
|
||||
public Dimension getMaximumSize(JComponent c) {
|
||||
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1690,15 +1690,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete references from LightweightDispatcher of a heavyweight parent
|
||||
*/
|
||||
void clearLightweightDispatcherOnRemove(Component removedComponent) {
|
||||
if (parent != null) {
|
||||
parent.clearLightweightDispatcherOnRemove(removedComponent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of JDK version 1.1,
|
||||
* replaced by <code>setVisible(boolean)</code>.
|
||||
@ -6242,7 +6233,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
/**
|
||||
* Indicates whether a class or its superclasses override coalesceEvents.
|
||||
* Must be called with lock on coalesceMap and privileged.
|
||||
* @see checkCoalsecing
|
||||
* @see checkCoalescing
|
||||
*/
|
||||
private static boolean isCoalesceEventsOverriden(Class<?> clazz) {
|
||||
assert Thread.holdsLock(coalesceMap);
|
||||
@ -7083,8 +7074,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
}
|
||||
|
||||
synchronized (getTreeLock()) {
|
||||
clearLightweightDispatcherOnRemove(this);
|
||||
|
||||
if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) {
|
||||
transferFocus(true);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,6 +41,7 @@ import java.io.ObjectStreamField;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.security.AccessController;
|
||||
|
||||
import java.util.EventListener;
|
||||
@ -3321,16 +3322,6 @@ public class Container extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void clearLightweightDispatcherOnRemove(Component removedComponent) {
|
||||
if (dispatcher != null) {
|
||||
dispatcher.removeReferences(removedComponent);
|
||||
} else {
|
||||
//It is a Lightweight Container, should clear parent`s Dispatcher
|
||||
super.clearLightweightDispatcherOnRemove(removedComponent);
|
||||
}
|
||||
}
|
||||
|
||||
final Container getTraversalRoot() {
|
||||
if (isFocusCycleRoot()) {
|
||||
return findTraversalRoot();
|
||||
@ -4431,7 +4422,9 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
|
||||
LightweightDispatcher(Container nativeContainer) {
|
||||
this.nativeContainer = nativeContainer;
|
||||
mouseEventTarget = null;
|
||||
mouseEventTarget = new WeakReference<>(null);
|
||||
targetLastEntered = new WeakReference<>(null);
|
||||
targetLastEnteredDT = new WeakReference<>(null);
|
||||
eventMask = 0;
|
||||
}
|
||||
|
||||
@ -4442,9 +4435,9 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
void dispose() {
|
||||
//System.out.println("Disposing lw dispatcher");
|
||||
stopListeningForOtherDrags();
|
||||
mouseEventTarget = null;
|
||||
targetLastEntered = null;
|
||||
targetLastEnteredDT = null;
|
||||
mouseEventTarget.clear();
|
||||
targetLastEntered.clear();
|
||||
targetLastEnteredDT.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4531,65 +4524,62 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
|
||||
trackMouseEnterExit(mouseOver, e);
|
||||
|
||||
// 4508327 : MOUSE_CLICKED should only go to the recipient of
|
||||
// the accompanying MOUSE_PRESSED, so don't reset mouseEventTarget on a
|
||||
// MOUSE_CLICKED.
|
||||
if (!isMouseGrab(e) && id != MouseEvent.MOUSE_CLICKED) {
|
||||
mouseEventTarget = (mouseOver != nativeContainer) ? mouseOver: null;
|
||||
isCleaned = false;
|
||||
Component met = mouseEventTarget.get();
|
||||
// 4508327 : MOUSE_CLICKED should only go to the recipient of
|
||||
// the accompanying MOUSE_PRESSED, so don't reset mouseEventTarget on a
|
||||
// MOUSE_CLICKED.
|
||||
if (!isMouseGrab(e) && id != MouseEvent.MOUSE_CLICKED) {
|
||||
met = (mouseOver != nativeContainer) ? mouseOver : null;
|
||||
mouseEventTarget = new WeakReference<>(met);
|
||||
}
|
||||
|
||||
if (mouseEventTarget != null) {
|
||||
if (met != null) {
|
||||
switch (id) {
|
||||
case MouseEvent.MOUSE_ENTERED:
|
||||
case MouseEvent.MOUSE_EXITED:
|
||||
break;
|
||||
case MouseEvent.MOUSE_PRESSED:
|
||||
retargetMouseEvent(mouseEventTarget, id, e);
|
||||
break;
|
||||
case MouseEvent.MOUSE_RELEASED:
|
||||
retargetMouseEvent(mouseEventTarget, id, e);
|
||||
break;
|
||||
case MouseEvent.MOUSE_CLICKED:
|
||||
// 4508327: MOUSE_CLICKED should never be dispatched to a Component
|
||||
// other than that which received the MOUSE_PRESSED event. If the
|
||||
// mouse is now over a different Component, don't dispatch the event.
|
||||
// The previous fix for a similar problem was associated with bug
|
||||
// 4155217.
|
||||
if (mouseOver == mouseEventTarget) {
|
||||
retargetMouseEvent(mouseOver, id, e);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
retargetMouseEvent(mouseEventTarget, id, e);
|
||||
break;
|
||||
case MouseEvent.MOUSE_DRAGGED:
|
||||
if (isMouseGrab(e)) {
|
||||
retargetMouseEvent(mouseEventTarget, id, e);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_WHEEL:
|
||||
// This may send it somewhere that doesn't have MouseWheelEvents
|
||||
// enabled. In this case, Component.dispatchEventImpl() will
|
||||
// retarget the event to a parent that DOES have the events enabled.
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINEST) && (mouseOver != null)) {
|
||||
eventLog.finest("retargeting mouse wheel to " +
|
||||
case MouseEvent.MOUSE_ENTERED:
|
||||
case MouseEvent.MOUSE_EXITED:
|
||||
break;
|
||||
case MouseEvent.MOUSE_PRESSED:
|
||||
retargetMouseEvent(met, id, e);
|
||||
break;
|
||||
case MouseEvent.MOUSE_RELEASED:
|
||||
retargetMouseEvent(met, id, e);
|
||||
break;
|
||||
case MouseEvent.MOUSE_CLICKED:
|
||||
// 4508327: MOUSE_CLICKED should never be dispatched to a Component
|
||||
// other than that which received the MOUSE_PRESSED event. If the
|
||||
// mouse is now over a different Component, don't dispatch the event.
|
||||
// The previous fix for a similar problem was associated with bug
|
||||
// 4155217.
|
||||
if (mouseOver == met) {
|
||||
retargetMouseEvent(mouseOver, id, e);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
retargetMouseEvent(met, id, e);
|
||||
break;
|
||||
case MouseEvent.MOUSE_DRAGGED:
|
||||
if (isMouseGrab(e)) {
|
||||
retargetMouseEvent(met, id, e);
|
||||
}
|
||||
break;
|
||||
case MouseEvent.MOUSE_WHEEL:
|
||||
// This may send it somewhere that doesn't have MouseWheelEvents
|
||||
// enabled. In this case, Component.dispatchEventImpl() will
|
||||
// retarget the event to a parent that DOES have the events enabled.
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINEST) && (mouseOver != null)) {
|
||||
eventLog.finest("retargeting mouse wheel to " +
|
||||
mouseOver.getName() + ", " +
|
||||
mouseOver.getClass());
|
||||
}
|
||||
retargetMouseEvent(mouseOver, id, e);
|
||||
break;
|
||||
}
|
||||
retargetMouseEvent(mouseOver, id, e);
|
||||
break;
|
||||
//Consuming of wheel events is implemented in "retargetMouseEvent".
|
||||
if (id != MouseEvent.MOUSE_WHEEL) {
|
||||
e.consume();
|
||||
}
|
||||
//Consuming of wheel events is implemented in "retargetMouseEvent".
|
||||
if (id != MouseEvent.MOUSE_WHEEL) {
|
||||
e.consume();
|
||||
}
|
||||
} else if (isCleaned && id != MouseEvent.MOUSE_WHEEL) {
|
||||
//After mouseEventTarget was removed and cleaned should consume all events
|
||||
//until new mouseEventTarget is found
|
||||
e.consume();
|
||||
}
|
||||
return e.isConsumed();
|
||||
return e.isConsumed();
|
||||
}
|
||||
|
||||
private boolean processDropTargetEvent(SunDropTargetEvent e) {
|
||||
@ -4646,15 +4636,16 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
// drag has an associated drop target. MOUSE_ENTERED comes when the
|
||||
// mouse is in the native container already. To propagate this event
|
||||
// properly we should null out targetLastEntered.
|
||||
targetLastEnteredDT = null;
|
||||
targetLastEnteredDT.clear();
|
||||
} else if (id == MouseEvent.MOUSE_ENTERED) {
|
||||
isMouseDTInNativeContainer = true;
|
||||
} else if (id == MouseEvent.MOUSE_EXITED) {
|
||||
isMouseDTInNativeContainer = false;
|
||||
}
|
||||
targetLastEnteredDT = retargetMouseEnterExit(targetOver, e,
|
||||
targetLastEnteredDT,
|
||||
Component tle = retargetMouseEnterExit(targetOver, e,
|
||||
targetLastEnteredDT.get(),
|
||||
isMouseDTInNativeContainer);
|
||||
targetLastEnteredDT = new WeakReference<>(tle);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4680,9 +4671,10 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
isMouseInNativeContainer = false;
|
||||
stopListeningForOtherDrags();
|
||||
}
|
||||
targetLastEntered = retargetMouseEnterExit(targetOver, e,
|
||||
targetLastEntered,
|
||||
Component tle = retargetMouseEnterExit(targetOver, e,
|
||||
targetLastEntered.get(),
|
||||
isMouseInNativeContainer);
|
||||
targetLastEntered = new WeakReference<>(tle);
|
||||
}
|
||||
|
||||
private Component retargetMouseEnterExit(Component targetOver, MouseEvent e,
|
||||
@ -4944,22 +4936,17 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
* is null, there are currently no events being forwarded to
|
||||
* a subcomponent.
|
||||
*/
|
||||
private transient Component mouseEventTarget;
|
||||
private transient WeakReference<Component> mouseEventTarget;
|
||||
|
||||
/**
|
||||
* The last component entered by the {@code MouseEvent}.
|
||||
*/
|
||||
private transient Component targetLastEntered;
|
||||
private transient WeakReference<Component> targetLastEntered;
|
||||
|
||||
/**
|
||||
* The last component entered by the {@code SunDropTargetEvent}.
|
||||
*/
|
||||
private transient Component targetLastEnteredDT;
|
||||
|
||||
/**
|
||||
* Indicates whether {@code mouseEventTarget} was removed and nulled
|
||||
*/
|
||||
private transient boolean isCleaned;
|
||||
private transient WeakReference<Component> targetLastEnteredDT;
|
||||
|
||||
/**
|
||||
* Is the mouse over the native container.
|
||||
@ -5000,17 +4987,4 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
|
||||
AWTEvent.MOUSE_EVENT_MASK |
|
||||
AWTEvent.MOUSE_MOTION_EVENT_MASK |
|
||||
AWTEvent.MOUSE_WHEEL_EVENT_MASK;
|
||||
|
||||
void removeReferences(Component removedComponent) {
|
||||
if (mouseEventTarget == removedComponent) {
|
||||
isCleaned = true;
|
||||
mouseEventTarget = null;
|
||||
}
|
||||
if (targetLastEntered == removedComponent) {
|
||||
targetLastEntered = null;
|
||||
}
|
||||
if (targetLastEnteredDT == removedComponent) {
|
||||
targetLastEnteredDT = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,7 +182,14 @@ public class EventQueue {
|
||||
|
||||
private FwDispatcher fwDispatcher;
|
||||
|
||||
private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue");
|
||||
private static volatile PlatformLogger eventLog;
|
||||
|
||||
private static final PlatformLogger getEventLog() {
|
||||
if(eventLog == null) {
|
||||
eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue");
|
||||
}
|
||||
return eventLog;
|
||||
}
|
||||
|
||||
static {
|
||||
AWTAccessor.setEventQueueAccessor(
|
||||
@ -762,8 +769,8 @@ public class EventQueue {
|
||||
dispatchThread.stopDispatching();
|
||||
}
|
||||
} else {
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
eventLog.fine("Unable to dispatch event: " + event);
|
||||
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
|
||||
getEventLog().fine("Unable to dispatch event: " + event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -860,8 +867,8 @@ public class EventQueue {
|
||||
* @since 1.2
|
||||
*/
|
||||
public void push(EventQueue newEventQueue) {
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
eventLog.fine("EventQueue.push(" + newEventQueue + ")");
|
||||
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
|
||||
getEventLog().fine("EventQueue.push(" + newEventQueue + ")");
|
||||
}
|
||||
|
||||
pushPopLock.lock();
|
||||
@ -886,8 +893,8 @@ public class EventQueue {
|
||||
// Use getNextEventPrivate() as it doesn't call flushPendingEvents()
|
||||
newEventQueue.postEventPrivate(topQueue.getNextEventPrivate());
|
||||
} catch (InterruptedException ie) {
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
eventLog.fine("Interrupted push", ie);
|
||||
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
|
||||
getEventLog().fine("Interrupted push", ie);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -925,8 +932,8 @@ public class EventQueue {
|
||||
* @since 1.2
|
||||
*/
|
||||
protected void pop() throws EmptyStackException {
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
eventLog.fine("EventQueue.pop(" + this + ")");
|
||||
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
|
||||
getEventLog().fine("EventQueue.pop(" + this + ")");
|
||||
}
|
||||
|
||||
pushPopLock.lock();
|
||||
@ -948,8 +955,8 @@ public class EventQueue {
|
||||
try {
|
||||
prevQueue.postEventPrivate(topQueue.getNextEventPrivate());
|
||||
} catch (InterruptedException ie) {
|
||||
if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
eventLog.fine("Interrupted pop", ie);
|
||||
if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
|
||||
getEventLog().fine("Interrupted pop", ie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -181,7 +181,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
|
||||
* removed from the menu bar, and replaced with the specified menu.
|
||||
* @param m the menu to be set as the help menu
|
||||
*/
|
||||
public void setHelpMenu(Menu m) {
|
||||
public void setHelpMenu(final Menu m) {
|
||||
synchronized (getTreeLock()) {
|
||||
if (helpMenu == m) {
|
||||
return;
|
||||
@ -189,11 +189,11 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
|
||||
if (helpMenu != null) {
|
||||
remove(helpMenu);
|
||||
}
|
||||
if (m.parent != this) {
|
||||
add(m);
|
||||
}
|
||||
helpMenu = m;
|
||||
if (m != null) {
|
||||
if (m.parent != this) {
|
||||
add(m);
|
||||
}
|
||||
m.isHelpMenu = true;
|
||||
m.parent = this;
|
||||
MenuBarPeer peer = (MenuBarPeer)this.peer;
|
||||
@ -242,7 +242,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
|
||||
* @param index the position of the menu to be removed.
|
||||
* @see java.awt.MenuBar#add(java.awt.Menu)
|
||||
*/
|
||||
public void remove(int index) {
|
||||
public void remove(final int index) {
|
||||
synchronized (getTreeLock()) {
|
||||
Menu m = getMenu(index);
|
||||
menus.removeElementAt(index);
|
||||
@ -252,6 +252,10 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
|
||||
m.parent = null;
|
||||
peer.delMenu(index);
|
||||
}
|
||||
if (helpMenu == m) {
|
||||
helpMenu = null;
|
||||
m.isHelpMenu = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,26 +25,23 @@
|
||||
|
||||
package java.awt.image;
|
||||
|
||||
import java.awt.Transparency;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.ImageCapabilities;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import sun.awt.image.BytePackedRaster;
|
||||
import sun.awt.image.ShortComponentRaster;
|
||||
import sun.awt.image.ByteComponentRaster;
|
||||
import sun.awt.image.BytePackedRaster;
|
||||
import sun.awt.image.IntegerComponentRaster;
|
||||
import sun.awt.image.OffScreenImageSource;
|
||||
import sun.awt.image.ShortComponentRaster;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -68,18 +65,14 @@ import sun.awt.image.OffScreenImageSource;
|
||||
* @see Raster
|
||||
* @see WritableRaster
|
||||
*/
|
||||
|
||||
public class BufferedImage extends java.awt.Image
|
||||
implements WritableRenderedImage, Transparency
|
||||
{
|
||||
int imageType = TYPE_CUSTOM;
|
||||
ColorModel colorModel;
|
||||
WritableRaster raster;
|
||||
OffScreenImageSource osis;
|
||||
Hashtable<?, ?> properties;
|
||||
|
||||
boolean isAlphaPremultiplied;// If true, alpha has been premultiplied in
|
||||
// color channels
|
||||
private int imageType = TYPE_CUSTOM;
|
||||
private ColorModel colorModel;
|
||||
private final WritableRaster raster;
|
||||
private OffScreenImageSource osis;
|
||||
private Hashtable<String, Object> properties;
|
||||
|
||||
/**
|
||||
* Image Type Constants
|
||||
@ -328,8 +321,8 @@ public class BufferedImage extends java.awt.Image
|
||||
0x000000ff, // Blue
|
||||
0x0 // Alpha
|
||||
);
|
||||
raster = colorModel.createCompatibleWritableRaster(width,
|
||||
height);
|
||||
raster = colorModel.createCompatibleWritableRaster(width,
|
||||
height);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -355,9 +348,8 @@ public class BufferedImage extends java.awt.Image
|
||||
true, // Alpha Premultiplied
|
||||
DataBuffer.TYPE_INT
|
||||
);
|
||||
|
||||
raster = colorModel.createCompatibleWritableRaster(width,
|
||||
height);
|
||||
raster = colorModel.createCompatibleWritableRaster(width,
|
||||
height);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -368,8 +360,8 @@ public class BufferedImage extends java.awt.Image
|
||||
0x0000ff00, // Green
|
||||
0x00ff0000 // Blue
|
||||
);
|
||||
raster = colorModel.createCompatibleWritableRaster(width,
|
||||
height);
|
||||
raster = colorModel.createCompatibleWritableRaster(width,
|
||||
height);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -642,7 +634,14 @@ public class BufferedImage extends java.awt.Image
|
||||
|
||||
colorModel = cm;
|
||||
this.raster = raster;
|
||||
this.properties = properties;
|
||||
if (properties != null && !properties.isEmpty()) {
|
||||
this.properties = new Hashtable<>();
|
||||
for (final Object key : properties.keySet()) {
|
||||
if (key instanceof String) {
|
||||
this.properties.put((String) key, properties.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
int numBands = raster.getNumBands();
|
||||
boolean isAlphaPre = cm.isAlphaPremultiplied();
|
||||
final boolean isStandard = isStandard(cm, raster);
|
||||
@ -1272,7 +1271,11 @@ public class BufferedImage extends java.awt.Image
|
||||
* or <code>null</code> if no property names are recognized.
|
||||
*/
|
||||
public String[] getPropertyNames() {
|
||||
return null;
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
final Set<String> keys = properties.keySet();
|
||||
return keys.toArray(new String[keys.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2215,10 +2215,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
|
||||
*/
|
||||
public boolean imageUpdate(Image img, int infoflags,
|
||||
int x, int y, int w, int h) {
|
||||
Icon iconDisplayed = getIcon();
|
||||
if (iconDisplayed == null) {
|
||||
return false;
|
||||
}
|
||||
Icon iconDisplayed = null;
|
||||
|
||||
if (!model.isEnabled()) {
|
||||
if (model.isSelected()) {
|
||||
@ -2238,7 +2235,12 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
|
||||
iconDisplayed = getSelectedIcon();
|
||||
}
|
||||
|
||||
if (!SwingUtilities.doesIconReferenceImage(iconDisplayed, img)) {
|
||||
if (iconDisplayed == null) {
|
||||
iconDisplayed = getIcon();
|
||||
}
|
||||
|
||||
if (iconDisplayed == null
|
||||
|| !SwingUtilities.doesIconReferenceImage(iconDisplayed, img)) {
|
||||
// We don't know about this image, disable the notification so
|
||||
// we don't keep repainting.
|
||||
return false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,22 +27,15 @@ package javax.swing;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
import java.util.EventListener;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.VolatileImage;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.peer.LightweightPeer;
|
||||
import java.awt.dnd.DropTarget;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.VetoableChangeListener;
|
||||
import java.beans.VetoableChangeSupport;
|
||||
@ -1868,7 +1861,7 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
|
||||
/**
|
||||
* Overrides <code>Container.getAlignmentY</code> to return
|
||||
* the horizontal alignment.
|
||||
* the vertical alignment.
|
||||
*
|
||||
* @return the value of the <code>alignmentY</code> property
|
||||
* @see #setAlignmentY
|
||||
@ -1882,9 +1875,9 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the horizontal alignment.
|
||||
* Sets the vertical alignment.
|
||||
*
|
||||
* @param alignmentY the new horizontal alignment
|
||||
* @param alignmentY the new vertical alignment
|
||||
* @see #getAlignmentY
|
||||
* @beaninfo
|
||||
* description: The preferred vertical alignment of the component.
|
||||
@ -1897,7 +1890,7 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
|
||||
/**
|
||||
* Overrides <code>Container.getAlignmentX</code> to return
|
||||
* the vertical alignment.
|
||||
* the horizontal alignment.
|
||||
*
|
||||
* @return the value of the <code>alignmentX</code> property
|
||||
* @see #setAlignmentX
|
||||
@ -1911,9 +1904,9 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the vertical alignment.
|
||||
* Sets the horizontal alignment.
|
||||
*
|
||||
* @param alignmentX the new vertical alignment
|
||||
* @param alignmentX the new horizontal alignment
|
||||
* @see #getAlignmentX
|
||||
* @beaninfo
|
||||
* description: The preferred horizontal alignment of the component.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,7 +30,6 @@ import java.awt.im.InputContext;
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.*;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.text.*;
|
||||
@ -151,7 +150,7 @@ import javax.swing.text.*;
|
||||
* will be created to handle formatting of numbers:
|
||||
* <pre>
|
||||
* JFormattedTextField tf = new JFormattedTextField();
|
||||
* tf.setValue(new Number(100));
|
||||
* tf.setValue(100);
|
||||
* </pre>
|
||||
* <p>
|
||||
* <strong>Warning:</strong> As the <code>AbstractFormatter</code> will
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1287,10 +1287,10 @@ public class JSlider extends JComponent implements SwingConstants, Accessible {
|
||||
return paintTrack;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines whether the track is painted on the slider.
|
||||
* By default, this property is {@code true}.
|
||||
* Determines whether the track is painted on the slider. By default, this
|
||||
* property is {@code true}. It is up to the look and feel to honor this
|
||||
* property, some may choose to ignore it.
|
||||
*
|
||||
* @param b whether or not to paint the slider track
|
||||
* @see #getPaintTrack
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user