mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
Merge
This commit is contained in:
commit
3cd103bbeb
289 changed files with 12747 additions and 7091 deletions
|
@ -397,12 +397,10 @@ else
|
||||||
INCLUDE_SA = true
|
INCLUDE_SA = true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CROSS_COMPILE_ARCH
|
# X11 headers are not under /usr/include
|
||||||
# X11 headers are not under /usr/include
|
OTHER_CFLAGS += -I$(OPENWIN_HOME)/include
|
||||||
OTHER_CFLAGS += -I$(OPENWIN_HOME)/include
|
OTHER_CXXFLAGS += -I$(OPENWIN_HOME)/include
|
||||||
OTHER_CXXFLAGS += -I$(OPENWIN_HOME)/include
|
OTHER_CPPFLAGS += -I$(OPENWIN_HOME)/include
|
||||||
OTHER_CPPFLAGS += -I$(OPENWIN_HOME)/include
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIB_LOCATION ?= $(LIBDIR)
|
LIB_LOCATION ?= $(LIBDIR)
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,7 @@ FILES_java += java/util/prefs/MacOSXPreferences.java \
|
||||||
java/util/prefs/MacOSXPreferencesFactory.java
|
java/util/prefs/MacOSXPreferencesFactory.java
|
||||||
|
|
||||||
CFLAGS_$(VARIANT)/java_props_md.o = -Os -x objective-c
|
CFLAGS_$(VARIANT)/java_props_md.o = -Os -x objective-c
|
||||||
|
CFLAGS_$(VARIANT)/java_props_macosx.o = -Os -x objective-c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -38,31 +38,31 @@ FILES_compiled_properties_orig := $(FILES_compiled_properties)
|
||||||
# only FILES_java and FILES_compiled_properties variables will be picked up
|
# only FILES_java and FILES_compiled_properties variables will be picked up
|
||||||
#
|
#
|
||||||
# $(BUILDDIR)/java/util/FILES_java.gmk & $(BUILDDIR)/java/util/FILES_properties.gmk
|
# $(BUILDDIR)/java/util/FILES_java.gmk & $(BUILDDIR)/java/util/FILES_properties.gmk
|
||||||
# contain "sun.util.resources" for US language support
|
# contain "sun.util.resources" for EN language support
|
||||||
|
|
||||||
include $(BUILDDIR)/java/util/FILES_java.gmk
|
include $(BUILDDIR)/java/util/FILES_java.gmk
|
||||||
include $(BUILDDIR)/java/util/FILES_properties.gmk
|
include $(BUILDDIR)/java/util/FILES_properties.gmk
|
||||||
|
|
||||||
US_Resources_java := $(FILES_java)
|
EN_Resources_java := $(FILES_java)
|
||||||
US_Resources_properties := $(FILES_compiled_properties)
|
EN_Resources_properties := $(FILES_compiled_properties)
|
||||||
|
|
||||||
# $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for
|
# $(BUILDDIR)/java/text/FILES_java.gmk contains the "sun.text.resources" for
|
||||||
# US language support
|
# EN language support
|
||||||
|
|
||||||
include $(BUILDDIR)/java/text/base/FILES_java.gmk
|
include $(BUILDDIR)/java/text/base/FILES_java.gmk
|
||||||
|
|
||||||
US_Resources_java += $(FILES_java)
|
EN_Resources_java += $(FILES_java)
|
||||||
|
|
||||||
FILES_compiled_properties=
|
FILES_compiled_properties=
|
||||||
|
|
||||||
# $(BUILDDIR)/sun/text/FILES_java.gmk & $(BUILDDIR)/sun/text/FILES_properties.gmk
|
# $(BUILDDIR)/sun/text/FILES_java.gmk & $(BUILDDIR)/sun/text/FILES_properties.gmk
|
||||||
# contain both resources for Non-US language support
|
# contain both resources for Non-EN language support
|
||||||
|
|
||||||
include $(BUILDDIR)/sun/text/FILES_java.gmk
|
include $(BUILDDIR)/sun/text/FILES_java.gmk
|
||||||
include $(BUILDDIR)/sun/text/FILES_properties.gmk
|
include $(BUILDDIR)/sun/text/FILES_properties.gmk
|
||||||
|
|
||||||
NonUS_Resources_java := $(FILES_java)
|
NonEN_Resources_java := $(FILES_java)
|
||||||
NonUS_Resources_properties := $(FILES_compiled_properties)
|
NonEN_Resources_properties := $(FILES_compiled_properties)
|
||||||
|
|
||||||
# Restore the orignal FILES_java & FILES_compiled_properties variables
|
# Restore the orignal FILES_java & FILES_compiled_properties variables
|
||||||
FILES_java := $(FILES_java_orig)
|
FILES_java := $(FILES_java_orig)
|
||||||
|
@ -80,30 +80,30 @@ RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames
|
||||||
ifeq ($(PLATFORM), macosx)
|
ifeq ($(PLATFORM), macosx)
|
||||||
|
|
||||||
$(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
|
$(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
|
||||||
@$(RM) $@.tmp.us $@.tmp.nonus;
|
@$(RM) $@.tmp.en $@.tmp.nonen;
|
||||||
@$(prep-target)
|
@$(prep-target)
|
||||||
@$(ECHO) $(US_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.us;
|
@$(ECHO) $(EN_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.en;
|
||||||
@$(ECHO) $(US_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.us;
|
@$(ECHO) $(EN_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.en;
|
||||||
@$(ECHO) $(NonUS_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.nonus;
|
@$(ECHO) $(NonEN_Resources_properties) | $(NAWK) 'gsub(/.properties/,"\n") {print}' > $@.tmp.nonen;
|
||||||
@$(ECHO) $(NonUS_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.nonus;
|
@$(ECHO) $(NonEN_Resources_java) | $(NAWK) 'gsub(/.java/,"\n") {print}' >> $@.tmp.nonen;
|
||||||
NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
|
NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
|
||||||
$(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.us \
|
$(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.en \
|
||||||
$@.tmp.nonus $< $@
|
$@.tmp.nonen $< $@
|
||||||
@$(RM) $@.tmp.us $@.tmp.nonus;
|
@$(RM) $@.tmp.en $@.tmp.nonen;
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
$(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
|
$(LocaleDataMetaInfo_Dest):$(LocaleDataMetaInfo_Src) $(LOCALEGEN_SH)
|
||||||
@$(RM) $@.tmp.us $@.tmp.nonus;
|
@$(RM) $@.tmp.en $@.tmp.nonen;
|
||||||
@$(prep-target)
|
@$(prep-target)
|
||||||
@$(ECHO) $(subst .properties,'\n',$(US_Resources_properties)) > $@.tmp.us;
|
@$(ECHO) $(subst .properties,'\n',$(EN_Resources_properties)) > $@.tmp.en;
|
||||||
@$(ECHO) $(subst .java,'\n',$(US_Resources_java)) >> $@.tmp.us;
|
@$(ECHO) $(subst .java,'\n',$(EN_Resources_java)) >> $@.tmp.en;
|
||||||
@$(ECHO) $(subst .properties,'\n',$(NonUS_Resources_properties)) > $@.tmp.nonus;
|
@$(ECHO) $(subst .properties,'\n',$(NonEN_Resources_properties)) > $@.tmp.nonen;
|
||||||
@$(ECHO) $(subst .java,'\n',$(NonUS_Resources_java)) >> $@.tmp.nonus;
|
@$(ECHO) $(subst .java,'\n',$(NonEN_Resources_java)) >> $@.tmp.nonen;
|
||||||
NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
|
NAWK="$(NAWK)" SED="$(SED)" SORT="$(SORT)" \
|
||||||
$(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.us \
|
$(SH) $(LOCALEGEN_SH) $(RESOURCE_NAMES) $@.tmp.en \
|
||||||
$@.tmp.nonus $< $@
|
$@.tmp.nonen $< $@
|
||||||
@$(RM) $@.tmp.us $@.tmp.nonus;
|
@$(RM) $@.tmp.en $@.tmp.nonen;
|
||||||
endif
|
endif
|
||||||
|
|
||||||
genlocales : $(LocaleDataMetaInfo_Dest)
|
genlocales : $(LocaleDataMetaInfo_Dest)
|
||||||
|
|
|
@ -35,11 +35,11 @@
|
||||||
# A list of resource base name list;
|
# A list of resource base name list;
|
||||||
RESOURCE_NAMES=$1
|
RESOURCE_NAMES=$1
|
||||||
|
|
||||||
# A list of US resources;
|
# A list of EN resources;
|
||||||
US_FILES_LIST=$2
|
EN_FILES_LIST=$2
|
||||||
|
|
||||||
# A list of non-US resources;
|
# A list of non-EN resources;
|
||||||
NONUS_FILES_LIST=$3
|
NONEN_FILES_LIST=$3
|
||||||
|
|
||||||
INPUT_FILE=$4
|
INPUT_FILE=$4
|
||||||
OUTPUT_FILE=$5
|
OUTPUT_FILE=$5
|
||||||
|
@ -53,23 +53,23 @@ getlocalelist() {
|
||||||
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
|
sed_script="$SED -e \"s@^#warn .*@// -- This file was mechanically generated: Do not edit! -- //@\" "
|
||||||
|
|
||||||
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
|
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
|
||||||
nonusall=" ja-JP-JP th-TH-TH "
|
nonenall=" ja-JP-JP th-TH-TH "
|
||||||
|
|
||||||
for FILE in $RESOURCE_NAMES
|
for FILE in $RESOURCE_NAMES
|
||||||
do
|
do
|
||||||
getlocalelist $FILE $US_FILES_LIST
|
getlocalelist $FILE $EN_FILES_LIST
|
||||||
sed_script=$sed_script"-e \"s@#"$FILE"_USLocales#@$localelist@g\" "
|
sed_script=$sed_script"-e \"s@#"$FILE"_ENLocales#@$localelist@g\" "
|
||||||
usall=$usall" "$localelist
|
enall=$enall" "$localelist
|
||||||
getlocalelist $FILE $NONUS_FILES_LIST
|
getlocalelist $FILE $NONEN_FILES_LIST
|
||||||
sed_script=$sed_script"-e \"s@#"$FILE"_NonUSLocales#@$localelist@g\" "
|
sed_script=$sed_script"-e \"s@#"$FILE"_NonENLocales#@$localelist@g\" "
|
||||||
nonusall=$nonusall" "$localelist
|
nonenall=$nonenall" "$localelist
|
||||||
done
|
done
|
||||||
|
|
||||||
usall=`(for LOC in $usall; do echo $LOC;done) |$SORT -u`
|
enall=`(for LOC in $enall; do echo $LOC;done) |$SORT -u`
|
||||||
nonusall=`(for LOC in $nonusall; do echo $LOC;done) |$SORT -u`
|
nonenall=`(for LOC in $nonenall; do echo $LOC;done) |$SORT -u`
|
||||||
|
|
||||||
sed_script=$sed_script"-e \"s@#AvailableLocales_USLocales#@$usall@g\" "
|
sed_script=$sed_script"-e \"s@#AvailableLocales_ENLocales#@$enall@g\" "
|
||||||
sed_script=$sed_script"-e \"s@#AvailableLocales_NonUSLocales#@$nonusall@g\" "
|
sed_script=$sed_script"-e \"s@#AvailableLocales_NonENLocales#@$nonenall@g\" "
|
||||||
|
|
||||||
sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
|
sed_script=$sed_script"$INPUT_FILE > $OUTPUT_FILE"
|
||||||
eval $sed_script
|
eval $sed_script
|
||||||
|
|
|
@ -107,5 +107,17 @@ FILES_java = \
|
||||||
sun/text/resources/FormatData.java \
|
sun/text/resources/FormatData.java \
|
||||||
sun/text/resources/JavaTimeSupplementary.java \
|
sun/text/resources/JavaTimeSupplementary.java \
|
||||||
sun/text/resources/en/FormatData_en.java \
|
sun/text/resources/en/FormatData_en.java \
|
||||||
|
sun/text/resources/en/FormatData_en_AU.java \
|
||||||
|
sun/text/resources/en/FormatData_en_CA.java \
|
||||||
|
sun/text/resources/en/FormatData_en_GB.java \
|
||||||
|
sun/text/resources/en/FormatData_en_IE.java \
|
||||||
|
sun/text/resources/en/FormatData_en_IN.java \
|
||||||
|
sun/text/resources/en/FormatData_en_MT.java \
|
||||||
|
sun/text/resources/en/FormatData_en_NZ.java \
|
||||||
|
sun/text/resources/en/FormatData_en_PH.java \
|
||||||
|
sun/text/resources/en/FormatData_en_SG.java \
|
||||||
sun/text/resources/en/FormatData_en_US.java \
|
sun/text/resources/en/FormatData_en_US.java \
|
||||||
|
sun/text/resources/en/FormatData_en_ZA.java \
|
||||||
sun/text/resources/en/JavaTimeSupplementary_en.java \
|
sun/text/resources/en/JavaTimeSupplementary_en.java \
|
||||||
|
sun/text/resources/en/JavaTimeSupplementary_en_GB.java \
|
||||||
|
sun/text/resources/en/JavaTimeSupplementary_en_SG.java
|
||||||
|
|
|
@ -30,4 +30,7 @@ FILES_java = \
|
||||||
sun/util/resources/LocaleNamesBundle.java \
|
sun/util/resources/LocaleNamesBundle.java \
|
||||||
sun/util/resources/TimeZoneNamesBundle.java \
|
sun/util/resources/TimeZoneNamesBundle.java \
|
||||||
sun/util/resources/TimeZoneNames.java \
|
sun/util/resources/TimeZoneNames.java \
|
||||||
sun/util/resources/en/TimeZoneNames_en.java
|
sun/util/resources/en/TimeZoneNames_en.java \
|
||||||
|
sun/util/resources/en/TimeZoneNames_en_CA.java \
|
||||||
|
sun/util/resources/en/TimeZoneNames_en_GB.java \
|
||||||
|
sun/util/resources/en/TimeZoneNames_en_IE.java
|
||||||
|
|
|
@ -26,9 +26,25 @@
|
||||||
FILES_compiled_properties = \
|
FILES_compiled_properties = \
|
||||||
sun/util/resources/LocaleNames.properties \
|
sun/util/resources/LocaleNames.properties \
|
||||||
sun/util/resources/en/LocaleNames_en.properties \
|
sun/util/resources/en/LocaleNames_en.properties \
|
||||||
|
sun/util/resources/en/LocaleNames_en_MT.properties \
|
||||||
|
sun/util/resources/en/LocaleNames_en_PH.properties \
|
||||||
|
sun/util/resources/en/LocaleNames_en_SG.properties \
|
||||||
\
|
\
|
||||||
sun/util/resources/CalendarData.properties \
|
sun/util/resources/CalendarData.properties \
|
||||||
sun/util/resources/en/CalendarData_en.properties \
|
sun/util/resources/en/CalendarData_en.properties \
|
||||||
|
sun/util/resources/en/CalendarData_en_GB.properties \
|
||||||
|
sun/util/resources/en/CalendarData_en_IE.properties \
|
||||||
|
sun/util/resources/en/CalendarData_en_MT.properties \
|
||||||
\
|
\
|
||||||
sun/util/resources/CurrencyNames.properties \
|
sun/util/resources/CurrencyNames.properties \
|
||||||
sun/util/resources/en/CurrencyNames_en_US.properties
|
sun/util/resources/en/CurrencyNames_en_AU.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_CA.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_GB.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_IE.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_IN.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_MT.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_NZ.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_PH.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_SG.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_US.properties \
|
||||||
|
sun/util/resources/en/CurrencyNames_en_ZA.properties
|
||||||
|
|
|
@ -96,16 +96,6 @@ FILES_java = \
|
||||||
sun/text/resources/el/FormatData_el.java \
|
sun/text/resources/el/FormatData_el.java \
|
||||||
sun/text/resources/el/FormatData_el_CY.java \
|
sun/text/resources/el/FormatData_el_CY.java \
|
||||||
sun/text/resources/el/FormatData_el_GR.java \
|
sun/text/resources/el/FormatData_el_GR.java \
|
||||||
sun/text/resources/en/FormatData_en_AU.java \
|
|
||||||
sun/text/resources/en/FormatData_en_CA.java \
|
|
||||||
sun/text/resources/en/FormatData_en_GB.java \
|
|
||||||
sun/text/resources/en/FormatData_en_IE.java \
|
|
||||||
sun/text/resources/en/FormatData_en_IN.java \
|
|
||||||
sun/text/resources/en/FormatData_en_MT.java \
|
|
||||||
sun/text/resources/en/FormatData_en_NZ.java \
|
|
||||||
sun/text/resources/en/FormatData_en_PH.java \
|
|
||||||
sun/text/resources/en/FormatData_en_SG.java \
|
|
||||||
sun/text/resources/en/FormatData_en_ZA.java \
|
|
||||||
sun/text/resources/es/FormatData_es.java \
|
sun/text/resources/es/FormatData_es.java \
|
||||||
sun/text/resources/es/FormatData_es_BO.java \
|
sun/text/resources/es/FormatData_es_BO.java \
|
||||||
sun/text/resources/es/FormatData_es_AR.java \
|
sun/text/resources/es/FormatData_es_AR.java \
|
||||||
|
@ -214,9 +204,6 @@ FILES_java = \
|
||||||
sun/util/resources/zh/CurrencyNames_zh_SG.java \
|
sun/util/resources/zh/CurrencyNames_zh_SG.java \
|
||||||
sun/util/resources/zh/LocaleNames_zh_HK.java \
|
sun/util/resources/zh/LocaleNames_zh_HK.java \
|
||||||
sun/util/resources/de/TimeZoneNames_de.java \
|
sun/util/resources/de/TimeZoneNames_de.java \
|
||||||
sun/util/resources/en/TimeZoneNames_en_CA.java \
|
|
||||||
sun/util/resources/en/TimeZoneNames_en_GB.java \
|
|
||||||
sun/util/resources/en/TimeZoneNames_en_IE.java \
|
|
||||||
sun/util/resources/es/TimeZoneNames_es.java \
|
sun/util/resources/es/TimeZoneNames_es.java \
|
||||||
sun/util/resources/fr/TimeZoneNames_fr.java \
|
sun/util/resources/fr/TimeZoneNames_fr.java \
|
||||||
sun/util/resources/hi/TimeZoneNames_hi.java \
|
sun/util/resources/hi/TimeZoneNames_hi.java \
|
||||||
|
@ -237,8 +224,6 @@ FILES_java = \
|
||||||
sun/text/resources/da/JavaTimeSupplementary_da.java \
|
sun/text/resources/da/JavaTimeSupplementary_da.java \
|
||||||
sun/text/resources/de/JavaTimeSupplementary_de.java \
|
sun/text/resources/de/JavaTimeSupplementary_de.java \
|
||||||
sun/text/resources/el/JavaTimeSupplementary_el.java \
|
sun/text/resources/el/JavaTimeSupplementary_el.java \
|
||||||
sun/text/resources/en/JavaTimeSupplementary_en_GB.java \
|
|
||||||
sun/text/resources/en/JavaTimeSupplementary_en_SG.java \
|
|
||||||
sun/text/resources/es/JavaTimeSupplementary_es.java \
|
sun/text/resources/es/JavaTimeSupplementary_es.java \
|
||||||
sun/text/resources/et/JavaTimeSupplementary_et.java \
|
sun/text/resources/et/JavaTimeSupplementary_et.java \
|
||||||
sun/text/resources/fi/JavaTimeSupplementary_fi.java \
|
sun/text/resources/fi/JavaTimeSupplementary_fi.java \
|
||||||
|
|
|
@ -33,9 +33,6 @@ FILES_compiled_properties = \
|
||||||
sun/util/resources/de/LocaleNames_de.properties \
|
sun/util/resources/de/LocaleNames_de.properties \
|
||||||
sun/util/resources/el/LocaleNames_el.properties \
|
sun/util/resources/el/LocaleNames_el.properties \
|
||||||
sun/util/resources/el/LocaleNames_el_CY.properties \
|
sun/util/resources/el/LocaleNames_el_CY.properties \
|
||||||
sun/util/resources/en/LocaleNames_en_MT.properties \
|
|
||||||
sun/util/resources/en/LocaleNames_en_PH.properties \
|
|
||||||
sun/util/resources/en/LocaleNames_en_SG.properties \
|
|
||||||
sun/util/resources/es/LocaleNames_es.properties \
|
sun/util/resources/es/LocaleNames_es.properties \
|
||||||
sun/util/resources/es/LocaleNames_es_US.properties \
|
sun/util/resources/es/LocaleNames_es_US.properties \
|
||||||
sun/util/resources/et/LocaleNames_et.properties \
|
sun/util/resources/et/LocaleNames_et.properties \
|
||||||
|
@ -88,9 +85,6 @@ FILES_compiled_properties = \
|
||||||
sun/util/resources/de/CalendarData_de.properties \
|
sun/util/resources/de/CalendarData_de.properties \
|
||||||
sun/util/resources/el/CalendarData_el.properties \
|
sun/util/resources/el/CalendarData_el.properties \
|
||||||
sun/util/resources/el/CalendarData_el_CY.properties \
|
sun/util/resources/el/CalendarData_el_CY.properties \
|
||||||
sun/util/resources/en/CalendarData_en_GB.properties \
|
|
||||||
sun/util/resources/en/CalendarData_en_IE.properties \
|
|
||||||
sun/util/resources/en/CalendarData_en_MT.properties \
|
|
||||||
sun/util/resources/es/CalendarData_es.properties \
|
sun/util/resources/es/CalendarData_es.properties \
|
||||||
sun/util/resources/es/CalendarData_es_ES.properties \
|
sun/util/resources/es/CalendarData_es_ES.properties \
|
||||||
sun/util/resources/es/CalendarData_es_US.properties \
|
sun/util/resources/es/CalendarData_es_US.properties \
|
||||||
|
@ -164,16 +158,6 @@ FILES_compiled_properties = \
|
||||||
sun/util/resources/de/CurrencyNames_de_LU.properties \
|
sun/util/resources/de/CurrencyNames_de_LU.properties \
|
||||||
sun/util/resources/el/CurrencyNames_el_CY.properties \
|
sun/util/resources/el/CurrencyNames_el_CY.properties \
|
||||||
sun/util/resources/el/CurrencyNames_el_GR.properties \
|
sun/util/resources/el/CurrencyNames_el_GR.properties \
|
||||||
sun/util/resources/en/CurrencyNames_en_AU.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_CA.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_GB.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_IE.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_IN.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_MT.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_NZ.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_PH.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_SG.properties \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_ZA.properties \
|
|
||||||
sun/util/resources/es/CurrencyNames_es.properties \
|
sun/util/resources/es/CurrencyNames_es.properties \
|
||||||
sun/util/resources/es/CurrencyNames_es_AR.properties \
|
sun/util/resources/es/CurrencyNames_es_AR.properties \
|
||||||
sun/util/resources/es/CurrencyNames_es_BO.properties \
|
sun/util/resources/es/CurrencyNames_es_BO.properties \
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class CharacterName {
|
||||||
FileReader reader = null;
|
FileReader reader = null;
|
||||||
try {
|
try {
|
||||||
if (args.length != 2) {
|
if (args.length != 2) {
|
||||||
System.err.println("Usage: java CharacterName UniocdeData.txt uniName.dat");
|
System.err.println("Usage: java CharacterName UnicodeData.txt uniName.dat");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ ifneq ($(OPENJDK_TARGET_OS),macosx)
|
||||||
LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
|
LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
|
||||||
else
|
else
|
||||||
BUILD_LIBJAVA_java_props_md.c_CFLAGS:=-x objective-c
|
BUILD_LIBJAVA_java_props_md.c_CFLAGS:=-x objective-c
|
||||||
|
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS:=-x objective-c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OPENJDK_TARGET_OS),windows)
|
ifeq ($(OPENJDK_TARGET_OS),windows)
|
||||||
|
@ -252,6 +253,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\
|
||||||
LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
|
LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
|
||||||
LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
|
LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
|
||||||
-framework CoreFoundation \
|
-framework CoreFoundation \
|
||||||
|
-framework Foundation \
|
||||||
-framework Security -framework SystemConfiguration, \
|
-framework Security -framework SystemConfiguration, \
|
||||||
LDFLAGS_SUFFIX_windows:=-export:winFileHandleOpen -export:handleLseek \
|
LDFLAGS_SUFFIX_windows:=-export:winFileHandleOpen -export:handleLseek \
|
||||||
jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
|
jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
|
||||||
|
|
|
@ -80,39 +80,6 @@ LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in
|
||||||
LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) \
|
LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/,$(LOCALEDATA_INCLUDE_LOCALES)) \
|
||||||
$(addprefix sun/util/resources/,$(LOCALEDATA_INCLUDE_LOCALES))
|
$(addprefix sun/util/resources/,$(LOCALEDATA_INCLUDE_LOCALES))
|
||||||
|
|
||||||
# For non-US English locale data
|
|
||||||
|
|
||||||
LOCALEDATA_INCLUDES += \
|
|
||||||
sun/text/resources/en/FormatData_en_AU.class \
|
|
||||||
sun/text/resources/en/FormatData_en_CA.class \
|
|
||||||
sun/text/resources/en/FormatData_en_GB.class \
|
|
||||||
sun/text/resources/en/FormatData_en_IE.class \
|
|
||||||
sun/text/resources/en/FormatData_en_IN.class \
|
|
||||||
sun/text/resources/en/FormatData_en_MT.class \
|
|
||||||
sun/text/resources/en/FormatData_en_NZ.class \
|
|
||||||
sun/text/resources/en/FormatData_en_PH.class \
|
|
||||||
sun/text/resources/en/FormatData_en_SG.class \
|
|
||||||
sun/text/resources/en/FormatData_en_ZA.class \
|
|
||||||
sun/util/resources/en/CalendarData_en_GB.class \
|
|
||||||
sun/util/resources/en/CalendarData_en_IE.class \
|
|
||||||
sun/util/resources/en/CalendarData_en_MT.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_AU.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_CA.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_GB.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_IE.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_IN.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_MT.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_NZ.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_PH.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_SG.class \
|
|
||||||
sun/util/resources/en/CurrencyNames_en_ZA.class \
|
|
||||||
sun/util/resources/en/LocaleNames_en_MT.class \
|
|
||||||
sun/util/resources/en/LocaleNames_en_PH.class \
|
|
||||||
sun/util/resources/en/LocaleNames_en_SG.class \
|
|
||||||
sun/util/resources/en/TimeZoneNames_en_CA.class \
|
|
||||||
sun/util/resources/en/TimeZoneNames_en_GB.class \
|
|
||||||
sun/util/resources/en/TimeZoneNames_en_IE.class
|
|
||||||
|
|
||||||
$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\
|
$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR,,\
|
||||||
SRCS:=$(JDK_OUTPUTDIR)/classes,\
|
SRCS:=$(JDK_OUTPUTDIR)/classes,\
|
||||||
SUFFIXES:=.class _dict _th,\
|
SUFFIXES:=.class _dict _th,\
|
||||||
|
|
|
@ -50,27 +50,27 @@ ifneq (,$(MISSING_RESOURCES)$(NEW_RESOURCES))
|
||||||
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
|
$(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The US locales
|
# The EN locales
|
||||||
US_LOCALES:=en en-US
|
EN_LOCALES:=en%
|
||||||
|
|
||||||
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
|
# ja-JP-JP and th-TH-TH need to be manually added, as they don't have any resource files.
|
||||||
ALL_NON_US_LOCALES:=ja-JP-JP th-TH-TH
|
ALL_NON_EN_LOCALES:=ja-JP-JP th-TH-TH
|
||||||
|
|
||||||
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
|
SED_ARGS:=-e 's|$(HASH)warn This file is preprocessed before being compiled|// -- This file was mechanically generated: Do not edit! -- //|g'
|
||||||
|
|
||||||
# This macro creates a sed expression that substitues for example:
|
# This macro creates a sed expression that substitues for example:
|
||||||
# #FormatData_USLocales# with: en and/or en_US.
|
# #FormatData_ENLocales# with: en% locales.
|
||||||
define CaptureLocale
|
define CaptureLocale
|
||||||
$1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))
|
$1_LOCALES := $$(subst _,-,$$(filter-out $1,$$(subst $1_,,$$(filter $1_%,$(LOCALE_RESOURCES)))))
|
||||||
$1_US_LOCALES := $$(filter $(US_LOCALES),$$($1_LOCALES))
|
$1_EN_LOCALES := $$(filter $(EN_LOCALES),$$($1_LOCALES))
|
||||||
$1_NON_US_LOCALES := $$(filter-out $(US_LOCALES),$$($1_LOCALES))
|
$1_NON_EN_LOCALES := $$(filter-out $(EN_LOCALES),$$($1_LOCALES))
|
||||||
|
|
||||||
ALL_US_LOCALES += $$($1_US_LOCALES)
|
ALL_EN_LOCALES += $$($1_EN_LOCALES)
|
||||||
ALL_NON_US_LOCALES += $$($1_NON_US_LOCALES)
|
ALL_NON_EN_LOCALES += $$($1_NON_EN_LOCALES)
|
||||||
|
|
||||||
# Don't sed in a space if there are no locales.
|
# Don't sed in a space if there are no locales.
|
||||||
SED_ARGS+= -e 's/$$(HASH)$1_USLocales$$(HASH)/$$(if $$($1_US_LOCALES),$$(SPACE)$$($1_US_LOCALES),)/g'
|
SED_ARGS+= -e 's/$$(HASH)$1_ENLocales$$(HASH)/$$(if $$($1_EN_LOCALES),$$(SPACE)$$($1_EN_LOCALES),)/g'
|
||||||
SED_ARGS+= -e 's/$$(HASH)$1_NonUSLocales$$(HASH)/$$(if $$($1_NON_US_LOCALES),$$(SPACE)$$($1_NON_US_LOCALES),)/g'
|
SED_ARGS+= -e 's/$$(HASH)$1_NonENLocales$$(HASH)/$$(if $$($1_NON_EN_LOCALES),$$(SPACE)$$($1_NON_EN_LOCALES),)/g'
|
||||||
endef
|
endef
|
||||||
|
|
||||||
#sun.text.resources.FormatData
|
#sun.text.resources.FormatData
|
||||||
|
@ -91,8 +91,8 @@ $(eval $(call CaptureLocale,CurrencyNames))
|
||||||
#sun.util.resources.CalendarData
|
#sun.util.resources.CalendarData
|
||||||
$(eval $(call CaptureLocale,CalendarData))
|
$(eval $(call CaptureLocale,CalendarData))
|
||||||
|
|
||||||
SED_ARGS+= -e 's/$(HASH)AvailableLocales_USLocales$(HASH)/$(sort $(ALL_US_LOCALES))/g'
|
SED_ARGS+= -e 's/$(HASH)AvailableLocales_ENLocales$(HASH)/$(sort $(ALL_EN_LOCALES))/g'
|
||||||
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonUSLocales$(HASH)/$(sort $(ALL_NON_US_LOCALES))/g'
|
SED_ARGS+= -e 's/$(HASH)AvailableLocales_NonENLocales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g'
|
||||||
|
|
||||||
$(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \
|
$(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java: \
|
||||||
$(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
|
$(JDK_TOPDIR)/src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,10 @@
|
||||||
|
|
||||||
DISABLE_WARNINGS:=-Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
|
DISABLE_WARNINGS:=-Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
|
||||||
|
|
||||||
|
# To build with all warnings enabled, do the following:
|
||||||
|
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
|
||||||
|
JAVAC_WARNINGS:=-Xlint:-unchecked,-deprecation,-overrides,classfile,dep-ann,divzero,varargs -Werror
|
||||||
|
|
||||||
# The generate old bytecode javac setup uses the new compiler to compile for the
|
# The generate old bytecode javac setup uses the new compiler to compile for the
|
||||||
# boot jdk to generate tools that need to be run with the boot jdk.
|
# boot jdk to generate tools that need to be run with the boot jdk.
|
||||||
# Thus we force the target bytecode to 7.
|
# Thus we force the target bytecode to 7.
|
||||||
|
@ -41,7 +45,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE,\
|
||||||
JVM:=$(JAVA),\
|
JVM:=$(JAVA),\
|
||||||
JAVAC:=$(NEW_JAVAC),\
|
JAVAC:=$(NEW_JAVAC),\
|
||||||
FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes -source 8 -target 8 \
|
FLAGS:=-bootclasspath $(JDK_OUTPUTDIR)/classes -source 8 -target 8 \
|
||||||
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS) \
|
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
|
||||||
$(GENERATE_JDKBYTECODE_EXTRA_FLAGS),\
|
$(GENERATE_JDKBYTECODE_EXTRA_FLAGS),\
|
||||||
SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
|
SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
|
||||||
SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
|
SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
|
||||||
|
|
|
@ -38,6 +38,7 @@ import java.util.*;
|
||||||
import sun.awt.*;
|
import sun.awt.*;
|
||||||
import sun.lwawt.macosx.*;
|
import sun.lwawt.macosx.*;
|
||||||
import sun.print.*;
|
import sun.print.*;
|
||||||
|
import sun.security.util.SecurityConstants;
|
||||||
|
|
||||||
public abstract class LWToolkit extends SunToolkit implements Runnable {
|
public abstract class LWToolkit extends SunToolkit implements Runnable {
|
||||||
|
|
||||||
|
@ -502,7 +503,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
||||||
public Clipboard getSystemClipboard() {
|
public Clipboard getSystemClipboard() {
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkSystemClipboardAccess();
|
security.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
|
@ -58,6 +58,13 @@ public class Association {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of this class.
|
* Initializes a new instance of this class.
|
||||||
|
*
|
||||||
|
* @param associationID
|
||||||
|
* The association ID
|
||||||
|
* @param maxInStreams
|
||||||
|
* The maximum number of inbound streams
|
||||||
|
* @param maxOutStreams
|
||||||
|
* The maximum number of outbound streams
|
||||||
*/
|
*/
|
||||||
protected Association(int associationID,
|
protected Association(int associationID,
|
||||||
int maxInStreams,
|
int maxInStreams,
|
||||||
|
|
|
@ -41,6 +41,9 @@ public class IllegalReceiveException extends IllegalStateException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an instance of this class with the specified message.
|
* Constructs an instance of this class with the specified message.
|
||||||
|
*
|
||||||
|
* @param msg
|
||||||
|
* The String that contains a detailed message
|
||||||
*/
|
*/
|
||||||
public IllegalReceiveException(String msg) {
|
public IllegalReceiveException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
|
|
|
@ -41,6 +41,9 @@ public class IllegalUnbindException extends IllegalStateException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an instance of this class with the specified detailed message.
|
* Constructs an instance of this class with the specified detailed message.
|
||||||
|
*
|
||||||
|
* @param msg
|
||||||
|
* The String that contains a detailed message
|
||||||
*/
|
*/
|
||||||
public IllegalUnbindException(String msg) {
|
public IllegalUnbindException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
|
|
|
@ -40,6 +40,9 @@ public class InvalidStreamException extends IllegalArgumentException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an instance of this class with the specified detailed message.
|
* Constructs an instance of this class with the specified detailed message.
|
||||||
|
*
|
||||||
|
* @param msg
|
||||||
|
* The String that contains a detailed message
|
||||||
*/
|
*/
|
||||||
public InvalidStreamException(String msg) {
|
public InvalidStreamException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
|
|
|
@ -48,7 +48,7 @@ import java.net.SocketAddress;
|
||||||
* longer required to be sent after the time period expires. It is not a hard
|
* longer required to be sent after the time period expires. It is not a hard
|
||||||
* timeout and may be influenced by whether the association supports the partial
|
* timeout and may be influenced by whether the association supports the partial
|
||||||
* reliability extension, <a href=http://www.ietf.org/rfc/rfc3758.txt>RFC 3758
|
* reliability extension, <a href=http://www.ietf.org/rfc/rfc3758.txt>RFC 3758
|
||||||
* <a>
|
* </a>.
|
||||||
*
|
*
|
||||||
* <P> {@code MessageInfo} instances are not safe for use by multiple concurrent
|
* <P> {@code MessageInfo} instances are not safe for use by multiple concurrent
|
||||||
* threads. If a MessageInfo is to be used by more than one thread then access
|
* threads. If a MessageInfo is to be used by more than one thread then access
|
||||||
|
|
|
@ -40,6 +40,8 @@ package com.sun.nio.sctp;
|
||||||
public interface Notification {
|
public interface Notification {
|
||||||
/**
|
/**
|
||||||
* Returns the association that this notification is applicable to.
|
* Returns the association that this notification is applicable to.
|
||||||
|
*
|
||||||
|
* @return The association
|
||||||
*/
|
*/
|
||||||
public Association association();
|
public Association association();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ import java.nio.channels.SelectionKey;
|
||||||
* {@link #setOption(SctpSocketOption,Object) setOption} method. An SCTP
|
* {@link #setOption(SctpSocketOption,Object) setOption} method. An SCTP
|
||||||
* channel support the following options:
|
* channel support the following options:
|
||||||
* <blockquote>
|
* <blockquote>
|
||||||
* <table border>
|
* <table border summary="Socket options">
|
||||||
* <tr>
|
* <tr>
|
||||||
* <th>Option Name</th>
|
* <th>Option Name</th>
|
||||||
* <th>Description</th>
|
* <th>Description</th>
|
||||||
|
@ -636,6 +636,9 @@ public abstract class SctpChannel
|
||||||
/**
|
/**
|
||||||
* Returns the value of a socket option.
|
* Returns the value of a socket option.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the socket option value
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The socket option
|
* The socket option
|
||||||
*
|
*
|
||||||
|
@ -659,6 +662,9 @@ public abstract class SctpChannel
|
||||||
/**
|
/**
|
||||||
* Sets the value of a socket option.
|
* Sets the value of a socket option.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the socket option value
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The socket option
|
* The socket option
|
||||||
*
|
*
|
||||||
|
@ -752,6 +758,9 @@ public abstract class SctpChannel
|
||||||
* the {@code receive} method of this channel, if it does an
|
* the {@code receive} method of this channel, if it does an
|
||||||
* {@link IllegalReceiveException} will be thrown.
|
* {@link IllegalReceiveException} will be thrown.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the attachment
|
||||||
|
*
|
||||||
* @param dst
|
* @param dst
|
||||||
* The buffer into which message bytes are to be transferred
|
* The buffer into which message bytes are to be transferred
|
||||||
*
|
*
|
||||||
|
@ -831,7 +840,7 @@ public abstract class SctpChannel
|
||||||
* there was insufficient room for the message in the underlying
|
* there was insufficient room for the message in the underlying
|
||||||
* output buffer
|
* output buffer
|
||||||
*
|
*
|
||||||
* @throws InvalidStreamExcepton
|
* @throws InvalidStreamException
|
||||||
* If {@code streamNumner} is negative or greater than or equal to
|
* If {@code streamNumner} is negative or greater than or equal to
|
||||||
* the maximum number of outgoing streams
|
* the maximum number of outgoing streams
|
||||||
*
|
*
|
||||||
|
|
|
@ -63,7 +63,7 @@ import java.nio.channels.SelectionKey;
|
||||||
* {@link #setOption(SctpSocketOption,Object,Association) setOption} method. An
|
* {@link #setOption(SctpSocketOption,Object,Association) setOption} method. An
|
||||||
* {@code SctpMultiChannel} supports the following options:
|
* {@code SctpMultiChannel} supports the following options:
|
||||||
* <blockquote>
|
* <blockquote>
|
||||||
* <table border>
|
* <table border summary="Socket options">
|
||||||
* <tr>
|
* <tr>
|
||||||
* <th>Option Name</th>
|
* <th>Option Name</th>
|
||||||
* <th>Description</th>
|
* <th>Description</th>
|
||||||
|
@ -394,6 +394,9 @@ public abstract class SctpMultiChannel
|
||||||
* Returns all of the remote addresses to which the given association on
|
* Returns all of the remote addresses to which the given association on
|
||||||
* this channel's socket is connected.
|
* this channel's socket is connected.
|
||||||
*
|
*
|
||||||
|
* @param association
|
||||||
|
* The association
|
||||||
|
*
|
||||||
* @return All of the remote addresses for the given association, or
|
* @return All of the remote addresses for the given association, or
|
||||||
* an empty {@code Set} if the association has been shutdown
|
* an empty {@code Set} if the association has been shutdown
|
||||||
*
|
*
|
||||||
|
@ -431,6 +434,9 @@ public abstract class SctpMultiChannel
|
||||||
* ignored if given. However, if the option is association specific then the
|
* ignored if given. However, if the option is association specific then the
|
||||||
* association must be given.
|
* association must be given.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the socket option value
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The socket option
|
* The socket option
|
||||||
*
|
*
|
||||||
|
@ -464,6 +470,9 @@ public abstract class SctpMultiChannel
|
||||||
* ignored if given. However, if the option is association specific then the
|
* ignored if given. However, if the option is association specific then the
|
||||||
* association must be given.
|
* association must be given.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the socket option value
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The socket option
|
* The socket option
|
||||||
*
|
*
|
||||||
|
@ -567,6 +576,9 @@ public abstract class SctpMultiChannel
|
||||||
* the {@code receive} method of this channel, if it does an
|
* the {@code receive} method of this channel, if it does an
|
||||||
* {@link IllegalReceiveException} will be thrown.
|
* {@link IllegalReceiveException} will be thrown.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the attachment
|
||||||
|
*
|
||||||
* @param buffer
|
* @param buffer
|
||||||
* The buffer into which bytes are to be transferred
|
* The buffer into which bytes are to be transferred
|
||||||
*
|
*
|
||||||
|
@ -673,7 +685,7 @@ public abstract class SctpMultiChannel
|
||||||
* there was insufficient room for the message in the underlying
|
* there was insufficient room for the message in the underlying
|
||||||
* output buffer
|
* output buffer
|
||||||
*
|
*
|
||||||
* @throws InvalidStreamExcepton
|
* @throws InvalidStreamException
|
||||||
* If {@code streamNumber} is negative, or if an association already
|
* If {@code streamNumber} is negative, or if an association already
|
||||||
* exists and {@code streamNumber} is greater than the maximum number
|
* exists and {@code streamNumber} is greater than the maximum number
|
||||||
* of outgoing streams
|
* of outgoing streams
|
||||||
|
|
|
@ -47,7 +47,7 @@ import java.nio.channels.spi.AbstractSelectableChannel;
|
||||||
* {@link #setOption(SctpSocketOption,Object) setOption} method. SCTP server socket
|
* {@link #setOption(SctpSocketOption,Object) setOption} method. SCTP server socket
|
||||||
* channels support the following options:
|
* channels support the following options:
|
||||||
* <blockquote>
|
* <blockquote>
|
||||||
* <table border>
|
* <table border summary="Socket options">
|
||||||
* <tr>
|
* <tr>
|
||||||
* <th>Option Name</th>
|
* <th>Option Name</th>
|
||||||
* <th>Description</th>
|
* <th>Description</th>
|
||||||
|
@ -345,6 +345,9 @@ public abstract class SctpServerChannel
|
||||||
/**
|
/**
|
||||||
* Returns the value of a socket option.
|
* Returns the value of a socket option.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the socket option value
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The socket option
|
* The socket option
|
||||||
*
|
*
|
||||||
|
@ -367,6 +370,9 @@ public abstract class SctpServerChannel
|
||||||
/**
|
/**
|
||||||
* Sets the value of a socket option.
|
* Sets the value of a socket option.
|
||||||
*
|
*
|
||||||
|
* @param <T>
|
||||||
|
* The type of the socket option value
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* The socket option
|
* The socket option
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,6 +35,7 @@ import java.text.BreakIterator;
|
||||||
import javax.swing.text.AttributeSet;
|
import javax.swing.text.AttributeSet;
|
||||||
import javax.accessibility.*;
|
import javax.accessibility.*;
|
||||||
import java.awt.im.InputMethodRequests;
|
import java.awt.im.InputMethodRequests;
|
||||||
|
import sun.security.util.SecurityConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>TextComponent</code> class is the superclass of
|
* The <code>TextComponent</code> class is the superclass of
|
||||||
|
@ -728,7 +729,7 @@ public class TextComponent extends Component implements Accessible {
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm == null) return true;
|
if (sm == null) return true;
|
||||||
try {
|
try {
|
||||||
sm.checkSystemClipboardAccess();
|
sm.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
|
||||||
return true;
|
return true;
|
||||||
} catch (SecurityException e) {}
|
} catch (SecurityException e) {}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1270,12 +1270,8 @@ public abstract class Toolkit {
|
||||||
* <p>
|
* <p>
|
||||||
* Each actual implementation of this method should first check if there
|
* Each actual implementation of this method should first check if there
|
||||||
* is a security manager installed. If there is, the method should call
|
* is a security manager installed. If there is, the method should call
|
||||||
* the security manager's <code>checkSystemClipboardAccess</code> method
|
* the security manager's {@link SecurityManager#checkPermission
|
||||||
* to ensure it's ok to to access the system clipboard. If the default
|
* checkPermission} method to check {@code AWTPermission("accessClipboard")}.
|
||||||
* implementation of <code>checkSystemClipboardAccess</code> is used (that
|
|
||||||
* is, that method is not overriden), then this results in a call to the
|
|
||||||
* security manager's <code>checkPermission</code> method with an <code>
|
|
||||||
* AWTPermission("accessClipboard")</code> permission.
|
|
||||||
*
|
*
|
||||||
* @return the system Clipboard
|
* @return the system Clipboard
|
||||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||||
|
@ -1318,14 +1314,9 @@ public abstract class Toolkit {
|
||||||
* system selection <code>Clipboard</code> as described above.
|
* system selection <code>Clipboard</code> as described above.
|
||||||
* <p>
|
* <p>
|
||||||
* Each actual implementation of this method should first check if there
|
* Each actual implementation of this method should first check if there
|
||||||
* is a <code>SecurityManager</code> installed. If there is, the method
|
* is a security manager installed. If there is, the method should call
|
||||||
* should call the <code>SecurityManager</code>'s
|
* the security manager's {@link SecurityManager#checkPermission
|
||||||
* <code>checkSystemClipboardAccess</code> method to ensure that client
|
* checkPermission} method to check {@code AWTPermission("accessClipboard")}.
|
||||||
* code has access the system selection. If the default implementation of
|
|
||||||
* <code>checkSystemClipboardAccess</code> is used (that is, if the method
|
|
||||||
* is not overridden), then this results in a call to the
|
|
||||||
* <code>SecurityManager</code>'s <code>checkPermission</code> method with
|
|
||||||
* an <code>AWTPermission("accessClipboard")</code> permission.
|
|
||||||
*
|
*
|
||||||
* @return the system selection as a <code>Clipboard</code>, or
|
* @return the system selection as a <code>Clipboard</code>, or
|
||||||
* <code>null</code> if the native platform does not support a
|
* <code>null</code> if the native platform does not support a
|
||||||
|
@ -1699,25 +1690,20 @@ public abstract class Toolkit {
|
||||||
* therefore not assume that the EventQueue instance returned
|
* therefore not assume that the EventQueue instance returned
|
||||||
* by this method will be shared by other applets or the system.
|
* by this method will be shared by other applets or the system.
|
||||||
*
|
*
|
||||||
* <p>First, if there is a security manager, its
|
* <p> If there is a security manager then its
|
||||||
* <code>checkAwtEventQueueAccess</code>
|
* {@link SecurityManager#checkPermission checkPermission} method
|
||||||
* method is called.
|
* is called to check {@code AWTPermission("accessEventQueue")}.
|
||||||
* If the default implementation of <code>checkAwtEventQueueAccess</code>
|
|
||||||
* is used (that is, that method is not overriden), then this results in
|
|
||||||
* a call to the security manager's <code>checkPermission</code> method
|
|
||||||
* with an <code>AWTPermission("accessEventQueue")</code> permission.
|
|
||||||
*
|
*
|
||||||
* @return the <code>EventQueue</code> object
|
* @return the <code>EventQueue</code> object
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* if a security manager exists and its <code>{@link
|
* if a security manager is set and it denies access to
|
||||||
* java.lang.SecurityManager#checkAwtEventQueueAccess}</code>
|
* the {@code EventQueue}
|
||||||
* method denies access to the <code>EventQueue</code>
|
|
||||||
* @see java.awt.AWTPermission
|
* @see java.awt.AWTPermission
|
||||||
*/
|
*/
|
||||||
public final EventQueue getSystemEventQueue() {
|
public final EventQueue getSystemEventQueue() {
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkAwtEventQueueAccess();
|
security.checkPermission(SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION);
|
||||||
}
|
}
|
||||||
return getSystemEventQueueImpl();
|
return getSystemEventQueueImpl();
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,10 +195,9 @@ public class Window extends Container implements Accessible {
|
||||||
/**
|
/**
|
||||||
* This represents the warning message that is
|
* This represents the warning message that is
|
||||||
* to be displayed in a non secure window. ie :
|
* to be displayed in a non secure window. ie :
|
||||||
* a window that has a security manager installed for
|
* a window that has a security manager installed that denies
|
||||||
* which calling SecurityManager.checkTopLevelWindow()
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}.
|
||||||
* is false. This message can be displayed anywhere in
|
* This message can be displayed anywhere in the window.
|
||||||
* the window.
|
|
||||||
*
|
*
|
||||||
* @serial
|
* @serial
|
||||||
* @see #getWarningString
|
* @see #getWarningString
|
||||||
|
@ -417,11 +416,10 @@ public class Window extends Container implements Accessible {
|
||||||
* Constructs a new, initially invisible window in default size with the
|
* Constructs a new, initially invisible window in default size with the
|
||||||
* specified {@code GraphicsConfiguration}.
|
* specified {@code GraphicsConfiguration}.
|
||||||
* <p>
|
* <p>
|
||||||
* If there is a security manager, this method first calls
|
* If there is a security manager, then it is invoked to check
|
||||||
* the security manager's {@code checkTopLevelWindow}
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}
|
||||||
* method with {@code this}
|
* to determine whether or not the window must be displayed with
|
||||||
* as its argument to determine whether or not the window
|
* a warning banner.
|
||||||
* must be displayed with a warning banner.
|
|
||||||
*
|
*
|
||||||
* @param gc the {@code GraphicsConfiguration} of the target screen
|
* @param gc the {@code GraphicsConfiguration} of the target screen
|
||||||
* device. If {@code gc} is {@code null}, the system default
|
* device. If {@code gc} is {@code null}, the system default
|
||||||
|
@ -432,7 +430,6 @@ public class Window extends Container implements Accessible {
|
||||||
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
|
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
|
||||||
*
|
*
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
* @see java.lang.SecurityManager#checkTopLevelWindow
|
|
||||||
*/
|
*/
|
||||||
Window(GraphicsConfiguration gc) {
|
Window(GraphicsConfiguration gc) {
|
||||||
init(gc);
|
init(gc);
|
||||||
|
@ -511,25 +508,16 @@ public class Window extends Container implements Accessible {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new, initially invisible window in the default size.
|
* Constructs a new, initially invisible window in the default size.
|
||||||
*
|
* <p>
|
||||||
* <p>First, if there is a security manager, its
|
* If there is a security manager set, it is invoked to check
|
||||||
* {@code checkTopLevelWindow}
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}.
|
||||||
* method is called with {@code this}
|
* If that check fails with a {@code SecurityException} then a warning
|
||||||
* as its argument
|
* banner is created.
|
||||||
* to see if it's ok to display the window without a warning banner.
|
|
||||||
* If the default implementation of {@code checkTopLevelWindow}
|
|
||||||
* is used (that is, that method is not overriden), then this results in
|
|
||||||
* a call to the security manager's {@code checkPermission} method
|
|
||||||
* with an {@code AWTPermission("showWindowWithoutWarningBanner")}
|
|
||||||
* permission. It that method raises a SecurityException,
|
|
||||||
* {@code checkTopLevelWindow} returns false, otherwise it
|
|
||||||
* returns true. If it returns false, a warning banner is created.
|
|
||||||
*
|
*
|
||||||
* @exception HeadlessException when
|
* @exception HeadlessException when
|
||||||
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
|
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
|
||||||
*
|
*
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
* @see java.lang.SecurityManager#checkTopLevelWindow
|
|
||||||
*/
|
*/
|
||||||
Window() throws HeadlessException {
|
Window() throws HeadlessException {
|
||||||
GraphicsEnvironment.checkHeadless();
|
GraphicsEnvironment.checkHeadless();
|
||||||
|
@ -541,11 +529,10 @@ public class Window extends Container implements Accessible {
|
||||||
* {@code Frame} as its owner. The window will not be focusable
|
* {@code Frame} as its owner. The window will not be focusable
|
||||||
* unless its owner is showing on the screen.
|
* unless its owner is showing on the screen.
|
||||||
* <p>
|
* <p>
|
||||||
* If there is a security manager, this method first calls
|
* If there is a security manager set, it is invoked to check
|
||||||
* the security manager's {@code checkTopLevelWindow}
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}.
|
||||||
* method with {@code this}
|
* If that check fails with a {@code SecurityException} then a warning
|
||||||
* as its argument to determine whether or not the window
|
* banner is created.
|
||||||
* must be displayed with a warning banner.
|
|
||||||
*
|
*
|
||||||
* @param owner the {@code Frame} to act as owner or {@code null}
|
* @param owner the {@code Frame} to act as owner or {@code null}
|
||||||
* if this window has no owner
|
* if this window has no owner
|
||||||
|
@ -555,7 +542,6 @@ public class Window extends Container implements Accessible {
|
||||||
* {@code GraphicsEnvironment.isHeadless} returns {@code true}
|
* {@code GraphicsEnvironment.isHeadless} returns {@code true}
|
||||||
*
|
*
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
* @see java.lang.SecurityManager#checkTopLevelWindow
|
|
||||||
* @see #isShowing
|
* @see #isShowing
|
||||||
*/
|
*/
|
||||||
public Window(Frame owner) {
|
public Window(Frame owner) {
|
||||||
|
@ -570,11 +556,10 @@ public class Window extends Container implements Accessible {
|
||||||
* unless its nearest owning {@code Frame} or {@code Dialog}
|
* unless its nearest owning {@code Frame} or {@code Dialog}
|
||||||
* is showing on the screen.
|
* is showing on the screen.
|
||||||
* <p>
|
* <p>
|
||||||
* If there is a security manager, this method first calls
|
* If there is a security manager set, it is invoked to check
|
||||||
* the security manager's {@code checkTopLevelWindow}
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}.
|
||||||
* method with {@code this}
|
* If that check fails with a {@code SecurityException} then a
|
||||||
* as its argument to determine whether or not the window
|
* warning banner is created.
|
||||||
* must be displayed with a warning banner.
|
|
||||||
*
|
*
|
||||||
* @param owner the {@code Window} to act as owner or
|
* @param owner the {@code Window} to act as owner or
|
||||||
* {@code null} if this window has no owner
|
* {@code null} if this window has no owner
|
||||||
|
@ -585,7 +570,6 @@ public class Window extends Container implements Accessible {
|
||||||
* {@code true}
|
* {@code true}
|
||||||
*
|
*
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
* @see java.lang.SecurityManager#checkTopLevelWindow
|
|
||||||
* @see #isShowing
|
* @see #isShowing
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
|
@ -603,11 +587,10 @@ public class Window extends Container implements Accessible {
|
||||||
* its nearest owning {@code Frame} or {@code Dialog}
|
* its nearest owning {@code Frame} or {@code Dialog}
|
||||||
* is showing on the screen.
|
* is showing on the screen.
|
||||||
* <p>
|
* <p>
|
||||||
* If there is a security manager, this method first calls
|
* If there is a security manager set, it is invoked to check
|
||||||
* the security manager's {@code checkTopLevelWindow}
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}. If that
|
||||||
* method with {@code this}
|
* check fails with a {@code SecurityException} then a warning banner
|
||||||
* as its argument to determine whether or not the window
|
* is created.
|
||||||
* must be displayed with a warning banner.
|
|
||||||
*
|
*
|
||||||
* @param owner the window to act as owner or {@code null}
|
* @param owner the window to act as owner or {@code null}
|
||||||
* if this window has no owner
|
* if this window has no owner
|
||||||
|
@ -621,7 +604,6 @@ public class Window extends Container implements Accessible {
|
||||||
* {@code true}
|
* {@code true}
|
||||||
*
|
*
|
||||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||||
* @see java.lang.SecurityManager#checkTopLevelWindow
|
|
||||||
* @see GraphicsConfiguration#getBounds
|
* @see GraphicsConfiguration#getBounds
|
||||||
* @see #isShowing
|
* @see #isShowing
|
||||||
* @since 1.3
|
* @since 1.3
|
||||||
|
@ -1362,10 +1344,9 @@ public class Window extends Container implements Accessible {
|
||||||
* Gets the warning string that is displayed with this window.
|
* Gets the warning string that is displayed with this window.
|
||||||
* If this window is insecure, the warning string is displayed
|
* If this window is insecure, the warning string is displayed
|
||||||
* somewhere in the visible area of the window. A window is
|
* somewhere in the visible area of the window. A window is
|
||||||
* insecure if there is a security manager, and the security
|
* insecure if there is a security manager and the security
|
||||||
* manager's {@code checkTopLevelWindow} method returns
|
* manager denies
|
||||||
* {@code false} when this window is passed to it as an
|
* {@code AWTPermission("showWindowWithoutWarningBanner")}.
|
||||||
* argument.
|
|
||||||
* <p>
|
* <p>
|
||||||
* If the window is secure, then {@code getWarningString}
|
* If the window is secure, then {@code getWarningString}
|
||||||
* returns {@code null}. If the window is insecure, this
|
* returns {@code null}. If the window is insecure, this
|
||||||
|
@ -1373,7 +1354,6 @@ public class Window extends Container implements Accessible {
|
||||||
* {@code awt.appletWarning}
|
* {@code awt.appletWarning}
|
||||||
* and returns the string value of that property.
|
* and returns the string value of that property.
|
||||||
* @return the warning string for this window.
|
* @return the warning string for this window.
|
||||||
* @see java.lang.SecurityManager#checkTopLevelWindow(java.lang.Object)
|
|
||||||
*/
|
*/
|
||||||
public final String getWarningString() {
|
public final String getWarningString() {
|
||||||
return warningString;
|
return warningString;
|
||||||
|
@ -1383,10 +1363,12 @@ public class Window extends Container implements Accessible {
|
||||||
warningString = null;
|
warningString = null;
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
if (!sm.checkTopLevelWindow(this)) {
|
try {
|
||||||
|
sm.checkPermission(SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION);
|
||||||
|
} catch (SecurityException se) {
|
||||||
// make sure the privileged action is only
|
// make sure the privileged action is only
|
||||||
// for getting the property! We don't want the
|
// for getting the property! We don't want the
|
||||||
// above checkTopLevelWindow call to always succeed!
|
// above checkPermission call to always succeed!
|
||||||
warningString = AccessController.doPrivileged(
|
warningString = AccessController.doPrivileged(
|
||||||
new GetPropertyAction("awt.appletWarning",
|
new GetPropertyAction("awt.appletWarning",
|
||||||
"Java Applet Window"));
|
"Java Applet Window"));
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
import sun.util.logging.PlatformLogger;
|
import sun.util.logging.PlatformLogger;
|
||||||
|
import sun.security.util.SecurityConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root event class for all component-level input events.
|
* The root event class for all component-level input events.
|
||||||
|
@ -350,7 +351,7 @@ public abstract class InputEvent extends ComponentEvent {
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
try {
|
try {
|
||||||
sm.checkSystemClipboardAccess();
|
sm.checkPermission(SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION);
|
||||||
b = true;
|
b = true;
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
|
|
|
@ -124,9 +124,11 @@ public final class Console implements Flushable
|
||||||
* {@link java.io.Reader#read(java.nio.CharBuffer) read(java.nio.CharBuffer)}
|
* {@link java.io.Reader#read(java.nio.CharBuffer) read(java.nio.CharBuffer)}
|
||||||
* on the returned object will not read in characters beyond the line
|
* on the returned object will not read in characters beyond the line
|
||||||
* bound for each invocation, even if the destination buffer has space for
|
* bound for each invocation, even if the destination buffer has space for
|
||||||
* more characters. A line bound is considered to be any one of a line feed
|
* more characters. The {@code Reader}'s {@code read} methods may block if a
|
||||||
* (<tt>'\n'</tt>), a carriage return (<tt>'\r'</tt>), a carriage return
|
* line bound has not been entered or reached on the console's input device.
|
||||||
* followed immediately by a linefeed, or an end of stream.
|
* A line bound is considered to be any one of a line feed (<tt>'\n'</tt>),
|
||||||
|
* a carriage return (<tt>'\r'</tt>), a carriage return followed immediately
|
||||||
|
* by a linefeed, or an end of stream.
|
||||||
*
|
*
|
||||||
* @return The reader associated with this console
|
* @return The reader associated with this console
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,24 @@
|
||||||
package java.lang;
|
package java.lang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A resource that must be closed when it is no longer needed.
|
* An object that may hold resources (such as file or socket handles)
|
||||||
|
* until it is closed. The {@link #close()} method of an {@code AutoCloseable}
|
||||||
|
* object is called automatically when exiting a {@code
|
||||||
|
* try}-with-resources block for which the object has been declared in
|
||||||
|
* the resource specification header. This construction ensures prompt
|
||||||
|
* release, avoiding resource exhaustion exceptions and errors that
|
||||||
|
* may otherwise occur.
|
||||||
|
*
|
||||||
|
* @apiNote
|
||||||
|
* <p>It is possible, and in fact common, for a base class to
|
||||||
|
* implement AutoCloseable even though not all of its subclasses or
|
||||||
|
* instances will hold releasable resources. For code that must operate
|
||||||
|
* in complete generality, or when it is known that the {@code AutoCloseable}
|
||||||
|
* instance requires resource release, it is recommended to use {@code
|
||||||
|
* try}-with-resources constructions. However, when using facilities such as
|
||||||
|
* {@link java.util.stream.Stream} that support both I/O-based and
|
||||||
|
* non-I/O-based forms, {@code try}-with-resources blocks are in
|
||||||
|
* general unnecessary when using non-I/O-based forms.
|
||||||
*
|
*
|
||||||
* @author Josh Bloch
|
* @author Josh Bloch
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
|
|
@ -821,6 +821,10 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* <p> If this object represents a primitive type or void, the method
|
* <p> If this object represents a primitive type or void, the method
|
||||||
* returns an array of length 0.
|
* returns an array of length 0.
|
||||||
*
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, the
|
||||||
|
* interfaces {@code Cloneable} and {@code java.io.Serializable} are
|
||||||
|
* returned in that order.
|
||||||
|
*
|
||||||
* @return an array of interfaces implemented by this class.
|
* @return an array of interfaces implemented by this class.
|
||||||
*/
|
*/
|
||||||
public Class<?>[] getInterfaces() {
|
public Class<?>[] getInterfaces() {
|
||||||
|
@ -1484,22 +1488,24 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
/**
|
/**
|
||||||
* Returns an array containing {@code Field} objects reflecting all
|
* Returns an array containing {@code Field} objects reflecting all
|
||||||
* the accessible public fields of the class or interface represented by
|
* the accessible public fields of the class or interface represented by
|
||||||
* this {@code Class} object. The elements in the array returned are
|
* this {@code Class} object.
|
||||||
* not sorted and are not in any particular order. This method returns an
|
|
||||||
* array of length 0 if the class or interface has no accessible public
|
|
||||||
* fields, or if it represents an array class, a primitive type, or void.
|
|
||||||
*
|
*
|
||||||
* <p> Specifically, if this {@code Class} object represents a class,
|
* <p> If this {@code Class} object represents a class or interface with no
|
||||||
* this method returns the public fields of this class and of all its
|
* no accessible public fields, then this method returns an array of length
|
||||||
* superclasses. If this {@code Class} object represents an
|
* 0.
|
||||||
* interface, this method returns the fields of this interface and of all
|
|
||||||
* its superinterfaces.
|
|
||||||
*
|
*
|
||||||
* <p> The implicit length field for array class is not reflected by this
|
* <p> If this {@code Class} object represents a class, then this method
|
||||||
* method. User code should use the methods of class {@code Array} to
|
* returns the public fields of the class and of all its superclasses.
|
||||||
* manipulate arrays.
|
|
||||||
*
|
*
|
||||||
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
|
* <p> If this {@code Class} object represents an interface, then this
|
||||||
|
* method returns the fields of the interface and of all its
|
||||||
|
* superinterfaces.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, a primitive
|
||||||
|
* type, or void, then this method returns an array of length 0.
|
||||||
|
*
|
||||||
|
* <p> The elements in the returned array are not sorted and are not in any
|
||||||
|
* particular order.
|
||||||
*
|
*
|
||||||
* @return the array of {@code Field} objects representing the
|
* @return the array of {@code Field} objects representing the
|
||||||
* public fields
|
* public fields
|
||||||
|
@ -1512,6 +1518,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* of this class.
|
* of this class.
|
||||||
*
|
*
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.3 Field Declarations
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
public Field[] getFields() throws SecurityException {
|
public Field[] getFields() throws SecurityException {
|
||||||
|
@ -1521,23 +1529,33 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array containing {@code Method} objects reflecting all
|
* Returns an array containing {@code Method} objects reflecting all the
|
||||||
* the public <em>member</em> methods of the class or interface represented
|
* public methods of the class or interface represented by this {@code
|
||||||
* by this {@code Class} object, including those declared by the class
|
* Class} object, including those declared by the class or interface and
|
||||||
* or interface and those inherited from superclasses and
|
* those inherited from superclasses and superinterfaces.
|
||||||
* superinterfaces. Array classes return all the (public) member methods
|
|
||||||
* inherited from the {@code Object} class. The elements in the array
|
|
||||||
* returned are not sorted and are not in any particular order. This
|
|
||||||
* method returns an array of length 0 if this {@code Class} object
|
|
||||||
* represents a class or interface that has no public member methods, or if
|
|
||||||
* this {@code Class} object represents a primitive type or void.
|
|
||||||
*
|
*
|
||||||
* <p> The class initialization method {@code <clinit>} is not
|
* <p> If this {@code Class} object represents a type that has multiple
|
||||||
* included in the returned array. If the class declares multiple public
|
* public methods with the same name and parameter types, but different
|
||||||
* member methods with the same parameter types, they are all included in
|
* return types, then the returned array has a {@code Method} object for
|
||||||
* the returned array.
|
* each such method.
|
||||||
*
|
*
|
||||||
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4.
|
* <p> If this {@code Class} object represents a type with a class
|
||||||
|
* initialization method {@code <clinit>}, then the returned array does
|
||||||
|
* <em>not</em> have a corresponding {@code Method} object.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, then the
|
||||||
|
* returned array has a {@code Method} object for each of the public
|
||||||
|
* methods inherited by the array type from {@code Object}. It does not
|
||||||
|
* contain a {@code Method} object for {@code clone()}.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents a class or interface with no
|
||||||
|
* public methods, then the returned array has length 0.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents a primitive type or void,
|
||||||
|
* then the returned array has length 0.
|
||||||
|
*
|
||||||
|
* <p> The elements in the returned array are not sorted and are not in any
|
||||||
|
* particular order.
|
||||||
*
|
*
|
||||||
* @return the array of {@code Method} objects representing the
|
* @return the array of {@code Method} objects representing the
|
||||||
* public methods of this class
|
* public methods of this class
|
||||||
|
@ -1549,6 +1567,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* s.checkPackageAccess()} denies access to the package
|
* s.checkPackageAccess()} denies access to the package
|
||||||
* of this class.
|
* of this class.
|
||||||
*
|
*
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.4 Method Declarations
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
|
@ -1595,13 +1615,14 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@code Field} object that reflects the specified public
|
* Returns a {@code Field} object that reflects the specified public member
|
||||||
* member field of the class or interface represented by this
|
* field of the class or interface represented by this {@code Class}
|
||||||
* {@code Class} object. The {@code name} parameter is a
|
* object. The {@code name} parameter is a {@code String} specifying the
|
||||||
* {@code String} specifying the simple name of the desired field.
|
* simple name of the desired field.
|
||||||
*
|
*
|
||||||
* <p> The field to be reflected is determined by the algorithm that
|
* <p> The field to be reflected is determined by the algorithm that
|
||||||
* follows. Let C be the class represented by this object:
|
* follows. Let C be the class or interface represented by this object:
|
||||||
|
*
|
||||||
* <OL>
|
* <OL>
|
||||||
* <LI> If C declares a public field with the name specified, that is the
|
* <LI> If C declares a public field with the name specified, that is the
|
||||||
* field to be reflected.</LI>
|
* field to be reflected.</LI>
|
||||||
|
@ -1614,7 +1635,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* is thrown.</LI>
|
* is thrown.</LI>
|
||||||
* </OL>
|
* </OL>
|
||||||
*
|
*
|
||||||
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
|
* <p> If this {@code Class} object represents an array type, then this
|
||||||
|
* method does not find the {@code length} field of the array type.
|
||||||
*
|
*
|
||||||
* @param name the field name
|
* @param name the field name
|
||||||
* @return the {@code Field} object of this class specified by
|
* @return the {@code Field} object of this class specified by
|
||||||
|
@ -1631,6 +1653,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* of this class.
|
* of this class.
|
||||||
*
|
*
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.3 Field Declarations
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
public Field getField(String name)
|
public Field getField(String name)
|
||||||
|
@ -1685,7 +1709,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* method and the method being overridden would have the same
|
* method and the method being overridden would have the same
|
||||||
* signature but different return types.
|
* signature but different return types.
|
||||||
*
|
*
|
||||||
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4.
|
* <p> If this {@code Class} object represents an array type, then this
|
||||||
|
* method does not find the {@code clone()} method.
|
||||||
*
|
*
|
||||||
* @param name the name of the method
|
* @param name the name of the method
|
||||||
* @param parameterTypes the list of parameters
|
* @param parameterTypes the list of parameters
|
||||||
|
@ -1702,6 +1727,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* s.checkPackageAccess()} denies access to the package
|
* s.checkPackageAccess()} denies access to the package
|
||||||
* of this class.
|
* of this class.
|
||||||
*
|
*
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.4 Method Declarations
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
|
@ -1800,12 +1827,15 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* declared by the class or interface represented by this
|
* declared by the class or interface represented by this
|
||||||
* {@code Class} object. This includes public, protected, default
|
* {@code Class} object. This includes public, protected, default
|
||||||
* (package) access, and private fields, but excludes inherited fields.
|
* (package) access, and private fields, but excludes inherited fields.
|
||||||
* The elements in the array returned are not sorted and are not in any
|
|
||||||
* particular order. This method returns an array of length 0 if the class
|
|
||||||
* or interface declares no fields, or if this {@code Class} object
|
|
||||||
* represents a primitive type, an array class, or void.
|
|
||||||
*
|
*
|
||||||
* <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
|
* <p> If this {@code Class} object represents a class or interface with no
|
||||||
|
* declared fields, then this method returns an array of length 0.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, a primitive
|
||||||
|
* type, or void, then this method returns an array of length 0.
|
||||||
|
*
|
||||||
|
* <p> The elements in the returned array are not sorted and are not in any
|
||||||
|
* particular order.
|
||||||
*
|
*
|
||||||
* @return the array of {@code Field} objects representing all the
|
* @return the array of {@code Field} objects representing all the
|
||||||
* declared fields of this class
|
* declared fields of this class
|
||||||
|
@ -1831,6 +1861,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.3 Field Declarations
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
public Field[] getDeclaredFields() throws SecurityException {
|
public Field[] getDeclaredFields() throws SecurityException {
|
||||||
|
@ -1840,20 +1872,29 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of {@code Method} objects reflecting all the
|
|
||||||
* methods declared by the class or interface represented by this
|
|
||||||
* {@code Class} object. This includes public, protected, default
|
|
||||||
* (package) access, and private methods, but excludes inherited methods.
|
|
||||||
* The elements in the array returned are not sorted and are not in any
|
|
||||||
* particular order. This method returns an array of length 0 if the class
|
|
||||||
* or interface declares no methods, or if this {@code Class} object
|
|
||||||
* represents a primitive type, an array class, or void. The class
|
|
||||||
* initialization method {@code <clinit>} is not included in the
|
|
||||||
* returned array. If the class declares multiple public member methods
|
|
||||||
* with the same parameter types, they are all included in the returned
|
|
||||||
* array.
|
|
||||||
*
|
*
|
||||||
* <p> See <em>The Java Language Specification</em>, section 8.2.
|
* Returns an array containing {@code Method} objects reflecting all the
|
||||||
|
* declared methods of the class or interface represented by this {@code
|
||||||
|
* Class} object, including public, protected, default (package)
|
||||||
|
* access, and private methods, but excluding inherited methods.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents a type that has multiple
|
||||||
|
* declared methods with the same name and parameter types, but different
|
||||||
|
* return types, then the returned array has a {@code Method} object for
|
||||||
|
* each such method.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents a type that has a class
|
||||||
|
* initialization method {@code <clinit>}, then the returned array does
|
||||||
|
* <em>not</em> have a corresponding {@code Method} object.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents a class or interface with no
|
||||||
|
* declared methods, then the returned array has length 0.
|
||||||
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, a primitive
|
||||||
|
* type, or void, then the returned array has length 0.
|
||||||
|
*
|
||||||
|
* <p> The elements in the returned array are not sorted and are not in any
|
||||||
|
* particular order.
|
||||||
*
|
*
|
||||||
* @return the array of {@code Method} objects representing all the
|
* @return the array of {@code Method} objects representing all the
|
||||||
* declared methods of this class
|
* declared methods of this class
|
||||||
|
@ -1878,6 +1919,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
*
|
*
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.4 Method Declarations
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
|
@ -1935,9 +1978,11 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
/**
|
/**
|
||||||
* Returns a {@code Field} object that reflects the specified declared
|
* Returns a {@code Field} object that reflects the specified declared
|
||||||
* field of the class or interface represented by this {@code Class}
|
* field of the class or interface represented by this {@code Class}
|
||||||
* object. The {@code name} parameter is a {@code String} that
|
* object. The {@code name} parameter is a {@code String} that specifies
|
||||||
* specifies the simple name of the desired field. Note that this method
|
* the simple name of the desired field.
|
||||||
* will not reflect the {@code length} field of an array class.
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, then this
|
||||||
|
* method does not find the {@code length} field of the array type.
|
||||||
*
|
*
|
||||||
* @param name the name of the field
|
* @param name the name of the field
|
||||||
* @return the {@code Field} object for the specified field in this
|
* @return the {@code Field} object for the specified field in this
|
||||||
|
@ -1967,6 +2012,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.3 Field Declarations
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
public Field getDeclaredField(String name)
|
public Field getDeclaredField(String name)
|
||||||
|
@ -1994,6 +2041,9 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
* name is "<init>"or "<clinit>" a {@code NoSuchMethodException}
|
* name is "<init>"or "<clinit>" a {@code NoSuchMethodException}
|
||||||
* is raised.
|
* is raised.
|
||||||
*
|
*
|
||||||
|
* <p> If this {@code Class} object represents an array type, then this
|
||||||
|
* method does not find the {@code clone()} method.
|
||||||
|
*
|
||||||
* @param name the name of the method
|
* @param name the name of the method
|
||||||
* @param parameterTypes the parameter array
|
* @param parameterTypes the parameter array
|
||||||
* @return the {@code Method} object for the method of this class
|
* @return the {@code Method} object for the method of this class
|
||||||
|
@ -2021,6 +2071,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||||
*
|
*
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
* @jls 8.2 Class Members
|
||||||
|
* @jls 8.4 Method Declarations
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
*/
|
*/
|
||||||
@CallerSensitive
|
@CallerSensitive
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -646,7 +646,7 @@ public final class Math {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the closest {@code int} to the argument, with ties
|
* Returns the closest {@code int} to the argument, with ties
|
||||||
* rounding up.
|
* rounding to positive infinity.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Special cases:
|
* Special cases:
|
||||||
|
@ -665,15 +665,37 @@ public final class Math {
|
||||||
* @see java.lang.Integer#MIN_VALUE
|
* @see java.lang.Integer#MIN_VALUE
|
||||||
*/
|
*/
|
||||||
public static int round(float a) {
|
public static int round(float a) {
|
||||||
if (a != 0x1.fffffep-2f) // greatest float value less than 0.5
|
int intBits = Float.floatToRawIntBits(a);
|
||||||
return (int)floor(a + 0.5f);
|
int biasedExp = (intBits & FloatConsts.EXP_BIT_MASK)
|
||||||
else
|
>> (FloatConsts.SIGNIFICAND_WIDTH - 1);
|
||||||
return 0;
|
int shift = (FloatConsts.SIGNIFICAND_WIDTH - 2
|
||||||
|
+ FloatConsts.EXP_BIAS) - biasedExp;
|
||||||
|
if ((shift & -32) == 0) { // shift >= 0 && shift < 32
|
||||||
|
// a is a finite number such that pow(2,-32) <= ulp(a) < 1
|
||||||
|
int r = ((intBits & FloatConsts.SIGNIF_BIT_MASK)
|
||||||
|
| (FloatConsts.SIGNIF_BIT_MASK + 1));
|
||||||
|
if (intBits < 0) {
|
||||||
|
r = -r;
|
||||||
|
}
|
||||||
|
// In the comments below each Java expression evaluates to the value
|
||||||
|
// the corresponding mathematical expression:
|
||||||
|
// (r) evaluates to a / ulp(a)
|
||||||
|
// (r >> shift) evaluates to floor(a * 2)
|
||||||
|
// ((r >> shift) + 1) evaluates to floor((a + 1/2) * 2)
|
||||||
|
// (((r >> shift) + 1) >> 1) evaluates to floor(a + 1/2)
|
||||||
|
return ((r >> shift) + 1) >> 1;
|
||||||
|
} else {
|
||||||
|
// a is either
|
||||||
|
// - a finite number with abs(a) < exp(2,FloatConsts.SIGNIFICAND_WIDTH-32) < 1/2
|
||||||
|
// - a finite number with ulp(a) >= 1 and hence a is a mathematical integer
|
||||||
|
// - an infinity or NaN
|
||||||
|
return (int) a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the closest {@code long} to the argument, with ties
|
* Returns the closest {@code long} to the argument, with ties
|
||||||
* rounding up.
|
* rounding to positive infinity.
|
||||||
*
|
*
|
||||||
* <p>Special cases:
|
* <p>Special cases:
|
||||||
* <ul><li>If the argument is NaN, the result is 0.
|
* <ul><li>If the argument is NaN, the result is 0.
|
||||||
|
@ -692,10 +714,32 @@ public final class Math {
|
||||||
* @see java.lang.Long#MIN_VALUE
|
* @see java.lang.Long#MIN_VALUE
|
||||||
*/
|
*/
|
||||||
public static long round(double a) {
|
public static long round(double a) {
|
||||||
if (a != 0x1.fffffffffffffp-2) // greatest double value less than 0.5
|
long longBits = Double.doubleToRawLongBits(a);
|
||||||
return (long)floor(a + 0.5d);
|
long biasedExp = (longBits & DoubleConsts.EXP_BIT_MASK)
|
||||||
else
|
>> (DoubleConsts.SIGNIFICAND_WIDTH - 1);
|
||||||
return 0;
|
long shift = (DoubleConsts.SIGNIFICAND_WIDTH - 2
|
||||||
|
+ DoubleConsts.EXP_BIAS) - biasedExp;
|
||||||
|
if ((shift & -64) == 0) { // shift >= 0 && shift < 64
|
||||||
|
// a is a finite number such that pow(2,-64) <= ulp(a) < 1
|
||||||
|
long r = ((longBits & DoubleConsts.SIGNIF_BIT_MASK)
|
||||||
|
| (DoubleConsts.SIGNIF_BIT_MASK + 1));
|
||||||
|
if (longBits < 0) {
|
||||||
|
r = -r;
|
||||||
|
}
|
||||||
|
// In the comments below each Java expression evaluates to the value
|
||||||
|
// the corresponding mathematical expression:
|
||||||
|
// (r) evaluates to a / ulp(a)
|
||||||
|
// (r >> shift) evaluates to floor(a * 2)
|
||||||
|
// ((r >> shift) + 1) evaluates to floor((a + 1/2) * 2)
|
||||||
|
// (((r >> shift) + 1) >> 1) evaluates to floor(a + 1/2)
|
||||||
|
return ((r >> shift) + 1) >> 1;
|
||||||
|
} else {
|
||||||
|
// a is either
|
||||||
|
// - a finite number with abs(a) < exp(2,DoubleConsts.SIGNIFICAND_WIDTH-64) < 1/2
|
||||||
|
// - a finite number with ulp(a) >= 1 and hence a is a mathematical integer
|
||||||
|
// - an infinity or NaN
|
||||||
|
return (long) a;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class RandomNumberGeneratorHolder {
|
private static final class RandomNumberGeneratorHolder {
|
||||||
|
|
|
@ -1336,9 +1336,16 @@ class SecurityManager {
|
||||||
* top-level windows; <code>false</code> otherwise.
|
* top-level windows; <code>false</code> otherwise.
|
||||||
* @exception NullPointerException if the <code>window</code> argument is
|
* @exception NullPointerException if the <code>window</code> argument is
|
||||||
* <code>null</code>.
|
* <code>null</code>.
|
||||||
|
* @deprecated The dependency on {@code AWTPermission} creates an
|
||||||
|
* impediment to future modularization of the Java platform.
|
||||||
|
* Users of this method should instead invoke
|
||||||
|
* {@link #checkPermission} directly.
|
||||||
|
* This method will be changed in a future release to check
|
||||||
|
* the permission {@code java.security.AllPermission}.
|
||||||
* @see java.awt.Window
|
* @see java.awt.Window
|
||||||
* @see #checkPermission(java.security.Permission) checkPermission
|
* @see #checkPermission(java.security.Permission) checkPermission
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean checkTopLevelWindow(Object window) {
|
public boolean checkTopLevelWindow(Object window) {
|
||||||
if (window == null) {
|
if (window == null) {
|
||||||
throw new NullPointerException("window can't be null");
|
throw new NullPointerException("window can't be null");
|
||||||
|
@ -1398,8 +1405,15 @@ class SecurityManager {
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
* @exception SecurityException if the calling thread does not have
|
* @exception SecurityException if the calling thread does not have
|
||||||
* permission to access the system clipboard.
|
* permission to access the system clipboard.
|
||||||
|
* @deprecated The dependency on {@code AWTPermission} creates an
|
||||||
|
* impediment to future modularization of the Java platform.
|
||||||
|
* Users of this method should instead invoke
|
||||||
|
* {@link #checkPermission} directly.
|
||||||
|
* This method will be changed in a future release to check
|
||||||
|
* the permission {@code java.security.AllPermission}.
|
||||||
* @see #checkPermission(java.security.Permission) checkPermission
|
* @see #checkPermission(java.security.Permission) checkPermission
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void checkSystemClipboardAccess() {
|
public void checkSystemClipboardAccess() {
|
||||||
Permission perm = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
|
Permission perm = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
|
||||||
if (perm == null) {
|
if (perm == null) {
|
||||||
|
@ -1427,8 +1441,15 @@ class SecurityManager {
|
||||||
* @since JDK1.1
|
* @since JDK1.1
|
||||||
* @exception SecurityException if the calling thread does not have
|
* @exception SecurityException if the calling thread does not have
|
||||||
* permission to access the AWT event queue.
|
* permission to access the AWT event queue.
|
||||||
|
* @deprecated The dependency on {@code AWTPermission} creates an
|
||||||
|
* impediment to future modularization of the Java platform.
|
||||||
|
* Users of this method should instead invoke
|
||||||
|
* {@link #checkPermission} directly.
|
||||||
|
* This method will be changed in a future release to check
|
||||||
|
* the permission {@code java.security.AllPermission}.
|
||||||
* @see #checkPermission(java.security.Permission) checkPermission
|
* @see #checkPermission(java.security.Permission) checkPermission
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void checkAwtEventQueueAccess() {
|
public void checkAwtEventQueueAccess() {
|
||||||
Permission perm = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
|
Permission perm = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
|
||||||
if (perm == null) {
|
if (perm == null) {
|
||||||
|
|
|
@ -633,7 +633,7 @@ public final class StrictMath {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the closest {@code int} to the argument, with ties
|
* Returns the closest {@code int} to the argument, with ties
|
||||||
* rounding up.
|
* rounding to positive infinity.
|
||||||
*
|
*
|
||||||
* <p>Special cases:
|
* <p>Special cases:
|
||||||
* <ul><li>If the argument is NaN, the result is 0.
|
* <ul><li>If the argument is NaN, the result is 0.
|
||||||
|
@ -656,7 +656,7 @@ public final class StrictMath {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the closest {@code long} to the argument, with ties
|
* Returns the closest {@code long} to the argument, with ties
|
||||||
* rounding up.
|
* rounding to positive infinity.
|
||||||
*
|
*
|
||||||
* <p>Special cases:
|
* <p>Special cases:
|
||||||
* <ul><li>If the argument is NaN, the result is 0.
|
* <ul><li>If the argument is NaN, the result is 0.
|
||||||
|
|
|
@ -2457,8 +2457,8 @@ public final class String
|
||||||
* String message = String.join(" ", strings);
|
* String message = String.join(" ", strings);
|
||||||
* //message returned is: "Java is cool"
|
* //message returned is: "Java is cool"
|
||||||
*
|
*
|
||||||
* Set<String> strings = new HashSet<>();
|
* Set<String> strings = new LinkedHashSet<>();
|
||||||
* Strings.add("Java"); strings.add("is");
|
* strings.add("Java"); strings.add("is");
|
||||||
* strings.add("very"); strings.add("cool");
|
* strings.add("very"); strings.add("cool");
|
||||||
* String message = String.join("-", strings);
|
* String message = String.join("-", strings);
|
||||||
* //message returned is: "Java-is-very-cool"
|
* //message returned is: "Java-is-very-cool"
|
||||||
|
@ -2652,7 +2652,7 @@ public final class String
|
||||||
* returns {@code "t\u005Cu0131tle"}, where '\u005Cu0131' is the
|
* returns {@code "t\u005Cu0131tle"}, where '\u005Cu0131' is the
|
||||||
* LATIN SMALL LETTER DOTLESS I character.
|
* LATIN SMALL LETTER DOTLESS I character.
|
||||||
* To obtain correct results for locale insensitive strings, use
|
* To obtain correct results for locale insensitive strings, use
|
||||||
* {@code toLowerCase(Locale.ENGLISH)}.
|
* {@code toLowerCase(Locale.ROOT)}.
|
||||||
* <p>
|
* <p>
|
||||||
* @return the {@code String}, converted to lowercase.
|
* @return the {@code String}, converted to lowercase.
|
||||||
* @see java.lang.String#toLowerCase(Locale)
|
* @see java.lang.String#toLowerCase(Locale)
|
||||||
|
@ -2815,7 +2815,7 @@ public final class String
|
||||||
* returns {@code "T\u005Cu0130TLE"}, where '\u005Cu0130' is the
|
* returns {@code "T\u005Cu0130TLE"}, where '\u005Cu0130' is the
|
||||||
* LATIN CAPITAL LETTER I WITH DOT ABOVE character.
|
* LATIN CAPITAL LETTER I WITH DOT ABOVE character.
|
||||||
* To obtain correct results for locale insensitive strings, use
|
* To obtain correct results for locale insensitive strings, use
|
||||||
* {@code toUpperCase(Locale.ENGLISH)}.
|
* {@code toUpperCase(Locale.ROOT)}.
|
||||||
* <p>
|
* <p>
|
||||||
* @return the {@code String}, converted to uppercase.
|
* @return the {@code String}, converted to uppercase.
|
||||||
* @see java.lang.String#toUpperCase(Locale)
|
* @see java.lang.String#toUpperCase(Locale)
|
||||||
|
|
|
@ -124,7 +124,7 @@ import static sun.invoke.util.Wrapper.isWrapperType;
|
||||||
this.samMethodType = samMethodType;
|
this.samMethodType = samMethodType;
|
||||||
|
|
||||||
this.implMethod = implMethod;
|
this.implMethod = implMethod;
|
||||||
this.implInfo = new MethodHandleInfo(implMethod);
|
this.implInfo = caller.revealDirect(implMethod);
|
||||||
// @@@ Temporary work-around pending resolution of 8005119
|
// @@@ Temporary work-around pending resolution of 8005119
|
||||||
this.implKind = (implInfo.getReferenceKind() == MethodHandleInfo.REF_invokeSpecial)
|
this.implKind = (implInfo.getReferenceKind() == MethodHandleInfo.REF_invokeSpecial)
|
||||||
? MethodHandleInfo.REF_invokeVirtual
|
? MethodHandleInfo.REF_invokeVirtual
|
||||||
|
|
145
jdk/src/share/classes/java/lang/invoke/InfoFromMemberName.java
Normal file
145
jdk/src/share/classes/java/lang/invoke/InfoFromMemberName.java
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012, 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 java.lang.invoke;
|
||||||
|
|
||||||
|
import java.security.*;
|
||||||
|
import java.lang.reflect.*;
|
||||||
|
import java.lang.invoke.MethodHandleNatives.Constants;
|
||||||
|
import java.lang.invoke.MethodHandles.Lookup;
|
||||||
|
import static java.lang.invoke.MethodHandleStatics.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Auxiliary to MethodHandleInfo, wants to nest in MethodHandleInfo but must be non-public.
|
||||||
|
*/
|
||||||
|
/*non-public*/
|
||||||
|
final
|
||||||
|
class InfoFromMemberName implements MethodHandleInfo {
|
||||||
|
private final MemberName member;
|
||||||
|
private final int referenceKind;
|
||||||
|
|
||||||
|
InfoFromMemberName(Lookup lookup, MemberName member, byte referenceKind) {
|
||||||
|
assert(member.isResolved() || member.isMethodHandleInvoke());
|
||||||
|
assert(member.referenceKindIsConsistentWith(referenceKind));
|
||||||
|
this.member = member;
|
||||||
|
this.referenceKind = referenceKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> getDeclaringClass() {
|
||||||
|
return member.getDeclaringClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return member.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MethodType getMethodType() {
|
||||||
|
return member.getMethodOrFieldType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getModifiers() {
|
||||||
|
return member.getModifiers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getReferenceKind() {
|
||||||
|
return referenceKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return MethodHandleInfo.toString(getReferenceKind(), getDeclaringClass(), getName(), getMethodType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Member> T reflectAs(Class<T> expected, Lookup lookup) {
|
||||||
|
if (member.isMethodHandleInvoke() && !member.isVarargs()) {
|
||||||
|
// This member is an instance of a signature-polymorphic method, which cannot be reflected
|
||||||
|
// A method handle invoker can come in either of two forms:
|
||||||
|
// A generic placeholder (present in the source code, and varargs)
|
||||||
|
// and a signature-polymorphic instance (synthetic and not varargs).
|
||||||
|
// For more information see comments on {@link MethodHandleNatives#linkMethod}.
|
||||||
|
throw new IllegalArgumentException("cannot reflect signature polymorphic method");
|
||||||
|
}
|
||||||
|
Member mem = AccessController.doPrivileged(new PrivilegedAction<Member>() {
|
||||||
|
public Member run() {
|
||||||
|
try {
|
||||||
|
return reflectUnchecked();
|
||||||
|
} catch (ReflectiveOperationException ex) {
|
||||||
|
throw new IllegalArgumentException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
Class<?> defc = getDeclaringClass();
|
||||||
|
byte refKind = (byte) getReferenceKind();
|
||||||
|
lookup.checkAccess(refKind, defc, convertToMemberName(refKind, mem));
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
throw new IllegalArgumentException(ex);
|
||||||
|
}
|
||||||
|
return expected.cast(mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Member reflectUnchecked() throws ReflectiveOperationException {
|
||||||
|
byte refKind = (byte) getReferenceKind();
|
||||||
|
Class<?> defc = getDeclaringClass();
|
||||||
|
boolean isPublic = Modifier.isPublic(getModifiers());
|
||||||
|
if (MethodHandleNatives.refKindIsMethod(refKind)) {
|
||||||
|
if (isPublic)
|
||||||
|
return defc.getMethod(getName(), getMethodType().parameterArray());
|
||||||
|
else
|
||||||
|
return defc.getDeclaredMethod(getName(), getMethodType().parameterArray());
|
||||||
|
} else if (MethodHandleNatives.refKindIsConstructor(refKind)) {
|
||||||
|
if (isPublic)
|
||||||
|
return defc.getConstructor(getMethodType().parameterArray());
|
||||||
|
else
|
||||||
|
return defc.getDeclaredConstructor(getMethodType().parameterArray());
|
||||||
|
} else if (MethodHandleNatives.refKindIsField(refKind)) {
|
||||||
|
if (isPublic)
|
||||||
|
return defc.getField(getName());
|
||||||
|
else
|
||||||
|
return defc.getDeclaredField(getName());
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("referenceKind="+refKind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MemberName convertToMemberName(byte refKind, Member mem) throws IllegalAccessException {
|
||||||
|
if (mem instanceof Method) {
|
||||||
|
boolean wantSpecial = (refKind == REF_invokeSpecial);
|
||||||
|
return new MemberName((Method) mem, wantSpecial);
|
||||||
|
} else if (mem instanceof Constructor) {
|
||||||
|
return new MemberName((Constructor) mem);
|
||||||
|
} else if (mem instanceof Field) {
|
||||||
|
boolean isSetter = (refKind == REF_putField || refKind == REF_putStatic);
|
||||||
|
return new MemberName((Field) mem, isSetter);
|
||||||
|
}
|
||||||
|
throw new InternalError(mem.getClass().getName());
|
||||||
|
}
|
||||||
|
}
|
|
@ -612,6 +612,12 @@ class InvokerBytecodeGenerator {
|
||||||
return false; // inner class of some sort
|
return false; // inner class of some sort
|
||||||
if (cls.getClassLoader() != MethodHandle.class.getClassLoader())
|
if (cls.getClassLoader() != MethodHandle.class.getClassLoader())
|
||||||
return false; // not on BCP
|
return false; // not on BCP
|
||||||
|
MethodType mtype = member.getMethodOrFieldType();
|
||||||
|
if (!isStaticallyNameable(mtype.returnType()))
|
||||||
|
return false;
|
||||||
|
for (Class<?> ptype : mtype.parameterArray())
|
||||||
|
if (!isStaticallyNameable(ptype))
|
||||||
|
return false;
|
||||||
if (!member.isPrivate() && VerifyAccess.isSamePackage(MethodHandle.class, cls))
|
if (!member.isPrivate() && VerifyAccess.isSamePackage(MethodHandle.class, cls))
|
||||||
return true; // in java.lang.invoke package
|
return true; // in java.lang.invoke package
|
||||||
if (member.isPublic() && isStaticallyNameable(cls))
|
if (member.isPublic() && isStaticallyNameable(cls))
|
||||||
|
|
|
@ -87,6 +87,7 @@ class Invokers {
|
||||||
lform = invokeForm(mtype, true, MethodTypeForm.LF_EX_INVOKER);
|
lform = invokeForm(mtype, true, MethodTypeForm.LF_EX_INVOKER);
|
||||||
invoker = SimpleMethodHandle.make(invokerType, lform);
|
invoker = SimpleMethodHandle.make(invokerType, lform);
|
||||||
}
|
}
|
||||||
|
invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke("invokeExact", mtype));
|
||||||
assert(checkInvoker(invoker));
|
assert(checkInvoker(invoker));
|
||||||
exactInvoker = invoker;
|
exactInvoker = invoker;
|
||||||
return invoker;
|
return invoker;
|
||||||
|
@ -110,6 +111,7 @@ class Invokers {
|
||||||
lform = invokeForm(mtype, true, MethodTypeForm.LF_GEN_INVOKER);
|
lform = invokeForm(mtype, true, MethodTypeForm.LF_GEN_INVOKER);
|
||||||
invoker = SimpleMethodHandle.make(invokerType, lform);
|
invoker = SimpleMethodHandle.make(invokerType, lform);
|
||||||
}
|
}
|
||||||
|
invoker = invoker.withInternalMemberName(MemberName.makeMethodHandleInvoke("invoke", mtype));
|
||||||
assert(checkInvoker(invoker));
|
assert(checkInvoker(invoker));
|
||||||
generalInvoker = invoker;
|
generalInvoker = invoker;
|
||||||
return invoker;
|
return invoker;
|
||||||
|
|
|
@ -320,14 +320,18 @@ import java.util.Objects;
|
||||||
|
|
||||||
/** Utility method to query if this member is a method handle invocation (invoke or invokeExact). */
|
/** Utility method to query if this member is a method handle invocation (invoke or invokeExact). */
|
||||||
public boolean isMethodHandleInvoke() {
|
public boolean isMethodHandleInvoke() {
|
||||||
final int bits = Modifier.NATIVE | Modifier.FINAL;
|
final int bits = MH_INVOKE_MODS;
|
||||||
final int negs = Modifier.STATIC;
|
final int negs = Modifier.STATIC;
|
||||||
if (testFlags(bits | negs, bits) &&
|
if (testFlags(bits | negs, bits) &&
|
||||||
clazz == MethodHandle.class) {
|
clazz == MethodHandle.class) {
|
||||||
return name.equals("invoke") || name.equals("invokeExact");
|
return isMethodHandleInvokeName(name);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public static boolean isMethodHandleInvokeName(String name) {
|
||||||
|
return name.equals("invoke") || name.equals("invokeExact");
|
||||||
|
}
|
||||||
|
private static final int MH_INVOKE_MODS = Modifier.NATIVE | Modifier.FINAL | Modifier.PUBLIC;
|
||||||
|
|
||||||
/** Utility method to query the modifier flags of this member. */
|
/** Utility method to query the modifier flags of this member. */
|
||||||
public boolean isStatic() {
|
public boolean isStatic() {
|
||||||
|
@ -482,12 +486,27 @@ import java.util.Objects;
|
||||||
m.getClass(); // NPE check
|
m.getClass(); // NPE check
|
||||||
// fill in vmtarget, vmindex while we have m in hand:
|
// fill in vmtarget, vmindex while we have m in hand:
|
||||||
MethodHandleNatives.init(this, m);
|
MethodHandleNatives.init(this, m);
|
||||||
|
if (clazz == null) { // MHN.init failed
|
||||||
|
if (m.getDeclaringClass() == MethodHandle.class &&
|
||||||
|
isMethodHandleInvokeName(m.getName())) {
|
||||||
|
// The JVM did not reify this signature-polymorphic instance.
|
||||||
|
// Need a special case here.
|
||||||
|
// See comments on MethodHandleNatives.linkMethod.
|
||||||
|
MethodType type = MethodType.methodType(m.getReturnType(), m.getParameterTypes());
|
||||||
|
int flags = flagsMods(IS_METHOD, m.getModifiers(), REF_invokeVirtual);
|
||||||
|
init(MethodHandle.class, m.getName(), type, flags);
|
||||||
|
if (isMethodHandleInvoke())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new LinkageError(m.toString());
|
||||||
|
}
|
||||||
assert(isResolved() && this.clazz != null);
|
assert(isResolved() && this.clazz != null);
|
||||||
this.name = m.getName();
|
this.name = m.getName();
|
||||||
if (this.type == null)
|
if (this.type == null)
|
||||||
this.type = new Object[] { m.getReturnType(), m.getParameterTypes() };
|
this.type = new Object[] { m.getReturnType(), m.getParameterTypes() };
|
||||||
if (wantSpecial) {
|
if (wantSpecial) {
|
||||||
assert(!isAbstract()) : this;
|
if (isAbstract())
|
||||||
|
throw new AbstractMethodError(this.toString());
|
||||||
if (getReferenceKind() == REF_invokeVirtual)
|
if (getReferenceKind() == REF_invokeVirtual)
|
||||||
changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual);
|
changeReferenceKind(REF_invokeSpecial, REF_invokeVirtual);
|
||||||
else if (getReferenceKind() == REF_invokeInterface)
|
else if (getReferenceKind() == REF_invokeInterface)
|
||||||
|
@ -562,6 +581,22 @@ import java.util.Objects;
|
||||||
initResolved(true);
|
initResolved(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a name for a signature-polymorphic invoker.
|
||||||
|
* This is a placeholder for a signature-polymorphic instance
|
||||||
|
* (of MH.invokeExact, etc.) that the JVM does not reify.
|
||||||
|
* See comments on {@link MethodHandleNatives#linkMethod}.
|
||||||
|
*/
|
||||||
|
static MemberName makeMethodHandleInvoke(String name, MethodType type) {
|
||||||
|
return makeMethodHandleInvoke(name, type, MH_INVOKE_MODS | SYNTHETIC);
|
||||||
|
}
|
||||||
|
static MemberName makeMethodHandleInvoke(String name, MethodType type, int mods) {
|
||||||
|
MemberName mem = new MemberName(MethodHandle.class, name, type, REF_invokeVirtual);
|
||||||
|
mem.flags |= mods; // it's not resolved, but add these modifiers anyway
|
||||||
|
assert(mem.isMethodHandleInvoke()) : mem;
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
// bare-bones constructor; the JVM will fill it in
|
// bare-bones constructor; the JVM will fill it in
|
||||||
MemberName() { }
|
MemberName() { }
|
||||||
|
|
||||||
|
|
|
@ -1284,6 +1284,21 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
||||||
return null; // DMH returns DMH.member
|
return null; // DMH returns DMH.member
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*non-public*/
|
||||||
|
MethodHandle withInternalMemberName(MemberName member) {
|
||||||
|
if (member != null) {
|
||||||
|
return MethodHandleImpl.makeWrappedMember(this, member);
|
||||||
|
} else if (internalMemberName() == null) {
|
||||||
|
// The required internaMemberName is null, and this MH (like most) doesn't have one.
|
||||||
|
return this;
|
||||||
|
} else {
|
||||||
|
// The following case is rare. Mask the internalMemberName by wrapping the MH in a BMH.
|
||||||
|
MethodHandle result = rebind();
|
||||||
|
assert (result.internalMemberName() == null);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*non-public*/
|
/*non-public*/
|
||||||
boolean isInvokeSpecial() {
|
boolean isInvokeSpecial() {
|
||||||
return false; // DMH.Special returns true
|
return false; // DMH.Special returns true
|
||||||
|
@ -1356,7 +1371,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
||||||
MethodHandle rebind() {
|
MethodHandle rebind() {
|
||||||
// Bind 'this' into a new invoker, of the known class BMH.
|
// Bind 'this' into a new invoker, of the known class BMH.
|
||||||
MethodType type2 = type();
|
MethodType type2 = type();
|
||||||
LambdaForm form2 = reinvokerForm(type2.basicType());
|
LambdaForm form2 = reinvokerForm(this);
|
||||||
// form2 = lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }
|
// form2 = lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }
|
||||||
return BoundMethodHandle.bindSingle(type2, form2, this);
|
return BoundMethodHandle.bindSingle(type2, form2, this);
|
||||||
}
|
}
|
||||||
|
@ -1369,23 +1384,38 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
||||||
/** Create a LF which simply reinvokes a target of the given basic type.
|
/** Create a LF which simply reinvokes a target of the given basic type.
|
||||||
* The target MH must override {@link #reinvokerTarget} to provide the target.
|
* The target MH must override {@link #reinvokerTarget} to provide the target.
|
||||||
*/
|
*/
|
||||||
static LambdaForm reinvokerForm(MethodType mtype) {
|
static LambdaForm reinvokerForm(MethodHandle target) {
|
||||||
mtype = mtype.basicType();
|
MethodType mtype = target.type().basicType();
|
||||||
LambdaForm reinvoker = mtype.form().cachedLambdaForm(MethodTypeForm.LF_REINVOKE);
|
LambdaForm reinvoker = mtype.form().cachedLambdaForm(MethodTypeForm.LF_REINVOKE);
|
||||||
if (reinvoker != null) return reinvoker;
|
if (reinvoker != null) return reinvoker;
|
||||||
MethodHandle MH_invokeBasic = MethodHandles.basicInvoker(mtype);
|
if (mtype.parameterSlotCount() >= MethodType.MAX_MH_ARITY)
|
||||||
|
return makeReinvokerForm(target.type(), target); // cannot cache this
|
||||||
|
reinvoker = makeReinvokerForm(mtype, null);
|
||||||
|
return mtype.form().setCachedLambdaForm(MethodTypeForm.LF_REINVOKE, reinvoker);
|
||||||
|
}
|
||||||
|
private static LambdaForm makeReinvokerForm(MethodType mtype, MethodHandle customTargetOrNull) {
|
||||||
|
boolean customized = (customTargetOrNull != null);
|
||||||
|
MethodHandle MH_invokeBasic = customized ? null : MethodHandles.basicInvoker(mtype);
|
||||||
final int THIS_BMH = 0;
|
final int THIS_BMH = 0;
|
||||||
final int ARG_BASE = 1;
|
final int ARG_BASE = 1;
|
||||||
final int ARG_LIMIT = ARG_BASE + mtype.parameterCount();
|
final int ARG_LIMIT = ARG_BASE + mtype.parameterCount();
|
||||||
int nameCursor = ARG_LIMIT;
|
int nameCursor = ARG_LIMIT;
|
||||||
final int NEXT_MH = nameCursor++;
|
final int NEXT_MH = customized ? -1 : nameCursor++;
|
||||||
final int REINVOKE = nameCursor++;
|
final int REINVOKE = nameCursor++;
|
||||||
LambdaForm.Name[] names = LambdaForm.arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
|
LambdaForm.Name[] names = LambdaForm.arguments(nameCursor - ARG_LIMIT, mtype.invokerType());
|
||||||
|
Object[] targetArgs;
|
||||||
|
MethodHandle targetMH;
|
||||||
|
if (customized) {
|
||||||
|
targetArgs = Arrays.copyOfRange(names, ARG_BASE, ARG_LIMIT, Object[].class);
|
||||||
|
targetMH = customTargetOrNull;
|
||||||
|
} else {
|
||||||
names[NEXT_MH] = new LambdaForm.Name(NF_reinvokerTarget, names[THIS_BMH]);
|
names[NEXT_MH] = new LambdaForm.Name(NF_reinvokerTarget, names[THIS_BMH]);
|
||||||
Object[] targetArgs = Arrays.copyOfRange(names, THIS_BMH, ARG_LIMIT, Object[].class);
|
targetArgs = Arrays.copyOfRange(names, THIS_BMH, ARG_LIMIT, Object[].class);
|
||||||
targetArgs[0] = names[NEXT_MH]; // overwrite this MH with next MH
|
targetArgs[0] = names[NEXT_MH]; // overwrite this MH with next MH
|
||||||
names[REINVOKE] = new LambdaForm.Name(MH_invokeBasic, targetArgs);
|
targetMH = MethodHandles.basicInvoker(mtype);
|
||||||
return mtype.form().setCachedLambdaForm(MethodTypeForm.LF_REINVOKE, new LambdaForm("BMH.reinvoke", ARG_LIMIT, names));
|
}
|
||||||
|
names[REINVOKE] = new LambdaForm.Name(targetMH, targetArgs);
|
||||||
|
return new LambdaForm("BMH.reinvoke", ARG_LIMIT, names);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final LambdaForm.NamedFunction NF_reinvokerTarget;
|
private static final LambdaForm.NamedFunction NF_reinvokerTarget;
|
||||||
|
|
|
@ -317,7 +317,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||||
private MethodHandle cache;
|
private MethodHandle cache;
|
||||||
|
|
||||||
AsVarargsCollector(MethodHandle target, MethodType type, Class<?> arrayType) {
|
AsVarargsCollector(MethodHandle target, MethodType type, Class<?> arrayType) {
|
||||||
super(type, reinvokerForm(type));
|
super(type, reinvokerForm(target));
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.arrayType = arrayType;
|
this.arrayType = arrayType;
|
||||||
this.cache = target.asCollector(arrayType, 0);
|
this.cache = target.asCollector(arrayType, 0);
|
||||||
|
@ -778,16 +778,27 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||||
}
|
}
|
||||||
static <T extends Throwable> Empty throwException(T t) throws T { throw t; }
|
static <T extends Throwable> Empty throwException(T t) throws T { throw t; }
|
||||||
|
|
||||||
static MethodHandle FAKE_METHOD_HANDLE_INVOKE;
|
static MethodHandle[] FAKE_METHOD_HANDLE_INVOKE = new MethodHandle[2];
|
||||||
static
|
static MethodHandle fakeMethodHandleInvoke(MemberName method) {
|
||||||
MethodHandle fakeMethodHandleInvoke(MemberName method) {
|
int idx;
|
||||||
MethodType type = method.getInvocationType();
|
assert(method.isMethodHandleInvoke());
|
||||||
assert(type.equals(MethodType.methodType(Object.class, Object[].class)));
|
switch (method.getName()) {
|
||||||
MethodHandle mh = FAKE_METHOD_HANDLE_INVOKE;
|
case "invoke": idx = 0; break;
|
||||||
|
case "invokeExact": idx = 1; break;
|
||||||
|
default: throw new InternalError(method.getName());
|
||||||
|
}
|
||||||
|
MethodHandle mh = FAKE_METHOD_HANDLE_INVOKE[idx];
|
||||||
if (mh != null) return mh;
|
if (mh != null) return mh;
|
||||||
mh = throwException(type.insertParameterTypes(0, UnsupportedOperationException.class));
|
MethodType type = MethodType.methodType(Object.class, UnsupportedOperationException.class,
|
||||||
|
MethodHandle.class, Object[].class);
|
||||||
|
mh = throwException(type);
|
||||||
mh = mh.bindTo(new UnsupportedOperationException("cannot reflectively invoke MethodHandle"));
|
mh = mh.bindTo(new UnsupportedOperationException("cannot reflectively invoke MethodHandle"));
|
||||||
FAKE_METHOD_HANDLE_INVOKE = mh;
|
if (!method.getInvocationType().equals(mh.type()))
|
||||||
|
throw new InternalError(method.toString());
|
||||||
|
mh = mh.withInternalMemberName(method);
|
||||||
|
mh = mh.asVarargsCollector(Object[].class);
|
||||||
|
assert(method.isVarargs());
|
||||||
|
FAKE_METHOD_HANDLE_INVOKE[idx] = mh;
|
||||||
return mh;
|
return mh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +832,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||||
MethodHandle vamh = prepareForInvoker(mh);
|
MethodHandle vamh = prepareForInvoker(mh);
|
||||||
// Cache the result of makeInjectedInvoker once per argument class.
|
// Cache the result of makeInjectedInvoker once per argument class.
|
||||||
MethodHandle bccInvoker = CV_makeInjectedInvoker.get(hostClass);
|
MethodHandle bccInvoker = CV_makeInjectedInvoker.get(hostClass);
|
||||||
return restoreToType(bccInvoker.bindTo(vamh), mh.type());
|
return restoreToType(bccInvoker.bindTo(vamh), mh.type(), mh.internalMemberName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MethodHandle makeInjectedInvoker(Class<?> hostClass) {
|
private static MethodHandle makeInjectedInvoker(Class<?> hostClass) {
|
||||||
|
@ -876,8 +887,11 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Undo the adapter effect of prepareForInvoker:
|
// Undo the adapter effect of prepareForInvoker:
|
||||||
private static MethodHandle restoreToType(MethodHandle vamh, MethodType type) {
|
private static MethodHandle restoreToType(MethodHandle vamh, MethodType type, MemberName member) {
|
||||||
return vamh.asCollector(Object[].class, type.parameterCount()).asType(type);
|
MethodHandle mh = vamh.asCollector(Object[].class, type.parameterCount());
|
||||||
|
mh = mh.asType(type);
|
||||||
|
mh = mh.withInternalMemberName(member);
|
||||||
|
return mh;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final MethodHandle MH_checkCallerClass;
|
private static final MethodHandle MH_checkCallerClass;
|
||||||
|
@ -939,4 +953,41 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** This subclass allows a wrapped method handle to be re-associated with an arbitrary member name. */
|
||||||
|
static class WrappedMember extends MethodHandle {
|
||||||
|
private final MethodHandle target;
|
||||||
|
private final MemberName member;
|
||||||
|
|
||||||
|
private WrappedMember(MethodHandle target, MethodType type, MemberName member) {
|
||||||
|
super(type, reinvokerForm(target));
|
||||||
|
this.target = target;
|
||||||
|
this.member = member;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
MethodHandle reinvokerTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
MemberName internalMemberName() {
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
boolean isInvokeSpecial() {
|
||||||
|
return target.isInvokeSpecial();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
MethodHandle viewAsType(MethodType newType) {
|
||||||
|
return new WrappedMember(target, newType, member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static MethodHandle makeWrappedMember(MethodHandle target, MemberName member) {
|
||||||
|
if (member.equals(target.internalMemberName()))
|
||||||
|
return target;
|
||||||
|
return new WrappedMember(target, target.type(), member);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,95 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package java.lang.invoke;
|
package java.lang.invoke;
|
||||||
|
|
||||||
|
import java.lang.reflect.*;
|
||||||
|
import java.util.*;
|
||||||
import java.lang.invoke.MethodHandleNatives.Constants;
|
import java.lang.invoke.MethodHandleNatives.Constants;
|
||||||
|
import java.lang.invoke.MethodHandles.Lookup;
|
||||||
|
import static java.lang.invoke.MethodHandleStatics.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cracking (reflecting) method handles back into their constituent symbolic parts.
|
* A symbolic reference obtained by cracking a method handle into its consitutent symbolic parts.
|
||||||
|
* To crack a direct method handle, call {@link Lookup#revealDirect Lookup.revealDirect}.
|
||||||
|
* <p>
|
||||||
|
* A <em>direct method handle</em> represents a method, constructor, or field without
|
||||||
|
* any intervening argument bindings or other transformations.
|
||||||
|
* The method, constructor, or field referred to by a direct method handle is called
|
||||||
|
* its <em>underlying member</em>.
|
||||||
|
* Direct method handles may be obtained in any of these ways:
|
||||||
|
* <ul>
|
||||||
|
* <li>By executing an {@code ldc} instruction on a {@code CONSTANT_MethodHandle} constant.
|
||||||
|
* (See the Java Virtual Machine Specification, sections 4.4.8 and 5.4.3.)
|
||||||
|
* <li>By calling one of the <a href="MethodHandles.Lookup.html#lookups">Lookup Factory Methods</a>,
|
||||||
|
* such as {@link Lookup#findVirtual Lookup.findVirtual},
|
||||||
|
* to resolve a symbolic reference into a method handle.
|
||||||
|
* A symbolic reference consists of a class, name string, and type.
|
||||||
|
* <li>By calling the factory method {@link Lookup#unreflect Lookup.unreflect}
|
||||||
|
* or {@link Lookup#unreflectSpecial Lookup.unreflectSpecial}
|
||||||
|
* to convert a {@link Method} into a method handle.
|
||||||
|
* <li>By calling the factory method {@link Lookup#unreflectConstructor Lookup.unreflectConstructor}
|
||||||
|
* to convert a {@link Constructor} into a method handle.
|
||||||
|
* <li>By calling the factory method {@link Lookup#unreflectGetter Lookup.unreflectGetter}
|
||||||
|
* or {@link Lookup#unreflectSetter Lookup.unreflectSetter}
|
||||||
|
* to convert a {@link Field} into a method handle.
|
||||||
|
* </ul>
|
||||||
|
* In all of these cases, it is possible to crack the resulting direct method handle
|
||||||
|
* to recover a symbolic reference for the underlying method, constructor, or field.
|
||||||
|
* Cracking must be done via a {@code Lookup} object equivalent to that which created
|
||||||
|
* the target method handle, or which has enough access permissions to recreate
|
||||||
|
* an equivalent method handle.
|
||||||
*
|
*
|
||||||
|
* <h1><a name="refkinds"></a>Reference kinds</h1>
|
||||||
|
* The <a href="MethodHandles.Lookup.html#lookups">Lookup Factory Methods</a>
|
||||||
|
* correspond to all major use cases for methods, constructors, and fields.
|
||||||
|
* These use cases may be distinguished using small integers as follows:
|
||||||
|
* <table border=1 cellpadding=5 summary="reference kinds">
|
||||||
|
* <tr><th>reference kind</th><th>descriptive name</th><th>scope</th><th>member</th><th>behavior</th></tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 1}</td><td>{@code REF_getField}</td><td>{@code class}</td>
|
||||||
|
* <td>{@code FT f;}</td><td>{@code (T) this.f;}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 2}</td><td>{@code REF_getStatic}</td><td>{@code class} or {@code interface}</td>
|
||||||
|
* <td>{@code static}<br>{@code FT f;}</td><td>{@code (T) C.f;}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 3}</td><td>{@code REF_putField}</td><td>{@code class}</td>
|
||||||
|
* <td>{@code FT f;}</td><td>{@code this.f = x;}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 4}</td><td>{@code REF_putStatic}</td><td>{@code class}</td>
|
||||||
|
* <td>{@code static}<br>{@code FT f;}</td><td>{@code C.f = arg;}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 5}</td><td>{@code REF_invokeVirtual}</td><td>{@code class}</td>
|
||||||
|
* <td>{@code T m(A*);}</td><td>{@code (T) this.m(arg*);}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 6}</td><td>{@code REF_invokeStatic}</td><td>{@code class} or {@code interface}</td>
|
||||||
|
* <td>{@code static}<br>{@code T m(A*);}</td><td>{@code (T) C.m(arg*);}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 7}</td><td>{@code REF_invokeSpecial}</td><td>{@code class} or {@code interface}</td>
|
||||||
|
* <td>{@code T m(A*);}</td><td>{@code (T) super.m(arg*);}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 8}</td><td>{@code REF_newInvokeSpecial}</td><td>{@code class}</td>
|
||||||
|
* <td>{@code C(A*);}</td><td>{@code new C(arg*);}</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@code 9}</td><td>{@code REF_invokeInterface}</td><td>{@code interface}</td>
|
||||||
|
* <td>{@code T m(A*);}</td><td>{@code (T) this.m(arg*);}</td>
|
||||||
|
* </tr>
|
||||||
|
* </table>
|
||||||
|
* @since 1.8
|
||||||
|
*/
|
||||||
|
public
|
||||||
|
interface MethodHandleInfo {
|
||||||
|
/**
|
||||||
|
* A direct method handle reference kind,
|
||||||
|
* as defined in the <a href="MethodHandleInfo.html#refkinds">table above</a>.
|
||||||
*/
|
*/
|
||||||
final class MethodHandleInfo {
|
|
||||||
public static final int
|
public static final int
|
||||||
REF_getField = Constants.REF_getField,
|
REF_getField = Constants.REF_getField,
|
||||||
REF_getStatic = Constants.REF_getStatic,
|
REF_getStatic = Constants.REF_getStatic,
|
||||||
|
@ -42,62 +124,146 @@ final class MethodHandleInfo {
|
||||||
REF_newInvokeSpecial = Constants.REF_newInvokeSpecial,
|
REF_newInvokeSpecial = Constants.REF_newInvokeSpecial,
|
||||||
REF_invokeInterface = Constants.REF_invokeInterface;
|
REF_invokeInterface = Constants.REF_invokeInterface;
|
||||||
|
|
||||||
private final Class<?> declaringClass;
|
/**
|
||||||
private final String name;
|
* Returns the reference kind of the cracked method handle, which in turn
|
||||||
private final MethodType methodType;
|
* determines whether the method handle's underlying member was a constructor, method, or field.
|
||||||
private final int referenceKind;
|
* See the <a href="MethodHandleInfo.html#refkinds">table above</a> for definitions.
|
||||||
|
* @return the integer code for the kind of reference used to access the underlying member
|
||||||
|
*/
|
||||||
|
public int getReferenceKind();
|
||||||
|
|
||||||
public MethodHandleInfo(MethodHandle mh) {
|
/**
|
||||||
MemberName mn = mh.internalMemberName();
|
* Returns the class in which the cracked method handle's underlying member was defined.
|
||||||
if (mn == null) throw new IllegalArgumentException("not a direct method handle");
|
* @return the declaring class of the underlying member
|
||||||
this.declaringClass = mn.getDeclaringClass();
|
*/
|
||||||
this.name = mn.getName();
|
public Class<?> getDeclaringClass();
|
||||||
this.methodType = mn.getMethodOrFieldType();
|
|
||||||
byte refKind = mn.getReferenceKind();
|
/**
|
||||||
if (refKind == REF_invokeSpecial && !mh.isInvokeSpecial())
|
* Returns the name of the cracked method handle's underlying member.
|
||||||
// Devirtualized method invocation is usually formally virtual.
|
* This is {@code "<init>"} if the underlying member was a constructor,
|
||||||
refKind = REF_invokeVirtual;
|
* else it is a simple method name or field name.
|
||||||
this.referenceKind = refKind;
|
* @return the simple name of the underlying member
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the nominal type of the cracked symbolic reference, expressed as a method type.
|
||||||
|
* If the reference is to a constructor, the return type will be {@code void}.
|
||||||
|
* If it is to a non-static method, the method type will not mention the {@code this} parameter.
|
||||||
|
* If it is to a field and the requested access is to read the field,
|
||||||
|
* the method type will have no parameters and return the field type.
|
||||||
|
* If it is to a field and the requested access is to write the field,
|
||||||
|
* the method type will have one parameter of the field type and return {@code void}.
|
||||||
|
* <p>
|
||||||
|
* Note that original direct method handle may include a leading {@code this} parameter,
|
||||||
|
* or (in the case of a constructor) will replace the {@code void} return type
|
||||||
|
* with the constructed class.
|
||||||
|
* The nominal type does not include any {@code this} parameter,
|
||||||
|
* and (in the case of a constructor) will return {@code void}.
|
||||||
|
* @return the type of the underlying member, expressed as a method type
|
||||||
|
*/
|
||||||
|
public MethodType getMethodType();
|
||||||
|
|
||||||
|
// Utility methods.
|
||||||
|
// NOTE: class/name/type and reference kind constitute a symbolic reference
|
||||||
|
// member and modifiers are an add-on, derived from Core Reflection (or the equivalent)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reflects the underlying member as a method, constructor, or field object.
|
||||||
|
* If the underlying member is public, it is reflected as if by
|
||||||
|
* {@code getMethod}, {@code getConstructor}, or {@code getField}.
|
||||||
|
* Otherwise, it is reflected as if by
|
||||||
|
* {@code getDeclaredMethod}, {@code getDeclaredConstructor}, or {@code getDeclaredField}.
|
||||||
|
* The underlying member must be accessible to the given lookup object.
|
||||||
|
* @param <T> the desired type of the result, either {@link Member} or a subtype
|
||||||
|
* @param expected a class object representing the desired result type {@code T}
|
||||||
|
* @param lookup the lookup object that created this MethodHandleInfo, or one with equivalent access privileges
|
||||||
|
* @return a reference to the method, constructor, or field object
|
||||||
|
* @exception ClassCastException if the member is not of the expected type
|
||||||
|
* @exception NullPointerException if either argument is {@code null}
|
||||||
|
* @exception IllegalArgumentException if the underlying member is not accessible to the given lookup object
|
||||||
|
*/
|
||||||
|
public <T extends Member> T reflectAs(Class<T> expected, Lookup lookup);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the access modifiers of the underlying member.
|
||||||
|
* @return the Java language modifiers for underlying member,
|
||||||
|
* or -1 if the member cannot be accessed
|
||||||
|
* @see Modifier
|
||||||
|
* @see reflectAs
|
||||||
|
*/
|
||||||
|
public int getModifiers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the underlying member was a variable arity method or constructor.
|
||||||
|
* Such members are represented by method handles that are varargs collectors.
|
||||||
|
* @implSpec
|
||||||
|
* This produces a result equivalent to:
|
||||||
|
* <pre>{@code
|
||||||
|
* getReferenceKind() >= REF_invokeVirtual && Modifier.isTransient(getModifiers())
|
||||||
|
* }</pre>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return {@code true} if and only if the underlying member was declared with variable arity.
|
||||||
|
*/
|
||||||
|
// spelling derived from java.lang.reflect.Executable, not MethodHandle.isVarargsCollector
|
||||||
|
public default boolean isVarArgs() {
|
||||||
|
// fields are never varargs:
|
||||||
|
if (MethodHandleNatives.refKindIsField((byte) getReferenceKind()))
|
||||||
|
return false;
|
||||||
|
// not in the public API: Modifier.VARARGS
|
||||||
|
final int ACC_VARARGS = 0x00000080; // from JVMS 4.6 (Table 4.20)
|
||||||
|
assert(ACC_VARARGS == Modifier.TRANSIENT);
|
||||||
|
return Modifier.isTransient(getModifiers());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<?> getDeclaringClass() {
|
/**
|
||||||
return declaringClass;
|
* Returns the descriptive name of the given reference kind,
|
||||||
|
* as defined in the <a href="MethodHandleInfo.html#refkinds">table above</a>.
|
||||||
|
* The conventional prefix "REF_" is omitted.
|
||||||
|
* @param referenceKind an integer code for a kind of reference used to access a class member
|
||||||
|
* @return a mixed-case string such as {@code "getField"}
|
||||||
|
* @exception IllegalArgumentException if the argument is not a valid
|
||||||
|
* <a href="MethodHandleInfo.html#refkinds">reference kind number</a>
|
||||||
|
*/
|
||||||
|
public static String referenceKindToString(int referenceKind) {
|
||||||
|
if (!MethodHandleNatives.refKindIsValid(referenceKind))
|
||||||
|
throw newIllegalArgumentException("invalid reference kind", referenceKind);
|
||||||
|
return MethodHandleNatives.refKindName((byte)referenceKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
/**
|
||||||
return name;
|
* Returns a string representation for a {@code MethodHandleInfo},
|
||||||
}
|
* given the four parts of its symbolic reference.
|
||||||
|
* This is defined to be of the form {@code "RK C.N:MT"}, where {@code RK} is the
|
||||||
public MethodType getMethodType() {
|
* {@linkplain #referenceKindToString reference kind string} for {@code kind},
|
||||||
return methodType;
|
* {@code C} is the {@linkplain java.lang.Class#getName name} of {@code defc}
|
||||||
}
|
* {@code N} is the {@code name}, and
|
||||||
|
* {@code MT} is the {@code type}.
|
||||||
public int getModifiers() {
|
* These four values may be obtained from the
|
||||||
return -1; //TODO
|
* {@linkplain #getReferenceKind reference kind},
|
||||||
}
|
* {@linkplain #getDeclaringClass declaring class},
|
||||||
|
* {@linkplain #getName member name},
|
||||||
public int getReferenceKind() {
|
* and {@linkplain #getMethodType method type}
|
||||||
return referenceKind;
|
* of a {@code MethodHandleInfo} object.
|
||||||
}
|
*
|
||||||
|
* @implSpec
|
||||||
static String getReferenceKindString(int referenceKind) {
|
* This produces a result equivalent to:
|
||||||
switch (referenceKind) {
|
* <pre>{@code
|
||||||
case REF_getField: return "getfield";
|
* String.format("%s %s.%s:%s", referenceKindToString(kind), defc.getName(), name, type)
|
||||||
case REF_getStatic: return "getstatic";
|
* }</pre>
|
||||||
case REF_putField: return "putfield";
|
*
|
||||||
case REF_putStatic: return "putstatic";
|
* @param kind the {@linkplain #getReferenceKind reference kind} part of the symbolic reference
|
||||||
case REF_invokeVirtual: return "invokevirtual";
|
* @param defc the {@linkplain #getDeclaringClass declaring class} part of the symbolic reference
|
||||||
case REF_invokeStatic: return "invokestatic";
|
* @param name the {@linkplain #getName member name} part of the symbolic reference
|
||||||
case REF_invokeSpecial: return "invokespecial";
|
* @param type the {@linkplain #getMethodType method type} part of the symbolic reference
|
||||||
case REF_newInvokeSpecial: return "newinvokespecial";
|
* @return a string of the form {@code "RK C.N:MT"}
|
||||||
case REF_invokeInterface: return "invokeinterface";
|
* @exception IllegalArgumentException if the first argument is not a valid
|
||||||
default: return "UNKNOWN_REFENCE_KIND" + "[" + referenceKind + "]";
|
* <a href="MethodHandleInfo.html#refkinds">reference kind number</a>
|
||||||
}
|
* @exception NullPointerException if any reference argument is {@code null}
|
||||||
}
|
*/
|
||||||
|
public static String toString(int kind, Class<?> defc, String name, MethodType type) {
|
||||||
@Override
|
Objects.requireNonNull(name); Objects.requireNonNull(type);
|
||||||
public String toString() {
|
return String.format("%s %s.%s:%s", referenceKindToString(kind), defc.getName(), name, type);
|
||||||
return String.format("%s %s.%s:%s", getReferenceKindString(referenceKind),
|
|
||||||
declaringClass.getName(), name, methodType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,9 @@ class MethodHandleNatives {
|
||||||
static boolean refKindIsMethod(byte refKind) {
|
static boolean refKindIsMethod(byte refKind) {
|
||||||
return !refKindIsField(refKind) && (refKind != REF_newInvokeSpecial);
|
return !refKindIsField(refKind) && (refKind != REF_newInvokeSpecial);
|
||||||
}
|
}
|
||||||
|
static boolean refKindIsConstructor(byte refKind) {
|
||||||
|
return (refKind == REF_newInvokeSpecial);
|
||||||
|
}
|
||||||
static boolean refKindHasReceiver(byte refKind) {
|
static boolean refKindHasReceiver(byte refKind) {
|
||||||
assert(refKindIsValid(refKind));
|
assert(refKindIsValid(refKind));
|
||||||
return (refKind & 1) != 0;
|
return (refKind & 1) != 0;
|
||||||
|
@ -313,7 +316,65 @@ class MethodHandleNatives {
|
||||||
* The method assumes the following arguments on the stack:
|
* The method assumes the following arguments on the stack:
|
||||||
* 0: the method handle being invoked
|
* 0: the method handle being invoked
|
||||||
* 1-N: the arguments to the method handle invocation
|
* 1-N: the arguments to the method handle invocation
|
||||||
* N+1: an implicitly added type argument (the given MethodType)
|
* N+1: an optional, implicitly added argument (typically the given MethodType)
|
||||||
|
* <p>
|
||||||
|
* The nominal method at such a call site is an instance of
|
||||||
|
* a signature-polymorphic method (see @PolymorphicSignature).
|
||||||
|
* Such method instances are user-visible entities which are
|
||||||
|
* "split" from the generic placeholder method in {@code MethodHandle}.
|
||||||
|
* (Note that the placeholder method is not identical with any of
|
||||||
|
* its instances. If invoked reflectively, is guaranteed to throw an
|
||||||
|
* {@code UnsupportedOperationException}.)
|
||||||
|
* If the signature-polymorphic method instance is ever reified,
|
||||||
|
* it appears as a "copy" of the original placeholder
|
||||||
|
* (a native final member of {@code MethodHandle}) except
|
||||||
|
* that its type descriptor has shape required by the instance,
|
||||||
|
* and the method instance is <em>not</em> varargs.
|
||||||
|
* The method instance is also marked synthetic, since the
|
||||||
|
* method (by definition) does not appear in Java source code.
|
||||||
|
* <p>
|
||||||
|
* The JVM is allowed to reify this method as instance metadata.
|
||||||
|
* For example, {@code invokeBasic} is always reified.
|
||||||
|
* But the JVM may instead call {@code linkMethod}.
|
||||||
|
* If the result is an * ordered pair of a {@code (method, appendix)},
|
||||||
|
* the method gets all the arguments (0..N inclusive)
|
||||||
|
* plus the appendix (N+1), and uses the appendix to complete the call.
|
||||||
|
* In this way, one reusable method (called a "linker method")
|
||||||
|
* can perform the function of any number of polymorphic instance
|
||||||
|
* methods.
|
||||||
|
* <p>
|
||||||
|
* Linker methods are allowed to be weakly typed, with any or
|
||||||
|
* all references rewritten to {@code Object} and any primitives
|
||||||
|
* (except {@code long}/{@code float}/{@code double})
|
||||||
|
* rewritten to {@code int}.
|
||||||
|
* A linker method is trusted to return a strongly typed result,
|
||||||
|
* according to the specific method type descriptor of the
|
||||||
|
* signature-polymorphic instance it is emulating.
|
||||||
|
* This can involve (as necessary) a dynamic check using
|
||||||
|
* data extracted from the appendix argument.
|
||||||
|
* <p>
|
||||||
|
* The JVM does not inspect the appendix, other than to pass
|
||||||
|
* it verbatim to the linker method at every call.
|
||||||
|
* This means that the JDK runtime has wide latitude
|
||||||
|
* for choosing the shape of each linker method and its
|
||||||
|
* corresponding appendix.
|
||||||
|
* Linker methods should be generated from {@code LambdaForm}s
|
||||||
|
* so that they do not become visible on stack traces.
|
||||||
|
* <p>
|
||||||
|
* The {@code linkMethod} call is free to omit the appendix
|
||||||
|
* (returning null) and instead emulate the required function
|
||||||
|
* completely in the linker method.
|
||||||
|
* As a corner case, if N==255, no appendix is possible.
|
||||||
|
* In this case, the method returned must be custom-generated to
|
||||||
|
* to perform any needed type checking.
|
||||||
|
* <p>
|
||||||
|
* If the JVM does not reify a method at a call site, but instead
|
||||||
|
* calls {@code linkMethod}, the corresponding call represented
|
||||||
|
* in the bytecodes may mention a valid method which is not
|
||||||
|
* representable with a {@code MemberName}.
|
||||||
|
* Therefore, use cases for {@code linkMethod} tend to correspond to
|
||||||
|
* special cases in reflective code such as {@code findVirtual}
|
||||||
|
* or {@code revealDirect}.
|
||||||
*/
|
*/
|
||||||
static MemberName linkMethod(Class<?> callerClass, int refKind,
|
static MemberName linkMethod(Class<?> callerClass, int refKind,
|
||||||
Class<?> defc, String name, Object type,
|
Class<?> defc, String name, Object type,
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
package java.lang.invoke;
|
package java.lang.invoke;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -54,6 +52,7 @@ import sun.security.util.SecurityConstants;
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
* @author John Rose, JSR 292 EG
|
* @author John Rose, JSR 292 EG
|
||||||
|
* @since 1.7
|
||||||
*/
|
*/
|
||||||
public class MethodHandles {
|
public class MethodHandles {
|
||||||
|
|
||||||
|
@ -96,6 +95,38 @@ public class MethodHandles {
|
||||||
return Lookup.PUBLIC_LOOKUP;
|
return Lookup.PUBLIC_LOOKUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs an unchecked "crack" of a direct method handle.
|
||||||
|
* The result is as if the user had obtained a lookup object capable enough
|
||||||
|
* to crack the target method handle, called
|
||||||
|
* {@link java.lang.invoke.MethodHandles.Lookup#revealDirect Lookup.revealDirect}
|
||||||
|
* on the target to obtain its symbolic reference, and then called
|
||||||
|
* {@link java.lang.invoke.MethodHandleInfo#reflectAs MethodHandleInfo.reflectAs}
|
||||||
|
* to resolve the symbolic reference to a member.
|
||||||
|
* <p>
|
||||||
|
* If there is a security manager, its {@code checkPermission} method
|
||||||
|
* is called with a {@code ReflectPermission("suppressAccessChecks")} permission.
|
||||||
|
* @param <T> the desired type of the result, either {@link Member} or a subtype
|
||||||
|
* @param target a direct method handle to crack into symbolic reference components
|
||||||
|
* @param expected a class object representing the desired result type {@code T}
|
||||||
|
* @return a reference to the method, constructor, or field object
|
||||||
|
* @exception SecurityException if the caller is not privileged to call {@code setAccessible}
|
||||||
|
* @exception NullPointerException if either argument is {@code null}
|
||||||
|
* @exception IllegalArgumentException if the target is not a direct method handle
|
||||||
|
* @exception ClassCastException if the member is not of the expected type
|
||||||
|
* @since 1.8
|
||||||
|
*/
|
||||||
|
public static <T extends Member> T
|
||||||
|
reflectAs(Class<T> expected, MethodHandle target) {
|
||||||
|
SecurityManager smgr = System.getSecurityManager();
|
||||||
|
if (smgr != null) smgr.checkPermission(ACCESS_PERMISSION);
|
||||||
|
Lookup lookup = Lookup.IMPL_LOOKUP; // use maximally privileged lookup
|
||||||
|
return lookup.revealDirect(target).reflectAs(expected, lookup);
|
||||||
|
}
|
||||||
|
// Copied from AccessibleObject, as used by Method.setAccessible, etc.:
|
||||||
|
static final private java.security.Permission ACCESS_PERMISSION =
|
||||||
|
new ReflectPermission("suppressAccessChecks");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <em>lookup object</em> is a factory for creating method handles,
|
* A <em>lookup object</em> is a factory for creating method handles,
|
||||||
* when the creation requires access checking.
|
* when the creation requires access checking.
|
||||||
|
@ -647,6 +678,7 @@ public class MethodHandles {
|
||||||
return invoker(type);
|
return invoker(type);
|
||||||
if ("invokeExact".equals(name))
|
if ("invokeExact".equals(name))
|
||||||
return exactInvoker(type);
|
return exactInvoker(type);
|
||||||
|
assert(!MemberName.isMethodHandleInvokeName(name));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -892,6 +924,10 @@ return mh1;
|
||||||
* @throws NullPointerException if the argument is null
|
* @throws NullPointerException if the argument is null
|
||||||
*/
|
*/
|
||||||
public MethodHandle unreflect(Method m) throws IllegalAccessException {
|
public MethodHandle unreflect(Method m) throws IllegalAccessException {
|
||||||
|
if (m.getDeclaringClass() == MethodHandle.class) {
|
||||||
|
MethodHandle mh = unreflectForMH(m);
|
||||||
|
if (mh != null) return mh;
|
||||||
|
}
|
||||||
MemberName method = new MemberName(m);
|
MemberName method = new MemberName(m);
|
||||||
byte refKind = method.getReferenceKind();
|
byte refKind = method.getReferenceKind();
|
||||||
if (refKind == REF_invokeSpecial)
|
if (refKind == REF_invokeSpecial)
|
||||||
|
@ -900,6 +936,12 @@ return mh1;
|
||||||
Lookup lookup = m.isAccessible() ? IMPL_LOOKUP : this;
|
Lookup lookup = m.isAccessible() ? IMPL_LOOKUP : this;
|
||||||
return lookup.getDirectMethod(refKind, method.getDeclaringClass(), method, findBoundCallerClass(method));
|
return lookup.getDirectMethod(refKind, method.getDeclaringClass(), method, findBoundCallerClass(method));
|
||||||
}
|
}
|
||||||
|
private MethodHandle unreflectForMH(Method m) {
|
||||||
|
// these names require special lookups because they throw UnsupportedOperationException
|
||||||
|
if (MemberName.isMethodHandleInvokeName(m.getName()))
|
||||||
|
return MethodHandleImpl.fakeMethodHandleInvoke(new MemberName(m));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces a method handle for a reflected method.
|
* Produces a method handle for a reflected method.
|
||||||
|
@ -1004,6 +1046,46 @@ return mh1;
|
||||||
return unreflectField(f, true);
|
return unreflectField(f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cracks a direct method handle created by this lookup object or a similar one.
|
||||||
|
* Security and access checks are performed to ensure that this lookup object
|
||||||
|
* is capable of reproducing the target method handle.
|
||||||
|
* This means that the cracking may fail if target is a direct method handle
|
||||||
|
* but was created by an unrelated lookup object.
|
||||||
|
* @param target a direct method handle to crack into symbolic reference components
|
||||||
|
* @return a symbolic reference which can be used to reconstruct this method handle from this lookup object
|
||||||
|
* @exception SecurityException if a security manager is present and it
|
||||||
|
* <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
|
||||||
|
* @throws IllegalArgumentException if the target is not a direct method handle or if access checking fails
|
||||||
|
* @exception NullPointerException if the target is {@code null}
|
||||||
|
* @since 1.8
|
||||||
|
*/
|
||||||
|
public MethodHandleInfo revealDirect(MethodHandle target) {
|
||||||
|
MemberName member = target.internalMemberName();
|
||||||
|
if (member == null || (!member.isResolved() && !member.isMethodHandleInvoke()))
|
||||||
|
throw newIllegalArgumentException("not a direct method handle");
|
||||||
|
Class<?> defc = member.getDeclaringClass();
|
||||||
|
byte refKind = member.getReferenceKind();
|
||||||
|
assert(MethodHandleNatives.refKindIsValid(refKind));
|
||||||
|
if (refKind == REF_invokeSpecial && !target.isInvokeSpecial())
|
||||||
|
// Devirtualized method invocation is usually formally virtual.
|
||||||
|
// To avoid creating extra MemberName objects for this common case,
|
||||||
|
// we encode this extra degree of freedom using MH.isInvokeSpecial.
|
||||||
|
refKind = REF_invokeVirtual;
|
||||||
|
if (refKind == REF_invokeVirtual && defc.isInterface())
|
||||||
|
// Symbolic reference is through interface but resolves to Object method (toString, etc.)
|
||||||
|
refKind = REF_invokeInterface;
|
||||||
|
// Check SM permissions and member access before cracking.
|
||||||
|
try {
|
||||||
|
checkSecurityManager(defc, member);
|
||||||
|
checkAccess(refKind, defc, member);
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
throw new IllegalArgumentException(ex);
|
||||||
|
}
|
||||||
|
// Produce the handle to the results.
|
||||||
|
return new InfoFromMemberName(this, member, refKind);
|
||||||
|
}
|
||||||
|
|
||||||
/// Helper methods, all package-private.
|
/// Helper methods, all package-private.
|
||||||
|
|
||||||
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
|
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
@ -1201,12 +1283,12 @@ return mh1;
|
||||||
private MethodHandle getDirectMethodCommon(byte refKind, Class<?> refc, MemberName method,
|
private MethodHandle getDirectMethodCommon(byte refKind, Class<?> refc, MemberName method,
|
||||||
boolean doRestrict, Class<?> callerClass) throws IllegalAccessException {
|
boolean doRestrict, Class<?> callerClass) throws IllegalAccessException {
|
||||||
checkMethod(refKind, refc, method);
|
checkMethod(refKind, refc, method);
|
||||||
if (method.isMethodHandleInvoke())
|
assert(!method.isMethodHandleInvoke());
|
||||||
return fakeMethodHandleInvoke(method);
|
|
||||||
|
|
||||||
Class<?> refcAsSuper;
|
Class<?> refcAsSuper;
|
||||||
if (refKind == REF_invokeSpecial &&
|
if (refKind == REF_invokeSpecial &&
|
||||||
refc != lookupClass() &&
|
refc != lookupClass() &&
|
||||||
|
!refc.isInterface() &&
|
||||||
refc != (refcAsSuper = lookupClass().getSuperclass()) &&
|
refc != (refcAsSuper = lookupClass().getSuperclass()) &&
|
||||||
refc.isAssignableFrom(lookupClass())) {
|
refc.isAssignableFrom(lookupClass())) {
|
||||||
assert(!method.getName().equals("<init>")); // not this code path
|
assert(!method.getName().equals("<init>")); // not this code path
|
||||||
|
@ -1234,9 +1316,6 @@ return mh1;
|
||||||
mh = restrictReceiver(method, mh, lookupClass());
|
mh = restrictReceiver(method, mh, lookupClass());
|
||||||
return mh;
|
return mh;
|
||||||
}
|
}
|
||||||
private MethodHandle fakeMethodHandleInvoke(MemberName method) {
|
|
||||||
return throwException(method.getReturnType(), UnsupportedOperationException.class);
|
|
||||||
}
|
|
||||||
private MethodHandle maybeBindCaller(MemberName method, MethodHandle mh,
|
private MethodHandle maybeBindCaller(MemberName method, MethodHandle mh,
|
||||||
Class<?> callerClass)
|
Class<?> callerClass)
|
||||||
throws IllegalAccessException {
|
throws IllegalAccessException {
|
||||||
|
|
|
@ -225,7 +225,7 @@ public final class SerializedLambda implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String implKind=MethodHandleInfo.getReferenceKindString(implMethodKind);
|
String implKind=MethodHandleInfo.referenceKindToString(implMethodKind);
|
||||||
return String.format("SerializedLambda[%s=%s, %s=%s.%s:%s, " +
|
return String.format("SerializedLambda[%s=%s, %s=%s.%s:%s, " +
|
||||||
"%s=%s %s.%s:%s, %s=%s, %s=%d]",
|
"%s=%s %s.%s:%s, %s=%s, %s=%d]",
|
||||||
"capturingClass", capturingClass,
|
"capturingClass", capturingClass,
|
||||||
|
|
|
@ -428,20 +428,32 @@ public abstract class Executable extends AccessibleObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of arrays that represent the annotations on
|
* Returns an array of arrays of {@code Annotation}s that
|
||||||
* the formal parameters, in declaration order, of the executable
|
* represent the annotations on the formal parameters, in
|
||||||
* represented by this object. (Returns an array of length zero if
|
* declaration order, of the {@code Executable} represented by
|
||||||
* the underlying executable is parameterless. If the executable has
|
* this object. Synthetic and mandated parameters (see
|
||||||
* one or more parameters, a nested array of length zero is
|
* explanation below), such as the outer "this" parameter to an
|
||||||
* returned for each parameter with no annotations.) The
|
* inner class constructor will be represented in the returned
|
||||||
* annotation objects contained in the returned arrays are
|
* array. If the executable has no parameters (meaning no formal,
|
||||||
* serializable. The caller of this method is free to modify the
|
* no synthetic, and no mandated parameters), a zero-length array
|
||||||
* returned arrays; it will have no effect on the arrays returned
|
* will be returned. If the {@code Executable} has one or more
|
||||||
* to other callers.
|
* parameters, a nested array of length zero is returned for each
|
||||||
|
* parameter with no annotations. The annotation objects contained
|
||||||
|
* in the returned arrays are serializable. The caller of this
|
||||||
|
* method is free to modify the returned arrays; it will have no
|
||||||
|
* effect on the arrays returned to other callers.
|
||||||
*
|
*
|
||||||
* @return an array of arrays that represent the annotations on the formal
|
* A compiler may add extra parameters that are implicitly
|
||||||
* parameters, in declaration order, of the executable represented by this
|
* declared in source ("mandated"), as well as parameters that
|
||||||
* object
|
* are neither implicitly nor explicitly declared in source
|
||||||
|
* ("synthetic") to the parameter list for a method. See {@link
|
||||||
|
* java.lang.reflect.Parameter} for more information.
|
||||||
|
*
|
||||||
|
* @see java.lang.reflect.Parameter
|
||||||
|
* @see java.lang.reflect.Parameter#getAnnotations
|
||||||
|
* @return an array of arrays that represent the annotations on
|
||||||
|
* the formal and implicit parameters, in declaration order, of
|
||||||
|
* the executable represented by this object
|
||||||
*/
|
*/
|
||||||
public abstract Annotation[][] getParameterAnnotations();
|
public abstract Annotation[][] getParameterAnnotations();
|
||||||
|
|
||||||
|
|
|
@ -719,7 +719,3 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
|
||||||
public final static int SHUT_RD = 0;
|
public final static int SHUT_RD = 0;
|
||||||
public final static int SHUT_WR = 1;
|
public final static int SHUT_WR = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
class InetAddressContainer {
|
|
||||||
InetAddress addr;
|
|
||||||
}
|
|
||||||
|
|
|
@ -292,13 +292,17 @@ public final class IDN {
|
||||||
if (useSTD3ASCIIRules) {
|
if (useSTD3ASCIIRules) {
|
||||||
for (int i = 0; i < dest.length(); i++) {
|
for (int i = 0; i < dest.length(); i++) {
|
||||||
int c = dest.charAt(i);
|
int c = dest.charAt(i);
|
||||||
if (!isLDHChar(c)) {
|
if (isNonLDHAsciiCodePoint(c)) {
|
||||||
throw new IllegalArgumentException("Contains non-LDH characters");
|
throw new IllegalArgumentException(
|
||||||
|
"Contains non-LDH ASCII characters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest.charAt(0) == '-' || dest.charAt(dest.length() - 1) == '-') {
|
if (dest.charAt(0) == '-' ||
|
||||||
throw new IllegalArgumentException("Has leading or trailing hyphen");
|
dest.charAt(dest.length() - 1) == '-') {
|
||||||
|
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Has leading or trailing hyphen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,25 +405,19 @@ public final class IDN {
|
||||||
//
|
//
|
||||||
// LDH stands for "letter/digit/hyphen", with characters restricted to the
|
// LDH stands for "letter/digit/hyphen", with characters restricted to the
|
||||||
// 26-letter Latin alphabet <A-Z a-z>, the digits <0-9>, and the hyphen
|
// 26-letter Latin alphabet <A-Z a-z>, the digits <0-9>, and the hyphen
|
||||||
// <->
|
// <->.
|
||||||
// non-LDH = 0..0x2C, 0x2E..0x2F, 0x3A..0x40, 0x56..0x60, 0x7B..0x7F
|
// Non LDH refers to characters in the ASCII range, but which are not
|
||||||
|
// letters, digits or the hypen.
|
||||||
//
|
//
|
||||||
private static boolean isLDHChar(int ch){
|
// non-LDH = 0..0x2C, 0x2E..0x2F, 0x3A..0x40, 0x5B..0x60, 0x7B..0x7F
|
||||||
// high runner case
|
//
|
||||||
if(ch > 0x007A){
|
private static boolean isNonLDHAsciiCodePoint(int ch){
|
||||||
return false;
|
return (0x0000 <= ch && ch <= 0x002C) ||
|
||||||
|
(0x002E <= ch && ch <= 0x002F) ||
|
||||||
|
(0x003A <= ch && ch <= 0x0040) ||
|
||||||
|
(0x005B <= ch && ch <= 0x0060) ||
|
||||||
|
(0x007B <= ch && ch <= 0x007F);
|
||||||
}
|
}
|
||||||
//['-' '0'..'9' 'A'..'Z' 'a'..'z']
|
|
||||||
if((ch == 0x002D) ||
|
|
||||||
(0x0030 <= ch && ch <= 0x0039) ||
|
|
||||||
(0x0041 <= ch && ch <= 0x005A) ||
|
|
||||||
(0x0061 <= ch && ch <= 0x007A)
|
|
||||||
){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// search dots in a string and return the index of that character;
|
// search dots in a string and return the index of that character;
|
||||||
|
|
30
jdk/src/share/classes/java/net/InetAddressContainer.java
Normal file
30
jdk/src/share/classes/java/net/InetAddressContainer.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation. 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 java.net;
|
||||||
|
|
||||||
|
class InetAddressContainer {
|
||||||
|
InetAddress addr;
|
||||||
|
}
|
|
@ -25,34 +25,56 @@
|
||||||
|
|
||||||
package java.nio.file;
|
package java.nio.file;
|
||||||
|
|
||||||
import java.nio.file.attribute.*;
|
import java.io.BufferedReader;
|
||||||
import java.nio.file.spi.FileSystemProvider;
|
import java.io.BufferedWriter;
|
||||||
import java.nio.file.spi.FileTypeDetector;
|
import java.io.Closeable;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.UncheckedIOException;
|
||||||
|
import java.io.Writer;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.nio.channels.SeekableByteChannel;
|
import java.nio.channels.SeekableByteChannel;
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UncheckedIOException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.BiPredicate;
|
|
||||||
import java.util.stream.CloseableStream;
|
|
||||||
import java.util.stream.DelegatingStream;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import java.util.stream.StreamSupport;
|
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.CharsetDecoder;
|
import java.nio.charset.CharsetDecoder;
|
||||||
import java.nio.charset.CharsetEncoder;
|
import java.nio.charset.CharsetEncoder;
|
||||||
|
import java.nio.file.attribute.BasicFileAttributeView;
|
||||||
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
|
import java.nio.file.attribute.DosFileAttributes;
|
||||||
|
import java.nio.file.attribute.FileAttribute;
|
||||||
|
import java.nio.file.attribute.FileAttributeView;
|
||||||
|
import java.nio.file.attribute.FileOwnerAttributeView;
|
||||||
|
import java.nio.file.attribute.FileStoreAttributeView;
|
||||||
|
import java.nio.file.attribute.FileTime;
|
||||||
|
import java.nio.file.attribute.PosixFileAttributeView;
|
||||||
|
import java.nio.file.attribute.PosixFileAttributes;
|
||||||
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
|
import java.nio.file.attribute.UserPrincipal;
|
||||||
|
import java.nio.file.spi.FileSystemProvider;
|
||||||
|
import java.nio.file.spi.FileTypeDetector;
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.Spliterator;
|
||||||
|
import java.util.Spliterators;
|
||||||
|
import java.util.function.BiPredicate;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class consists exclusively of static methods that operate on files,
|
* This class consists exclusively of static methods that operate on files,
|
||||||
|
@ -74,6 +96,21 @@ public final class Files {
|
||||||
return path.getFileSystem().provider();
|
return path.getFileSystem().provider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a Closeable to a Runnable by converting checked IOException
|
||||||
|
* to UncheckedIOException
|
||||||
|
*/
|
||||||
|
private static Runnable asUncheckedRunnable(Closeable c) {
|
||||||
|
return () -> {
|
||||||
|
try {
|
||||||
|
c.close();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new UncheckedIOException(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// -- File contents --
|
// -- File contents --
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3228,29 +3265,7 @@ public final class Files {
|
||||||
// -- Stream APIs --
|
// -- Stream APIs --
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of CloseableStream
|
* Return a lazily populated {@code Stream}, the elements of
|
||||||
*/
|
|
||||||
private static class DelegatingCloseableStream<T> extends DelegatingStream<T>
|
|
||||||
implements CloseableStream<T>
|
|
||||||
{
|
|
||||||
private final Closeable closeable;
|
|
||||||
|
|
||||||
DelegatingCloseableStream(Closeable c, Stream<T> delegate) {
|
|
||||||
super(delegate);
|
|
||||||
this.closeable = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
|
||||||
try {
|
|
||||||
closeable.close();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new UncheckedIOException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a lazily populated {@code CloseableStream}, the elements of
|
|
||||||
* which are the entries in the directory. The listing is not recursive.
|
* which are the entries in the directory. The listing is not recursive.
|
||||||
*
|
*
|
||||||
* <p> The elements of the stream are {@link Path} objects that are
|
* <p> The elements of the stream are {@link Path} objects that are
|
||||||
|
@ -3264,10 +3279,13 @@ public final class Files {
|
||||||
* reflect updates to the directory that occur after returning from this
|
* reflect updates to the directory that occur after returning from this
|
||||||
* method.
|
* method.
|
||||||
*
|
*
|
||||||
* <p> When not using the try-with-resources construct, then the stream's
|
* <p> The returned stream encapsulates a {@link DirectoryStream}.
|
||||||
* {@link CloseableStream#close close} method should be invoked after the
|
* If timely disposal of file system resources is required, the
|
||||||
* operation is completed so as to free any resources held for the open
|
* {@code try}-with-resources construct should be used to ensure that the
|
||||||
* directory. Operating on a closed stream behaves as if the end of stream
|
* stream's {@link Stream#close close} method is invoked after the stream
|
||||||
|
* operations are completed.
|
||||||
|
*
|
||||||
|
* <p> Operating on a closed stream behaves as if the end of stream
|
||||||
* has been reached. Due to read-ahead, one or more elements may be
|
* has been reached. Due to read-ahead, one or more elements may be
|
||||||
* returned after the stream has been closed.
|
* returned after the stream has been closed.
|
||||||
*
|
*
|
||||||
|
@ -3278,7 +3296,7 @@ public final class Files {
|
||||||
*
|
*
|
||||||
* @param dir The path to the directory
|
* @param dir The path to the directory
|
||||||
*
|
*
|
||||||
* @return The {@code CloseableStream} describing the content of the
|
* @return The {@code Stream} describing the content of the
|
||||||
* directory
|
* directory
|
||||||
*
|
*
|
||||||
* @throws NotDirectoryException
|
* @throws NotDirectoryException
|
||||||
|
@ -3294,12 +3312,14 @@ public final class Files {
|
||||||
* @see #newDirectoryStream(Path)
|
* @see #newDirectoryStream(Path)
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
public static CloseableStream<Path> list(Path dir) throws IOException {
|
public static Stream<Path> list(Path dir) throws IOException {
|
||||||
DirectoryStream<Path> ds = Files.newDirectoryStream(dir);
|
DirectoryStream<Path> ds = Files.newDirectoryStream(dir);
|
||||||
|
try {
|
||||||
final Iterator<Path> delegate = ds.iterator();
|
final Iterator<Path> delegate = ds.iterator();
|
||||||
|
|
||||||
// Re-wrap DirectoryIteratorException to UncheckedIOException
|
// Re-wrap DirectoryIteratorException to UncheckedIOException
|
||||||
Iterator<Path> it = new Iterator<Path>() {
|
Iterator<Path> it = new Iterator<Path>() {
|
||||||
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
try {
|
try {
|
||||||
return delegate.hasNext();
|
return delegate.hasNext();
|
||||||
|
@ -3307,6 +3327,7 @@ public final class Files {
|
||||||
throw new UncheckedIOException(e.getCause());
|
throw new UncheckedIOException(e.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Path next() {
|
public Path next() {
|
||||||
try {
|
try {
|
||||||
return delegate.next();
|
return delegate.next();
|
||||||
|
@ -3316,21 +3337,29 @@ public final class Files {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Stream<Path> s = StreamSupport.stream(
|
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, Spliterator.DISTINCT), false)
|
||||||
Spliterators.spliteratorUnknownSize(it, Spliterator.DISTINCT),
|
.onClose(asUncheckedRunnable(ds));
|
||||||
false);
|
} catch (Error|RuntimeException e) {
|
||||||
return new DelegatingCloseableStream<>(ds, s);
|
try {
|
||||||
|
ds.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
try {
|
||||||
|
e.addSuppressed(ex);
|
||||||
|
} catch (Throwable ignore) {}
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@code CloseableStream} that is lazily populated with {@code
|
* Return a {@code Stream} that is lazily populated with {@code
|
||||||
* Path} by walking the file tree rooted at a given starting file. The
|
* Path} by walking the file tree rooted at a given starting file. The
|
||||||
* file tree is traversed <em>depth-first</em>, the elements in the stream
|
* file tree is traversed <em>depth-first</em>, the elements in the stream
|
||||||
* are {@link Path} objects that are obtained as if by {@link
|
* are {@link Path} objects that are obtained as if by {@link
|
||||||
* Path#resolve(Path) resolving} the relative path against {@code start}.
|
* Path#resolve(Path) resolving} the relative path against {@code start}.
|
||||||
*
|
*
|
||||||
* <p> The {@code stream} walks the file tree as elements are consumed.
|
* <p> The {@code stream} walks the file tree as elements are consumed.
|
||||||
* The {@code CloseableStream} returned is guaranteed to have at least one
|
* The {@code Stream} returned is guaranteed to have at least one
|
||||||
* element, the starting file itself. For each file visited, the stream
|
* element, the starting file itself. For each file visited, the stream
|
||||||
* attempts to read its {@link BasicFileAttributes}. If the file is a
|
* attempts to read its {@link BasicFileAttributes}. If the file is a
|
||||||
* directory and can be opened successfully, entries in the directory, and
|
* directory and can be opened successfully, entries in the directory, and
|
||||||
|
@ -3370,10 +3399,11 @@ public final class Files {
|
||||||
* <p> When a security manager is installed and it denies access to a file
|
* <p> When a security manager is installed and it denies access to a file
|
||||||
* (or directory), then it is ignored and not included in the stream.
|
* (or directory), then it is ignored and not included in the stream.
|
||||||
*
|
*
|
||||||
* <p> When not using the try-with-resources construct, then the stream's
|
* <p> The returned stream encapsulates one or more {@link DirectoryStream}s.
|
||||||
* {@link CloseableStream#close close} method should be invoked after the
|
* If timely disposal of file system resources is required, the
|
||||||
* operation is completed so as to free any resources held for the open
|
* {@code try}-with-resources construct should be used to ensure that the
|
||||||
* directory. Operate the stream after it is closed will throw an
|
* stream's {@link Stream#close close} method is invoked after the stream
|
||||||
|
* operations are completed. Operating on a closed stream will result in an
|
||||||
* {@link java.lang.IllegalStateException}.
|
* {@link java.lang.IllegalStateException}.
|
||||||
*
|
*
|
||||||
* <p> If an {@link IOException} is thrown when accessing the directory
|
* <p> If an {@link IOException} is thrown when accessing the directory
|
||||||
|
@ -3388,7 +3418,7 @@ public final class Files {
|
||||||
* @param options
|
* @param options
|
||||||
* options to configure the traversal
|
* options to configure the traversal
|
||||||
*
|
*
|
||||||
* @return the {@link CloseableStream} of {@link Path}
|
* @return the {@link Stream} of {@link Path}
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the {@code maxDepth} parameter is negative
|
* if the {@code maxDepth} parameter is negative
|
||||||
|
@ -3401,21 +3431,22 @@ public final class Files {
|
||||||
* if an I/O error is thrown when accessing the starting file.
|
* if an I/O error is thrown when accessing the starting file.
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
public static CloseableStream<Path> walk(Path start, int maxDepth,
|
public static Stream<Path> walk(Path start, int maxDepth,
|
||||||
FileVisitOption... options)
|
FileVisitOption... options)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options);
|
FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options);
|
||||||
|
try {
|
||||||
Stream<Path> s = StreamSupport.stream(
|
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT), false)
|
||||||
Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT),
|
.onClose(iterator::close)
|
||||||
false).
|
.map(entry -> entry.file());
|
||||||
map(entry -> entry.file());
|
} catch (Error|RuntimeException e) {
|
||||||
return new DelegatingCloseableStream<>(iterator, s);
|
iterator.close();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@code CloseableStream} that is lazily populated with {@code
|
* Return a {@code Stream} that is lazily populated with {@code
|
||||||
* Path} by walking the file tree rooted at a given starting file. The
|
* Path} by walking the file tree rooted at a given starting file. The
|
||||||
* file tree is traversed <em>depth-first</em>, the elements in the stream
|
* file tree is traversed <em>depth-first</em>, the elements in the stream
|
||||||
* are {@link Path} objects that are obtained as if by {@link
|
* are {@link Path} objects that are obtained as if by {@link
|
||||||
|
@ -3428,12 +3459,19 @@ public final class Files {
|
||||||
* </pre></blockquote>
|
* </pre></blockquote>
|
||||||
* In other words, it visits all levels of the file tree.
|
* In other words, it visits all levels of the file tree.
|
||||||
*
|
*
|
||||||
|
* <p> The returned stream encapsulates one or more {@link DirectoryStream}s.
|
||||||
|
* If timely disposal of file system resources is required, the
|
||||||
|
* {@code try}-with-resources construct should be used to ensure that the
|
||||||
|
* stream's {@link Stream#close close} method is invoked after the stream
|
||||||
|
* operations are completed. Operating on a closed stream will result in an
|
||||||
|
* {@link java.lang.IllegalStateException}.
|
||||||
|
*
|
||||||
* @param start
|
* @param start
|
||||||
* the starting file
|
* the starting file
|
||||||
* @param options
|
* @param options
|
||||||
* options to configure the traversal
|
* options to configure the traversal
|
||||||
*
|
*
|
||||||
* @return the {@link CloseableStream} of {@link Path}
|
* @return the {@link Stream} of {@link Path}
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
* If the security manager denies access to the starting file.
|
* If the security manager denies access to the starting file.
|
||||||
|
@ -3446,15 +3484,14 @@ public final class Files {
|
||||||
* @see #walk(Path, int, FileVisitOption...)
|
* @see #walk(Path, int, FileVisitOption...)
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
public static CloseableStream<Path> walk(Path start,
|
public static Stream<Path> walk(Path start,
|
||||||
FileVisitOption... options)
|
FileVisitOption... options)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
return walk(start, Integer.MAX_VALUE, options);
|
return walk(start, Integer.MAX_VALUE, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@code CloseableStream} that is lazily populated with {@code
|
* Return a {@code Stream} that is lazily populated with {@code
|
||||||
* Path} by searching for files in a file tree rooted at a given starting
|
* Path} by searching for files in a file tree rooted at a given starting
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
|
@ -3463,12 +3500,19 @@ public final class Files {
|
||||||
* {@link BiPredicate} is invoked with its {@link Path} and {@link
|
* {@link BiPredicate} is invoked with its {@link Path} and {@link
|
||||||
* BasicFileAttributes}. The {@code Path} object is obtained as if by
|
* BasicFileAttributes}. The {@code Path} object is obtained as if by
|
||||||
* {@link Path#resolve(Path) resolving} the relative path against {@code
|
* {@link Path#resolve(Path) resolving} the relative path against {@code
|
||||||
* start} and is only included in the returned {@link CloseableStream} if
|
* start} and is only included in the returned {@link Stream} if
|
||||||
* the {@code BiPredicate} returns true. Compare to calling {@link
|
* the {@code BiPredicate} returns true. Compare to calling {@link
|
||||||
* java.util.stream.Stream#filter filter} on the {@code Stream}
|
* java.util.stream.Stream#filter filter} on the {@code Stream}
|
||||||
* returned by {@code walk} method, this method may be more efficient by
|
* returned by {@code walk} method, this method may be more efficient by
|
||||||
* avoiding redundant retrieval of the {@code BasicFileAttributes}.
|
* avoiding redundant retrieval of the {@code BasicFileAttributes}.
|
||||||
*
|
*
|
||||||
|
* <p> The returned stream encapsulates one or more {@link DirectoryStream}s.
|
||||||
|
* If timely disposal of file system resources is required, the
|
||||||
|
* {@code try}-with-resources construct should be used to ensure that the
|
||||||
|
* stream's {@link Stream#close close} method is invoked after the stream
|
||||||
|
* operations are completed. Operating on a closed stream will result in an
|
||||||
|
* {@link java.lang.IllegalStateException}.
|
||||||
|
*
|
||||||
* <p> If an {@link IOException} is thrown when accessing the directory
|
* <p> If an {@link IOException} is thrown when accessing the directory
|
||||||
* after returned from this method, it is wrapped in an {@link
|
* after returned from this method, it is wrapped in an {@link
|
||||||
* UncheckedIOException} which will be thrown from the method that caused
|
* UncheckedIOException} which will be thrown from the method that caused
|
||||||
|
@ -3484,7 +3528,7 @@ public final class Files {
|
||||||
* @param options
|
* @param options
|
||||||
* options to configure the traversal
|
* options to configure the traversal
|
||||||
*
|
*
|
||||||
* @return the {@link CloseableStream} of {@link Path}
|
* @return the {@link Stream} of {@link Path}
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* if the {@code maxDepth} parameter is negative
|
* if the {@code maxDepth} parameter is negative
|
||||||
|
@ -3499,24 +3543,25 @@ public final class Files {
|
||||||
* @see #walk(Path, int, FileVisitOption...)
|
* @see #walk(Path, int, FileVisitOption...)
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
public static CloseableStream<Path> find(Path start,
|
public static Stream<Path> find(Path start,
|
||||||
int maxDepth,
|
int maxDepth,
|
||||||
BiPredicate<Path, BasicFileAttributes> matcher,
|
BiPredicate<Path, BasicFileAttributes> matcher,
|
||||||
FileVisitOption... options)
|
FileVisitOption... options)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options);
|
FileTreeIterator iterator = new FileTreeIterator(start, maxDepth, options);
|
||||||
|
try {
|
||||||
Stream<Path> s = StreamSupport.stream(
|
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT), false)
|
||||||
Spliterators.spliteratorUnknownSize(iterator, Spliterator.DISTINCT),
|
.onClose(iterator::close)
|
||||||
false).
|
.filter(entry -> matcher.test(entry.file(), entry.attributes()))
|
||||||
filter(entry -> matcher.test(entry.file(), entry.attributes())).
|
.map(entry -> entry.file());
|
||||||
map(entry -> entry.file());
|
} catch (Error|RuntimeException e) {
|
||||||
return new DelegatingCloseableStream<>(iterator, s);
|
iterator.close();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read all lines from a file as a {@code CloseableStream}. Unlike {@link
|
* Read all lines from a file as a {@code Stream}. Unlike {@link
|
||||||
* #readAllLines(Path, Charset) readAllLines}, this method does not read
|
* #readAllLines(Path, Charset) readAllLines}, this method does not read
|
||||||
* all lines into a {@code List}, but instead populates lazily as the stream
|
* all lines into a {@code List}, but instead populates lazily as the stream
|
||||||
* is consumed.
|
* is consumed.
|
||||||
|
@ -3528,22 +3573,24 @@ public final class Files {
|
||||||
* <p> After this method returns, then any subsequent I/O exception that
|
* <p> After this method returns, then any subsequent I/O exception that
|
||||||
* occurs while reading from the file or when a malformed or unmappable byte
|
* occurs while reading from the file or when a malformed or unmappable byte
|
||||||
* sequence is read, is wrapped in an {@link UncheckedIOException} that will
|
* sequence is read, is wrapped in an {@link UncheckedIOException} that will
|
||||||
* be thrown form the
|
* be thrown from the
|
||||||
* {@link java.util.stream.Stream} method that caused the read to take
|
* {@link java.util.stream.Stream} method that caused the read to take
|
||||||
* place. In case an {@code IOException} is thrown when closing the file,
|
* place. In case an {@code IOException} is thrown when closing the file,
|
||||||
* it is also wrapped as an {@code UncheckedIOException}.
|
* it is also wrapped as an {@code UncheckedIOException}.
|
||||||
*
|
*
|
||||||
* <p> When not using the try-with-resources construct, then stream's
|
* <p> The returned stream encapsulates a {@link Reader}. If timely
|
||||||
* {@link CloseableStream#close close} method should be invoked after
|
* disposal of file system resources is required, the try-with-resources
|
||||||
* operation is completed so as to free any resources held for the open
|
* construct should be used to ensure that the stream's
|
||||||
* file.
|
* {@link Stream#close close} method is invoked after the stream operations
|
||||||
|
* are completed.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* the path to the file
|
* the path to the file
|
||||||
* @param cs
|
* @param cs
|
||||||
* the charset to use for decoding
|
* the charset to use for decoding
|
||||||
*
|
*
|
||||||
* @return the lines from the file as a {@code CloseableStream}
|
* @return the lines from the file as a {@code Stream}
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* if an I/O error occurs opening the file
|
* if an I/O error occurs opening the file
|
||||||
|
@ -3557,10 +3604,19 @@ public final class Files {
|
||||||
* @see java.io.BufferedReader#lines()
|
* @see java.io.BufferedReader#lines()
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
public static CloseableStream<String> lines(Path path, Charset cs)
|
public static Stream<String> lines(Path path, Charset cs) throws IOException {
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
BufferedReader br = Files.newBufferedReader(path, cs);
|
BufferedReader br = Files.newBufferedReader(path, cs);
|
||||||
return new DelegatingCloseableStream<>(br, br.lines());
|
try {
|
||||||
|
return br.lines().onClose(asUncheckedRunnable(br));
|
||||||
|
} catch (Error|RuntimeException e) {
|
||||||
|
try {
|
||||||
|
br.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
try {
|
||||||
|
e.addSuppressed(ex);
|
||||||
|
} catch (Throwable ignore) {}
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -93,6 +93,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @exception RemoteException if either of the following fails:
|
* @exception RemoteException if either of the following fails:
|
||||||
* a) registering the object with the activation system or b) exporting
|
* a) registering the object with the activation system or b) exporting
|
||||||
* the object to the RMI runtime.
|
* the object to the RMI runtime.
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation.
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
**/
|
**/
|
||||||
protected Activatable(String location,
|
protected Activatable(String location,
|
||||||
|
@ -143,6 +145,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @exception RemoteException if either of the following fails:
|
* @exception RemoteException if either of the following fails:
|
||||||
* a) registering the object with the activation system or b) exporting
|
* a) registering the object with the activation system or b) exporting
|
||||||
* the object to the RMI runtime.
|
* the object to the RMI runtime.
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation.
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
**/
|
**/
|
||||||
protected Activatable(String location,
|
protected Activatable(String location,
|
||||||
|
@ -175,6 +179,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @param port the port number on which the object is exported
|
* @param port the port number on which the object is exported
|
||||||
* @exception RemoteException if exporting the object to the RMI
|
* @exception RemoteException if exporting the object to the RMI
|
||||||
* runtime fails
|
* runtime fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
protected Activatable(ActivationID id, int port)
|
protected Activatable(ActivationID id, int port)
|
||||||
|
@ -206,6 +212,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @param ssf the server-side socket factory for receiving remote calls
|
* @param ssf the server-side socket factory for receiving remote calls
|
||||||
* @exception RemoteException if exporting the object to the RMI
|
* @exception RemoteException if exporting the object to the RMI
|
||||||
* runtime fails
|
* runtime fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
protected Activatable(ActivationID id, int port,
|
protected Activatable(ActivationID id, int port,
|
||||||
|
@ -239,6 +247,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* is not registered with the activation system
|
* is not registered with the activation system
|
||||||
* @exception ActivationException if activation system is not running
|
* @exception ActivationException if activation system is not running
|
||||||
* @exception RemoteException if remote call fails
|
* @exception RemoteException if remote call fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static Remote register(ActivationDesc desc)
|
public static Remote register(ActivationDesc desc)
|
||||||
|
@ -273,6 +283,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* already be inactive)
|
* already be inactive)
|
||||||
* @exception ActivationException if group is not active
|
* @exception ActivationException if group is not active
|
||||||
* @exception RemoteException if call informing monitor fails
|
* @exception RemoteException if call informing monitor fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static boolean inactive(ActivationID id)
|
public static boolean inactive(ActivationID id)
|
||||||
|
@ -290,6 +302,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @exception UnknownObjectException if object (<code>id</code>) is unknown
|
* @exception UnknownObjectException if object (<code>id</code>) is unknown
|
||||||
* @exception ActivationException if activation system is not running
|
* @exception ActivationException if activation system is not running
|
||||||
* @exception RemoteException if remote call to activation system fails
|
* @exception RemoteException if remote call to activation system fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static void unregister(ActivationID id)
|
public static void unregister(ActivationID id)
|
||||||
|
@ -334,6 +348,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* the wrong group
|
* the wrong group
|
||||||
* @exception ActivationException if activation group is not active
|
* @exception ActivationException if activation group is not active
|
||||||
* @exception RemoteException if object registration or export fails
|
* @exception RemoteException if object registration or export fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
**/
|
**/
|
||||||
public static ActivationID exportObject(Remote obj,
|
public static ActivationID exportObject(Remote obj,
|
||||||
|
@ -407,6 +423,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* descriptor with the activation system
|
* descriptor with the activation system
|
||||||
* @exception ActivationException if activation group is not active
|
* @exception ActivationException if activation group is not active
|
||||||
* @exception RemoteException if object registration or export fails
|
* @exception RemoteException if object registration or export fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
**/
|
**/
|
||||||
public static ActivationID exportObject(Remote obj,
|
public static ActivationID exportObject(Remote obj,
|
||||||
|
@ -473,6 +491,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @param port the port on which the object is exported (an anonymous
|
* @param port the port on which the object is exported (an anonymous
|
||||||
* port is used if port=0)
|
* port is used if port=0)
|
||||||
* @exception RemoteException if object export fails
|
* @exception RemoteException if object export fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static Remote exportObject(Remote obj,
|
public static Remote exportObject(Remote obj,
|
||||||
|
@ -503,6 +523,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* remote object
|
* remote object
|
||||||
* @param ssf the server-side socket factory for receiving remote calls
|
* @param ssf the server-side socket factory for receiving remote calls
|
||||||
* @exception RemoteException if object export fails
|
* @exception RemoteException if object export fails
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static Remote exportObject(Remote obj,
|
public static Remote exportObject(Remote obj,
|
||||||
|
@ -531,6 +553,8 @@ public abstract class Activatable extends RemoteServer {
|
||||||
* @return true if operation is successful, false otherwise
|
* @return true if operation is successful, false otherwise
|
||||||
* @exception NoSuchObjectException if the remote object is not
|
* @exception NoSuchObjectException if the remote object is not
|
||||||
* currently exported
|
* currently exported
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static boolean unexportObject(Remote obj, boolean force)
|
public static boolean unexportObject(Remote obj, boolean force)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -105,6 +105,8 @@ public final class ActivationDesc implements Serializable {
|
||||||
* @param data the object's initialization (activation) data contained
|
* @param data the object's initialization (activation) data contained
|
||||||
* in marshalled form.
|
* in marshalled form.
|
||||||
* @exception ActivationException if the current group is nonexistent
|
* @exception ActivationException if the current group is nonexistent
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public ActivationDesc(String className,
|
public ActivationDesc(String className,
|
||||||
|
@ -142,6 +144,8 @@ public final class ActivationDesc implements Serializable {
|
||||||
* <code>true</code> does not force an initial immediate activation of
|
* <code>true</code> does not force an initial immediate activation of
|
||||||
* a newly registered object; initial activation is lazy.
|
* a newly registered object; initial activation is lazy.
|
||||||
* @exception ActivationException if the current group is nonexistent
|
* @exception ActivationException if the current group is nonexistent
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public ActivationDesc(String className,
|
public ActivationDesc(String className,
|
||||||
|
@ -176,6 +180,8 @@ public final class ActivationDesc implements Serializable {
|
||||||
* @param data the object's initialization (activation) data contained
|
* @param data the object's initialization (activation) data contained
|
||||||
* in marshalled form.
|
* in marshalled form.
|
||||||
* @exception IllegalArgumentException if <code>groupID</code> is null
|
* @exception IllegalArgumentException if <code>groupID</code> is null
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public ActivationDesc(ActivationGroupID groupID,
|
public ActivationDesc(ActivationGroupID groupID,
|
||||||
|
@ -208,6 +214,8 @@ public final class ActivationDesc implements Serializable {
|
||||||
* <code>true</code> does not force an initial immediate activation of
|
* <code>true</code> does not force an initial immediate activation of
|
||||||
* a newly registered object; initial activation is lazy.
|
* a newly registered object; initial activation is lazy.
|
||||||
* @exception IllegalArgumentException if <code>groupID</code> is null
|
* @exception IllegalArgumentException if <code>groupID</code> is null
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public ActivationDesc(ActivationGroupID groupID,
|
public ActivationDesc(ActivationGroupID groupID,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -133,6 +133,8 @@ public abstract class ActivationGroup
|
||||||
*
|
*
|
||||||
* @param groupID the group's identifier
|
* @param groupID the group's identifier
|
||||||
* @throws RemoteException if this group could not be exported
|
* @throws RemoteException if this group could not be exported
|
||||||
|
* @throws UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
protected ActivationGroup(ActivationGroupID groupID)
|
protected ActivationGroup(ActivationGroupID groupID)
|
||||||
|
@ -267,6 +269,8 @@ public abstract class ActivationGroup
|
||||||
* (Note: The default implementation of the security manager
|
* (Note: The default implementation of the security manager
|
||||||
* <code>checkSetFactory</code>
|
* <code>checkSetFactory</code>
|
||||||
* method requires the RuntimePermission "setFactory")
|
* method requires the RuntimePermission "setFactory")
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @see SecurityManager#checkSetFactory
|
* @see SecurityManager#checkSetFactory
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
@ -345,6 +349,8 @@ public abstract class ActivationGroup
|
||||||
/**
|
/**
|
||||||
* Returns the current activation group's identifier. Returns null
|
* Returns the current activation group's identifier. Returns null
|
||||||
* if no group is currently active for this VM.
|
* if no group is currently active for this VM.
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @return the activation group's identifier
|
* @return the activation group's identifier
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
@ -394,6 +400,8 @@ public abstract class ActivationGroup
|
||||||
* (Note: The default implementation of the security manager
|
* (Note: The default implementation of the security manager
|
||||||
* <code>checkSetFactory</code>
|
* <code>checkSetFactory</code>
|
||||||
* method requires the RuntimePermission "setFactory")
|
* method requires the RuntimePermission "setFactory")
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @see #getSystem
|
* @see #getSystem
|
||||||
* @see SecurityManager#checkSetFactory
|
* @see SecurityManager#checkSetFactory
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
|
@ -428,6 +436,8 @@ public abstract class ActivationGroup
|
||||||
* @exception ActivationException if activation system cannot be
|
* @exception ActivationException if activation system cannot be
|
||||||
* obtained or is not bound
|
* obtained or is not bound
|
||||||
* (means that it is not running)
|
* (means that it is not running)
|
||||||
|
* @exception UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @see #setSystem
|
* @see #setSystem
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -63,6 +63,8 @@ public class ActivationGroupID implements java.io.Serializable {
|
||||||
* Constructs a unique group id.
|
* Constructs a unique group id.
|
||||||
*
|
*
|
||||||
* @param system the group's activation system
|
* @param system the group's activation system
|
||||||
|
* @throws UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public ActivationGroupID(ActivationSystem system) {
|
public ActivationGroupID(ActivationSystem system) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -90,6 +90,8 @@ public class ActivationID implements Serializable {
|
||||||
*
|
*
|
||||||
* @param activator reference to the activator responsible for
|
* @param activator reference to the activator responsible for
|
||||||
* activating the object
|
* activating the object
|
||||||
|
* @throws UnsupportedOperationException if and only if activation is
|
||||||
|
* not supported by this implementation
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public ActivationID(Activator activator) {
|
public ActivationID(Activator activator) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
|
Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,6 +31,15 @@ Provides support for RMI Object Activation. A remote
|
||||||
object's reference can be made ``persistent'' and later activated into a
|
object's reference can be made ``persistent'' and later activated into a
|
||||||
``live'' object using the RMI activation mechanism.
|
``live'' object using the RMI activation mechanism.
|
||||||
|
|
||||||
|
<p>Implementations are not required to support the activation
|
||||||
|
mechanism. If activation is not supported by this implementation,
|
||||||
|
several specific activation API methods are all required to throw
|
||||||
|
{@code UnsupportedOperationException}. If activation is supported by this
|
||||||
|
implementation, these methods must never throw {@code
|
||||||
|
UnsupportedOperationException}. These methods are denoted by the
|
||||||
|
presence of an entry for {@code UnsupportedOperationException} in the
|
||||||
|
<strong>Throws</strong> section of each method's specification.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<h2>Package Specification</h2>
|
<h2>Package Specification</h2>
|
||||||
|
|
||||||
|
|
|
@ -279,6 +279,9 @@ public final class AccessController {
|
||||||
* <p> Note that any DomainCombiner associated with the current
|
* <p> Note that any DomainCombiner associated with the current
|
||||||
* AccessControlContext will be ignored while the action is performed.
|
* AccessControlContext will be ignored while the action is performed.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||||
|
* {@code run} method.
|
||||||
|
*
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
*
|
*
|
||||||
* @return the value returned by the action's {@code run} method.
|
* @return the value returned by the action's {@code run} method.
|
||||||
|
@ -305,6 +308,9 @@ public final class AccessController {
|
||||||
* <p> This method preserves the current AccessControlContext's
|
* <p> This method preserves the current AccessControlContext's
|
||||||
* DomainCombiner (which may be null) while the action is performed.
|
* DomainCombiner (which may be null) while the action is performed.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||||
|
* {@code run} method.
|
||||||
|
*
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
*
|
*
|
||||||
* @return the value returned by the action's {@code run} method.
|
* @return the value returned by the action's {@code run} method.
|
||||||
|
@ -344,6 +350,8 @@ public final class AccessController {
|
||||||
* {@link java.security.SecurityPermission}, then the action is performed
|
* {@link java.security.SecurityPermission}, then the action is performed
|
||||||
* with no permissions.
|
* with no permissions.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||||
|
* {@code run} method.
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
* @param context an <i>access control context</i>
|
* @param context an <i>access control context</i>
|
||||||
* representing the restriction to be applied to the
|
* representing the restriction to be applied to the
|
||||||
|
@ -377,6 +385,8 @@ public final class AccessController {
|
||||||
* If the action's {@code run} method throws an (unchecked) exception,
|
* If the action's {@code run} method throws an (unchecked) exception,
|
||||||
* it will propagate through this method.
|
* it will propagate through this method.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||||
|
* {@code run} method.
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
* @param context an <i>access control context</i>
|
* @param context an <i>access control context</i>
|
||||||
* representing the restriction to be applied to the
|
* representing the restriction to be applied to the
|
||||||
|
@ -429,6 +439,8 @@ public final class AccessController {
|
||||||
* <p> This method preserves the current AccessControlContext's
|
* <p> This method preserves the current AccessControlContext's
|
||||||
* DomainCombiner (which may be null) while the action is performed.
|
* DomainCombiner (which may be null) while the action is performed.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the PrivilegedAction's
|
||||||
|
* {@code run} method.
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
* @param context an <i>access control context</i>
|
* @param context an <i>access control context</i>
|
||||||
* representing the restriction to be applied to the
|
* representing the restriction to be applied to the
|
||||||
|
@ -479,6 +491,9 @@ public final class AccessController {
|
||||||
* <p> Note that any DomainCombiner associated with the current
|
* <p> Note that any DomainCombiner associated with the current
|
||||||
* AccessControlContext will be ignored while the action is performed.
|
* AccessControlContext will be ignored while the action is performed.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the
|
||||||
|
* PrivilegedExceptionAction's {@code run} method.
|
||||||
|
*
|
||||||
* @param action the action to be performed
|
* @param action the action to be performed
|
||||||
*
|
*
|
||||||
* @return the value returned by the action's {@code run} method
|
* @return the value returned by the action's {@code run} method
|
||||||
|
@ -509,6 +524,9 @@ public final class AccessController {
|
||||||
* <p> This method preserves the current AccessControlContext's
|
* <p> This method preserves the current AccessControlContext's
|
||||||
* DomainCombiner (which may be null) while the action is performed.
|
* DomainCombiner (which may be null) while the action is performed.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the
|
||||||
|
* PrivilegedExceptionAction's {@code run} method.
|
||||||
|
*
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
*
|
*
|
||||||
* @return the value returned by the action's {@code run} method
|
* @return the value returned by the action's {@code run} method
|
||||||
|
@ -585,6 +603,8 @@ public final class AccessController {
|
||||||
* {@link java.security.SecurityPermission}, then the action is performed
|
* {@link java.security.SecurityPermission}, then the action is performed
|
||||||
* with no permissions.
|
* with no permissions.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the
|
||||||
|
* PrivilegedExceptionAction's {@code run} method.
|
||||||
* @param action the action to be performed
|
* @param action the action to be performed
|
||||||
* @param context an <i>access control context</i>
|
* @param context an <i>access control context</i>
|
||||||
* representing the restriction to be applied to the
|
* representing the restriction to be applied to the
|
||||||
|
@ -622,6 +642,8 @@ public final class AccessController {
|
||||||
* If the action's {@code run} method throws an (unchecked) exception,
|
* If the action's {@code run} method throws an (unchecked) exception,
|
||||||
* it will propagate through this method.
|
* it will propagate through this method.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the
|
||||||
|
* PrivilegedExceptionAction's {@code run} method.
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
* @param context an <i>access control context</i>
|
* @param context an <i>access control context</i>
|
||||||
* representing the restriction to be applied to the
|
* representing the restriction to be applied to the
|
||||||
|
@ -676,6 +698,8 @@ public final class AccessController {
|
||||||
* <p> This method preserves the current AccessControlContext's
|
* <p> This method preserves the current AccessControlContext's
|
||||||
* DomainCombiner (which may be null) while the action is performed.
|
* DomainCombiner (which may be null) while the action is performed.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the value returned by the
|
||||||
|
* PrivilegedExceptionAction's {@code run} method.
|
||||||
* @param action the action to be performed.
|
* @param action the action to be performed.
|
||||||
* @param context an <i>access control context</i>
|
* @param context an <i>access control context</i>
|
||||||
* representing the restriction to be applied to the
|
* representing the restriction to be applied to the
|
||||||
|
|
|
@ -324,6 +324,7 @@ public class AlgorithmParameters {
|
||||||
* parameters should be returned in an instance of the
|
* parameters should be returned in an instance of the
|
||||||
* {@code DSAParameterSpec} class.
|
* {@code DSAParameterSpec} class.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the parameter specification to be returrned
|
||||||
* @param paramSpec the specification class in which
|
* @param paramSpec the specification class in which
|
||||||
* the parameters should be returned.
|
* the parameters should be returned.
|
||||||
*
|
*
|
||||||
|
|
|
@ -102,6 +102,8 @@ public abstract class AlgorithmParametersSpi {
|
||||||
* parameters should be returned in an instance of the
|
* parameters should be returned in an instance of the
|
||||||
* {@code DSAParameterSpec} class.
|
* {@code DSAParameterSpec} class.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the parameter specification to be returned
|
||||||
|
*
|
||||||
* @param paramSpec the specification class in which
|
* @param paramSpec the specification class in which
|
||||||
* the parameters should be returned.
|
* the parameters should be returned.
|
||||||
*
|
*
|
||||||
|
|
|
@ -395,6 +395,8 @@ public class KeyFactory {
|
||||||
* key material should be returned in an instance of the
|
* key material should be returned in an instance of the
|
||||||
* {@code DSAPublicKeySpec} class.
|
* {@code DSAPublicKeySpec} class.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the key specification to be returned
|
||||||
|
*
|
||||||
* @param key the key.
|
* @param key the key.
|
||||||
*
|
*
|
||||||
* @param keySpec the specification class in which
|
* @param keySpec the specification class in which
|
||||||
|
|
|
@ -106,6 +106,8 @@ public abstract class KeyFactorySpi {
|
||||||
* key material should be returned in an instance of the
|
* key material should be returned in an instance of the
|
||||||
* {@code DSAPublicKeySpec} class.
|
* {@code DSAPublicKeySpec} class.
|
||||||
*
|
*
|
||||||
|
* @param <T> the type of the key specification to be returned
|
||||||
|
*
|
||||||
* @param key the key.
|
* @param key the key.
|
||||||
*
|
*
|
||||||
* @param keySpec the specification class in which
|
* @param keySpec the specification class in which
|
||||||
|
|
|
@ -1753,6 +1753,7 @@ public class KeyStore {
|
||||||
/**
|
/**
|
||||||
* Returns the KeyStore described by this object.
|
* Returns the KeyStore described by this object.
|
||||||
*
|
*
|
||||||
|
* @return the {@code KeyStore} described by this object
|
||||||
* @exception KeyStoreException if an error occured during the
|
* @exception KeyStoreException if an error occured during the
|
||||||
* operation, for example if the KeyStore could not be
|
* operation, for example if the KeyStore could not be
|
||||||
* instantiated or loaded
|
* instantiated or loaded
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -81,6 +81,7 @@ public interface Principal {
|
||||||
* <p>Subclasses may override this with a different implementation, if
|
* <p>Subclasses may override this with a different implementation, if
|
||||||
* necessary.
|
* necessary.
|
||||||
*
|
*
|
||||||
|
* @param subject the {@code Subject}
|
||||||
* @return true if {@code subject} is non-null and is
|
* @return true if {@code subject} is non-null and is
|
||||||
* implied by this principal, or false otherwise.
|
* implied by this principal, or false otherwise.
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
|
|
|
@ -87,6 +87,8 @@ public abstract class CertPathBuilderSpi {
|
||||||
* service providers, this method cannot be abstract and by default throws
|
* service providers, this method cannot be abstract and by default throws
|
||||||
* an {@code UnsupportedOperationException}.
|
* an {@code UnsupportedOperationException}.
|
||||||
*
|
*
|
||||||
|
* @return a {@code CertPathChecker} that this implementation uses to
|
||||||
|
* check the revocation status of certificates
|
||||||
* @throws UnsupportedOperationException if this method is not supported
|
* @throws UnsupportedOperationException if this method is not supported
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -97,6 +97,8 @@ public abstract class CertPathValidatorSpi {
|
||||||
* service providers, this method cannot be abstract and by default throws
|
* service providers, this method cannot be abstract and by default throws
|
||||||
* an {@code UnsupportedOperationException}.
|
* an {@code UnsupportedOperationException}.
|
||||||
*
|
*
|
||||||
|
* @return a {@code CertPathChecker} that this implementation uses to
|
||||||
|
* check the revocation status of certificates
|
||||||
* @throws UnsupportedOperationException if this method is not supported
|
* @throws UnsupportedOperationException if this method is not supported
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -103,6 +103,9 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
|
||||||
private Map<X509Certificate, byte[]> ocspResponses = Collections.emptyMap();
|
private Map<X509Certificate, byte[]> ocspResponses = Collections.emptyMap();
|
||||||
private Set<Option> options = Collections.emptySet();
|
private Set<Option> options = Collections.emptySet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
protected PKIXRevocationChecker() {}
|
protected PKIXRevocationChecker() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -300,8 +303,7 @@ public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
|
||||||
* <li>The CRL or OCSP response cannot be obtained because of a
|
* <li>The CRL or OCSP response cannot be obtained because of a
|
||||||
* network error.
|
* network error.
|
||||||
* <li>The OCSP responder returns one of the following errors
|
* <li>The OCSP responder returns one of the following errors
|
||||||
* specified in section 2.3 of RFC 2560: internalError, tryLater,
|
* specified in section 2.3 of RFC 2560: internalError or tryLater.
|
||||||
* or unauthorized.
|
|
||||||
* </ul><br>
|
* </ul><br>
|
||||||
* Note that these conditions apply to both OCSP and CRLs, and unless
|
* Note that these conditions apply to both OCSP and CRLs, and unless
|
||||||
* the {@code NO_FALLBACK} option is set, the revocation check is
|
* the {@code NO_FALLBACK} option is set, the revocation check is
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -46,6 +46,11 @@ import java.security.spec.RSAOtherPrimeInfo;
|
||||||
|
|
||||||
public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey {
|
public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type fingerprint that is set to indicate
|
||||||
|
* serialization compatibility with a previous
|
||||||
|
* version of the type.
|
||||||
|
*/
|
||||||
static final long serialVersionUID = 618058533534628008L;
|
static final long serialVersionUID = 618058533534628008L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,6 +39,11 @@ import java.math.BigInteger;
|
||||||
|
|
||||||
public interface RSAPrivateCrtKey extends RSAPrivateKey {
|
public interface RSAPrivateCrtKey extends RSAPrivateKey {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type fingerprint that is set to indicate
|
||||||
|
* serialization compatibility with a previous
|
||||||
|
* version of the type.
|
||||||
|
*/
|
||||||
static final long serialVersionUID = -5682214253527700368L;
|
static final long serialVersionUID = -5682214253527700368L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,6 +39,11 @@ import java.math.BigInteger;
|
||||||
public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey
|
public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type fingerprint that is set to indicate
|
||||||
|
* serialization compatibility with a previous
|
||||||
|
* version of the type.
|
||||||
|
*/
|
||||||
static final long serialVersionUID = 5187144804936595022L;
|
static final long serialVersionUID = 5187144804936595022L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -36,6 +36,11 @@ import java.math.BigInteger;
|
||||||
|
|
||||||
public interface RSAPublicKey extends java.security.PublicKey, RSAKey
|
public interface RSAPublicKey extends java.security.PublicKey, RSAKey
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The type fingerprint that is set to indicate
|
||||||
|
* serialization compatibility with a previous
|
||||||
|
* version of the type.
|
||||||
|
*/
|
||||||
static final long serialVersionUID = -8727434096241101194L;
|
static final long serialVersionUID = -8727434096241101194L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -326,6 +326,7 @@ public class DriverManager {
|
||||||
* @param driver the new JDBC Driver that is to be registered with the
|
* @param driver the new JDBC Driver that is to be registered with the
|
||||||
* {@code DriverManager}
|
* {@code DriverManager}
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
|
* @exception NullPointerException if {@code driver} is null
|
||||||
*/
|
*/
|
||||||
public static synchronized void registerDriver(java.sql.Driver driver)
|
public static synchronized void registerDriver(java.sql.Driver driver)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
@ -345,6 +346,7 @@ public class DriverManager {
|
||||||
* @param da the {@code DriverAction} implementation to be used when
|
* @param da the {@code DriverAction} implementation to be used when
|
||||||
* {@code DriverManager#deregisterDriver} is called
|
* {@code DriverManager#deregisterDriver} is called
|
||||||
* @exception SQLException if a database access error occurs
|
* @exception SQLException if a database access error occurs
|
||||||
|
* @exception NullPointerException if {@code driver} is null
|
||||||
*/
|
*/
|
||||||
public static synchronized void registerDriver(java.sql.Driver driver,
|
public static synchronized void registerDriver(java.sql.Driver driver,
|
||||||
DriverAction da)
|
DriverAction da)
|
||||||
|
|
|
@ -954,7 +954,6 @@ public interface PreparedStatement extends Statement {
|
||||||
* the JDBC driver does not support this data type
|
* the JDBC driver does not support this data type
|
||||||
* @see Types
|
* @see Types
|
||||||
*
|
*
|
||||||
* @since 1.6
|
|
||||||
*/
|
*/
|
||||||
void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)
|
void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength)
|
||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
|
@ -74,7 +74,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
@ -1299,8 +1299,9 @@ public final class Duration
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(1); // identifies this as a Duration
|
* out.writeByte(1); // identifies a Duration
|
||||||
* out.writeLong(seconds);
|
* out.writeLong(seconds);
|
||||||
* out.writeInt(nanos);
|
* out.writeInt(nanos);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -1316,7 +1317,7 @@ public final class Duration
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
|
@ -1317,8 +1317,9 @@ public final class Instant
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(2); // identifies this as an Instant
|
* out.writeByte(2); // identifies an Instant
|
||||||
* out.writeLong(seconds);
|
* out.writeLong(seconds);
|
||||||
* out.writeInt(nanos);
|
* out.writeInt(nanos);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -1334,7 +1335,7 @@ public final class Instant
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.ChronoLocalDate;
|
import java.time.chrono.ChronoLocalDate;
|
||||||
import java.time.chrono.Era;
|
import java.time.chrono.Era;
|
||||||
|
@ -2019,8 +2019,9 @@ public final class LocalDate
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(3); // identifies this as a LocalDate
|
* out.writeByte(3); // identifies a LocalDate
|
||||||
* out.writeInt(year);
|
* out.writeInt(year);
|
||||||
* out.writeByte(month);
|
* out.writeByte(month);
|
||||||
* out.writeByte(day);
|
* out.writeByte(day);
|
||||||
|
@ -2037,7 +2038,7 @@ public final class LocalDate
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.ChronoLocalDateTime;
|
import java.time.chrono.ChronoLocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
@ -1953,8 +1953,9 @@ public final class LocalDateTime
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(5); // identifies this as a LocalDateTime
|
* out.writeByte(5); // identifies a LocalDateTime
|
||||||
* // the <a href="../../serialized-form.html#java.time.LocalDate">date</a> excluding the one byte header
|
* // the <a href="../../serialized-form.html#java.time.LocalDate">date</a> excluding the one byte header
|
||||||
* // the <a href="../../serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
|
* // the <a href="../../serialized-form.html#java.time.LocalTime">time</a> excluding the one byte header
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -1970,7 +1971,7 @@ public final class LocalDateTime
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
|
@ -1595,8 +1595,11 @@ public final class LocalTime
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* A twos-complement value indicates the remaining values are not in the stream
|
||||||
|
* and should be set to zero.
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(4); // identifies this as a LocalTime
|
* out.writeByte(4); // identifies a LocalTime
|
||||||
* if (nano == 0) {
|
* if (nano == 0) {
|
||||||
* if (second == 0) {
|
* if (second == 0) {
|
||||||
* if (minute == 0) {
|
* if (minute == 0) {
|
||||||
|
@ -1629,7 +1632,7 @@ public final class LocalTime
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.Chronology;
|
import java.time.chrono.Chronology;
|
||||||
import java.time.chrono.IsoChronology;
|
import java.time.chrono.IsoChronology;
|
||||||
|
@ -744,9 +744,10 @@ public final class MonthDay
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../../serialized-form.html#java.time.temporal.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(13); // identifies this as a MonthDay
|
* out.writeByte(13); // identifies a MonthDay
|
||||||
* out.writeByte(month);
|
* out.writeByte(month);
|
||||||
* out.writeByte(day);
|
* out.writeByte(day);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -762,7 +763,7 @@ public final class MonthDay
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectInput;
|
import java.io.ObjectInput;
|
||||||
import java.io.ObjectOutput;
|
import java.io.ObjectOutput;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.IsoChronology;
|
import java.time.chrono.IsoChronology;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
@ -1901,9 +1901,10 @@ public final class OffsetDateTime
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../../serialized-form.html#java.time.temporal.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(10); // identifies this as a OffsetDateTime
|
* out.writeByte(10); // identifies a OffsetDateTime
|
||||||
* out.writeObject(dateTime);
|
* out.writeObject(dateTime);
|
||||||
* out.writeObject(offset);
|
* out.writeObject(offset);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -1919,7 +1920,7 @@ public final class OffsetDateTime
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectInput;
|
import java.io.ObjectInput;
|
||||||
import java.io.ObjectOutput;
|
import java.io.ObjectOutput;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
|
@ -1372,9 +1372,10 @@ public final class OffsetTime
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../../serialized-form.html#java.time.temporal.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(9); // identifies this as a OffsetTime
|
* out.writeByte(9); // identifies a OffsetTime
|
||||||
* out.writeObject(time);
|
* out.writeObject(time);
|
||||||
* out.writeObject(offset);
|
* out.writeObject(offset);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -1390,7 +1391,7 @@ public final class OffsetTime
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.ChronoLocalDate;
|
import java.time.chrono.ChronoLocalDate;
|
||||||
import java.time.chrono.Chronology;
|
import java.time.chrono.Chronology;
|
||||||
|
@ -993,11 +993,12 @@ public final class Period
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(14); // identifies this as a Period
|
* out.writeByte(14); // identifies a Period
|
||||||
* out.writeInt(years);
|
* out.writeInt(years);
|
||||||
* out.writeInt(months);
|
* out.writeInt(months);
|
||||||
* out.writeInt(seconds);
|
* out.writeInt(days);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @return the instance of {@code Ser}, not null
|
* @return the instance of {@code Ser}, not null
|
||||||
|
@ -1011,7 +1012,7 @@ public final class Period
|
||||||
* @return never
|
* @return never
|
||||||
* @throws java.io.InvalidObjectException always
|
* @throws java.io.InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,14 +72,14 @@ import java.io.StreamCorruptedException;
|
||||||
* byte flag would be used in order to specify an alternative version of the type format.
|
* byte flag would be used in order to specify an alternative version of the type format.
|
||||||
* For example {@code LOCAL_DATE_TYPE_VERSION_2 = 21}.
|
* For example {@code LOCAL_DATE_TYPE_VERSION_2 = 21}.
|
||||||
* <p>
|
* <p>
|
||||||
* In order to serialise the object it writes its byte and then calls back to the appropriate class where
|
* In order to serialize the object it writes its byte and then calls back to the appropriate class where
|
||||||
* the serialisation is performed. In order to deserialise the object it read in the type byte, switching
|
* the serialization is performed. In order to deserialize the object it read in the type byte, switching
|
||||||
* in order to select which class to call back into.
|
* in order to select which class to call back into.
|
||||||
* <p>
|
* <p>
|
||||||
* The serialisation format is determined on a per class basis. In the case of field based classes each
|
* The serialization format is determined on a per class basis. In the case of field based classes each
|
||||||
* of the fields is written out with an appropriate size format in descending order of the field's size. For
|
* of the fields is written out with an appropriate size format in descending order of the field's size. For
|
||||||
* example in the case of {@link LocalDate} year is written before month. Composite classes, such as
|
* example in the case of {@link LocalDate} year is written before month. Composite classes, such as
|
||||||
* {@link LocalDateTime} are serialised as one object.
|
* {@link LocalDateTime} are serialized as one object.
|
||||||
* <p>
|
* <p>
|
||||||
* This class is mutable and should be created once per serialization.
|
* This class is mutable and should be created once per serialization.
|
||||||
*
|
*
|
||||||
|
@ -133,6 +133,27 @@ final class Ser implements Externalizable {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Implements the {@code Externalizable} interface to write the object.
|
* Implements the {@code Externalizable} interface to write the object.
|
||||||
|
* @serialData
|
||||||
|
*
|
||||||
|
* Each serializable class is mapped to a type that is the first byte
|
||||||
|
* in the stream. Refer to each class {@code writeReplace}
|
||||||
|
* serialized form for the value of the type and sequence of values for the type.
|
||||||
|
* <ul>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Duration">Duration.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Instant">Instant.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.LocalDate">LocalDate.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.LocalDateTime">LocalDateTime.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.LocalTime">LocalTime.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.MonthDay">MonthDay.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.OffsetTime">OffsetTime.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.OffsetDateTime">OffsetDateTime.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Period">Period.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Year">Year.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.YearMonth">YearMonth.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.ZoneId">ZoneId.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.ZoneOffset">ZoneOffset.writeReplace</a>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.ZonedDateTime">ZonedDateTime.writeReplace</a>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param out the data stream to write to, not null
|
* @param out the data stream to write to, not null
|
||||||
*/
|
*/
|
||||||
|
@ -194,6 +215,29 @@ final class Ser implements Externalizable {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Implements the {@code Externalizable} interface to read the object.
|
* Implements the {@code Externalizable} interface to read the object.
|
||||||
|
* @serialData
|
||||||
|
*
|
||||||
|
* The streamed type and parameters defined by the type's {@code writeReplace}
|
||||||
|
* method are read and passed to the corresponding static factory for the type
|
||||||
|
* to create a new instance. That instance is returned as the de-serialized
|
||||||
|
* {@code Ser} object.
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Duration">Duration</a> - {@code Duration.ofSeconds(seconds, nanos);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Instant">Instant</a> - {@code Instant.ofEpochSecond(seconds, nanos);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.LocalDate">LocalDate</a> - {@code LocalDate.of(year, month, day);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.LocalDateTime">LocalDateTime</a> - {@code LocalDateTime.of(date, time);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.LocalTime">LocalTime</a> - {@code LocalTime.of(hour, minute, second, nano);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.MonthDay">MonthDay</a> - {@code MonthDay.of(month, day);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.OffsetTime">OffsetTime</a> - {@code OffsetTime.of(time, offset);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.OffsetDateTime">OffsetDateTime</a> - {@code OffsetDateTime.of(dateTime, offset);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Period">Period</a> - {@code Period.of(years, months, days);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.Year">Year</a> - {@code Year.of(year);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.YearMonth">YearMonth</a> - {@code YearMonth.of(year, month);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.ZonedDateTime">ZonedDateTime</a> - {@code ZonedDateTime.ofLenient(dateTime, offset, zone);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.ZoneId">ZoneId</a> - {@code ZoneId.of(id);}
|
||||||
|
* <li><a href="../../serialized-form.html#java.time.ZoneOffset">ZoneOffset</a> - {@code (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900));}
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param in the data to read, not null
|
* @param in the data to read, not null
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -74,7 +74,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.Chronology;
|
import java.time.chrono.Chronology;
|
||||||
import java.time.chrono.IsoChronology;
|
import java.time.chrono.IsoChronology;
|
||||||
|
@ -1080,9 +1080,10 @@ public final class Year
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../../serialized-form.html#java.time.temporal.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(11); // identifies this as a Year
|
* out.writeByte(11); // identifies a Year
|
||||||
* out.writeInt(year);
|
* out.writeInt(year);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -1097,7 +1098,7 @@ public final class Year
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.Chronology;
|
import java.time.chrono.Chronology;
|
||||||
import java.time.chrono.IsoChronology;
|
import java.time.chrono.IsoChronology;
|
||||||
|
@ -1205,9 +1205,10 @@ public final class YearMonth
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../../serialized-form.html#java.time.temporal.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(12); // identifies this as a YearMonth
|
* out.writeByte(12); // identifies a YearMonth
|
||||||
* out.writeInt(year);
|
* out.writeInt(year);
|
||||||
* out.writeByte(month);
|
* out.writeByte(month);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -1223,7 +1224,7 @@ public final class YearMonth
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ package java.time;
|
||||||
|
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.format.DateTimeFormatterBuilder;
|
import java.time.format.DateTimeFormatterBuilder;
|
||||||
import java.time.format.TextStyle;
|
import java.time.format.TextStyle;
|
||||||
|
@ -661,6 +662,15 @@ public abstract class ZoneId implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs this zone as a {@code String}, using the ID.
|
* Outputs this zone as a {@code String}, using the ID.
|
||||||
*
|
*
|
||||||
|
@ -675,9 +685,10 @@ public abstract class ZoneId implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(7); // identifies this as a ZoneId (not ZoneOffset)
|
* out.writeByte(7); // identifies a ZoneId (not ZoneOffset)
|
||||||
* out.writeUTF(zoneId);
|
* out.writeUTF(getId());
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
* When read back in, the {@code ZoneId} will be created as though using
|
* When read back in, the {@code ZoneId} will be created as though using
|
||||||
|
|
|
@ -70,7 +70,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.temporal.ChronoField;
|
import java.time.temporal.ChronoField;
|
||||||
import java.time.temporal.Temporal;
|
import java.time.temporal.Temporal;
|
||||||
|
@ -740,8 +740,9 @@ public final class ZoneOffset
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(8); // identifies this as a ZoneOffset
|
* out.writeByte(8); // identifies a ZoneOffset
|
||||||
* int offsetByte = totalSeconds % 900 == 0 ? totalSeconds / 900 : 127;
|
* int offsetByte = totalSeconds % 900 == 0 ? totalSeconds / 900 : 127;
|
||||||
* out.writeByte(offsetByte);
|
* out.writeByte(offsetByte);
|
||||||
* if (offsetByte == 127) {
|
* if (offsetByte == 127) {
|
||||||
|
@ -760,7 +761,7 @@ public final class ZoneOffset
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.zone.ZoneRules;
|
import java.time.zone.ZoneRules;
|
||||||
import java.time.zone.ZoneRulesException;
|
import java.time.zone.ZoneRulesException;
|
||||||
|
@ -181,8 +181,9 @@ final class ZoneRegion extends ZoneId implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(7); // identifies this as a ZoneId (not ZoneOffset)
|
* out.writeByte(7); // identifies a ZoneId (not ZoneOffset)
|
||||||
* out.writeUTF(zoneId);
|
* out.writeUTF(zoneId);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -197,7 +198,7 @@ final class ZoneRegion extends ZoneId implements Serializable {
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InvalidObjectException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectInput;
|
import java.io.ObjectInput;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.chrono.ChronoZonedDateTime;
|
import java.time.chrono.ChronoZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
@ -2192,9 +2192,10 @@ public final class ZonedDateTime
|
||||||
/**
|
/**
|
||||||
* Writes the object using a
|
* Writes the object using a
|
||||||
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
* <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(6); // identifies this as a ZonedDateTime
|
* out.writeByte(6); // identifies a ZonedDateTime
|
||||||
* // the <a href="../../serialized-form.html#java.time.LocalDateTime">date-time</a> excluding the one byte header
|
* // the <a href="../../serialized-form.html#java.time.LocalDateTime">dateTime</a> excluding the one byte header
|
||||||
* // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
|
* // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header
|
||||||
* // the <a href="../../serialized-form.html#java.time.ZoneId">zone ID</a> excluding the one byte header
|
* // the <a href="../../serialized-form.html#java.time.ZoneId">zone ID</a> excluding the one byte header
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -2210,7 +2211,7 @@ public final class ZonedDateTime
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ import java.util.Objects;
|
||||||
*
|
*
|
||||||
* @implSpec
|
* @implSpec
|
||||||
* This class is immutable and thread-safe.
|
* This class is immutable and thread-safe.
|
||||||
*
|
* @serial
|
||||||
* @param <D> the concrete type for the date of this date-time
|
* @param <D> the concrete type for the date of this date-time
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
|
@ -157,11 +157,11 @@ final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
|
||||||
/**
|
/**
|
||||||
* The date part.
|
* The date part.
|
||||||
*/
|
*/
|
||||||
private final D date;
|
private final transient D date;
|
||||||
/**
|
/**
|
||||||
* The time part.
|
* The time part.
|
||||||
*/
|
*/
|
||||||
private final LocalTime time;
|
private final transient LocalTime time;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -402,6 +402,18 @@ final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the ChronoLocalDateTime using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(2); // identifies a ChronoLocalDateTime
|
||||||
|
* out.writeObject(toLocalDate());
|
||||||
|
* out.witeObject(toLocalTime());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new Ser(Ser.CHRONO_LOCAL_DATE_TIME_TYPE, this);
|
return new Ser(Ser.CHRONO_LOCAL_DATE_TIME_TYPE, this);
|
||||||
}
|
}
|
||||||
|
@ -411,7 +423,7 @@ final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ import java.util.Objects;
|
||||||
* @implSpec
|
* @implSpec
|
||||||
* This class is immutable and thread-safe.
|
* This class is immutable and thread-safe.
|
||||||
*
|
*
|
||||||
|
* @serial Document the delegation of this class in the serialized-form specification.
|
||||||
* @param <D> the concrete type for the date of this date-time
|
* @param <D> the concrete type for the date of this date-time
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
|
@ -112,15 +113,15 @@ final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
|
||||||
/**
|
/**
|
||||||
* The local date-time.
|
* The local date-time.
|
||||||
*/
|
*/
|
||||||
private final ChronoLocalDateTimeImpl<D> dateTime;
|
private final transient ChronoLocalDateTimeImpl<D> dateTime;
|
||||||
/**
|
/**
|
||||||
* The zone offset.
|
* The zone offset.
|
||||||
*/
|
*/
|
||||||
private final ZoneOffset offset;
|
private final transient ZoneOffset offset;
|
||||||
/**
|
/**
|
||||||
* The zone ID.
|
* The zone ID.
|
||||||
*/
|
*/
|
||||||
private final ZoneId zone;
|
private final transient ZoneId zone;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -222,6 +223,7 @@ final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@Override
|
||||||
public ZoneOffset getOffset() {
|
public ZoneOffset getOffset() {
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
@ -256,10 +258,12 @@ final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ZoneId getZone() {
|
public ZoneId getZone() {
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ChronoZonedDateTime<D> withZoneSameLocal(ZoneId zone) {
|
public ChronoZonedDateTime<D> withZoneSameLocal(ZoneId zone) {
|
||||||
return ofBest(dateTime, zone, offset);
|
return ofBest(dateTime, zone, offset);
|
||||||
}
|
}
|
||||||
|
@ -321,6 +325,19 @@ final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the ChronoZonedDateTime using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(3); // identifies a ChronoZonedDateTime
|
||||||
|
* out.writeObject(toLocalDateTime());
|
||||||
|
* out.writeObject(getOffset());
|
||||||
|
* out.writeObject(getZone());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new Ser(Ser.CHRONO_ZONE_DATE_TIME_TYPE, this);
|
return new Ser(Ser.CHRONO_ZONE_DATE_TIME_TYPE, this);
|
||||||
}
|
}
|
||||||
|
@ -330,7 +347,7 @@ final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1258,14 +1258,15 @@ public abstract class Chronology implements Comparable<Chronology> {
|
||||||
/**
|
/**
|
||||||
* Writes the Chronology using a
|
* Writes the Chronology using a
|
||||||
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
* <pre>
|
* <pre>
|
||||||
* out.writeByte(1); // identifies this as a Chronology
|
* out.writeByte(1); // identifies a Chronology
|
||||||
* out.writeUTF(getId());
|
* out.writeUTF(getId());
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @return the instance of {@code Ser}, not null
|
* @return the instance of {@code Ser}, not null
|
||||||
*/
|
*/
|
||||||
protected Object writeReplace() {
|
Object writeReplace() {
|
||||||
return new Ser(Ser.CHRONO_TYPE, this);
|
return new Ser(Ser.CHRONO_TYPE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1274,14 +1275,26 @@ public abstract class Chronology implements Comparable<Chronology> {
|
||||||
* @return never
|
* @return never
|
||||||
* @throws InvalidObjectException always
|
* @throws InvalidObjectException always
|
||||||
*/
|
*/
|
||||||
private Object readResolve() throws ObjectStreamException {
|
private Object readResolve() throws InvalidObjectException {
|
||||||
throw new InvalidObjectException("Deserialization via serialization delegate");
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the Chronology id to the stream.
|
||||||
|
* @param out the output stream
|
||||||
|
* @throws IOException on any error during the write
|
||||||
|
*/
|
||||||
void writeExternal(DataOutput out) throws IOException {
|
void writeExternal(DataOutput out) throws IOException {
|
||||||
out.writeUTF(getId());
|
out.writeUTF(getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the Chronology id and creates the Chronology.
|
||||||
|
* @param in the input stream
|
||||||
|
* @return the Chronology
|
||||||
|
* @throws IOException on errors during the read
|
||||||
|
* @throws DateTimeException if the Chronology cannot be returned
|
||||||
|
*/
|
||||||
static Chronology readExternal(DataInput in) throws IOException {
|
static Chronology readExternal(DataInput in) throws IOException {
|
||||||
String id = in.readUTF();
|
String id = in.readUTF();
|
||||||
return Chronology.of(id);
|
return Chronology.of(id);
|
||||||
|
|
|
@ -63,6 +63,8 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
|
import java.io.ObjectStreamException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.security.AccessController;
|
import java.security.AccessController;
|
||||||
import java.security.PrivilegedActionException;
|
import java.security.PrivilegedActionException;
|
||||||
|
@ -217,11 +219,11 @@ public final class HijrahChronology extends Chronology implements Serializable {
|
||||||
/**
|
/**
|
||||||
* The Hijrah Calendar id.
|
* The Hijrah Calendar id.
|
||||||
*/
|
*/
|
||||||
private final String typeId;
|
private final transient String typeId;
|
||||||
/**
|
/**
|
||||||
* The Hijrah calendarType.
|
* The Hijrah calendarType.
|
||||||
*/
|
*/
|
||||||
private transient final String calendarType;
|
private final transient String calendarType;
|
||||||
/**
|
/**
|
||||||
* Serialization version.
|
* Serialization version.
|
||||||
*/
|
*/
|
||||||
|
@ -236,7 +238,7 @@ public final class HijrahChronology extends Chronology implements Serializable {
|
||||||
* Flag to indicate the initialization of configuration data is complete.
|
* Flag to indicate the initialization of configuration data is complete.
|
||||||
* @see #checkCalendarInit()
|
* @see #checkCalendarInit()
|
||||||
*/
|
*/
|
||||||
private volatile boolean initComplete;
|
private transient volatile boolean initComplete;
|
||||||
/**
|
/**
|
||||||
* Array of epoch days indexed by Hijrah Epoch month.
|
* Array of epoch days indexed by Hijrah Epoch month.
|
||||||
* Computed by {@link #loadCalendarData}.
|
* Computed by {@link #loadCalendarData}.
|
||||||
|
@ -281,7 +283,7 @@ public final class HijrahChronology extends Chronology implements Serializable {
|
||||||
* A reference to the properties stored in
|
* A reference to the properties stored in
|
||||||
* ${java.home}/lib/calendars.properties
|
* ${java.home}/lib/calendars.properties
|
||||||
*/
|
*/
|
||||||
private transient final static Properties calendarProperties;
|
private final transient static Properties calendarProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefix of property names for Hijrah calendar variants.
|
* Prefix of property names for Hijrah calendar variants.
|
||||||
|
@ -1073,4 +1075,30 @@ public final class HijrahChronology extends Chronology implements Serializable {
|
||||||
throw new IllegalArgumentException("date must be yyyy-MM-dd", ex);
|
throw new IllegalArgumentException("date must be yyyy-MM-dd", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the Chronology using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(1); // identifies a Chronology
|
||||||
|
* out.writeUTF(getId());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
Object writeReplace() {
|
||||||
|
return super.writeReplace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
|
||||||
import static java.time.temporal.ChronoField.YEAR;
|
import static java.time.temporal.ChronoField.YEAR;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
import java.io.ObjectInput;
|
import java.io.ObjectInput;
|
||||||
import java.io.ObjectOutput;
|
import java.io.ObjectOutput;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -118,7 +119,7 @@ public final class HijrahDate
|
||||||
/**
|
/**
|
||||||
* The Chronology of this HijrahDate.
|
* The Chronology of this HijrahDate.
|
||||||
*/
|
*/
|
||||||
private final HijrahChronology chrono;
|
private final transient HijrahChronology chrono;
|
||||||
/**
|
/**
|
||||||
* The proleptic year.
|
* The proleptic year.
|
||||||
*/
|
*/
|
||||||
|
@ -600,29 +601,41 @@ public final class HijrahDate
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the object using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(6); // identifies a HijrahDate
|
||||||
|
* out.writeObject(chrono); // the HijrahChronology variant
|
||||||
|
* out.writeInt(get(YEAR));
|
||||||
|
* out.writeByte(get(MONTH_OF_YEAR));
|
||||||
|
* out.writeByte(get(DAY_OF_MONTH));
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new Ser(Ser.HIJRAH_DATE_TYPE, this);
|
return new Ser(Ser.HIJRAH_DATE_TYPE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeExternal(ObjectOutput out) throws IOException {
|
void writeExternal(ObjectOutput out) throws IOException {
|
||||||
// HijrahChronology is implicit in the Hijrah_DATE_TYPE
|
// HijrahChronology is implicit in the Hijrah_DATE_TYPE
|
||||||
out.writeObject(chrono);
|
out.writeObject(getChronology());
|
||||||
out.writeInt(get(YEAR));
|
out.writeInt(get(YEAR));
|
||||||
out.writeByte(get(MONTH_OF_YEAR));
|
out.writeByte(get(MONTH_OF_YEAR));
|
||||||
out.writeByte(get(DAY_OF_MONTH));
|
out.writeByte(get(DAY_OF_MONTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Replaces the date instance from the stream with a valid one.
|
|
||||||
* ReadExternal has already read the fields and created a new instance
|
|
||||||
* from the data.
|
|
||||||
*
|
|
||||||
* @return the resolved date, never null
|
|
||||||
*/
|
|
||||||
private Object readResolve() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HijrahDate readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
static HijrahDate readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
||||||
HijrahChronology chrono = (HijrahChronology) in.readObject();
|
HijrahChronology chrono = (HijrahChronology) in.readObject();
|
||||||
int year = in.readInt();
|
int year = in.readInt();
|
||||||
|
|
|
@ -63,9 +63,6 @@ package java.time.chrono;
|
||||||
|
|
||||||
import static java.time.temporal.ChronoField.ERA;
|
import static java.time.temporal.ChronoField.ERA;
|
||||||
|
|
||||||
import java.io.DataInput;
|
|
||||||
import java.io.DataOutput;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.DateTimeException;
|
import java.time.DateTimeException;
|
||||||
import java.time.temporal.ChronoField;
|
import java.time.temporal.ChronoField;
|
||||||
import java.time.temporal.TemporalField;
|
import java.time.temporal.TemporalField;
|
||||||
|
@ -158,18 +155,4 @@ public enum HijrahEra implements Era {
|
||||||
return Era.super.range(field);
|
return Era.super.range(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
private Object writeReplace() {
|
|
||||||
return new Ser(Ser.HIJRAH_ERA_TYPE, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeExternal(DataOutput out) throws IOException {
|
|
||||||
out.writeByte(this.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
static HijrahEra readExternal(DataInput in) throws IOException {
|
|
||||||
byte eraValue = in.readByte();
|
|
||||||
return HijrahEra.of(eraValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
*/
|
*/
|
||||||
package java.time.chrono;
|
package java.time.chrono;
|
||||||
|
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
|
import java.io.ObjectStreamException;
|
||||||
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
|
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
|
||||||
import static java.time.temporal.ChronoField.ERA;
|
import static java.time.temporal.ChronoField.ERA;
|
||||||
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
|
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
|
||||||
|
@ -563,4 +565,29 @@ public final class IsoChronology extends Chronology implements Serializable {
|
||||||
return field.range();
|
return field.range();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the Chronology using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(1); // identifies a Chronology
|
||||||
|
* out.writeUTF(getId());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
Object writeReplace() {
|
||||||
|
return super.writeReplace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@
|
||||||
*/
|
*/
|
||||||
package java.time.chrono;
|
package java.time.chrono;
|
||||||
|
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
|
import java.io.ObjectStreamException;
|
||||||
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
|
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
|
||||||
import static java.time.temporal.ChronoField.DAY_OF_YEAR;
|
import static java.time.temporal.ChronoField.DAY_OF_YEAR;
|
||||||
import static java.time.temporal.ChronoField.ERA;
|
import static java.time.temporal.ChronoField.ERA;
|
||||||
|
@ -503,4 +505,29 @@ public final class JapaneseChronology extends Chronology implements Serializable
|
||||||
return dateYearDay(era, yoe, doy); // smart is same as strict
|
return dateYearDay(era, yoe, doy); // smart is same as strict
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the Chronology using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(1); // identifies a Chronology
|
||||||
|
* out.writeUTF(getId());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
Object writeReplace() {
|
||||||
|
return super.writeReplace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ import static java.time.temporal.ChronoField.YEAR_OF_ERA;
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.time.DateTimeException;
|
import java.time.DateTimeException;
|
||||||
|
@ -129,7 +130,7 @@ public final class JapaneseDate
|
||||||
/**
|
/**
|
||||||
* The underlying ISO local date.
|
* The underlying ISO local date.
|
||||||
*/
|
*/
|
||||||
private transient final LocalDate isoDate;
|
private final transient LocalDate isoDate;
|
||||||
/**
|
/**
|
||||||
* The JapaneseEra of this date.
|
* The JapaneseEra of this date.
|
||||||
*/
|
*/
|
||||||
|
@ -689,6 +690,28 @@ public final class JapaneseDate
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the object using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(4); // identifies a JapaneseDate
|
||||||
|
* out.writeInt(get(YEAR));
|
||||||
|
* out.writeByte(get(MONTH_OF_YEAR));
|
||||||
|
* out.writeByte(get(DAY_OF_MONTH));
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new Ser(Ser.JAPANESE_DATE_TYPE, this);
|
return new Ser(Ser.JAPANESE_DATE_TYPE, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public final class JapaneseEra
|
||||||
static final sun.util.calendar.Era[] ERA_CONFIG;
|
static final sun.util.calendar.Era[] ERA_CONFIG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The singleton instance for the 'Meiji' era (1868-09-08 - 1912-07-29)
|
* The singleton instance for the 'Meiji' era (1868-01-01 - 1912-07-29)
|
||||||
* which has the value -1.
|
* which has the value -1.
|
||||||
*/
|
*/
|
||||||
public static final JapaneseEra MEIJI = new JapaneseEra(-1, LocalDate.of(1868, 1, 1));
|
public static final JapaneseEra MEIJI = new JapaneseEra(-1, LocalDate.of(1868, 1, 1));
|
||||||
|
@ -155,7 +155,7 @@ public final class JapaneseEra
|
||||||
* The era value.
|
* The era value.
|
||||||
* @serial
|
* @serial
|
||||||
*/
|
*/
|
||||||
private final int eraValue;
|
private final transient int eraValue;
|
||||||
|
|
||||||
// the first day of the era
|
// the first day of the era
|
||||||
private final transient LocalDate since;
|
private final transient LocalDate since;
|
||||||
|
@ -371,6 +371,17 @@ public final class JapaneseEra
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the object using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(5); // identifies a JapaneseEra
|
||||||
|
* out.writeInt(getValue());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
private Object writeReplace() {
|
private Object writeReplace() {
|
||||||
return new Ser(Ser.JAPANESE_ERA_TYPE, this);
|
return new Ser(Ser.JAPANESE_ERA_TYPE, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@
|
||||||
*/
|
*/
|
||||||
package java.time.chrono;
|
package java.time.chrono;
|
||||||
|
|
||||||
|
import java.io.InvalidObjectException;
|
||||||
|
import java.io.ObjectStreamException;
|
||||||
import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
|
import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
|
||||||
import static java.time.temporal.ChronoField.YEAR;
|
import static java.time.temporal.ChronoField.YEAR;
|
||||||
|
|
||||||
|
@ -333,4 +335,29 @@ public final class MinguoChronology extends Chronology implements Serializable {
|
||||||
return (MinguoDate) super.resolveDate(fieldValues, resolverStyle);
|
return (MinguoDate) super.resolveDate(fieldValues, resolverStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Writes the Chronology using a
|
||||||
|
* <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
|
||||||
|
* @serialData
|
||||||
|
* <pre>
|
||||||
|
* out.writeByte(1); // identifies a Chronology
|
||||||
|
* out.writeUTF(getId());
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the instance of {@code Ser}, not null
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
Object writeReplace() {
|
||||||
|
return super.writeReplace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defend against malicious streams.
|
||||||
|
* @return never
|
||||||
|
* @throws InvalidObjectException always
|
||||||
|
*/
|
||||||
|
private Object readResolve() throws InvalidObjectException {
|
||||||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue