提交 1c796c34 编写于 作者: L lana

Merge

...@@ -100,3 +100,7 @@ ac311eb325bfc763698219252bf3cee9e091f3af jdk7-b122 ...@@ -100,3 +100,7 @@ ac311eb325bfc763698219252bf3cee9e091f3af jdk7-b122
869190935eedee7750d955019ab2a1b80f0a13a8 jdk7-b123 869190935eedee7750d955019ab2a1b80f0a13a8 jdk7-b123
1c72adc9d5f331cb882cf5354ba0dcb118a60b23 jdk7-b124 1c72adc9d5f331cb882cf5354ba0dcb118a60b23 jdk7-b124
0a56bdd709d01c1663047e55201d19152ffd3d69 jdk7-b125 0a56bdd709d01c1663047e55201d19152ffd3d69 jdk7-b125
8361ef97a0f90086c9048beaf7cea1a37216c4cd jdk7-b126
29e09de1d0b4f84faea114cf10b3ec08b59acc4e jdk7-b127
f08682e23279d6cccbdcafda1eb0647ba4900874 jdk7-b128
14cd5d54a8d0b9c368d60ea83a066735b9931015 jdk7-b129
...@@ -100,7 +100,6 @@ CACERTS_FILE.desc = Location of certificates file ...@@ -100,7 +100,6 @@ CACERTS_FILE.desc = Location of certificates file
DEVTOOLS_PATH.desc = Directory containing zip and unzip DEVTOOLS_PATH.desc = Directory containing zip and unzip
CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files CUPS_HEADERS_PATH.desc = Include directory location for CUPS header files
DXSDK_PATH.desc = Root directory of DirectX SDK DXSDK_PATH.desc = Root directory of DirectX SDK
MSVCRT_DLL_PATH.desc = Directory containing mscvrt.dll
# Make variables to print out (description and value) # Make variables to print out (description and value)
VARIABLE_PRINTVAL_LIST += \ VARIABLE_PRINTVAL_LIST += \
...@@ -133,12 +132,10 @@ VARIABLE_CHECKFIL_LIST += \ ...@@ -133,12 +132,10 @@ VARIABLE_CHECKFIL_LIST += \
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
VARIABLE_PRINTVAL_LIST += \ VARIABLE_PRINTVAL_LIST += \
DXSDK_PATH \ DXSDK_PATH
MSVCRT_DLL_PATH
VARIABLE_CHECKDIR_LIST += \ VARIABLE_CHECKDIR_LIST += \
DXSDK_PATH \ DXSDK_PATH
MSVCRT_DLL_PATH
endif endif
......
...@@ -155,6 +155,7 @@ ifdef MT ...@@ -155,6 +155,7 @@ ifdef MT
$(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1 $(MT) /manifest $(OBJDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1
endif endif
$(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE) $(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE)
@$(call binary_file_verification,$@)
$(install-module-file) $(install-module-file)
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
......
...@@ -74,15 +74,6 @@ SCRIPT_SUFFIX = ...@@ -74,15 +74,6 @@ SCRIPT_SUFFIX =
CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
#
# Default HPI libraries. Build will build only native, unless
# overriden at the make command line. This makes it convenient for
# people doing, say, a pthreads port -- they can create a posix
# directory here, and say "gnumake HPIS=posix" at the top
# level.
#
HPIS = native
# #
# Default optimization # Default optimization
# #
......
...@@ -74,15 +74,6 @@ SCRIPT_SUFFIX = ...@@ -74,15 +74,6 @@ SCRIPT_SUFFIX =
CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
#
# Default HPI libraries. Build will build only native unless
# overriden at the make command line. This makes it convenient for
# people doing, say, a pthreads port -- they can create a posix
# directory here, and say "gnumake HPIS=posix" at the top
# level.
#
HPIS = native
# #
# Java default optimization (-x04/-O2) etc. Applies to the VM. # Java default optimization (-x04/-O2) etc. Applies to the VM.
# #
......
...@@ -43,7 +43,6 @@ FDDLIBM_SUFFIX = lib ...@@ -43,7 +43,6 @@ FDDLIBM_SUFFIX = lib
# The suffix applied to scripts (.bat for windows, nothing for unix) # The suffix applied to scripts (.bat for windows, nothing for unix)
SCRIPT_SUFFIX = .bat SCRIPT_SUFFIX = .bat
HPIS = windows
# LIB_LOCATION, which for windows identifies where .exe files go, may be # LIB_LOCATION, which for windows identifies where .exe files go, may be
# set by each GNUmakefile. The default is BINDIR. # set by each GNUmakefile. The default is BINDIR.
ifndef LIB_LOCATION ifndef LIB_LOCATION
...@@ -68,28 +67,27 @@ PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) ...@@ -68,28 +67,27 @@ PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
# The following DLL's are considered MS runtime libraries and should # The following DLL's are considered MS runtime libraries and should
# not to be REBASEd, see deploy/make/common/Release.gmk. # not to be REBASEd, see deploy/make/common/Release.gmk.
# msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes # msvcr*.dll: Microsoft runtimes
MS_RUNTIME_LIBRARIES = msvcrt.dll
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
ifeq ($(COMPILER_VERSION), VS2003) ifeq ($(COMPILER_VERSION), VS2003)
MSVCRNN_DLL = msvcr71.dll MSVCRNN_DLL = msvcr71.dll
MSVCPNN_DLL = msvcp71.dll MSVCPNN_DLL = msvcp71.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif endif
ifeq ($(COMPILER_VERSION), VS2005) ifeq ($(COMPILER_VERSION), VS2005)
MSVCRNN_DLL = msvcr80.dll MSVCRNN_DLL = msvcr80.dll
MSVCPNN_DLL = msvcp80.dll MSVCPNN_DLL = msvcp80.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif endif
ifeq ($(COMPILER_VERSION), VS2008) ifeq ($(COMPILER_VERSION), VS2008)
MSVCRNN_DLL = msvcr90.dll MSVCRNN_DLL = msvcr90.dll
MSVCPNN_DLL = msvcp90.dll MSVCPNN_DLL = msvcp90.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif endif
ifeq ($(COMPILER_VERSION), VS2010) ifeq ($(COMPILER_VERSION), VS2010)
MSVCRNN_DLL = msvcr100.dll MSVCRNN_DLL = msvcr100.dll
MSVCPNN_DLL = msvcp100.dll MSVCPNN_DLL = msvcp100.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
endif endif
endif endif
...@@ -97,12 +95,12 @@ ifeq ($(ARCH_DATA_MODEL), 64) ...@@ -97,12 +95,12 @@ ifeq ($(ARCH_DATA_MODEL), 64)
ifeq ($(COMPILER_VERSION), VS2008) ifeq ($(COMPILER_VERSION), VS2008)
MSVCRNN_DLL = msvcr90.dll MSVCRNN_DLL = msvcr90.dll
MSVCPNN_DLL = msvcp90.dll MSVCPNN_DLL = msvcp90.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif endif
ifeq ($(COMPILER_VERSION), VS2010) ifeq ($(COMPILER_VERSION), VS2010)
MSVCRNN_DLL = msvcr100.dll MSVCRNN_DLL = msvcr100.dll
MSVCPNN_DLL = msvcp100.dll MSVCPNN_DLL = msvcp100.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
endif endif
endif endif
...@@ -284,7 +282,7 @@ ifeq ($(MFC_DEBUG), true) ...@@ -284,7 +282,7 @@ ifeq ($(MFC_DEBUG), true)
MS_RUNTIME_OPTION=-MTd MS_RUNTIME_OPTION=-MTd
else else
# This MS debugging flag forces a dependence on the debug # This MS debugging flag forces a dependence on the debug
# version of the runtime library (MSVCRTD.DLL), as does -MDd. # version of the runtime library (MSVCR*D.DLL), as does -MDd.
# We cannot re-distribute this debug runtime. # We cannot re-distribute this debug runtime.
MS_RUNTIME_OPTION=-MDd MS_RUNTIME_OPTION=-MDd
endif endif
...@@ -365,10 +363,6 @@ ifeq ($(CC_VERSION),msvc) ...@@ -365,10 +363,6 @@ ifeq ($(CC_VERSION),msvc)
# LFLAGS are the flags given to $(LINK) and used to build the actual DLL file # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
BASELFLAGS = -nologo /opt:REF /incremental:no BASELFLAGS = -nologo /opt:REF /incremental:no
ifdef MT
# VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe
BASELFLAGS += /manifest
endif
LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION)) LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION)) LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
......
...@@ -271,10 +271,9 @@ DEMOSRCDIR = $(SHARE_SRC)/demo ...@@ -271,10 +271,9 @@ DEMOSRCDIR = $(SHARE_SRC)/demo
# An attempt is made to generate unique enough directories for the # An attempt is made to generate unique enough directories for the
# generated files to not have name collisisons. Most build units # generated files to not have name collisisons. Most build units
# defines PRODUCT (except Release.gmk), but then they may or may # defines PRODUCT (except Release.gmk), but then they may or may
# not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and # not define PACKAGE, PROGRAM, and LIBRARY. This code attempts to
# LIBRARY. This code chunk attempts to generate a unique # generate a unique OBJDIR/CLASSHDRDIR for each build unit based
# OBJDIR/CLASSHDRDIR for each build unit based on which of those # on which of those values are set within each build unit.
# values are set within each build unit.
UNIQUE_LOCATION_STRING = tmp UNIQUE_LOCATION_STRING = tmp
...@@ -298,10 +297,6 @@ ifneq ($(LIBRARY),) ...@@ -298,10 +297,6 @@ ifneq ($(LIBRARY),)
endif endif
endif endif
ifneq ($(THREADDIR),)
UNIQUE_LOCATION_STRING += /$(THREADDIR)
endif
# #
# Build units may or may not define MODULE. Default to "other". # Build units may or may not define MODULE. Default to "other".
# #
......
...@@ -294,6 +294,7 @@ $(DEMO_LIBRARY): $(DEMO_FULL_OBJECTS) ...@@ -294,6 +294,7 @@ $(DEMO_LIBRARY): $(DEMO_FULL_OBJECTS)
@$(prep-target) @$(prep-target)
$(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \ $(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \
$(DEMO_FULL_OBJECTS) $(LDLIBS.demo) $(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
@$(call binary_file_verification,$@)
# Generation of any javah include file, make sure objects are dependent on it # Generation of any javah include file, make sure objects are dependent on it
ifdef DEMO_NATIVECLASS ifdef DEMO_NATIVECLASS
......
...@@ -159,9 +159,6 @@ else # LIBRARY ...@@ -159,9 +159,6 @@ else # LIBRARY
# build it into $(OBJDIR) so that the other generated files get put # build it into $(OBJDIR) so that the other generated files get put
# there, then copy just the DLL (and MAP file) to the requested directory. # there, then copy just the DLL (and MAP file) to the requested directory.
# #
# In VS2005 or VS2008 the link command creates a .manifest file that we want
# to insert into the linked artifact so we do not need to track it separately.
# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
$(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
@$(prep-target) @$(prep-target)
@$(MKDIR) -p $(OBJDIR) @$(MKDIR) -p $(OBJDIR)
...@@ -169,10 +166,8 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf ...@@ -169,10 +166,8 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
-map:$(OBJDIR)/$(LIBRARY).map \ -map:$(OBJDIR)/$(LIBRARY).map \
$(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \ $(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
$(OTHER_LCF) $(JAVALIB) $(LDLIBS) $(OTHER_LCF) $(JAVALIB) $(LDLIBS)
ifdef MT
$(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2
endif
$(CP) $(OBJDIR)/$(@F) $@ $(CP) $(OBJDIR)/$(@F) $@
@$(call binary_file_verification,$@)
$(install-module-file) $(install-module-file)
$(CP) $(OBJDIR)/$(LIBRARY).map $(@D) $(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D) $(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
...@@ -239,6 +234,7 @@ ifeq ($(LIBRARY), fdlibm) ...@@ -239,6 +234,7 @@ ifeq ($(LIBRARY), fdlibm)
$(AR) -r $@ $(FILES_o) $(AR) -r $@ $(FILES_o)
else # LIBRARY else # LIBRARY
$(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS) $(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS)
@$(call binary_file_verification,$@)
$(install-module-file) $(install-module-file)
ifeq ($(WRITE_LIBVERSION),true) ifeq ($(WRITE_LIBVERSION),true)
$(MCS) -d -a "$(FULL_VERSION)" $@ $(MCS) -d -a "$(FULL_VERSION)" $@
......
...@@ -73,47 +73,20 @@ module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module ...@@ -73,47 +73,20 @@ module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module
# #
# Paths to these files we need # Paths to these files we need
JDK_MODULE_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%) JDK_MODULE_DOCFILES = $(IMAGE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
JDK_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%64) JRE_MODULE_DOCFILES = $(IMAGE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
JDK_MODULE_DOCFILES = $(OTHER_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
JRE_MODULE_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
JRE_MODULE_64_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%64)
JRE_MODULE_DOCFILES = $(OTHER_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
JRE_MODULE_DOCFILES += $(JRE_NAMECHANGE_DOCLIST:%=$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX))
###### RULES ###### RULES
# JDK files # JDK files
$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/% $(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
# Removes LICENSE_VERSION or not
ifdef LICENSE_VERSION
$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
else
$(JDK_MODULE_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%
$(process-doc-file)
endif
# JRE files # JRE files
$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/% $(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
# Add $(TEXT_SUFFIX) suffix ifeq ($(PLATFORM), windows)
ifdef TEXT_SUFFIX $(JRE_MODULE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README
$(JRE_MODULE_IMAGE_DIR)/%$(TEXT_SUFFIX): $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file)
endif
# Removes LICENSE_VERSION or not
ifdef LICENSE_VERSION
$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
else
$(JRE_MODULE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
endif endif
...@@ -157,8 +130,7 @@ initial-module-image-jre-setup: ...@@ -157,8 +130,7 @@ initial-module-image-jre-setup:
$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR) $(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)
# 64-bit solaris jre image contains only the 64-bit add-on files. # 64-bit solaris jre image contains only the 64-bit add-on files.
initial-module-image-jre-sol64:: initial-module-image-jre-setup \ initial-module-image-jre-sol64:: initial-module-image-jre-setup
$(JRE_MODULE_LICENSES) $(JRE_MODULE_64_LICENSES)
@# Use tar instead of cp to preserve the symbolic links @# Use tar instead of cp to preserve the symbolic links
for dir in bin lib ; do \ for dir in bin lib ; do \
( $(CD) $(OUTPUTDIR) && \ ( $(CD) $(OUTPUTDIR) && \
...@@ -174,7 +146,7 @@ initial-module-image-jre-sol64:: initial-module-image-jre-setup \ ...@@ -174,7 +146,7 @@ initial-module-image-jre-sol64:: initial-module-image-jre-setup \
# Construct an initial jre image (initial jdk jre) no trimming or stripping # Construct an initial jre image (initial jdk jre) no trimming or stripping
initial-module-image-jre:: initial-module-image-jre-setup \ initial-module-image-jre:: initial-module-image-jre-setup \
$(JRE_LICENSES) $(JRE_MODULE_DOCFILES) \ $(JRE_MODULE_DOCFILES) \
$(BUILDMETAINDEX_JARFILE) $(BUILDMETAINDEX_JARFILE)
@# Copy in bin directory @# Copy in bin directory
$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR) $(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
...@@ -222,7 +194,7 @@ ifeq ($(PLATFORM), windows) ...@@ -222,7 +194,7 @@ ifeq ($(PLATFORM), windows)
@# Remove certain *.lib files @# Remove certain *.lib files
$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \ $(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
$(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \ $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
@# The Java Kernel JRE image ships with a special VM. It is not included @# The Java Kernel JRE image ships with a special VM. It is not included
@# in the full JRE image, so remove it. Also, is it only for 32-bit windows. @# in the full JRE image, so remove it. Also, is it only for 32-bit windows.
...@@ -310,8 +282,7 @@ initial-module-image-jdk64-bindemos: ...@@ -310,8 +282,7 @@ initial-module-image-jdk64-bindemos:
# Solaris 64 bit image is special # Solaris 64 bit image is special
initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \ initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \
initial-module-image-jdk64-bindemos \ initial-module-image-jdk64-bindemos
$(JDK_MODULE_LICENSES) $(JDK_MODULARLIZED_64_LICENSES)
# DB files to add # DB files to add
ifeq ($(OPENJDK),true) ifeq ($(OPENJDK),true)
...@@ -335,7 +306,7 @@ endif ...@@ -335,7 +306,7 @@ endif
# Standard jdk image # Standard jdk image
initial-module-image-jdk:: initial-module-image-jdk-setup \ initial-module-image-jdk:: initial-module-image-jdk-setup \
initial-module-image-jdk-db \ initial-module-image-jdk-db \
$(JDK_MODULE_LICENSES) $(JDK_MODULE_DOCFILES) $(JDK_MODULE_DOCFILES)
$(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib $(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib
@# @#
@# copy jdk modules to jdk/lib @# copy jdk modules to jdk/lib
...@@ -415,8 +386,7 @@ endif # !windows ...@@ -415,8 +386,7 @@ endif # !windows
trim-module-image-jdk:: trim-module-image-jdk::
@# Remove tools that should not be part of SDK. @# Remove tools that should not be part of SDK.
for t in $(NOTJDKTOOLS); do \ for t in $(NOTJDKTOOLS); do \
$(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX) \ $(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \
$(JDK_MODULE_IMAGE_DIR)/bin/*/native_threads/$${t}$(EXE_SUFFIX); \
done done
# Get list of Elf files in the jdk # Get list of Elf files in the jdk
......
...@@ -142,10 +142,15 @@ else ...@@ -142,10 +142,15 @@ else
STACK_SIZE=1048576 STACK_SIZE=1048576
endif endif
# In VS2005 or VS2008 the link command creates a .manifest file that we want IMVERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
# to insert into the linked artifact so we do not need to track it separately. $(OBJDIR)/$(PROGRAM).exe.manifest: $(JDK_TOPDIR)/src/windows/resource/java.manifest
@$(prep-target)
$(SED) 's%IMVERSION%$(IMVERSION)%g;s%PROGRAM%$(PROGRAM)%g' $< > $@
# We used a hand-crafted manifest file for all executables.
# It is tweaked to embed the build number and executable name.
# Use ";#2" for .dll and ";#1" for .exe in the MT command below: # Use ";#2" for .dll and ";#1" for .exe in the MT command below:
$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) $(OBJDIR)/$(PROGRAM).exe.manifest
@$(prep-target) @$(prep-target)
@set -- $?; \ @set -- $?; \
$(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...}; $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
...@@ -155,6 +160,7 @@ $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LC ...@@ -155,6 +160,7 @@ $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LC
ifdef MT ifdef MT
$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1 $(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1
endif endif
@$(call binary_file_verification,$@)
else # PLATFORM else # PLATFORM
...@@ -179,6 +185,7 @@ $(ACTUAL_PROGRAM):: $(FILES_o) ...@@ -179,6 +185,7 @@ $(ACTUAL_PROGRAM):: $(FILES_o)
@$(MKDIR) -p $(TEMPDIR) @$(MKDIR) -p $(TEMPDIR)
$(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \ $(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \
$(FILES_o) $(THREADLIBS) $(LDLIBS) $(FILES_o) $(THREADLIBS) $(LDLIBS)
@$(call binary_file_verification,$@)
$(install-module-file) $(install-module-file)
endif # PLATFORM endif # PLATFORM
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
include $(JDK_TOPDIR)/make/docs/CORE_PKGS.gmk include $(JDK_TOPDIR)/make/docs/CORE_PKGS.gmk
include $(JDK_TOPDIR)/make/docs/NON_CORE_PKGS.gmk include $(JDK_TOPDIR)/make/docs/NON_CORE_PKGS.gmk
# What jdk version are we building
THIS_JDK_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
# #
# Perform release engineering tasks. # Perform release engineering tasks.
# #
...@@ -72,14 +75,6 @@ endif ...@@ -72,14 +75,6 @@ endif
JTG_DOCS = $(JDK_TOPDIR)/src/solaris/doc JTG_DOCS = $(JDK_TOPDIR)/src/solaris/doc
#We use this for man page header
jdkversion := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
# Text documents on windows use this suffix
ifeq ($(PLATFORM), windows)
TEXT_SUFFIX = .txt
endif
# The base names of all the license and document files for the jdk and jre # The base names of all the license and document files for the jdk and jre
# (These files get placed in the jdk and jre install images) # (These files get placed in the jdk and jre install images)
ifdef OPENJDK ifdef OPENJDK
...@@ -87,53 +82,28 @@ ifdef OPENJDK ...@@ -87,53 +82,28 @@ ifdef OPENJDK
SHARE_JDK_DOC_SRC = $(JDK_TOPDIR) SHARE_JDK_DOC_SRC = $(JDK_TOPDIR)
SHARE_JRE_DOC_SRC = $(JDK_TOPDIR) SHARE_JRE_DOC_SRC = $(JDK_TOPDIR)
# Same files for jdk and jre, no name changes # Same files for jdk and jre, no name changes
LICENSE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION IMAGE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
LICENSE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
OTHER_DOCLIST_JDK = THIRD_PARTY_README
OTHER_DOCLIST_JRE = THIRD_PARTY_README
else else
# Where to find these files # Where to find these files
SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk
SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre
# Select the pre-release or FCS license version based on the build milestone. IMAGE_DOCLIST_JDK = COPYRIGHT README.html THIRDPARTYLICENSEREADME.txt
LICENSE_VERSION=.pre IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt
ifeq ($(MILESTONE), fcs)
LICENSE_VERSION=.fcs
endif
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\ IMAGE_DOCLIST_JRE += README.txt
$(shell $(CD) $(SHARE_JDK_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION)))
LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\
$(shell $(CD) $(SHARE_JRE_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION)))
else else
LICENSE_DOCLIST_JDK = $(subst $(LICENSE_VERSION),,\ IMAGE_DOCLIST_JRE += README
$(shell $(CD) $(SHARE_JDK_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION) | $(GREP) -v rtf))
LICENSE_DOCLIST_JRE = $(subst $(LICENSE_VERSION),,\
$(shell $(CD) $(SHARE_JRE_DOC_SRC) && \
$(LS) *LICENSE*$(LICENSE_VERSION) | $(GREP) -v rtf))
endif endif
OTHER_DOCLIST_JDK = COPYRIGHT README.html README_ja.html README_zh_CN.html
OTHER_DOCLIST_JRE = COPYRIGHT Welcome.html
JRE_NAMECHANGE_DOCLIST = README
endif endif
# Paths to these files we need # Paths to these files we need
JDK_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%) JDK_DOCFILES = $(IMAGE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%)
JDK64_LICENSES = $(LICENSE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%64) JRE_DOCFILES = $(IMAGE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
JDK_DOCFILES = $(OTHER_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%)
JRE_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
JRE64_LICENSES = $(LICENSE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%64)
JRE_DOCFILES = $(OTHER_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
JRE_DOCFILES += $(JRE_NAMECHANGE_DOCLIST:%=$(JRE_IMAGE_DIR)/%$(TEXT_SUFFIX))
# absolute directory names: note, these must exist prior to build # absolute directory names: note, these must exist prior to build
# time - they are created in the main Makefile. # time - they are created in the main Makefile.
JRE_IMAGE_BINDIR = $(JRE_IMAGE_DIR)/bin JRE_IMAGE_BINDIR = $(JRE_IMAGE_DIR)/bin
JRE_IMAGE_THREADIR = $(JRE_IMAGE_DIR)/bin/*/native_threads
MAINMANIFEST = $(JDK_TOPDIR)/make/tools/manifest.mf MAINMANIFEST = $(JDK_TOPDIR)/make/tools/manifest.mf
BEANMANIFEST = $(JDK_TOPDIR)/make/javax/swing/beaninfo/manifest BEANMANIFEST = $(JDK_TOPDIR)/make/javax/swing/beaninfo/manifest
...@@ -214,7 +184,7 @@ for manbase in $(MANBASEDIRS:%=%/$(MAN1SUBDIR)) ; do \ ...@@ -214,7 +184,7 @@ for manbase in $(MANBASEDIRS:%=%/$(MAN1SUBDIR)) ; do \
$(MKDIR) -p $1/man/$${ja_dir}/man1; \ $(MKDIR) -p $1/man/$${ja_dir}/man1; \
$(CAT) $${manbase}/ja/$${manpage} \ $(CAT) $${manbase}/ja/$${manpage} \
| $(NATIVE2ASCII) -encoding $(JA_SOURCE_ENCODING) \ | $(NATIVE2ASCII) -encoding $(JA_SOURCE_ENCODING) \
| $(SED) 's/@@VERSION@@/$(jdkversion)/g' \ | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
| $(NATIVE2ASCII) -reverse -encoding $${ja_encoding} \ | $(NATIVE2ASCII) -reverse -encoding $${ja_encoding} \
> $1/man/$${ja_dir}/man1/$${manpage}; \ > $1/man/$${ja_dir}/man1/$${manpage}; \
done; \ done; \
...@@ -244,6 +214,7 @@ images images-clobber \ ...@@ -244,6 +214,7 @@ images images-clobber \
initial-image-jre initial-image-jdk \ initial-image-jre initial-image-jdk \
initial-image-jre-sol64 initial-image-jdk-sol64 \ initial-image-jre-sol64 initial-image-jdk-sol64 \
trim-image-jre trim-image-jdk \ trim-image-jre trim-image-jdk \
identify-image-jre identify-image-jdk \
process-image-jre process-image-jdk \ process-image-jre process-image-jdk \
compare-image \ compare-image \
sec-files sec-files-win jgss-files :: sec-files sec-files-win jgss-files ::
...@@ -253,11 +224,12 @@ sec-files sec-files-win jgss-files :: ...@@ -253,11 +224,12 @@ sec-files sec-files-win jgss-files ::
images:: sanity-images post-sanity-images \ images:: sanity-images post-sanity-images \
$(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \ $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
trim-image-jre trim-image-jdk \ trim-image-jre trim-image-jdk \
identify-image-jre identify-image-jdk \
process-image-jre process-image-jdk sec-files sec-files-win jgss-files process-image-jre process-image-jdk sec-files sec-files-win jgss-files
# Don't use these # Don't use these
image-jre:: initial-image-jre trim-image-jre process-image-jre image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre
image-jdk:: initial-image-jdk trim-image-jdk process-image-jdk image-jdk:: initial-image-jdk trim-image-jdk identify-image-jdk process-image-jdk
# #
# Sources we ship in the SDK. # Sources we ship in the SDK.
...@@ -504,33 +476,12 @@ endef ...@@ -504,33 +476,12 @@ endef
# JDK files # JDK files
$(JDK_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/% $(JDK_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
# Removes LICENSE_VERSION or not
ifdef LICENSE_VERSION
$(JDK_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
$(JDK_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
else
$(JDK_IMAGE_DIR)/%64: $(SHARE_JDK_DOC_SRC)/%
$(process-doc-file)
endif
# JRE files # JRE files
$(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/% $(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
# Add $(TEXT_SUFFIX) suffix ifeq ($(PLATFORM), windows)
ifdef TEXT_SUFFIX $(JRE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README
$(JRE_IMAGE_DIR)/%$(TEXT_SUFFIX): $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file)
endif
# Removes LICENSE_VERSION or not
ifdef LICENSE_VERSION
$(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
$(JRE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%$(LICENSE_VERSION)
$(process-doc-file)
else
$(JRE_IMAGE_DIR)/%64: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
endif endif
...@@ -738,8 +689,7 @@ initial-image-jre-setup: ...@@ -738,8 +689,7 @@ initial-image-jre-setup:
$(MKDIR) -p $(JRE_IMAGE_DIR) $(MKDIR) -p $(JRE_IMAGE_DIR)
# 64-bit solaris jre image contains only the 64-bit add-on files. # 64-bit solaris jre image contains only the 64-bit add-on files.
initial-image-jre-sol64:: initial-image-jre-setup \ initial-image-jre-sol64:: initial-image-jre-setup
$(JRE_LICENSES) $(JRE64_LICENSES)
@# Use tar instead of cp to preserve the symbolic links @# Use tar instead of cp to preserve the symbolic links
for dir in bin lib ; do \ for dir in bin lib ; do \
( $(CD) $(OUTPUTDIR) && \ ( $(CD) $(OUTPUTDIR) && \
...@@ -760,7 +710,7 @@ initial-image-jre-sol64:: initial-image-jre-setup \ ...@@ -760,7 +710,7 @@ initial-image-jre-sol64:: initial-image-jre-setup \
# See "initial-image-jdk-setup" for an explanation of the rm of # See "initial-image-jdk-setup" for an explanation of the rm of
# drive names like C: # drive names like C:
initial-image-jre:: initial-image-jre-setup \ initial-image-jre:: initial-image-jre-setup \
$(JRE_LICENSES) $(JRE_DOCFILES) \ $(JRE_DOCFILES) \
$(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) \ $(RT_JAR) $(RESOURCES_JAR) $(JSSE_JAR) \
$(BUILDMETAINDEX_JARFILE) $(BUILDMETAINDEX_JARFILE)
@# Copy in bin directory @# Copy in bin directory
...@@ -802,7 +752,7 @@ ifeq ($(PLATFORM), windows) ...@@ -802,7 +752,7 @@ ifeq ($(PLATFORM), windows)
@# Remove certain *.lib files @# Remove certain *.lib files
$(CD) $(JRE_IMAGE_DIR)/lib && \ $(CD) $(JRE_IMAGE_DIR)/lib && \
$(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \ $(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
hpi.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX) awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
@# The Java Kernel JRE image ships with a special VM. It is not included @# The Java Kernel JRE image ships with a special VM. It is not included
@# in the full JRE image, so remove it. Also, is it only for 32-bit windows. @# in the full JRE image, so remove it. Also, is it only for 32-bit windows.
...@@ -836,11 +786,14 @@ else # PLATFORM ...@@ -836,11 +786,14 @@ else # PLATFORM
endif endif
endif # PLATFORM endif # PLATFORM
# Get list of all Elf files in the jre # Get list of all binary (COFF or Elf) files in the jre
JRE_ELF_LIST=$(TEMPDIR)/jre-elf-files.list JRE_BIN_LIST=$(TEMPDIR)/jre-bin-files.list
$(JRE_ELF_LIST): $(JRE_BIN_LIST):
ifneq ($(PLATFORM), windows)
$(RM) $@ $(RM) $@
ifeq ($(PLATFORM), windows)
$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*.exe \
-o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" > $@
else
$(FIND) $(JRE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@ $(FIND) $(JRE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
$(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \ $(FILE) `$(FIND) $(JRE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@ | $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
...@@ -848,9 +801,9 @@ endif ...@@ -848,9 +801,9 @@ endif
# Post process the image (strips and mcs on Elf files we are shipping) # Post process the image (strips and mcs on Elf files we are shipping)
# (Note the jdk WILL want the jre image before this processing) # (Note the jdk WILL want the jre image before this processing)
process-image-jre:: $(JRE_ELF_LIST) process-image-jre:: $(JRE_BIN_LIST)
ifneq ($(POST_STRIP_PROCESS), ) ifneq ($(POST_STRIP_PROCESS), )
for f in `$(CAT) $(JRE_ELF_LIST)`; do \ @for f in `$(CAT) $(JRE_BIN_LIST)`; do \
$(CHMOD) u+w $${f}; \ $(CHMOD) u+w $${f}; \
$(ECHO) $(POST_STRIP_PROCESS) $${f}; \ $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
$(POST_STRIP_PROCESS) $${f}; \ $(POST_STRIP_PROCESS) $${f}; \
...@@ -858,14 +811,17 @@ ifneq ($(POST_STRIP_PROCESS), ) ...@@ -858,14 +811,17 @@ ifneq ($(POST_STRIP_PROCESS), )
done done
endif endif
ifneq ($(POST_MCS_PROCESS), ) ifneq ($(POST_MCS_PROCESS), )
for f in `$(CAT) $(JRE_ELF_LIST)`; do \ @for f in `$(CAT) $(JRE_BIN_LIST)`; do \
$(CHMOD) u+w $${f}; \ $(CHMOD) u+w $${f}; \
$(ECHO) $(POST_MCS_PROCESS) $${f}; \ $(ECHO) $(POST_MCS_PROCESS) $${f}; \
$(POST_MCS_PROCESS) $${f}; \ $(POST_MCS_PROCESS) $${f}; \
$(CHMOD) go-w $${f}; \ $(CHMOD) go-w $${f}; \
done done
endif endif
$(RM) $(JRE_ELF_LIST) @for f in `$(CAT) $(JRE_BIN_LIST)`; do \
$(call binary_file_verification,$${f}); \
done
$(RM) $(JRE_BIN_LIST)
###################################################### ######################################################
# JDK Image # JDK Image
...@@ -905,8 +861,7 @@ initial-image-jdk64-bindemos: ...@@ -905,8 +861,7 @@ initial-image-jdk64-bindemos:
# Solaris 64 bit image is special # Solaris 64 bit image is special
initial-image-jdk-sol64:: initial-image-jdk-setup \ initial-image-jdk-sol64:: initial-image-jdk-setup \
initial-image-jdk64-bindemos \ initial-image-jdk64-bindemos
$(JDK_LICENSES) $(JDK64_LICENSES)
# DB files to add # DB files to add
ifdef OPENJDK ifdef OPENJDK
...@@ -930,7 +885,7 @@ endif ...@@ -930,7 +885,7 @@ endif
# Standard jdk image # Standard jdk image
initial-image-jdk:: initial-image-jdk-setup \ initial-image-jdk:: initial-image-jdk-setup \
initial-image-jdk-db \ initial-image-jdk-db \
$(JDK_LICENSES) $(JDK_DOCFILES) $(JDK_DOCFILES)
$(MKDIR) $(JDK_IMAGE_DIR)/lib $(MKDIR) $(JDK_IMAGE_DIR)/lib
@# @#
@# Copy in the jars in lib that only belong in the JDK @# Copy in the jars in lib that only belong in the JDK
...@@ -1089,14 +1044,18 @@ endif # !windows ...@@ -1089,14 +1044,18 @@ endif # !windows
trim-image-jdk:: trim-image-jdk::
@# Remove tools that should not be part of SDK. @# Remove tools that should not be part of SDK.
for t in $(NOTJDKTOOLS); do \ for t in $(NOTJDKTOOLS); do \
$(RM) $(JDK_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX) \ $(RM) $(JDK_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \
$(JDK_IMAGE_DIR)/bin/*/native_threads/$${t}$(EXE_SUFFIX); \
done done
# Get list of Elf files in the jdk # Get list of binary (COFF or Elf) files in the jdk
JDK_ELF_LIST=$(TEMPDIR)/jdk-elf-files.list JDK_BIN_LIST=$(TEMPDIR)/jdk-bin-files.list
$(JDK_ELF_LIST): $(JDK_BIN_LIST):
ifneq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*.exe \
-o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" > $@
$(FIND) $(JDK_IMAGE_DIR)/bin -type f -name \*.exe \
-o -name \*.dll | $(EGREP) -v -i "$(MSVCRNN_DLL)" >> $@
else
$(RM) $@ $(RM) $@
$(FIND) $(JDK_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@ $(FIND) $(JDK_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
$(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \ $(FILE) `$(FIND) $(JDK_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
...@@ -1106,9 +1065,9 @@ ifneq ($(PLATFORM), windows) ...@@ -1106,9 +1065,9 @@ ifneq ($(PLATFORM), windows)
endif endif
# Post process the image (strips and mcs on files we are shipping) # Post process the image (strips and mcs on files we are shipping)
process-image-jdk:: $(JDK_ELF_LIST) process-image-jdk:: $(JDK_BIN_LIST)
ifneq ($(POST_STRIP_PROCESS), ) ifneq ($(POST_STRIP_PROCESS), )
for f in `$(CAT) $(JDK_ELF_LIST)`; do \ @for f in `$(CAT) $(JDK_BIN_LIST)`; do \
$(CHMOD) u+w $${f}; \ $(CHMOD) u+w $${f}; \
$(ECHO) $(POST_STRIP_PROCESS) $${f}; \ $(ECHO) $(POST_STRIP_PROCESS) $${f}; \
$(POST_STRIP_PROCESS) $${f}; \ $(POST_STRIP_PROCESS) $${f}; \
...@@ -1116,14 +1075,56 @@ ifneq ($(POST_STRIP_PROCESS), ) ...@@ -1116,14 +1075,56 @@ ifneq ($(POST_STRIP_PROCESS), )
done done
endif endif
ifneq ($(POST_MCS_PROCESS), ) ifneq ($(POST_MCS_PROCESS), )
for f in `$(CAT) $(JDK_ELF_LIST)`; do \ @for f in `$(CAT) $(JDK_BIN_LIST)`; do \
$(CHMOD) u+w $${f}; \ $(CHMOD) u+w $${f}; \
$(ECHO) $(POST_MCS_PROCESS) $${f}; \ $(ECHO) $(POST_MCS_PROCESS) $${f}; \
$(POST_MCS_PROCESS) $${f}; \ $(POST_MCS_PROCESS) $${f}; \
$(CHMOD) go-w $${f}; \ $(CHMOD) go-w $${f}; \
done done
endif endif
$(RM) $(JDK_ELF_LIST) @for f in `$(CAT) $(JDK_BIN_LIST)`; do \
$(call binary_file_verification,$${f}); \
done
$(RM) $(JDK_BIN_LIST)
###################################################################
# What did we build
###################################################################
# The jdk text info file that lives at the root of the install image.
JDK_INFO_FILE = $(JDK_IMAGE_DIR)/release
JRE_INFO_FILE = $(JRE_IMAGE_DIR)/release
# Common way to emit a line into the release or info file
define info-file-item # name value
$(PRINTF) "%s=\"%s\"\n" $1 $2 >> $@
endef
# Values to emit
MINIMUM_OS_NAME := $(REQUIRED_OS_NAME)
MINIMUM_OS_VERSION := $(REQUIRED_OS_VERSION)
MINIMUM_OS_ARCH := $(ARCH)
$(JDK_INFO_FILE): FRC
$(prep-target)
$(call info-file-item, "JAVA_VERSION", "$(THIS_JDK_VERSION)")
$(call info-file-item, "OS_NAME", "$(MINIMUM_OS_NAME)")
$(call info-file-item, "OS_VERSION", "$(MINIMUM_OS_VERSION)")
$(call info-file-item, "OS_ARCH", "$(MINIMUM_OS_ARCH)")
# Create release file to identify this image
identify-image-jdk:: $(JDK_INFO_FILE)
$(JRE_INFO_FILE): FRC
$(prep-target)
$(call info-file-item, "JAVA_VERSION", "$(THIS_JDK_VERSION)")
$(call info-file-item, "OS_NAME", "$(MINIMUM_OS_NAME)")
$(call info-file-item, "OS_VERSION", "$(MINIMUM_OS_VERSION)")
$(call info-file-item, "OS_ARCH", "$(MINIMUM_OS_ARCH)")
# Create release file to identify this image
identify-image-jre:: $(JRE_INFO_FILE)
################################################################### ###################################################################
# What do we compare against # What do we compare against
...@@ -1278,6 +1279,7 @@ images images-clobber:: ...@@ -1278,6 +1279,7 @@ images images-clobber::
initial-image-jre-setup \ initial-image-jre-setup \
trim-image-jre trim-image-jdk \ trim-image-jre trim-image-jdk \
process-image-jre process-image-jdk \ process-image-jre process-image-jdk \
identify-image-jre identify-image-jdk \
install-previous-jre install-previous-jdk \ install-previous-jre install-previous-jdk \
compare-image-jre compare-image-jdk \ compare-image-jre compare-image-jdk \
compare-image compare-image-clobber \ compare-image compare-image-clobber \
......
...@@ -35,6 +35,7 @@ ifeq ($(PLATFORM), windows) ...@@ -35,6 +35,7 @@ ifeq ($(PLATFORM), windows)
LIBEXE = $(COMPILER_PATH)lib LIBEXE = $(COMPILER_PATH)lib
LINK = $(COMPILER_PATH)link LINK = $(COMPILER_PATH)link
LINK32 = $(LINK) LINK32 = $(LINK)
DUMPBIN = $(COMPILER_PATH)dumpbin.exe
# Fill in unknown values # Fill in unknown values
COMPILER_NAME=Unknown MSVC Compiler COMPILER_NAME=Unknown MSVC Compiler
...@@ -139,8 +140,8 @@ ifeq ($(PLATFORM), windows) ...@@ -139,8 +140,8 @@ ifeq ($(PLATFORM), windows)
_OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/x64 _OTHER_TOOLS_BIN = $(WINDOWSSDKDIR)/Bin/x64
endif endif
endif endif
RC = $(_OTHER_TOOLS_BIN)/rc.exe RC = $(_OTHER_TOOLS_BIN)/RC.Exe
REBASE = $(_OTHER_TOOLS_BIN)/rebase.exe REBASE = $(_OTHER_TOOLS_BIN)/ReBase.Exe
MT = $(_OTHER_TOOLS_BIN)/mt.exe MT = $(_OTHER_TOOLS_BIN)/mt.exe
MTL = $(_OTHER_TOOLS_BIN)/midl.exe MTL = $(_OTHER_TOOLS_BIN)/midl.exe
endif endif
......
...@@ -76,12 +76,9 @@ SRC_BUNDLEDIR = $(OUTPUTDIR)/source-bundles ...@@ -76,12 +76,9 @@ SRC_BUNDLEDIR = $(OUTPUTDIR)/source-bundles
ABS_SRC_BUNDLEDIR = $(ABS_OUTPUTDIR)/source-bundles ABS_SRC_BUNDLEDIR = $(ABS_OUTPUTDIR)/source-bundles
BIN_BUNDLEDIR = $(OUTPUTDIR)/bundles BIN_BUNDLEDIR = $(OUTPUTDIR)/bundles
ABS_BIN_BUNDLEDIR = $(ABS_OUTPUTDIR)/bundles ABS_BIN_BUNDLEDIR = $(ABS_OUTPUTDIR)/bundles
JRL_BUNDLEDIR = $(OUTPUTDIR)/java.net
ABS_JRL_BUNDLEDIR = $(ABS_OUTPUTDIR)/java.net
dummy := $(shell $(MKDIR) -p $(BIN_BUNDLEDIR)) dummy := $(shell $(MKDIR) -p $(BIN_BUNDLEDIR))
dummy := $(shell $(MKDIR) -p $(SRC_BUNDLEDIR) ) dummy := $(shell $(MKDIR) -p $(SRC_BUNDLEDIR) )
dummy := $(shell $(MKDIR) -p $(JRL_BUNDLEDIR) )
TEMP_DIR = $(OUTPUTDIR)/tmp TEMP_DIR = $(OUTPUTDIR)/tmp
ABS_TEMP_DIR = $(ABS_OUTPUTDIR)/tmp ABS_TEMP_DIR = $(ABS_OUTPUTDIR)/tmp
......
...@@ -177,3 +177,20 @@ else ...@@ -177,3 +177,20 @@ else
endif endif
HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH) HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH)
# Special define for checking the binaries
# Macro to check it's input file for banned dependencies and verify the
# binary built properly. Relies on process exit code.
define binary_file_verification # binary_file
( \
$(ECHO) "Checking for mapfile use in: $1" && \
if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
$(ECHO) "WARNING: File was not built with a mapfile: $1"; \
fi && \
$(ECHO) "Library loads for: $1" && \
$(LDD) $1 && \
$(ECHO) "RUNPATH for: $1" && \
( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
)
endef
...@@ -186,3 +186,20 @@ else ...@@ -186,3 +186,20 @@ else
endif endif
HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH) HOTSPOT_SERVER_PATH:=$(call AltCheckValue,HOTSPOT_SERVER_PATH)
# Special define for checking the binaries
# Macro to check it's input file for banned dependencies and verify the
# binary built properly. Relies on process exit code.
define binary_file_verification # binary_file
( \
$(ECHO) "Checking for mapfile use in: $1" && \
if [ "`$(NM) -g -D $1 | $(EGREP) -v 'UNDEF' | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
$(ECHO) "WARNING: File was not built with a mapfile: $1"; \
fi && \
$(ECHO) "Library loads for: $1" && \
$(LDD) $1 && \
$(ECHO) "RUNPATH for: $1" && \
( $(DUMP) -L -v $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
)
endef
...@@ -85,6 +85,7 @@ DATE = $(UTILS_COMMAND_PATH)date ...@@ -85,6 +85,7 @@ DATE = $(UTILS_COMMAND_PATH)date
DF = $(UTILS_COMMAND_PATH)df DF = $(UTILS_COMMAND_PATH)df
DIFF = $(UTILS_USR_BIN_PATH)diff DIFF = $(UTILS_USR_BIN_PATH)diff
DIRNAME = $(UTILS_USR_BIN_PATH)dirname DIRNAME = $(UTILS_USR_BIN_PATH)dirname
DUMP = $(UTILS_CCS_BIN_PATH)dump
ECHO = $(UTILS_COMMAND_PATH)echo ECHO = $(UTILS_COMMAND_PATH)echo
EGREP = $(UTILS_COMMAND_PATH)egrep EGREP = $(UTILS_COMMAND_PATH)egrep
EXPR = $(UTILS_USR_BIN_PATH)expr EXPR = $(UTILS_USR_BIN_PATH)expr
...@@ -99,6 +100,7 @@ ID = $(UTILS_COMMAND_PATH)id ...@@ -99,6 +100,7 @@ ID = $(UTILS_COMMAND_PATH)id
ISAINFO = $(UTILS_COMMAND_PATH)isainfo ISAINFO = $(UTILS_COMMAND_PATH)isainfo
KSH = $(UTILS_COMMAND_PATH)ksh KSH = $(UTILS_COMMAND_PATH)ksh
LD = $(UTILS_CCS_BIN_PATH)ld LD = $(UTILS_CCS_BIN_PATH)ld
LDD = $(UTILS_USR_BIN_PATH)ldd
LEX = $(UTILS_CCS_BIN_PATH)lex LEX = $(UTILS_CCS_BIN_PATH)lex
LN = $(UTILS_COMMAND_PATH)ln LN = $(UTILS_COMMAND_PATH)ln
LS = $(UTILS_COMMAND_PATH)ls LS = $(UTILS_COMMAND_PATH)ls
...@@ -114,6 +116,7 @@ PKGMK = $(UTILS_COMMAND_PATH)pkgmk ...@@ -114,6 +116,7 @@ PKGMK = $(UTILS_COMMAND_PATH)pkgmk
PRINTF = $(UTILS_USR_BIN_PATH)printf PRINTF = $(UTILS_USR_BIN_PATH)printf
PWD = $(UTILS_COMMAND_PATH)pwd PWD = $(UTILS_COMMAND_PATH)pwd
RC = $(UTILS_COMMAND_PATH)rc RC = $(UTILS_COMMAND_PATH)rc
READELF = $(UTILS_USR_BIN_PATH)readelf
RMDIR = $(UTILS_COMMAND_PATH)rmdir RMDIR = $(UTILS_COMMAND_PATH)rmdir
RPM = $(UTILS_COMMAND_PATH)rpm RPM = $(UTILS_COMMAND_PATH)rpm
RPMBUILD = $(UTILS_COMMAND_PATH)rpmbuild RPMBUILD = $(UTILS_COMMAND_PATH)rpmbuild
......
...@@ -127,6 +127,7 @@ endif ...@@ -127,6 +127,7 @@ endif
# Solaris specific # Solaris specific
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
REQUIRED_OS_NAME = SunOS
REQUIRED_OS_VERSION = 5.10 REQUIRED_OS_VERSION = 5.10
REQUIRED_OS_VARIANT_NAME = Solaris REQUIRED_OS_VARIANT_NAME = Solaris
REQUIRED_OS_VARIANT_VERSION = $(REQUIRED_OS_VERSION) REQUIRED_OS_VARIANT_VERSION = $(REQUIRED_OS_VERSION)
...@@ -148,6 +149,7 @@ endif ...@@ -148,6 +149,7 @@ endif
# Linux specific # Linux specific
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
REQUIRED_OS_NAME = Linux
REQUIRED_OS_VERSION = 2.6 REQUIRED_OS_VERSION = 2.6
REQUIRED_OS_VARIANT_NAME = Fedora REQUIRED_OS_VARIANT_NAME = Fedora
REQUIRED_OS_VARIANT_VERSION = 9 REQUIRED_OS_VARIANT_VERSION = 9
...@@ -166,6 +168,7 @@ endif ...@@ -166,6 +168,7 @@ endif
# Windows specific # Windows specific
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
REQUIRED_OS_NAME = Windows
ifeq ($(ARCH_DATA_MODEL),64) ifeq ($(ARCH_DATA_MODEL),64)
REQUIRED_OS_VERSION = 5.2 REQUIRED_OS_VERSION = 5.2
REQUIRED_OS_VARIANT_NAME = Windows2003 REQUIRED_OS_VARIANT_NAME = Windows2003
...@@ -205,7 +208,7 @@ ifeq ($(PLATFORM), windows) ...@@ -205,7 +208,7 @@ ifeq ($(PLATFORM), windows)
endif endif
# Generic # Generic
REQUIRED_ANT_VER = 1.6.3 REQUIRED_ANT_VER = 1.7.1
REQUIRED_BOOT_VER = 1.6 REQUIRED_BOOT_VER = 1.6
REQUIRED_FREETYPE_VERSION = 2.3.0 REQUIRED_FREETYPE_VERSION = 2.3.0
REQUIRED_MAKE_VER = 3.81 REQUIRED_MAKE_VER = 3.81
......
...@@ -288,8 +288,8 @@ ifndef VS2010_EXISTS ...@@ -288,8 +288,8 @@ ifndef VS2010_EXISTS
xVS100COMNTOOLS :="$(_program_files32)/Microsoft Visual Studio 10.0/Common7/Tools/" xVS100COMNTOOLS :="$(_program_files32)/Microsoft Visual Studio 10.0/Common7/Tools/"
fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS)) fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS))
else else
xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
ifneq ($(word 2,$(VS100COMNTOOLS)),) ifneq ($(word 2,$(VS100COMNTOOLS)),)
xVS100COMNTOOLS :="$(subst \,/,$(VS100COMNTOOLS))"
fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS)) fVS100COMNTOOLS :=$(call FullPath,$(xVS100COMNTOOLS))
else else
fVS100COMNTOOLS :=$(xVS100COMNTOOLS) fVS100COMNTOOLS :=$(xVS100COMNTOOLS)
...@@ -551,18 +551,6 @@ ifndef ALT_BOOTDIR ...@@ -551,18 +551,6 @@ ifndef ALT_BOOTDIR
_BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH) _BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
endif endif
# 32 bit always needs 2 runtimes, 64 bit usually does too
# MSVCRT_DLL_PATH: location of msvcrt.dll that will be re-distributed
ifdef ALT_MSVCRT_DLL_PATH
xALT_MSVCRT_DLL_PATH :="$(subst \,/,$(ALT_MSVCRT_DLL_PATH))"
MSVCRT_DLL_PATH :=$(call FullPath,$(xALT_MSVCRT_DLL_PATH))
else
MSVCRT_DLL_PATH :=$(call FullPath,$(_system_root)/system32/)
endif
MSVCRT_DLL_PATH:=$(call AltCheckSpaces,MSVCRT_DLL_PATH)
MSVCRT_DLL_PATH:=$(call AltCheckValue,MSVCRT_DLL_PATH)
# 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008 # 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
_NEEDS_MSVCRNN = true _NEEDS_MSVCRNN = true
...@@ -641,15 +629,6 @@ else ...@@ -641,15 +629,6 @@ else
endif endif
INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK) INSTALL_MSSDK:=$(call AltCheckSpaces,INSTALL_MSSDK)
# INSTALL_MSIVAL2: Installation of MsiVal2 for this platform (for install)
ifdef ALT_INSTALL_MSIVAL2
xALT_INSTALL_MSIVAL2 :="$(subst \,/,$(ALT_INSTALL_MSIVAL2))"
INSTALL_MSIVAL2 :=$(call FullPath,$(xALT_INSTALL_MSIVAL2))
else
INSTALL_MSIVAL2 :=$(_program_files32)/MsiVal2
endif
INSTALL_MSIVAL2:=$(call AltCheckSpaces,INSTALL_MSIVAL2)
# WSCRIPT: path to wscript.exe (used in creating install bundles) # WSCRIPT: path to wscript.exe (used in creating install bundles)
ifdef ALT_WSCRIPT ifdef ALT_WSCRIPT
xALT_WSCRIPT :="$(subst \,/,$(ALT_WSCRIPT))" xALT_WSCRIPT :="$(subst \,/,$(ALT_WSCRIPT))"
...@@ -685,43 +664,6 @@ else ...@@ -685,43 +664,6 @@ else
endif endif
CABARC:=$(call AltCheckSpaces,CABARC) CABARC:=$(call AltCheckSpaces,CABARC)
# MSIVAL2: path to msival2.exe (used in validating install msi files)
ifdef ALT_MSIVAL2
xALT_MSIVAL2 :="$(subst \,/,$(ALT_MSIVAL2))"
MSIVAL2 =$(xALT_MSIVAL2)
else
_MSIVAL2_1 :=$(INSTALL_MSIVAL2)/msival2.exe
_MSIVAL2_2 :=$(DEVTOOLS_PATH)msival2.exe
MSIVAL2 :=$(call FileExists,$(_MSIVAL2_1),$(_MSIVAL2_2))
endif
MSIVAL2:=$(call AltCheckSpaces,MSIVAL2)
# suppress msival2 checks, as it hangs jprt builds
ifdef SKIP_MSIVAL2
MSIVAL2 := $(ECHO)
endif
# LOGOCUB: path to cub file for (used in validating install msi files)
ifdef ALT_LOGOCUB
xALT_LOGOCUB :="$(subst \,/,$(ALT_LOGOCUB))"
LOGOCUB =$(xALT_LOGOCUB)
else
_LOGOCUB1 :=$(INSTALL_MSIVAL2)/logo.cub
_LOGOCUB2 :=$(DEVTOOLS_PATH)logo.cub
LOGOCUB :=$(call FileExists,$(_LOGOCUB1),$(_LOGOCUB2))
endif
LOGOCUB:=$(call AltCheckSpaces,LOGOCUB)
# MSITRAN: path to msitran.exe (used in creating install bundles and sponsors)
ifdef ALT_MSITRAN
xALT_MSITRAN :="$(subst \,/,$(ALT_MSITRAN))"
MSITRAN =$(xALT_MSITRAN)
else
_MSITRAN1 :=$(INSTALL_MSSDK)/Bin/msitran.exe
_MSITRAN2 :=$(DEVTOOLS_PATH)msitran.exe
MSITRAN :=$(call FileExists,$(_MSITRAN1),$(_MSITRAN2))
endif
MSITRAN:=$(call AltCheckSpaces,MSITRAN)
# MSICERT: path to msicert.exe (used in creating install bundles) # MSICERT: path to msicert.exe (used in creating install bundles)
ifdef ALT_MSICERT ifdef ALT_MSICERT
xALT_MSICERT :="$(subst \,/,$(ALT_MSICERT))" xALT_MSICERT :="$(subst \,/,$(ALT_MSICERT))"
...@@ -798,3 +740,50 @@ else ...@@ -798,3 +740,50 @@ else
endif endif
HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH) HOTSPOT_LIB_PATH:=$(call AltCheckSpaces,HOTSPOT_LIB_PATH)
HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH) HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH)
# Special define for checking the binaries
ifeq ($(VS2010_EXISTS),true)
# All windows dll and exe files should have been built with /NXCOMPAT
# and be setup for dynamic base addresses.
# In addition, we should not be dependent on certain dll files that
# we do not or cannot redistribute.
# List of filenames we should NOT be dependent on
BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
# Macro to check it's input file for banned dependencies and verify the
# binary was built properly. Relies on process exit code.
define binary_file_verification # binary_file
( \
$(ECHO) "Checking for /NXCOMPAT usage in: $1" && \
if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'NX compatible'`" = "" ] ; then \
$(ECHO) "ERROR: Did not find 'NX compatible' in headers: $1" ; \
$(DUMPBIN) /headers $1 ; \
exit 7 ; \
fi ; \
$(ECHO) "Checking for /DYNAMICBASE usage in: $1" && \
if [ "`$(DUMPBIN) /headers $1 | $(EGREP) -i 'Dynamic base'`" = "" ] ; then \
$(ECHO) "ERROR: Did not find 'Dynamic base' in headers: $1" ; \
$(DUMPBIN) /headers $1 ; \
exit 8 ; \
fi ; \
$(ECHO) "Checking for banned dependencies in: $1" && \
if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
$(ECHO) "ERROR: Found us of $(BANNED_DLLS)"; \
$(DUMPBIN) /dependents $1 ; \
exit 9 ; \
fi ; \
)
endef
else
# Macro to check it's input file for banned dependencies and verify the
# binary was built properly. Relies on process exit code.
define binary_file_verification # binary_file
endef
endif
...@@ -96,7 +96,6 @@ ifeq ($(PLATFORM),solaris) ...@@ -96,7 +96,6 @@ ifeq ($(PLATFORM),solaris)
endif endif
endif endif
ifeq ($(PLATFORM),windows) ifeq ($(PLATFORM),windows)
ALL_SETTINGS+=$(call addAltSetting,MSVCRT_DLL_PATH)
ifneq ($(MSVCRNN_DLL),) ifneq ($(MSVCRNN_DLL),)
ALL_SETTINGS+=$(call addAltSetting,MSVCRNN_DLL_PATH) ALL_SETTINGS+=$(call addAltSetting,MSVCRNN_DLL_PATH)
endif endif
...@@ -117,6 +116,9 @@ ALL_SETTINGS+=$(call addRequiredVersionSetting,ZIP_VER) ...@@ -117,6 +116,9 @@ ALL_SETTINGS+=$(call addRequiredVersionSetting,ZIP_VER)
ALL_SETTINGS+=$(call addRequiredVersionSetting,UNZIP_VER) ALL_SETTINGS+=$(call addRequiredVersionSetting,UNZIP_VER)
ifeq ($(PLATFORM),windows) ifeq ($(PLATFORM),windows)
ALL_SETTINGS+=$(call addRequiredVersionSetting,LINK_VER) ALL_SETTINGS+=$(call addRequiredVersionSetting,LINK_VER)
ALL_SETTINGS+=$(call addRequiredSetting,CC)
ALL_SETTINGS+=$(call addRequiredSetting,LINK)
ALL_SETTINGS+=$(call addRequiredSetting,DUMPBIN)
endif endif
ALL_SETTINGS+=$(call addRequiredVersionSetting,ANT_VER) ALL_SETTINGS+=$(call addRequiredVersionSetting,ANT_VER)
ALL_SETTINGS+=$(call addRequiredSetting,TEMPDIR) ALL_SETTINGS+=$(call addRequiredSetting,TEMPDIR)
...@@ -226,13 +228,13 @@ ifeq ($(PLATFORM),windows) ...@@ -226,13 +228,13 @@ ifeq ($(PLATFORM),windows)
ALL_SETTINGS+=$(call addAltSetting,DXSDK_INCLUDE_PATH) ALL_SETTINGS+=$(call addAltSetting,DXSDK_INCLUDE_PATH)
ALL_SETTINGS+=$(call addAltSetting,DXSDK_LIB_PATH) ALL_SETTINGS+=$(call addAltSetting,DXSDK_LIB_PATH)
ALL_SETTINGS+=$(call addAltSetting,WINDOWSSDKDIR) ALL_SETTINGS+=$(call addAltSetting,WINDOWSSDKDIR)
ALL_SETTINGS+=$(call addRequiredSetting,RC)
ALL_SETTINGS+=$(call addRequiredSetting,REBASE)
ifndef OPENJDK ifndef OPENJDK
ALL_SETTINGS+=$(call addAltSetting,DEPLOY_MSSDK) ALL_SETTINGS+=$(call addAltSetting,DEPLOY_MSSDK)
ALL_SETTINGS+=$(call addAltSetting,INSTALL_MSSDK) ALL_SETTINGS+=$(call addAltSetting,INSTALL_MSSDK)
ALL_SETTINGS+=$(call addAltSetting,WSCRIPT) ALL_SETTINGS+=$(call addAltSetting,WSCRIPT)
ALL_SETTINGS+=$(call addAltSetting,MSICERT) ALL_SETTINGS+=$(call addAltSetting,MSICERT)
ALL_SETTINGS+=$(call addAltSetting,MSITRAN)
ALL_SETTINGS+=$(call addAltSetting,MSIVAL2)
endif endif
endif endif
ALL_SETTINGS+=$(call addAltSetting,CACERTS_FILE) ALL_SETTINGS+=$(call addAltSetting,CACERTS_FILE)
......
...@@ -255,10 +255,10 @@ endif ...@@ -255,10 +255,10 @@ endif
MAKE_CHECK :=$(call CheckVersions,$(MAKE_VER),$(REQUIRED_MAKE_VER)) MAKE_CHECK :=$(call CheckVersions,$(MAKE_VER),$(REQUIRED_MAKE_VER))
sane-make: sane-make:
@if [ "$(MAKE_CHECK)" != "same" -a "$(MAKE_CHECK)" != "newer" ]; then \ @if [ "$(MAKE_CHECK)" != "same" -a "$(MAKE_CHECK)" != "newer" ]; then \
$(ECHO) "WARNING: The version of make being used is older than \n" \ $(ECHO) "ERROR: The version of make being used is older than \n" \
" the required version of '$(REQUIRED_MAKE_VER)'. \n" \ " the required version of '$(REQUIRED_MAKE_VER)'. \n" \
" The version of make found was '$(MAKE_VER)'. \n" \ " The version of make found was '$(MAKE_VER)'. \n" \
"" >> $(WARNING_FILE) ; \ "" >> $(ERROR_FILE) ; \
fi fi
###################################################### ######################################################
...@@ -879,13 +879,6 @@ sane-devtools_path: ...@@ -879,13 +879,6 @@ sane-devtools_path:
###################################################### ######################################################
sane-msvcrt_path: sane-msvcrt_path:
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
@if [ ! -r "$(MSVCRT_DLL_PATH)/msvcrt.dll" ]; then \
$(ECHO) "ERROR: You do not have access to msvcrt.dll. \n" \
" Please check your access to \n" \
" $(MSVCRT_DLL_PATH) \n" \
" and/or check your value of ALT_MSVCRT_DLL_PATH. \n" \
"" >> $(ERROR_FILE) ; \
fi
ifneq ($(MSVCRNN_DLL),) ifneq ($(MSVCRNN_DLL),)
@if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \ @if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \
$(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \ $(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \
...@@ -1018,6 +1011,22 @@ ifeq ($(PLATFORM), windows) ...@@ -1018,6 +1011,22 @@ ifeq ($(PLATFORM), windows)
" and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \ " and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
"" >> $(ERROR_FILE) ; \ "" >> $(ERROR_FILE) ; \
fi fi
else
ifeq ($(wildcard $(REBASE)),)
@$(ECHO) "ERROR: Cannot find the REBASE utility from path: $(REBASE)\n" \
" This is normally obtained from the WINDOWSSDKDIR." \
"" >> $(ERROR_FILE)
endif
ifeq ($(wildcard $(RC)),)
@$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \
" This is normally obtained from the WINDOWSSDKDIR." \
"" >> $(ERROR_FILE)
endif
ifeq ($(wildcard $(DUMPBIN)),)
@$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
" This is normally obtained from the WINDOWSSDKDIR." \
"" >> $(ERROR_FILE)
endif
endif endif
endif endif
...@@ -1250,10 +1259,10 @@ ANT_CHECK :=$(call CheckVersions,$(ANT_VER),$(REQUIRED_ANT_VER)) ...@@ -1250,10 +1259,10 @@ ANT_CHECK :=$(call CheckVersions,$(ANT_VER),$(REQUIRED_ANT_VER))
sane-ant_version: sane-ant_version:
@if [ "$(ANT_CHECK)" != "same" \ @if [ "$(ANT_CHECK)" != "same" \
-a "$(ANT_CHECK)" != "newer" ]; then \ -a "$(ANT_CHECK)" != "newer" ]; then \
$(ECHO) "WARNING: The version of ant being used is older than \n" \ $(ECHO) "ERROR: The version of ant being used is older than \n" \
" the required version of '$(REQUIRED_ANT_VER)'. \n" \ " the required version of '$(REQUIRED_ANT_VER)'. \n" \
" The version of ant found was '$(ANT_VER)'. \n" \ " The version of ant found was '$(ANT_VER)'. \n" \
"" >> $(WARNING_FILE) ; \ "" >> $(ERROR_FILE) ; \
fi fi
###################################################### ######################################################
...@@ -1459,25 +1468,6 @@ ifeq ($(PLATFORM), windows) ...@@ -1459,25 +1468,6 @@ ifeq ($(PLATFORM), windows)
fi fi
endif endif
######################################################
# Check for existence of INSTALL_MSIVAL2 on windows
######################################################
sane-install-msival2_path:
ifeq ($(PLATFORM), windows)
@if [ -z "$(INSTALL_MSIVAL2)" ]; then \
$(ECHO) "WARNING: Your INSTALL_MSIVAL2 setting is empty.\n" \
" It is recommended to set ALT_INSTALL_MSIVAL2.\n" \
"" >> $(WARNING_FILE) ; \
fi
@if [ ! -r "$(INSTALL_MSIVAL2)" ]; then \
$(ECHO) "ERROR: You do not have a valid INSTALL_MSIVAL2 setting. \n" \
" Please check your access to \n" \
" $(INSTALL_MSIVAL2) \n" \
" and/or check your value of ALT_INSTALL_MSIVAL2. \n" \
"" >> $(ERROR_FILE) ; \
fi
endif
###################################################### ######################################################
# Check the GNU C++ compiler for OJI plugin # Check the GNU C++ compiler for OJI plugin
###################################################### ######################################################
......
...@@ -34,7 +34,7 @@ include $(BUILDDIR)/common/Defs.gmk ...@@ -34,7 +34,7 @@ include $(BUILDDIR)/common/Defs.gmk
# #
# The order of subdirs here is important # The order of subdirs here is important
# #
SUBDIRS += hpi version jvm redist verify fdlibm java sun_nio jli main zip SUBDIRS += version jvm redist verify fdlibm java sun_nio jli main zip
# Others # Others
# Note: java_crw_demo java_hprof_demo are demos but must be delivered built in sdk # Note: java_crw_demo java_hprof_demo are demos but must be delivered built in sdk
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
# #
# #
# Makefile for native threads HPI. # Makefile for fdlibm
# #
# Note: # Note:
# The fdlibm libraries are built using special rules in Library.gmk. # The fdlibm libraries are built using special rules in Library.gmk.
......
#
# Copyright (c) 1998, 2010, 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.
#
#
# Shared files between the different threads types on Solaris. Be
# careful when including this, you must get your variables right.
#
#
# Common files on Solaris.
#
ifneq ($(PLATFORM), windows)
FILES_c += \
interrupt.c \
linker_md.c \
memory_md.c \
system_md.c \
hpi.c
endif
#
# Include paths can also be shared.
#
ifneq ($(PLATFORM), windows)
OTHER_INCLUDES += \
-I$(PLATFORM_SRC)/hpi/$(THREADDIR)/include \
-I$(PLATFORM_SRC)/hpi/include \
-I$(PLATFORM_SRC)/hpi/export \
-I$(SHARE_SRC)/hpi/include \
-I$(SHARE_SRC)/hpi/export
else
OTHER_INCLUDES += \
-I$(PLATFORM_SRC)/hpi/include \
-I$(PLATFORM_SRC)/hpi/export \
-I$(SHARE_SRC)/hpi/include \
-I$(SHARE_SRC)/hpi/export
endif
#
# Add to the default C and assembly file search paths. Clear any initial
# vpath settings to ensure that we don't look in unexpected places for HPI
# files.
#
vpath %.c
vpath %.c $(PLATFORM_SRC)/hpi/$(THREADDIR)/src
vpath %.c $(PLATFORM_SRC)/hpi/src
vpath %.c $(SHARE_SRC)/hpi/src
vpath %.s
vpath %.s $(PLATFORM_SRC)/hpi/$(THREADDIR)/src
vpath %.s $(PLATFORM_SRC)/hpi/src
#
# By default leave out locking statistics
#
ifneq ($(PLATFORM), windows)
LOCKSTATS = false
ifeq ($(LOCKSTATS), true)
CFLAGS_COMMON += -DLOCKSTATS
endif
endif
#
# Things that must be linked in.
#
ifneq ($(PLATFORM), windows)
OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) $(LIBM) -ldl
endif
#
# Copyright (c) 1998, 2010, 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.
#
#
# Makefile for native threads HPI.
#
BUILDDIR = ../../..
MODULE = base
LIBRARY = hpi
PRODUCT = java
THREADDIR = native_threads
LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/$(THREADDIR)
include $(BUILDDIR)/common/Defs.gmk
#
# Native threads specific C and .s files.
#
FILES_c = \
monitor_md.c \
threads_md.c \
condvar_md.c \
interrupt_md.c \
mutex_md.c \
sys_api_td.c \
threads_$(PLATFORM).c
#
# Other files/flags shared between the HPIs.
#
include $(BUILDDIR)/java/hpi/hpi_common.gmk
#
# Rules for the .so file.
#
ifeq ($(PLATFORM), solaris)
ifneq ($(ARCH), amd64)
FILES_reorder += reorder-$(ARCH)
endif
endif
include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk
#
# HPI flags for native threads.
#
OTHER_CPPFLAGS += -D_REENTRANT -DNATIVE
ifeq ($(USE_PTHREADS),true)
OTHER_CPPFLAGS += -DUSE_PTHREADS
ifeq ($(MOOT_PRIORITIES),true)
OTHER_CPPFLAGS += -DMOOT_PRIORITIES
endif
LIBPOSIX4 = -lposix4
OTHER_LDLIBS += -lpthread $(LIBPOSIX4)
endif
HAVE_GETHRVTIME=true
ifeq ($(HAVE_GETHRVTIME),true)
OTHER_CPPFLAGS += -DHAVE_GETHRVTIME
endif
HAVE_FILIOH=true
ifeq ($(HAVE_FILIOH),true)
OTHER_CPPFLAGS += -DHAVE_FILIOH
endif
ifeq ($(NO_INTERRUPTIBLE_IO),true)
OTHER_CPPFLAGS += -DNO_INTERRUPTIBLE_IO
endif
data = R0x2000;
text = LOAD ?RXO;
# Test Null
text: .text%_init;
text: .text%checkForCorrectLibthread: OUTPUTDIR/tmp/java/hpi/native_threads/obj/threads_solaris.o;
text: .text%init64IO: OUTPUTDIR/tmp/java/hpi/native_threads/obj/system_md.o;
text: .text%DLL_Initialize;
text: .text%GetInterface: OUTPUTDIR/tmp/java/hpi/native_threads/obj/hpi.o;
text: .text%sysBuildLibName;
text: .text%sysLoadLibrary;
text: .text%sysFindLibraryEntry;
text: .text%sysNativePath;
text: .text%sysOpen;
text: .text%sysSeek;
text: .text%lseek64_w;
# Test Exit
# Test Hello
# Test Sleep
# Test IntToString
# Test LoadToolkit
text: .text%sysAvailable;
text: .text%sysFfileMode;
text: .text%sysGetLastErrorString;
# Test LoadFrame
# Test LoadJFrame
# Test JHello
# SwingSet
data = R0x2000;
text = LOAD ?RXO;
# Test Null
text: .text%checkForCorrectLibthread: OUTPUTDIR/tmp/java/hpi/native_threads/obj/threads_solaris.o;
text: .text%init64IO: OUTPUTDIR/tmp/java/hpi/native_threads/obj/system_md.o;
text: .text%DLL_Initialize;
text: .text%GetInterface: OUTPUTDIR/tmp/java/hpi/native_threads/obj/hpi.o;
text: .text%sysBuildLibName;
text: .text%sysLoadLibrary;
text: .text%sysFindLibraryEntry;
text: .text%sysNativePath;
text: .text%sysOpen;
text: .text%sysFfileMode;
text: .text%sysSeek;
text: .text%lseek64_w;
text: .text%sysAvailable;
# Test Exit
# Test Hello
# Test Sleep
# Test IntToString
# Test LoadToolkit
text: .text%sysGetLastErrorString;
# Test LoadFrame
# Test LoadJFrame
# Test JHello
# SwingSet
data = R0x2000;
text = LOAD ?RXO;
# Test Null
text: .text%checkForCorrectLibthread: OUTPUTDIR/tmp/java/hpi/native_threads/obj64/threads_solaris.o;
text: .text%init64IO: OUTPUTDIR/tmp/java/hpi/native_threads/obj64/system_md.o;
text: .text%DLL_Initialize;
text: .text%GetInterface: OUTPUTDIR/tmp/java/hpi/native_threads/obj64/hpi.o;
text: .text%sysBuildLibName;
text: .text%sysLoadLibrary;
text: .text%sysFindLibraryEntry;
text: .text%sysNativePath;
text: .text%sysOpen;
text: .text%sysFfileMode;
text: .text%sysSeek;
text: .text%lseek64_w;
text: .text%sysAvailable;
# Test Exit
# Test Hello
# Test Sleep
# Test IntToString
# Test LoadToolkit
text: .text%sysGetLastErrorString;
# Test LoadFrame
# Test LoadJFrame
# Test JHello
# SwingSet
# #
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2005, 2011, 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
...@@ -70,14 +70,18 @@ SUNWprivate_1.1 { ...@@ -70,14 +70,18 @@ SUNWprivate_1.1 {
Java_sun_management_ThreadImpl_dumpThreads0; Java_sun_management_ThreadImpl_dumpThreads0;
Java_sun_management_ThreadImpl_findDeadlockedThreads0; Java_sun_management_ThreadImpl_findDeadlockedThreads0;
Java_sun_management_ThreadImpl_findMonitorDeadlockedThreads0; Java_sun_management_ThreadImpl_findMonitorDeadlockedThreads0;
Java_sun_management_ThreadImpl_getThreadInfo0; Java_sun_management_ThreadImpl_getThreadInfo1;
Java_sun_management_ThreadImpl_getThreads; Java_sun_management_ThreadImpl_getThreads;
Java_sun_management_ThreadImpl_getThreadTotalCpuTime0; Java_sun_management_ThreadImpl_getThreadTotalCpuTime0;
Java_sun_management_ThreadImpl_getThreadTotalCpuTime1;
Java_sun_management_ThreadImpl_getThreadUserCpuTime0; Java_sun_management_ThreadImpl_getThreadUserCpuTime0;
Java_sun_management_ThreadImpl_getThreadUserCpuTime1;
Java_sun_management_ThreadImpl_getThreadAllocatedMemory1;
Java_sun_management_ThreadImpl_resetContentionTimes0; Java_sun_management_ThreadImpl_resetContentionTimes0;
Java_sun_management_ThreadImpl_resetPeakThreadCount0; Java_sun_management_ThreadImpl_resetPeakThreadCount0;
Java_sun_management_ThreadImpl_setThreadContentionMonitoringEnabled0; Java_sun_management_ThreadImpl_setThreadContentionMonitoringEnabled0;
Java_sun_management_ThreadImpl_setThreadCpuTimeEnabled0; Java_sun_management_ThreadImpl_setThreadCpuTimeEnabled0;
Java_sun_management_ThreadImpl_setThreadAllocatedMemoryEnabled0;
Java_sun_management_VMManagementImpl_getAvailableProcessors; Java_sun_management_VMManagementImpl_getAvailableProcessors;
Java_sun_management_VMManagementImpl_getClassInitializationTime; Java_sun_management_VMManagementImpl_getClassInitializationTime;
Java_sun_management_VMManagementImpl_getClassLoadingTime; Java_sun_management_VMManagementImpl_getClassLoadingTime;
...@@ -106,6 +110,7 @@ SUNWprivate_1.1 { ...@@ -106,6 +110,7 @@ SUNWprivate_1.1 {
Java_sun_management_VMManagementImpl_initOptionalSupportFields; Java_sun_management_VMManagementImpl_initOptionalSupportFields;
Java_sun_management_VMManagementImpl_isThreadContentionMonitoringEnabled; Java_sun_management_VMManagementImpl_isThreadContentionMonitoringEnabled;
Java_sun_management_VMManagementImpl_isThreadCpuTimeEnabled; Java_sun_management_VMManagementImpl_isThreadCpuTimeEnabled;
Java_sun_management_VMManagementImpl_isThreadAllocatedMemoryEnabled;
JNI_OnLoad; JNI_OnLoad;
local: local:
*; *;
......
...@@ -296,7 +296,7 @@ ifeq ($(PLATFORM), linux) ...@@ -296,7 +296,7 @@ ifeq ($(PLATFORM), linux)
OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread -ldl OTHER_LDLIBS += -L$(LIBDIR)/$(LIBARCH) -ljava -lnet -lpthread -ldl
endif endif
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
OTHER_LDLIBS += $(JVMLIB) $(LIBSOCKET) -lposix4 -ldl \ OTHER_LDLIBS += $(JVMLIB) $(LIBSOCKET) -lposix4 -ldl -lsendfile \
-L$(LIBDIR)/$(LIBARCH) -ljava -lnet -L$(LIBDIR)/$(LIBARCH) -ljava -lnet
endif # PLATFORM endif # PLATFORM
......
...@@ -93,10 +93,6 @@ ifeq ($(PLATFORM), windows) ...@@ -93,10 +93,6 @@ ifeq ($(PLATFORM), windows)
IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%) IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%)
# NOTE: These might actually come from BUILDDIR, depends on the settings.
$(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll
$(install-import-file)
$(call chmod-file, a+x)
$(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)
$(install-import-file) $(install-import-file)
$(call chmod-file, a+x) $(call chmod-file, a+x)
...@@ -223,12 +219,15 @@ endif # PLATFORM ...@@ -223,12 +219,15 @@ endif # PLATFORM
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVM_NAME): $(HOTSPOT_KERNEL_PATH)/$(JVM_NAME) $(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVM_NAME): $(HOTSPOT_KERNEL_PATH)/$(JVM_NAME)
$(install-file) $(install-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_NAME) $(LIB_LOCATION)/$(LIBJSIG_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \ $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_NAME) \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME): $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME):
...@@ -237,30 +236,39 @@ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME): ...@@ -237,30 +236,39 @@ $(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_NAME):
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_NAME) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME) $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDTRACE_NAME) $(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDTRACE_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_NAME) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_NAME) $(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_NAME) $(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_NAME)
$(install-import-file) $(install-import-file)
@$(call binary_file_verification,$@)
$(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt : $(HOTSPOT_SERVER_PATH)/Xusage.txt $(LIB_LOCATION)/$(SERVER_LOCATION)/Xusage.txt : $(HOTSPOT_SERVER_PATH)/Xusage.txt
$(install-import-file) $(install-import-file)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
# #
# Assumes basic unix utilities are in the PATH already (uname, hostname, etc.). # Assumes basic unix utilities are in the PATH already (uname, hostname, etc.).
# #
# On Windows, assumes PROCESSOR_IDENTIFIER, VS71COMNTOOLS, # On Windows, assumes PROCESSOR_IDENTIFIER, VS100COMNTOOLS,
# SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and # SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and
# USERNAME is defined in the environment. # USERNAME is defined in the environment.
# This profile does not rely on using vcvars32.bat and 64bit Setup.bat. # This profile does not rely on using vcvars32.bat and 64bit Setup.bat.
...@@ -81,8 +81,7 @@ ...@@ -81,8 +81,7 @@
# Windows Only: # Windows Only:
# ALT_UNIXCOMMAND_PATH # ALT_UNIXCOMMAND_PATH
# ALT_DXSDK_PATH # ALT_DXSDK_PATH
# ALT_MSVCRT_DLL_PATH # ALT_MSVCRNN_DLL_PATH
# ALT_MSVCR71_DLL_PATH
# #
############################################################################# #############################################################################
# #
...@@ -213,78 +212,17 @@ else ...@@ -213,78 +212,17 @@ else
# Compiler setup (nasty part) # Compiler setup (nasty part)
# NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE. # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
# NOTE: CYGWIN has a link.exe too, make sure the compilers are first # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
if [ "${windows_arch}" = i586 ] ; then
# 32bit Windows compiler settings # Use supplied vsvars.sh
# VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined) repo=`hg root`
vs_root=$(${cygpath} "${VS71COMNTOOLS}/../..") if [ -f "${repo}/make/scripts/vsvars.sh" ] ; then
# Fill in PATH, LIB, and INCLUDE (unset all others to make sure) eval `sh ${repo}/make/scripts/vsvars.sh -v10`
vc7_root="${vs_root}/Vc7" elif [ -f "${repo}/../make/scripts/vsvars.sh" ] ; then
compiler_path="${vc7_root}/bin" eval `sh ${repo}/../make/scripts/vsvars.sh -v10`
platform_sdk="${vc7_root}/PlatformSDK" else
echo "WARNING: No make/scripts/vsvars.sh file found"
# LIB and INCLUDE must use ; as a separator
include4sdk="${vc7_root}/atlmfc/include"
include4sdk="${include4sdk};${vc7_root}/include"
include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
include4sdk="${include4sdk};${platform_sdk}/include"
include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
lib4sdk="${lib4sdk};${vc7_root}/lib"
lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
lib4sdk="${lib4sdk};${platform_sdk}/lib"
lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
# Search path and DLL locating path
# WARNING: CYGWIN has a link.exe too, make sure compilers are first
path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
path4sdk="${compiler_path};${path4sdk}"
elif [ "${windows_arch}" = amd64 ] ; then
# AMD64 64bit Windows compiler settings
if [ "${ALT_DEPLOY_MSSDK}" != "" ] ; then
platform_sdk=${ALT_DEPLOY_MSSDK}
else
platform_sdk=$(${cygpath} "C:/Program Files/Microsoft Platform SDK/")
fi
if [ "${ALT_COMPILER_PATH}" != "" ] ; then
compiler_path=${ALT_COMPILER_PATH}
if [ "${ALT_DEPLOY_MSSDK}" = "" ] ; then
platform_sdk=${ALT_COMPILER_PATH}/../../../..
fi
else
compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
fi
# LIB and INCLUDE must use ; as a separator
include4sdk="${platform_sdk}/Include"
include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
include4sdk="${include4sdk};${platform_sdk}/Include/atl"
include4sdk="${include4sdk};${platform_sdk}/Include/crt"
lib4sdk="${platform_sdk}/Lib/AMD64"
lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
# Search path and DLL locating path
# WARNING: CYGWIN has a link.exe too, make sure compilers are first
path4sdk="${platform_sdk}/bin;${path4sdk}"
path4sdk="${compiler_path};${path4sdk}"
fi fi
# Export LIB and INCLUDE
unset lib
unset Lib
LIB="${lib4sdk}"
export LIB
unset include
unset Include
INCLUDE="${include4sdk}"
export INCLUDE
# Turn all \\ into /, remove duplicates and trailing /
slash_path="$(echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g')"
path4sdk="${slash_path}"
# Convert path4sdk to cygwin style
path4sdk="$(/usr/bin/cygpath -p ${path4sdk})"
fi fi
# Get the previous JDK to be used to bootstrap the build # Get the previous JDK to be used to bootstrap the build
......
...@@ -369,10 +369,6 @@ FONTCONFIGS_SRC = $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs ...@@ -369,10 +369,6 @@ FONTCONFIGS_SRC = $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs
_FONTCONFIGS = \ _FONTCONFIGS = \
fontconfig.properties \ fontconfig.properties \
fontconfig.RedHat.properties \ fontconfig.RedHat.properties \
fontconfig.RedHat.2.1.properties \
fontconfig.RedHat.3.properties \
fontconfig.RedHat.4.properties \
fontconfig.Sun.properties \
fontconfig.Turbo.properties \ fontconfig.Turbo.properties \
fontconfig.SuSE.10.properties \ fontconfig.SuSE.10.properties \
fontconfig.SuSE.11.properties fontconfig.SuSE.11.properties
...@@ -388,9 +384,7 @@ ifeq ($(PLATFORM), solaris) ...@@ -388,9 +384,7 @@ ifeq ($(PLATFORM), solaris)
FONTCONFIGS_SRC = $(PLATFORM_SRC)/classes/sun/awt/fontconfigs FONTCONFIGS_SRC = $(PLATFORM_SRC)/classes/sun/awt/fontconfigs
_FONTCONFIGS = \ _FONTCONFIGS = \
fontconfig.properties \ fontconfig.properties
fontconfig.5.9.properties \
fontconfig.5.8.properties
FONTCONFIGS_SRC_PREFIX = $(PLATFORM). FONTCONFIGS_SRC_PREFIX = $(PLATFORM).
......
...@@ -515,8 +515,7 @@ SUNWprivate_1.1 { ...@@ -515,8 +515,7 @@ SUNWprivate_1.1 {
getDefaultConfig; getDefaultConfig;
Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_awt_X11FontManager_getFontPath; Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_X11FontManager_setNativeFontPath;
Java_sun_font_SunFontManager_populateFontFileNameMap; Java_sun_font_SunFontManager_populateFontFileNameMap;
# CDE private entry point # CDE private entry point
......
...@@ -537,8 +537,7 @@ SUNWprivate_1.1 { ...@@ -537,8 +537,7 @@ SUNWprivate_1.1 {
getDefaultConfig; getDefaultConfig;
Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_awt_X11FontManager_getFontPath; Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_X11FontManager_setNativeFontPath;
Java_sun_font_SunFontManager_populateFontFileNameMap; Java_sun_font_SunFontManager_populateFontFileNameMap;
# CDE private entry point # CDE private entry point
......
...@@ -65,7 +65,7 @@ SUNWprivate_1.1 { ...@@ -65,7 +65,7 @@ SUNWprivate_1.1 {
Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigVersion; Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_awt_X11FontManager_getFontPath; Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_awt_FontDescriptor_initIDs; Java_sun_awt_FontDescriptor_initIDs;
Java_sun_awt_PlatformFont_initIDs; Java_sun_awt_PlatformFont_initIDs;
......
...@@ -33,6 +33,7 @@ FILES_java = \ ...@@ -33,6 +33,7 @@ FILES_java = \
sun/net/ProgressEvent.java \ sun/net/ProgressEvent.java \
sun/net/ProgressListener.java \ sun/net/ProgressListener.java \
sun/net/ProgressMeteringPolicy.java \ sun/net/ProgressMeteringPolicy.java \
sun/net/SocksProxy.java \
sun/net/TelnetInputStream.java \ sun/net/TelnetInputStream.java \
sun/net/TelnetOutputStream.java \ sun/net/TelnetOutputStream.java \
sun/net/TelnetProtocolException.java \ sun/net/TelnetProtocolException.java \
......
...@@ -136,8 +136,25 @@ ifeq ($(PLATFORM), linux) ...@@ -136,8 +136,25 @@ ifeq ($(PLATFORM), linux)
-I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include
endif endif
# We have some odd logic here because some Solaris 10 updates
# have a render.h file that suggests gradients are supported, but
# the Xrender.h doesn't have the corresponding type definitions.
# Earlier updates have neither. We'd like to know if there's a mismatch.
# Whilst in the C preprocessor we can tell if the render.h define's are set
# we can't tell anything about C declarations.
# A grep of Xrender.h is the only way to know this. If they are absent
# we will set a flag indicating this mismatch and the JDK source file
# will interpret it to resolve the problem.
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions
OS_VERSION := $(shell uname -r)
XRENDER_H := $(OPENWIN_HOME)/share/include/X11/extensions/Xrender.h
ifeq ($(OS_VERSION),5.10)
LINEARGRADIENT_CNT := $(shell $(EGREP) -c XLinearGradient $(XRENDER_H))
ifeq ($(LINEARGRADIENT_CNT),0)
CFLAGS+= -DSOLARIS10_NO_XRENDER_STRUCTS
endif
endif
endif endif
ifeq ($(MILESTONE), internal) ifeq ($(MILESTONE), internal)
......
...@@ -188,8 +188,7 @@ SUNWprivate_1.1 { ...@@ -188,8 +188,7 @@ SUNWprivate_1.1 {
Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfig;
Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigAASettings;
Java_sun_font_FontConfigManager_getFontConfigVersion; Java_sun_font_FontConfigManager_getFontConfigVersion;
Java_sun_awt_X11FontManager_getFontPath; Java_sun_awt_X11FontManager_getFontPathNative;
Java_sun_font_X11FontManager_setNativeFontPath;
Java_sun_awt_X11GraphicsEnvironment_initDisplay; Java_sun_awt_X11GraphicsEnvironment_initDisplay;
Java_sun_awt_X11GraphicsEnvironment_initGLX; Java_sun_awt_X11GraphicsEnvironment_initGLX;
Java_sun_awt_X11GraphicsEnvironment_initXRender; Java_sun_awt_X11GraphicsEnvironment_initXRender;
......
...@@ -85,7 +85,6 @@ reorder.jar : $(REORDER_JAR) ...@@ -85,7 +85,6 @@ reorder.jar : $(REORDER_JAR)
libs.reorder : libs.reorder :
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
$(MAKE) LIBBLDDIR=java/zip LIBTMPDIR=sun/java.util.zip/zip reorder.lib $(MAKE) LIBBLDDIR=java/zip LIBTMPDIR=sun/java.util.zip/zip reorder.lib
$(MAKE) LIBBLDDIR=java/hpi/native LIBTMPDIR=java/hpi/native_threads reorder.lib
$(MAKE) LIBBLDDIR=java/java LIBTMPDIR=java/java.lang/java reorder.lib $(MAKE) LIBBLDDIR=java/java LIBTMPDIR=java/java.lang/java reorder.lib
$(MAKE) LIBBLDDIR=java/nio LIBTMPDIR=java/java.nio/nio reorder.lib $(MAKE) LIBBLDDIR=java/nio LIBTMPDIR=java/java.nio/nio reorder.lib
$(MAKE) LIBBLDDIR=sun/font LIBTMPDIR=sun/sun.awt.font/fontmanager reorder.lib $(MAKE) LIBBLDDIR=sun/font LIBTMPDIR=sun/sun.awt.font/fontmanager reorder.lib
...@@ -96,7 +95,6 @@ endif ...@@ -96,7 +95,6 @@ endif
libs.copy: libs.copy:
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
$(CP) $(OUTDIR)/reorder_java_zip-$(ARCH) ../../java/zip/reorder-$(ARCH) $(CP) $(OUTDIR)/reorder_java_zip-$(ARCH) ../../java/zip/reorder-$(ARCH)
$(CP) $(OUTDIR)/reorder_java_hpi_native-$(ARCH) ../../java/hpi/native/reorder-$(ARCH)
$(CP) $(OUTDIR)/reorder_java_java-$(ARCH) ../../java/java/reorder-$(ARCH) $(CP) $(OUTDIR)/reorder_java_java-$(ARCH) ../../java/java/reorder-$(ARCH)
$(CP) $(OUTDIR)/reorder_sun_font-$(ARCH) ../../sun/font/reorder-$(ARCH) $(CP) $(OUTDIR)/reorder_sun_font-$(ARCH) ../../sun/font/reorder-$(ARCH)
$(CP) $(OUTDIR)/reorder_sun_jpeg-$(ARCH) ../../sun/jpeg/reorder-$(ARCH) $(CP) $(OUTDIR)/reorder_sun_jpeg-$(ARCH) ../../sun/jpeg/reorder-$(ARCH)
......
/* /*
* Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2010, 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,27 +133,60 @@ set_event_notification(jvmtiEventMode mode, EventIndex ei) ...@@ -133,27 +133,60 @@ set_event_notification(jvmtiEventMode mode, EventIndex ei)
return error; return error;
} }
typedef struct {
int major;
int minor;
} version_type;
typedef struct {
version_type runtime;
version_type compiletime;
} compatible_versions_type;
/*
* List of explicitly compatible JVMTI versions, specified as
* { runtime version, compile-time version } pairs. -1 is a wildcard.
*/
static int nof_compatible_versions = 3;
static compatible_versions_type compatible_versions_list[] = {
/*
* FIXUP: Allow version 0 to be compatible with anything
* Special check for FCS of 1.0.
*/
{ { 0, -1 }, { -1, -1 } },
{ { -1, -1 }, { 0, -1 } },
/*
* 1.2 is runtime compatible with 1.1 -- just make sure to check the
* version before using any new 1.2 features
*/
{ { 1, 1 }, { 1, 2 } }
};
/* Logic to determine JVMTI version compatibility */ /* Logic to determine JVMTI version compatibility */
static jboolean static jboolean
compatible_versions(jint major_runtime, jint minor_runtime, compatible_versions(jint major_runtime, jint minor_runtime,
jint major_compiletime, jint minor_compiletime) jint major_compiletime, jint minor_compiletime)
{ {
#if 1 /* FIXUP: We allow version 0 to be compatible with anything */ /*
/* Special check for FCS of 1.0. */ * First check to see if versions are explicitly compatible via the
if ( major_runtime == 0 || major_compiletime == 0 ) { * list specified above.
return JNI_TRUE; */
} int i;
#endif for (i = 0; i < nof_compatible_versions; ++i) {
/* Runtime major version must match. */ version_type runtime = compatible_versions_list[i].runtime;
if ( major_runtime != major_compiletime ) { version_type comptime = compatible_versions_list[i].compiletime;
return JNI_FALSE;
} if ((major_runtime == runtime.major || runtime.major == -1) &&
/* Runtime minor version must be >= the version compiled with. */ (minor_runtime == runtime.minor || runtime.minor == -1) &&
if ( minor_runtime < minor_compiletime ) { (major_compiletime == comptime.major || comptime.major == -1) &&
return JNI_FALSE; (minor_compiletime == comptime.minor || comptime.minor == -1)) {
return JNI_TRUE;
}
} }
/* Assumed compatible */
return JNI_TRUE; return major_runtime == major_compiletime &&
minor_runtime >= minor_compiletime;
} }
/* OnLoad startup: /* OnLoad startup:
......
/* /*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2010, 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,7 @@ ...@@ -39,6 +39,7 @@
#include "stepControl.h" #include "stepControl.h"
#include "threadControl.h" #include "threadControl.h"
#include "SDE.h" #include "SDE.h"
#include "jvmti.h"
typedef struct ClassFilter { typedef struct ClassFilter {
jclass clazz; jclass clazz;
...@@ -275,6 +276,24 @@ patternStringMatch(char *classname, const char *pattern) ...@@ -275,6 +276,24 @@ patternStringMatch(char *classname, const char *pattern)
} }
} }
static jboolean isVersionGte12x() {
jint version;
jvmtiError err =
JVMTI_FUNC_PTR(gdata->jvmti,GetVersionNumber)(gdata->jvmti, &version);
if (err == JVMTI_ERROR_NONE) {
jint major, minor;
major = (version & JVMTI_VERSION_MASK_MAJOR)
>> JVMTI_VERSION_SHIFT_MAJOR;
minor = (version & JVMTI_VERSION_MASK_MINOR)
>> JVMTI_VERSION_SHIFT_MINOR;
return (major > 1 || major == 1 && minor >= 2);
} else {
return JNI_FALSE;
}
}
/* Return the object instance in which the event occurred */ /* Return the object instance in which the event occurred */
/* Return NULL if static or if an error occurs */ /* Return NULL if static or if an error occurs */
static jobject static jobject
...@@ -286,6 +305,14 @@ eventInstance(EventInfo *evinfo) ...@@ -286,6 +305,14 @@ eventInstance(EventInfo *evinfo)
jint modifiers = 0; jint modifiers = 0;
jvmtiError error; jvmtiError error;
static jboolean got_version = JNI_FALSE;
static jboolean is_version_gte_12x = JNI_FALSE;
if (!got_version) {
is_version_gte_12x = isVersionGte12x();
got_version = JNI_TRUE;
}
switch (evinfo->ei) { switch (evinfo->ei) {
case EI_SINGLE_STEP: case EI_SINGLE_STEP:
case EI_BREAKPOINT: case EI_BREAKPOINT:
...@@ -314,11 +341,18 @@ eventInstance(EventInfo *evinfo) ...@@ -314,11 +341,18 @@ eventInstance(EventInfo *evinfo)
/* fail if error or static (0x8) */ /* fail if error or static (0x8) */
if (error == JVMTI_ERROR_NONE && thread!=NULL && (modifiers & 0x8) == 0) { if (error == JVMTI_ERROR_NONE && thread!=NULL && (modifiers & 0x8) == 0) {
FrameNumber fnum = 0; FrameNumber fnum = 0;
/* get slot zero object "this" */ if (is_version_gte_12x) {
error = JVMTI_FUNC_PTR(gdata->jvmti,GetLocalObject) /* Use new 1.2.x function, GetLocalInstance */
(gdata->jvmti, thread, fnum, 0, &object); error = JVMTI_FUNC_PTR(gdata->jvmti,GetLocalInstance)
if (error != JVMTI_ERROR_NONE) (gdata->jvmti, thread, fnum, &object);
} else {
/* get slot zero object "this" */
error = JVMTI_FUNC_PTR(gdata->jvmti,GetLocalObject)
(gdata->jvmti, thread, fnum, 0, &object);
}
if (error != JVMTI_ERROR_NONE) {
object = NULL; object = NULL;
}
} }
return object; return object;
......
...@@ -94,15 +94,15 @@ static int numOptions, maxOptions; ...@@ -94,15 +94,15 @@ static int numOptions, maxOptions;
* Prototypes for functions internal to launcher. * Prototypes for functions internal to launcher.
*/ */
static void SetClassPath(const char *s); static void SetClassPath(const char *s);
static void SetModulesBootClassPath(const char *s);
static void SelectVersion(int argc, char **argv, char **main_class); static void SelectVersion(int argc, char **argv, char **main_class);
static jboolean ParseArguments(int *pargc, char ***pargv, char **pjarfile, static jboolean ParseArguments(int *pargc, char ***pargv,
char **pclassname, int *pret, const char *jvmpath); int *pmode, char **pwhat,
int *pret, const char *jrepath);
static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv, static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
InvocationFunctions *ifn); InvocationFunctions *ifn);
static jstring NewPlatformString(JNIEnv *env, char *s); static jstring NewPlatformString(JNIEnv *env, char *s);
static jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc); static jobjectArray NewPlatformStringArray(JNIEnv *env, char **strv, int strc);
static jclass LoadMainClass(JNIEnv *env, jboolean isJar, char *name); static jclass LoadMainClass(JNIEnv *env, int mode, char *name);
static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv); static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv);
static jboolean AddApplicationOptions(int cpathc, const char **cpathv); static jboolean AddApplicationOptions(int cpathc, const char **cpathv);
...@@ -158,18 +158,27 @@ static jboolean IsWildCardEnabled(); ...@@ -158,18 +158,27 @@ static jboolean IsWildCardEnabled();
* Running Java code in primordial thread caused many problems. We will * Running Java code in primordial thread caused many problems. We will
* create a new thread to invoke JVM. See 6316197 for more information. * create a new thread to invoke JVM. See 6316197 for more information.
*/ */
static jlong threadStackSize = 0; /* stack size of the new thread */ static jlong threadStackSize = 0; /* stack size of the new thread */
static jlong maxHeapSize = 0; /* max heap size */ static jlong maxHeapSize = 0; /* max heap size */
static jlong initialHeapSize = 0; /* inital heap size */ static jlong initialHeapSize = 0; /* inital heap size */
int JNICALL JavaMain(void * args); /* entry point */ int JNICALL JavaMain(void * args); /* entry point */
enum LaunchMode { // cf. sun.launcher.LauncherHelper
LM_UNKNOWN = 0,
LM_CLASS,
LM_JAR
};
static const char *launchModeNames[]
= { "Unknown", "Main class", "JAR file" };
typedef struct { typedef struct {
int argc; int argc;
char ** argv; char **argv;
char * jarfile; int mode;
char * classname; char *what;
InvocationFunctions ifn; InvocationFunctions ifn;
} JavaMainArgs; } JavaMainArgs;
/* /*
...@@ -189,8 +198,8 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ ...@@ -189,8 +198,8 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
jint ergo /* ergonomics class policy */ jint ergo /* ergonomics class policy */
) )
{ {
char *jarfile = 0; int mode = LM_UNKNOWN;
char *classname = 0; char *what = NULL;
char *cpath = 0; char *cpath = 0;
char *main_class = NULL; char *main_class = NULL;
int ret; int ret;
...@@ -277,24 +286,21 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ ...@@ -277,24 +286,21 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
SetClassPath(cpath); SetClassPath(cpath);
} }
/* /* Parse command line options; if the return value of
* Parse command line options; if the return value of * ParseArguments is false, the program should exit.
* ParseArguments is false, the program should exit.
*/ */
if (!ParseArguments(&argc, &argv, &jarfile, &classname, &ret, jvmpath)) { if (!ParseArguments(&argc, &argv, &mode, &what, &ret, jrepath))
{
return(ret); return(ret);
} }
/* Set bootclasspath for modules */
SetModulesBootClassPath(jrepath);
/* Override class path if -jar flag was specified */ /* Override class path if -jar flag was specified */
if (jarfile != 0) { if (mode == LM_JAR) {
SetClassPath(jarfile); SetClassPath(what); /* Override class path */
} }
/* set the -Dsun.java.command pseudo property */ /* set the -Dsun.java.command pseudo property */
SetJavaCommandLineProp(classname, jarfile, argc, argv); SetJavaCommandLineProp(what, argc, argv);
/* Set the -Dsun.java.launcher pseudo property */ /* Set the -Dsun.java.launcher pseudo property */
SetJavaLauncherProp(); SetJavaLauncherProp();
...@@ -305,7 +311,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ ...@@ -305,7 +311,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
/* Show the splash screen if needed */ /* Show the splash screen if needed */
ShowSplashScreen(); ShowSplashScreen();
return ContinueInNewThread(&ifn, argc, argv, jarfile, classname, ret); return ContinueInNewThread(&ifn, argc, argv, mode, what, ret);
} }
/* /*
...@@ -353,13 +359,13 @@ JavaMain(void * _args) ...@@ -353,13 +359,13 @@ JavaMain(void * _args)
JavaMainArgs *args = (JavaMainArgs *)_args; JavaMainArgs *args = (JavaMainArgs *)_args;
int argc = args->argc; int argc = args->argc;
char **argv = args->argv; char **argv = args->argv;
char *jarfile = args->jarfile; int mode = args->mode;
char *classname = args->classname; char *what = args->what;
InvocationFunctions ifn = args->ifn; InvocationFunctions ifn = args->ifn;
JavaVM *vm = 0; JavaVM *vm = 0;
JNIEnv *env = 0; JNIEnv *env = 0;
jclass mainClass; jclass mainClass = NULL;
jmethodID mainID; jmethodID mainID;
jobjectArray mainArgs; jobjectArray mainArgs;
int ret = 0; int ret = 0;
...@@ -385,7 +391,7 @@ JavaMain(void * _args) ...@@ -385,7 +391,7 @@ JavaMain(void * _args)
CHECK_EXCEPTION_LEAVE(1); CHECK_EXCEPTION_LEAVE(1);
} }
/* If the user specified neither a class name nor a JAR file */ /* If the user specified neither a class name nor a JAR file */
if (printXUsage || printUsage || (jarfile == 0 && classname == 0)) { if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) {
PrintUsage(env, printXUsage); PrintUsage(env, printXUsage);
CHECK_EXCEPTION_LEAVE(1); CHECK_EXCEPTION_LEAVE(1);
LEAVE(); LEAVE();
...@@ -399,11 +405,11 @@ JavaMain(void * _args) ...@@ -399,11 +405,11 @@ JavaMain(void * _args)
(long)(jint)Counter2Micros(end-start)); (long)(jint)Counter2Micros(end-start));
} }
/* At this stage, argc/argv have the applications' arguments */ /* At this stage, argc/argv have the application's arguments */
if (JLI_IsTraceLauncher()){ if (JLI_IsTraceLauncher()){
int i; int i;
printf("Main-Class is '%s'\n", classname ? classname : ""); printf("%s is '%s'\n", launchModeNames[mode], what);
printf("Apps' argc is %d\n", argc); printf("App's argc is %d\n", argc);
for (i=0; i < argc; i++) { for (i=0; i < argc; i++) {
printf(" argv[%2d] = '%s'\n", i, argv[i]); printf(" argv[%2d] = '%s'\n", i, argv[i]);
} }
...@@ -431,11 +437,7 @@ JavaMain(void * _args) ...@@ -431,11 +437,7 @@ JavaMain(void * _args)
* 2) Remove the vestages of maintaining main_class through * 2) Remove the vestages of maintaining main_class through
* the environment (and remove these comments). * the environment (and remove these comments).
*/ */
if (jarfile != 0) { mainClass = LoadMainClass(env, mode, what);
mainClass = LoadMainClass(env, JNI_TRUE, jarfile);
} else {
mainClass = LoadMainClass(env, JNI_FALSE, classname);
}
CHECK_EXCEPTION_NULL_LEAVE(mainClass); CHECK_EXCEPTION_NULL_LEAVE(mainClass);
/* /*
...@@ -697,7 +699,7 @@ AddOption(char *str, void *info) ...@@ -697,7 +699,7 @@ AddOption(char *str, void *info)
if (JLI_StrCCmp(str, "-Xms") == 0) { if (JLI_StrCCmp(str, "-Xms") == 0) {
jlong tmp; jlong tmp;
if (parse_size(str + 4, &tmp)) { if (parse_size(str + 4, &tmp)) {
initialHeapSize = tmp; initialHeapSize = tmp;
} }
} }
} }
...@@ -718,44 +720,6 @@ SetClassPath(const char *s) ...@@ -718,44 +720,6 @@ SetClassPath(const char *s)
JLI_MemFree((char *) s); JLI_MemFree((char *) s);
} }
/*
* Set the bootclasspath for modules.
* A temporary workaround until jigsaw is integrated into JDK 7.
*/
static void
SetModulesBootClassPath(const char *jrepath)
{
char *def, *s;
char pathname[MAXPATHLEN];
const char separator[] = { FILE_SEPARATOR, '\0' };
const char *orig = jrepath;
static const char format[] = "-Xbootclasspath/p:%s";
struct stat statbuf;
/* return if jre/lib/rt.jar exists */
JLI_Snprintf(pathname, sizeof(pathname), "%s%slib%srt.jar", jrepath, separator, separator);
if (stat(pathname, &statbuf) == 0) {
return;
}
/* return if jre/classes exists */
JLI_Snprintf(pathname, sizeof(pathname), "%s%sclasses", jrepath, separator);
if (stat(pathname, &statbuf) == 0) {
return;
}
/* modularized jre */
JLI_Snprintf(pathname, sizeof(pathname), "%s%slib%s*", jrepath, separator, separator);
s = (char *) JLI_WildcardExpandClasspath(pathname);
def = JLI_MemAlloc(sizeof(format)
- 2 /* strlen("%s") */
+ JLI_StrLen(s));
sprintf(def, format, s);
AddOption(def, NULL);
if (s != orig)
JLI_MemFree((char *) s);
}
/* /*
* The SelectVersion() routine ensures that an appropriate version of * The SelectVersion() routine ensures that an appropriate version of
* the JRE is running. The specification for the appropriate version * the JRE is running. The specification for the appropriate version
...@@ -1000,16 +964,17 @@ SelectVersion(int argc, char **argv, char **main_class) ...@@ -1000,16 +964,17 @@ SelectVersion(int argc, char **argv, char **main_class)
/* /*
* Parses command line arguments. Returns JNI_FALSE if launcher * Parses command line arguments. Returns JNI_FALSE if launcher
* should exit without starting vm, returns JNI_TRUE if vm needs * should exit without starting vm, returns JNI_TRUE if vm needs
* to be started to process given options. *pret (the launcher * to be started to process given options. *pret (the launcher
* process return value) is set to 0 for a normal exit. * process return value) is set to 0 for a normal exit.
*/ */
static jboolean static jboolean
ParseArguments(int *pargc, char ***pargv, char **pjarfile, ParseArguments(int *pargc, char ***pargv,
char **pclassname, int *pret, const char *jvmpath) int *pmode, char **pwhat,
int *pret, const char *jrepath)
{ {
int argc = *pargc; int argc = *pargc;
char **argv = *pargv; char **argv = *pargv;
jboolean jarflag = JNI_FALSE; int mode = LM_UNKNOWN;
char *arg; char *arg;
*pret = 0; *pret = 0;
...@@ -1019,10 +984,11 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile, ...@@ -1019,10 +984,11 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
if (JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) { if (JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) {
ARG_CHECK (argc, ARG_ERROR1, arg); ARG_CHECK (argc, ARG_ERROR1, arg);
SetClassPath(*argv); SetClassPath(*argv);
mode = LM_CLASS;
argv++; --argc; argv++; --argc;
} else if (JLI_StrCmp(arg, "-jar") == 0) { } else if (JLI_StrCmp(arg, "-jar") == 0) {
ARG_CHECK (argc, ARG_ERROR2, arg); ARG_CHECK (argc, ARG_ERROR2, arg);
jarflag = JNI_TRUE; mode = LM_JAR;
} else if (JLI_StrCmp(arg, "-help") == 0 || } else if (JLI_StrCmp(arg, "-help") == 0 ||
JLI_StrCmp(arg, "-h") == 0 || JLI_StrCmp(arg, "-h") == 0 ||
JLI_StrCmp(arg, "-?") == 0) { JLI_StrCmp(arg, "-?") == 0) {
...@@ -1102,19 +1068,24 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile, ...@@ -1102,19 +1068,24 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
} }
if (--argc >= 0) { if (--argc >= 0) {
if (jarflag) { *pwhat = *argv++;
*pjarfile = *argv++;
*pclassname = NULL;
} else {
*pjarfile = NULL;
*pclassname = *argv++;
}
*pargc = argc;
*pargv = argv;
} }
if (*pjarfile == NULL && *pclassname == NULL) {
if (*pwhat == NULL) {
*pret = 1; *pret = 1;
} else if (mode == LM_UNKNOWN) {
/* default to LM_CLASS if -jar and -cp option are
* not specified */
mode = LM_CLASS;
}
if (argc >= 0) {
*pargc = argc;
*pargv = argv;
} }
*pmode = mode;
return JNI_TRUE; return JNI_TRUE;
} }
...@@ -1263,7 +1234,7 @@ NewPlatformStringArray(JNIEnv *env, char **strv, int strc) ...@@ -1263,7 +1234,7 @@ NewPlatformStringArray(JNIEnv *env, char **strv, int strc)
* call it for more details refer to the java implementation. * call it for more details refer to the java implementation.
*/ */
static jclass static jclass
LoadMainClass(JNIEnv *env, jboolean isJar, char *name) LoadMainClass(JNIEnv *env, int mode, char *name)
{ {
jclass cls; jclass cls;
jmethodID mid; jmethodID mid;
...@@ -1276,9 +1247,9 @@ LoadMainClass(JNIEnv *env, jboolean isJar, char *name) ...@@ -1276,9 +1247,9 @@ LoadMainClass(JNIEnv *env, jboolean isJar, char *name)
} }
NULL_CHECK0(cls = FindBootStrapClass(env, "sun/launcher/LauncherHelper")); NULL_CHECK0(cls = FindBootStrapClass(env, "sun/launcher/LauncherHelper"));
NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, "checkAndLoadMain", NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, "checkAndLoadMain",
"(ZZLjava/lang/String;)Ljava/lang/Object;")); "(ZILjava/lang/String;)Ljava/lang/Class;"));
str = (*env)->NewStringUTF(env, name); str = (*env)->NewStringUTF(env, name);
result = (*env)->CallStaticObjectMethod(env, cls, mid, JNI_TRUE, isJar, str); result = (*env)->CallStaticObjectMethod(env, cls, mid, JNI_TRUE, mode, str);
if (JLI_IsTraceLauncher()) { if (JLI_IsTraceLauncher()) {
end = CounterGet(); end = CounterGet();
...@@ -1424,8 +1395,7 @@ AddApplicationOptions(int cpathc, const char **cpathv) ...@@ -1424,8 +1395,7 @@ AddApplicationOptions(int cpathc, const char **cpathv)
* property is not exported by HotSpot to the Java layer. * property is not exported by HotSpot to the Java layer.
*/ */
void void
SetJavaCommandLineProp(char *classname, char *jarfile, SetJavaCommandLineProp(char *what, int argc, char **argv)
int argc, char **argv)
{ {
int i = 0; int i = 0;
...@@ -1433,22 +1403,17 @@ SetJavaCommandLineProp(char *classname, char *jarfile, ...@@ -1433,22 +1403,17 @@ SetJavaCommandLineProp(char *classname, char *jarfile,
char* javaCommand = NULL; char* javaCommand = NULL;
char* dashDstr = "-Dsun.java.command="; char* dashDstr = "-Dsun.java.command=";
if (classname == NULL && jarfile == NULL) { if (what == NULL) {
/* unexpected, one of these should be set. just return without /* unexpected, one of these should be set. just return without
* setting the property * setting the property
*/ */
return; return;
} }
/* if the class name is not set, then use the jarfile name */
if (classname == NULL) {
classname = jarfile;
}
/* determine the amount of memory to allocate assuming /* determine the amount of memory to allocate assuming
* the individual components will be space separated * the individual components will be space separated
*/ */
len = JLI_StrLen(classname); len = JLI_StrLen(what);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
len += JLI_StrLen(argv[i]) + 1; len += JLI_StrLen(argv[i]) + 1;
} }
...@@ -1459,7 +1424,7 @@ SetJavaCommandLineProp(char *classname, char *jarfile, ...@@ -1459,7 +1424,7 @@ SetJavaCommandLineProp(char *classname, char *jarfile,
/* build the -D string */ /* build the -D string */
*javaCommand = '\0'; *javaCommand = '\0';
JLI_StrCat(javaCommand, dashDstr); JLI_StrCat(javaCommand, dashDstr);
JLI_StrCat(javaCommand, classname); JLI_StrCat(javaCommand, what);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
/* the components of the string are space separated. In /* the components of the string are space separated. In
...@@ -1479,7 +1444,8 @@ SetJavaCommandLineProp(char *classname, char *jarfile, ...@@ -1479,7 +1444,8 @@ SetJavaCommandLineProp(char *classname, char *jarfile,
* JVM would like to know if it's created by a standard Sun launcher, or by * JVM would like to know if it's created by a standard Sun launcher, or by
* user native application, the following property indicates the former. * user native application, the following property indicates the former.
*/ */
void SetJavaLauncherProp() { void
SetJavaLauncherProp() {
AddOption("-Dsun.java.launcher=SUN_STANDARD", NULL); AddOption("-Dsun.java.launcher=SUN_STANDARD", NULL);
} }
...@@ -1913,8 +1879,8 @@ IsWildCardEnabled() ...@@ -1913,8 +1879,8 @@ IsWildCardEnabled()
} }
static int static int
ContinueInNewThread(InvocationFunctions* ifn, int argc, ContinueInNewThread(InvocationFunctions* ifn, int argc, char **argv,
char **argv, char *jarfile, char *classname, int ret) int mode, char *what, int ret)
{ {
/* /*
...@@ -1938,8 +1904,8 @@ ContinueInNewThread(InvocationFunctions* ifn, int argc, ...@@ -1938,8 +1904,8 @@ ContinueInNewThread(InvocationFunctions* ifn, int argc,
args.argc = argc; args.argc = argc;
args.argv = argv; args.argv = argv;
args.jarfile = jarfile; args.mode = mode;
args.classname = classname; args.what = what;
args.ifn = *ifn; args.ifn = *ifn;
rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args); rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args);
......
...@@ -153,7 +153,7 @@ int ContinueInNewThread0(int (JNICALL *continuation)(void *), ...@@ -153,7 +153,7 @@ int ContinueInNewThread0(int (JNICALL *continuation)(void *),
/* sun.java.launcher.* platform properties. */ /* sun.java.launcher.* platform properties. */
void SetJavaLauncherPlatformProps(void); void SetJavaLauncherPlatformProps(void);
void SetJavaCommandLineProp(char* classname, char* jarfile, int argc, char** argv); void SetJavaCommandLineProp(char* what, int argc, char** argv);
void SetJavaLauncherProp(void); void SetJavaLauncherProp(void);
/* /*
...@@ -178,8 +178,9 @@ jint GetErgoPolicy(); ...@@ -178,8 +178,9 @@ jint GetErgoPolicy();
jboolean ServerClassMachine(); jboolean ServerClassMachine();
static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv, static int ContinueInNewThread(InvocationFunctions* ifn,
char* jarfile, char* classname, int ret); int argc, char** argv,
int mode, char *what, int ret);
/* /*
* Initialize platform specific settings * Initialize platform specific settings
......
...@@ -1704,7 +1704,7 @@ class BandStructure { ...@@ -1704,7 +1704,7 @@ class BandStructure {
for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) { for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
assert(attrIndexLimit[i] == 0); assert(attrIndexLimit[i] == 0);
attrIndexLimit[i] = 32; // just for the sake of predefs. attrIndexLimit[i] = 32; // just for the sake of predefs.
attrDefs.set(i, new ArrayList<>(Collections.nCopies( attrDefs.set(i, new ArrayList<Attribute.Layout>(Collections.nCopies(
attrIndexLimit[i], (Attribute.Layout)null))); attrIndexLimit[i], (Attribute.Layout)null)));
} }
......
/*
* Copyright (c) 2011, 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 com.sun.management;
import java.util.Map;
/**
* Platform-specific management interface for the thread system
* of the Java virtual machine.
* <p>
* This platform extension is only available to a thread
* implementation that supports this extension.
*
* @author Paul Hohensee
* @since 6u25
*/
public interface ThreadMXBean extends java.lang.management.ThreadMXBean {
/**
* Returns the total CPU time for each thread whose ID is
* in the input array {@code ids} in nanoseconds.
* The returned values are of nanoseconds precision but
* not necessarily nanoseconds accuracy.
* <p>
* This method is equivalent to calling the
* {@link ThreadMXBean#getThreadCpuTime(long)}
* method for each thread ID in the input array {@code ids} and setting the
* returned value in the corresponding element of the returned array.
*
* @param ids an array of thread IDs.
* @return an array of long values, each of which is the amount of CPU
* time the thread whose ID is in the corresponding element of the input
* array of IDs has used,
* if the thread of a specified ID exists, the thread is alive,
* and CPU time measurement is enabled;
* {@code -1} otherwise.
*
* @throws NullPointerException if {@code ids} is {@code null}
* @throws IllegalArgumentException if any element in the input array
* {@code ids} is {@code <=} {@code 0}.
* @throws java.lang.UnsupportedOperationException if the Java
* virtual machine implementation does not support CPU time
* measurement.
*
* @see ThreadMXBean#getThreadCpuTime(long)
* @see #getThreadUserTime
* @see ThreadMXBean#isThreadCpuTimeSupported
* @see ThreadMXBean#isThreadCpuTimeEnabled
* @see ThreadMXBean#setThreadCpuTimeEnabled
*/
public long[] getThreadCpuTime(long[] ids);
/**
* Returns the CPU time that each thread whose ID is in the input array
* {@code ids} has executed in user mode in nanoseconds.
* The returned values are of nanoseconds precision but
* not necessarily nanoseconds accuracy.
* <p>
* This method is equivalent to calling the
* {@link ThreadMXBean#getThreadUserTime(long)}
* method for each thread ID in the input array {@code ids} and setting the
* returned value in the corresponding element of the returned array.
*
* @param ids an array of thread IDs.
* @return an array of long values, each of which is the amount of user
* mode CPU time the thread whose ID is in the corresponding element of
* the input array of IDs has used,
* if the thread of a specified ID exists, the thread is alive,
* and CPU time measurement is enabled;
* {@code -1} otherwise.
*
* @throws NullPointerException if {@code ids} is {@code null}
* @throws IllegalArgumentException if any element in the input array
* {@code ids} is {@code <=} {@code 0}.
* @throws java.lang.UnsupportedOperationException if the Java
* virtual machine implementation does not support CPU time
* measurement.
*
* @see ThreadMXBean#getThreadUserTime(long)
* @see #getThreadCpuTime
* @see ThreadMXBean#isThreadCpuTimeSupported
* @see ThreadMXBean#isThreadCpuTimeEnabled
* @see ThreadMXBean#setThreadCpuTimeEnabled
*/
public long[] getThreadUserTime(long[] ids);
/**
* Returns an approximation of the total amount of memory, in bytes,
* allocated in heap memory for the thread of the specified ID.
* The returned value is an approximation because some Java virtual machine
* implementations may use object allocation mechanisms that result in a
* delay between the time an object is allocated and the time its size is
* recorded.
* <p>
* If the thread of the specified ID is not alive or does not exist,
* this method returns {@code -1}. If thread memory allocation measurement
* is disabled, this method returns {@code -1}.
* A thread is alive if it has been started and has not yet died.
* <p>
* If thread memory allocation measurement is enabled after the thread has
* started, the Java virtual machine implementation may choose any time up
* to and including the time that the capability is enabled as the point
* where thread memory allocation measurement starts.
*
* @param id the thread ID of a thread
* @return an approximation of the total memory allocated, in bytes, in
* heap memory for a thread of the specified ID
* if the thread of the specified ID exists, the thread is alive,
* and thread memory allocation measurement is enabled;
* {@code -1} otherwise.
*
* @throws IllegalArgumentException if {@code id} {@code <=} {@code 0}.
* @throws java.lang.UnsupportedOperationException if the Java virtual
* machine implementation does not support thread memory allocation
* measurement.
*
* @see #isThreadAllocatedMemorySupported
* @see #isThreadAllocatedMemoryEnabled
* @see #setThreadAllocatedMemoryEnabled
*/
public long getThreadAllocatedBytes(long id);
/**
* Returns an approximation of the total amount of memory, in bytes,
* allocated in heap memory for each thread whose ID is in the input
* array {@code ids}.
* The returned values are approximations because some Java virtual machine
* implementations may use object allocation mechanisms that result in a
* delay between the time an object is allocated and the time its size is
* recorded.
* <p>
* This method is equivalent to calling the
* {@link #getThreadAllocatedBytes(long)}
* method for each thread ID in the input array {@code ids} and setting the
* returned value in the corresponding element of the returned array.
*
* @param ids an array of thread IDs.
* @return an array of long values, each of which is an approximation of
* the total memory allocated, in bytes, in heap memory for the thread
* whose ID is in the corresponding element of the input array of IDs.
*
* @throws NullPointerException if {@code ids} is {@code null}
* @throws IllegalArgumentException if any element in the input array
* {@code ids} is {@code <=} {@code 0}.
* @throws java.lang.UnsupportedOperationException if the Java virtual
* machine implementation does not support thread memory allocation
* measurement.
*
* @see #getThreadAllocatedBytes(long)
* @see #isThreadAllocatedMemorySupported
* @see #isThreadAllocatedMemoryEnabled
* @see #setThreadAllocatedMemoryEnabled
*/
public long[] getThreadAllocatedBytes(long[] ids);
/**
* Tests if the Java virtual machine implementation supports thread memory
* allocation measurement.
*
* @return
* {@code true}
* if the Java virtual machine implementation supports thread memory
* allocation measurement;
* {@code false} otherwise.
*/
public boolean isThreadAllocatedMemorySupported();
/**
* Tests if thread memory allocation measurement is enabled.
*
* @return {@code true} if thread memory allocation measurement is enabled;
* {@code false} otherwise.
*
* @throws java.lang.UnsupportedOperationException if the Java virtual
* machine does not support thread memory allocation measurement.
*
* @see #isThreadAllocatedMemorySupported
*/
public boolean isThreadAllocatedMemoryEnabled();
/**
* Enables or disables thread memory allocation measurement. The default
* is platform dependent.
*
* @param enable {@code true} to enable;
* {@code false} to disable.
*
* @throws java.lang.UnsupportedOperationException if the Java virtual
* machine does not support thread memory allocation measurement.
*
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
* ManagementPermission("control").
*
* @see #isThreadAllocatedMemorySupported
*/
public void setThreadAllocatedMemoryEnabled(boolean enable);
}
...@@ -223,7 +223,9 @@ public final class RhinoScriptEngine extends AbstractScriptEngine ...@@ -223,7 +223,9 @@ public final class RhinoScriptEngine extends AbstractScriptEngine
} catch (RhinoException re) { } catch (RhinoException re) {
if (DEBUG) re.printStackTrace(); if (DEBUG) re.printStackTrace();
int line = (line = re.lineNumber()) == 0 ? -1 : line; int line = (line = re.lineNumber()) == 0 ? -1 : line;
throw new ScriptException(re.toString(), re.sourceName(), line); ScriptException se = new ScriptException(re.toString(), re.sourceName(), line);
se.initCause(re);
throw se;
} finally { } finally {
cx.exit(); cx.exit();
} }
...@@ -257,6 +259,8 @@ public final class RhinoScriptEngine extends AbstractScriptEngine ...@@ -257,6 +259,8 @@ public final class RhinoScriptEngine extends AbstractScriptEngine
" str = 'null'; \n" + " str = 'null'; \n" +
" } \n" + " } \n" +
" var out = context.getWriter(); \n" + " var out = context.getWriter(); \n" +
" if (!(out instanceof java.io.PrintWriter))\n" +
" out = new java.io.PrintWriter(out); \n" +
" out.print(String(str)); \n" + " out.print(String(str)); \n" +
" if (newline) out.print('\\n'); \n" + " if (newline) out.print('\\n'); \n" +
" out.flush(); \n" + " out.flush(); \n" +
......
...@@ -1180,7 +1180,7 @@ public class PolicyFile extends javax.security.auth.Policy { ...@@ -1180,7 +1180,7 @@ public class PolicyFile extends javax.security.auth.Policy {
// Done // Done
return certs; return certs;
ArrayList<Certificate> userCertList = new ArrayList<Certificate>(); ArrayList<Certificate> userCertList = new ArrayList<>();
i = 0; i = 0;
while (i < certs.length) { while (i < certs.length) {
userCertList.add(certs[i]); userCertList.add(certs[i]);
......
...@@ -99,10 +99,10 @@ public class DialogCallbackHandler implements CallbackHandler { ...@@ -99,10 +99,10 @@ public class DialogCallbackHandler implements CallbackHandler {
throws UnsupportedCallbackException throws UnsupportedCallbackException
{ {
/* Collect messages to display in the dialog */ /* Collect messages to display in the dialog */
final List<Object> messages = new ArrayList<Object>(3); final List<Object> messages = new ArrayList<>(3);
/* Collection actions to perform if the user clicks OK */ /* Collection actions to perform if the user clicks OK */
final List<Action> okActions = new ArrayList<Action>(2); final List<Action> okActions = new ArrayList<>(2);
ConfirmationInfo confirmation = new ConfirmationInfo(); ConfirmationInfo confirmation = new ConfirmationInfo();
......
...@@ -152,7 +152,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration { ...@@ -152,7 +152,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
// new configuration // new configuration
HashMap<String, LinkedList<AppConfigurationEntry>> newConfig = HashMap<String, LinkedList<AppConfigurationEntry>> newConfig =
new HashMap<String, LinkedList<AppConfigurationEntry>>(); new HashMap<>();
if (url != null) { if (url != null) {
...@@ -392,8 +392,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration { ...@@ -392,8 +392,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
String moduleClass; String moduleClass;
String sflag; String sflag;
AppConfigurationEntry.LoginModuleControlFlag controlFlag; AppConfigurationEntry.LoginModuleControlFlag controlFlag;
LinkedList<AppConfigurationEntry> configEntries = LinkedList<AppConfigurationEntry> configEntries = new LinkedList<>();
new LinkedList<AppConfigurationEntry>();
// application name // application name
appName = st.sval; appName = st.sval;
...@@ -433,7 +432,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration { ...@@ -433,7 +432,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} }
// get the args // get the args
HashMap<String, String> options = new HashMap<String, String>(); HashMap<String, String> options = new HashMap<>();
String key; String key;
String value; String value;
while (peek(";") == false) { while (peek(";") == false) {
......
...@@ -184,7 +184,7 @@ public class JndiLoginModule implements LoginModule { ...@@ -184,7 +184,7 @@ public class JndiLoginModule implements LoginModule {
private UnixNumericUserPrincipal UIDPrincipal; private UnixNumericUserPrincipal UIDPrincipal;
private UnixNumericGroupPrincipal GIDPrincipal; private UnixNumericGroupPrincipal GIDPrincipal;
private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups = private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups =
new LinkedList<UnixNumericGroupPrincipal>(); new LinkedList<>();
// initial state // initial state
private Subject subject; private Subject subject;
......
...@@ -658,8 +658,7 @@ public class KeyStoreLoginModule implements LoginModule { ...@@ -658,8 +658,7 @@ public class KeyStoreLoginModule implements LoginModule {
throw new FailedLoginException( throw new FailedLoginException(
"Unable to find X.509 certificate chain in keystore"); "Unable to find X.509 certificate chain in keystore");
} else { } else {
LinkedList<Certificate> certList = LinkedList<Certificate> certList = new LinkedList<>();
new LinkedList<Certificate>();
for (int i=0; i < fromKeyStore.length; i++) { for (int i=0; i < fromKeyStore.length; i++) {
certList.add(fromKeyStore[i]); certList.add(fromKeyStore[i]);
} }
......
...@@ -76,7 +76,7 @@ public class SolarisLoginModule implements LoginModule { ...@@ -76,7 +76,7 @@ public class SolarisLoginModule implements LoginModule {
private SolarisNumericUserPrincipal UIDPrincipal; private SolarisNumericUserPrincipal UIDPrincipal;
private SolarisNumericGroupPrincipal GIDPrincipal; private SolarisNumericGroupPrincipal GIDPrincipal;
private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups = private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups =
new LinkedList<SolarisNumericGroupPrincipal>(); new LinkedList<>();
/** /**
* Initialize this <code>LoginModule</code>. * Initialize this <code>LoginModule</code>.
......
...@@ -70,7 +70,7 @@ public class UnixLoginModule implements LoginModule { ...@@ -70,7 +70,7 @@ public class UnixLoginModule implements LoginModule {
private UnixNumericUserPrincipal UIDPrincipal; private UnixNumericUserPrincipal UIDPrincipal;
private UnixNumericGroupPrincipal GIDPrincipal; private UnixNumericGroupPrincipal GIDPrincipal;
private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups = private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups =
new LinkedList<UnixNumericGroupPrincipal>(); new LinkedList<>();
/** /**
* Initialize this <code>LoginModule</code>. * Initialize this <code>LoginModule</code>.
......
...@@ -1387,203 +1387,13 @@ public abstract class CubicCurve2D implements Shape, Cloneable { ...@@ -1387,203 +1387,13 @@ public abstract class CubicCurve2D implements Shape, Cloneable {
return false; return false;
} }
// Trivially accept if either endpoint is inside the rectangle int numCrossings = rectCrossings(x, y, w, h);
// (not on its border since it may end there and not go inside) // the intended return value is
// Record where they lie with respect to the rectangle. // numCrossings != 0 || numCrossings == Curve.RECT_INTERSECTS
// -1 => left, 0 => inside, 1 => right // but if (numCrossings != 0) numCrossings == INTERSECTS won't matter
double x1 = getX1(); // and if !(numCrossings != 0) then numCrossings == 0, so
double y1 = getY1(); // numCrossings != RECT_INTERSECT
int x1tag = getTag(x1, x, x+w); return numCrossings != 0;
int y1tag = getTag(y1, y, y+h);
if (x1tag == INSIDE && y1tag == INSIDE) {
return true;
}
double x2 = getX2();
double y2 = getY2();
int x2tag = getTag(x2, x, x+w);
int y2tag = getTag(y2, y, y+h);
if (x2tag == INSIDE && y2tag == INSIDE) {
return true;
}
double ctrlx1 = getCtrlX1();
double ctrly1 = getCtrlY1();
double ctrlx2 = getCtrlX2();
double ctrly2 = getCtrlY2();
int ctrlx1tag = getTag(ctrlx1, x, x+w);
int ctrly1tag = getTag(ctrly1, y, y+h);
int ctrlx2tag = getTag(ctrlx2, x, x+w);
int ctrly2tag = getTag(ctrly2, y, y+h);
// Trivially reject if all points are entirely to one side of
// the rectangle.
if (x1tag < INSIDE && x2tag < INSIDE &&
ctrlx1tag < INSIDE && ctrlx2tag < INSIDE)
{
return false; // All points left
}
if (y1tag < INSIDE && y2tag < INSIDE &&
ctrly1tag < INSIDE && ctrly2tag < INSIDE)
{
return false; // All points above
}
if (x1tag > INSIDE && x2tag > INSIDE &&
ctrlx1tag > INSIDE && ctrlx2tag > INSIDE)
{
return false; // All points right
}
if (y1tag > INSIDE && y2tag > INSIDE &&
ctrly1tag > INSIDE && ctrly2tag > INSIDE)
{
return false; // All points below
}
// Test for endpoints on the edge where either the segment
// or the curve is headed "inwards" from them
// Note: These tests are a superset of the fast endpoint tests
// above and thus repeat those tests, but take more time
// and cover more cases
if (inwards(x1tag, x2tag, ctrlx1tag) &&
inwards(y1tag, y2tag, ctrly1tag))
{
// First endpoint on border with either edge moving inside
return true;
}
if (inwards(x2tag, x1tag, ctrlx2tag) &&
inwards(y2tag, y1tag, ctrly2tag))
{
// Second endpoint on border with either edge moving inside
return true;
}
// Trivially accept if endpoints span directly across the rectangle
boolean xoverlap = (x1tag * x2tag <= 0);
boolean yoverlap = (y1tag * y2tag <= 0);
if (x1tag == INSIDE && x2tag == INSIDE && yoverlap) {
return true;
}
if (y1tag == INSIDE && y2tag == INSIDE && xoverlap) {
return true;
}
// We now know that both endpoints are outside the rectangle
// but the 4 points are not all on one side of the rectangle.
// Therefore the curve cannot be contained inside the rectangle,
// but the rectangle might be contained inside the curve, or
// the curve might intersect the boundary of the rectangle.
double[] eqn = new double[4];
double[] res = new double[4];
if (!yoverlap) {
// Both y coordinates for the closing segment are above or
// below the rectangle which means that we can only intersect
// if the curve crosses the top (or bottom) of the rectangle
// in more than one place and if those crossing locations
// span the horizontal range of the rectangle.
fillEqn(eqn, (y1tag < INSIDE ? y : y+h), y1, ctrly1, ctrly2, y2);
int num = solveCubic(eqn, res);
num = evalCubic(res, num, true, true, null,
x1, ctrlx1, ctrlx2, x2);
// odd counts imply the crossing was out of [0,1] bounds
// otherwise there is no way for that part of the curve to
// "return" to meet its endpoint
return (num == 2 &&
getTag(res[0], x, x+w) * getTag(res[1], x, x+w) <= 0);
}
// Y ranges overlap. Now we examine the X ranges
if (!xoverlap) {
// Both x coordinates for the closing segment are left of
// or right of the rectangle which means that we can only
// intersect if the curve crosses the left (or right) edge
// of the rectangle in more than one place and if those
// crossing locations span the vertical range of the rectangle.
fillEqn(eqn, (x1tag < INSIDE ? x : x+w), x1, ctrlx1, ctrlx2, x2);
int num = solveCubic(eqn, res);
num = evalCubic(res, num, true, true, null,
y1, ctrly1, ctrly2, y2);
// odd counts imply the crossing was out of [0,1] bounds
// otherwise there is no way for that part of the curve to
// "return" to meet its endpoint
return (num == 2 &&
getTag(res[0], y, y+h) * getTag(res[1], y, y+h) <= 0);
}
// The X and Y ranges of the endpoints overlap the X and Y
// ranges of the rectangle, now find out how the endpoint
// line segment intersects the Y range of the rectangle
double dx = x2 - x1;
double dy = y2 - y1;
double k = y2 * x1 - x2 * y1;
int c1tag, c2tag;
if (y1tag == INSIDE) {
c1tag = x1tag;
} else {
c1tag = getTag((k + dx * (y1tag < INSIDE ? y : y+h)) / dy, x, x+w);
}
if (y2tag == INSIDE) {
c2tag = x2tag;
} else {
c2tag = getTag((k + dx * (y2tag < INSIDE ? y : y+h)) / dy, x, x+w);
}
// If the part of the line segment that intersects the Y range
// of the rectangle crosses it horizontally - trivially accept
if (c1tag * c2tag <= 0) {
return true;
}
// Now we know that both the X and Y ranges intersect and that
// the endpoint line segment does not directly cross the rectangle.
//
// We can almost treat this case like one of the cases above
// where both endpoints are to one side, except that we may
// get one or three intersections of the curve with the vertical
// side of the rectangle. This is because the endpoint segment
// accounts for the other intersection in an even pairing. Thus,
// with the endpoint crossing we end up with 2 or 4 total crossings.
//
// (Remember there is overlap in both the X and Y ranges which
// means that the segment itself must cross at least one vertical
// edge of the rectangle - in particular, the "near vertical side"
// - leaving an odd number of intersections for the curve.)
//
// Now we calculate the y tags of all the intersections on the
// "near vertical side" of the rectangle. We will have one with
// the endpoint segment, and one or three with the curve. If
// any pair of those vertical intersections overlap the Y range
// of the rectangle, we have an intersection. Otherwise, we don't.
// c1tag = vertical intersection class of the endpoint segment
//
// Choose the y tag of the endpoint that was not on the same
// side of the rectangle as the subsegment calculated above.
// Note that we can "steal" the existing Y tag of that endpoint
// since it will be provably the same as the vertical intersection.
c1tag = ((c1tag * x1tag <= 0) ? y1tag : y2tag);
// Now we have to calculate an array of solutions of the curve
// with the "near vertical side" of the rectangle. Then we
// need to sort the tags and do a pairwise range test to see
// if either of the pairs of crossings spans the Y range of
// the rectangle.
//
// Note that the c2tag can still tell us which vertical edge
// to test against.
fillEqn(eqn, (c2tag < INSIDE ? x : x+w), x1, ctrlx1, ctrlx2, x2);
int num = solveCubic(eqn, res);
num = evalCubic(res, num, true, true, null, y1, ctrly1, ctrly2, y2);
// Now put all of the tags into a bucket and sort them. There
// is an intersection iff one of the pairs of tags "spans" the
// Y range of the rectangle.
int tags[] = new int[num+1];
for (int i = 0; i < num; i++) {
tags[i] = getTag(res[i], y, y+h);
}
tags[num] = c1tag;
Arrays.sort(tags);
return ((num >= 1 && tags[0] * tags[1] <= 0) ||
(num >= 3 && tags[2] * tags[3] <= 0));
} }
/** /**
...@@ -1602,20 +1412,32 @@ public abstract class CubicCurve2D implements Shape, Cloneable { ...@@ -1602,20 +1412,32 @@ public abstract class CubicCurve2D implements Shape, Cloneable {
if (w <= 0 || h <= 0) { if (w <= 0 || h <= 0) {
return false; return false;
} }
// Assertion: Cubic curves closed by connecting their
// endpoints form either one or two convex halves with int numCrossings = rectCrossings(x, y, w, h);
// the closing line segment as an edge of both sides. return !(numCrossings == 0 || numCrossings == Curve.RECT_INTERSECTS);
if (!(contains(x, y) && }
contains(x + w, y) &&
contains(x + w, y + h) && private int rectCrossings(double x, double y, double w, double h) {
contains(x, y + h))) { int crossings = 0;
return false; if (!(getX1() == getX2() && getY1() == getY2())) {
crossings = Curve.rectCrossingsForLine(crossings,
x, y,
x+w, y+h,
getX1(), getY1(),
getX2(), getY2());
if (crossings == Curve.RECT_INTERSECTS) {
return crossings;
}
} }
// Either the rectangle is entirely inside one of the convex // we call this with the curve's direction reversed, because we wanted
// halves or it crosses from one to the other, in which case // to call rectCrossingsForLine first, because it's cheaper.
// it must intersect the closing line segment. return Curve.rectCrossingsForCubic(crossings,
Rectangle2D rect = new Rectangle2D.Double(x, y, w, h); x, y,
return !rect.intersectsLine(getX1(), getY1(), getX2(), getY2()); x+w, y+h,
getX2(), getY2(),
getCtrlX2(), getCtrlY2(),
getCtrlX1(), getCtrlY1(),
getX1(), getY1(), 0);
} }
/** /**
......
...@@ -329,7 +329,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -329,7 +329,7 @@ public class ObjectStreamClass implements Serializable {
entry = th; entry = th;
} }
if (future.set(entry)) { if (future.set(entry)) {
Caches.localDescs.put(key, new SoftReference<>(entry)); Caches.localDescs.put(key, new SoftReference<Object>(entry));
} else { } else {
// nested lookup call already set future // nested lookup call already set future
entry = future.get(); entry = future.get();
...@@ -2118,7 +2118,7 @@ public class ObjectStreamClass implements Serializable { ...@@ -2118,7 +2118,7 @@ public class ObjectStreamClass implements Serializable {
entry = th; entry = th;
} }
future.set(entry); future.set(entry);
Caches.reflectors.put(key, new SoftReference<>(entry)); Caches.reflectors.put(key, new SoftReference<Object>(entry));
} }
if (entry instanceof FieldReflector) { if (entry instanceof FieldReflector) {
......
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2011, 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
...@@ -27,7 +27,9 @@ package java.io; ...@@ -27,7 +27,9 @@ package java.io;
import java.util.Formatter; import java.util.Formatter;
import java.util.Locale; import java.util.Locale;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
/** /**
* A <code>PrintStream</code> adds functionality to another output stream, * A <code>PrintStream</code> adds functionality to another output stream,
...@@ -56,7 +58,7 @@ public class PrintStream extends FilterOutputStream ...@@ -56,7 +58,7 @@ public class PrintStream extends FilterOutputStream
implements Appendable, Closeable implements Appendable, Closeable
{ {
private boolean autoFlush = false; private final boolean autoFlush;
private boolean trouble = false; private boolean trouble = false;
private Formatter formatter; private Formatter formatter;
...@@ -68,36 +70,69 @@ public class PrintStream extends FilterOutputStream ...@@ -68,36 +70,69 @@ public class PrintStream extends FilterOutputStream
private OutputStreamWriter charOut; private OutputStreamWriter charOut;
/** /**
* Creates a new print stream. This stream will not flush automatically. * nonNull is explicitly declared here so as not to create an extra
* * dependency on java.util.Objects.nonNull. PrintStream is loaded
* @param out The output stream to which values and objects will be * early during system initialization.
* printed
*
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream)
*/ */
public PrintStream(OutputStream out) { private static <T> T nonNull(T obj, String message) {
this(out, false); if (obj == null)
throw new NullPointerException(message);
return obj;
} }
/* Initialization is factored into a private constructor (note the swapped /**
* parameters so that this one isn't confused with the public one) and a * Returns a charset object for the given charset name.
* separate init method so that the following two public constructors can * @throws NullPointerException is csn is null
* share code. We use a separate init method so that the constructor that * @throws UnsupportedEncodingException if the charset is not supported
* takes an encoding will throw an NPE for a null stream before it throws
* an UnsupportedEncodingException for an unsupported encoding.
*/ */
private static Charset toCharset(String csn)
private PrintStream(boolean autoFlush, OutputStream out) throws UnsupportedEncodingException
{ {
nonNull(csn, "charsetName");
try {
return Charset.forName(csn);
} catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
// UnsupportedEncodingException should be thrown
throw new UnsupportedEncodingException(csn);
}
}
/* Private constructors */
private PrintStream(boolean autoFlush, OutputStream out) {
super(out);
this.autoFlush = autoFlush;
this.charOut = new OutputStreamWriter(this);
this.textOut = new BufferedWriter(charOut);
}
private PrintStream(boolean autoFlush, OutputStream out, Charset charset) {
super(out); super(out);
if (out == null)
throw new NullPointerException("Null output stream");
this.autoFlush = autoFlush; this.autoFlush = autoFlush;
this.charOut = new OutputStreamWriter(this, charset);
this.textOut = new BufferedWriter(charOut);
} }
private void init(OutputStreamWriter osw) { /* Variant of the private constructor so that the given charset name
this.charOut = osw; * can be verified before evaluating the OutputStream argument. Used
this.textOut = new BufferedWriter(osw); * by constructors creating a FileOutputStream that also take a
* charset name.
*/
private PrintStream(boolean autoFlush, Charset charset, OutputStream out)
throws UnsupportedEncodingException
{
this(autoFlush, out, charset);
}
/**
* Creates a new print stream. This stream will not flush automatically.
*
* @param out The output stream to which values and objects will be
* printed
*
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream)
*/
public PrintStream(OutputStream out) {
this(out, false);
} }
/** /**
...@@ -113,8 +148,7 @@ public class PrintStream extends FilterOutputStream ...@@ -113,8 +148,7 @@ public class PrintStream extends FilterOutputStream
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean) * @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
*/ */
public PrintStream(OutputStream out, boolean autoFlush) { public PrintStream(OutputStream out, boolean autoFlush) {
this(autoFlush, out); this(autoFlush, nonNull(out, "Null output stream"));
init(new OutputStreamWriter(this));
} }
/** /**
...@@ -138,8 +172,9 @@ public class PrintStream extends FilterOutputStream ...@@ -138,8 +172,9 @@ public class PrintStream extends FilterOutputStream
public PrintStream(OutputStream out, boolean autoFlush, String encoding) public PrintStream(OutputStream out, boolean autoFlush, String encoding)
throws UnsupportedEncodingException throws UnsupportedEncodingException
{ {
this(autoFlush, out); this(autoFlush,
init(new OutputStreamWriter(this, encoding)); nonNull(out, "Null output stream"),
toCharset(encoding));
} }
/** /**
...@@ -171,7 +206,6 @@ public class PrintStream extends FilterOutputStream ...@@ -171,7 +206,6 @@ public class PrintStream extends FilterOutputStream
*/ */
public PrintStream(String fileName) throws FileNotFoundException { public PrintStream(String fileName) throws FileNotFoundException {
this(false, new FileOutputStream(fileName)); this(false, new FileOutputStream(fileName));
init(new OutputStreamWriter(this));
} }
/** /**
...@@ -210,8 +244,8 @@ public class PrintStream extends FilterOutputStream ...@@ -210,8 +244,8 @@ public class PrintStream extends FilterOutputStream
public PrintStream(String fileName, String csn) public PrintStream(String fileName, String csn)
throws FileNotFoundException, UnsupportedEncodingException throws FileNotFoundException, UnsupportedEncodingException
{ {
this(false, new FileOutputStream(fileName)); // ensure charset is checked before the file is opened
init(new OutputStreamWriter(this, csn)); this(false, toCharset(csn), new FileOutputStream(fileName));
} }
/** /**
...@@ -243,7 +277,6 @@ public class PrintStream extends FilterOutputStream ...@@ -243,7 +277,6 @@ public class PrintStream extends FilterOutputStream
*/ */
public PrintStream(File file) throws FileNotFoundException { public PrintStream(File file) throws FileNotFoundException {
this(false, new FileOutputStream(file)); this(false, new FileOutputStream(file));
init(new OutputStreamWriter(this));
} }
/** /**
...@@ -282,8 +315,8 @@ public class PrintStream extends FilterOutputStream ...@@ -282,8 +315,8 @@ public class PrintStream extends FilterOutputStream
public PrintStream(File file, String csn) public PrintStream(File file, String csn)
throws FileNotFoundException, UnsupportedEncodingException throws FileNotFoundException, UnsupportedEncodingException
{ {
this(false, new FileOutputStream(file)); // ensure charset is checked before the file is opened
init(new OutputStreamWriter(this, csn)); this(false, toCharset(csn), new FileOutputStream(file));
} }
/** Check to make sure that the stream has not been closed */ /** Check to make sure that the stream has not been closed */
......
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2011, 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,8 +25,12 @@ ...@@ -25,8 +25,12 @@
package java.io; package java.io;
import java.util.Objects;
import java.util.Formatter; import java.util.Formatter;
import java.util.Locale; import java.util.Locale;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
/** /**
* Prints formatted representations of objects to a text-output stream. This * Prints formatted representations of objects to a text-output stream. This
...@@ -59,7 +63,7 @@ public class PrintWriter extends Writer { ...@@ -59,7 +63,7 @@ public class PrintWriter extends Writer {
*/ */
protected Writer out; protected Writer out;
private boolean autoFlush = false; private final boolean autoFlush;
private boolean trouble = false; private boolean trouble = false;
private Formatter formatter; private Formatter formatter;
private PrintStream psOut = null; private PrintStream psOut = null;
...@@ -68,7 +72,24 @@ public class PrintWriter extends Writer { ...@@ -68,7 +72,24 @@ public class PrintWriter extends Writer {
* Line separator string. This is the value of the line.separator * Line separator string. This is the value of the line.separator
* property at the moment that the stream was created. * property at the moment that the stream was created.
*/ */
private String lineSeparator; private final String lineSeparator;
/**
* Returns a charset object for the given charset name.
* @throws NullPointerException is csn is null
* @throws UnsupportedEncodingException if the charset is not supported
*/
private static Charset toCharset(String csn)
throws UnsupportedEncodingException
{
Objects.nonNull(csn, "charsetName");
try {
return Charset.forName(csn);
} catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
// UnsupportedEncodingException should be thrown
throw new UnsupportedEncodingException(csn);
}
}
/** /**
* Creates a new PrintWriter, without automatic line flushing. * Creates a new PrintWriter, without automatic line flushing.
...@@ -164,6 +185,14 @@ public class PrintWriter extends Writer { ...@@ -164,6 +185,14 @@ public class PrintWriter extends Writer {
false); false);
} }
/* Private constructor */
private PrintWriter(Charset charset, File file)
throws FileNotFoundException
{
this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)),
false);
}
/** /**
* Creates a new PrintWriter, without automatic line flushing, with the * Creates a new PrintWriter, without automatic line flushing, with the
* specified file name and charset. This convenience constructor creates * specified file name and charset. This convenience constructor creates
...@@ -200,8 +229,7 @@ public class PrintWriter extends Writer { ...@@ -200,8 +229,7 @@ public class PrintWriter extends Writer {
public PrintWriter(String fileName, String csn) public PrintWriter(String fileName, String csn)
throws FileNotFoundException, UnsupportedEncodingException throws FileNotFoundException, UnsupportedEncodingException
{ {
this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), csn)), this(toCharset(csn), new File(fileName));
false);
} }
/** /**
...@@ -272,8 +300,7 @@ public class PrintWriter extends Writer { ...@@ -272,8 +300,7 @@ public class PrintWriter extends Writer {
public PrintWriter(File file, String csn) public PrintWriter(File file, String csn)
throws FileNotFoundException, UnsupportedEncodingException throws FileNotFoundException, UnsupportedEncodingException
{ {
this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), csn)), this(toCharset(csn), file);
false);
} }
/** Checks to make sure that the stream has not been closed */ /** Checks to make sure that the stream has not been closed */
......
/* /*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -33,7 +33,7 @@ package java.lang; ...@@ -33,7 +33,7 @@ package java.lang;
*/ */
public interface AutoCloseable { public interface AutoCloseable {
/** /**
* Close this resource, relinquishing any underlying resources. * Closes this resource, relinquishing any underlying resources.
* This method is invoked automatically by the {@code * This method is invoked automatically by the {@code
* try}-with-resources statement. * try}-with-resources statement.
* *
...@@ -48,6 +48,10 @@ public interface AutoCloseable { ...@@ -48,6 +48,10 @@ public interface AutoCloseable {
* visible side effect, unlike {@code Closeable.close} which is * visible side effect, unlike {@code Closeable.close} which is
* required to have no effect if called more than once. * required to have no effect if called more than once.
* *
* However, while not required to be idempotent, implementers of
* this interface are strongly encouraged to make their {@code
* close} methods idempotent.
*
* @throws Exception if this resource cannot be closed * @throws Exception if this resource cannot be closed
*/ */
void close() throws Exception; void close() throws Exception;
......
...@@ -67,7 +67,7 @@ class StringCoding { ...@@ -67,7 +67,7 @@ class StringCoding {
} }
private static <T> void set(ThreadLocal<SoftReference<T>> tl, T ob) { private static <T> void set(ThreadLocal<SoftReference<T>> tl, T ob) {
tl.set(new SoftReference<>(ob)); tl.set(new SoftReference<T>(ob));
} }
// Trim the given byte array to the given length // Trim the given byte array to the given length
......
/* /*
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, 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
...@@ -809,7 +809,7 @@ public class Throwable implements Serializable { ...@@ -809,7 +809,7 @@ public class Throwable implements Serializable {
native StackTraceElement getStackTraceElement(int index); native StackTraceElement getStackTraceElement(int index);
/** /**
* Read a {@code Throwable} from a stream, enforcing * Reads a {@code Throwable} from a stream, enforcing
* well-formedness constraints on fields. Null entries and * well-formedness constraints on fields. Null entries and
* self-pointers are not allowed in the list of {@code * self-pointers are not allowed in the list of {@code
* suppressedExceptions}. Null entries are not allowed for stack * suppressedExceptions}. Null entries are not allowed for stack
...@@ -865,9 +865,10 @@ public class Throwable implements Serializable { ...@@ -865,9 +865,10 @@ public class Throwable implements Serializable {
} }
/** /**
* Adds the specified exception to the list of exceptions that * Appends the specified exception to the exceptions that were
* were suppressed, typically by the {@code try}-with-resources * suppressed in order to deliver this exception. This method is
* statement, in order to deliver this exception. * typically called (automatically and implicitly) by the {@code
* try}-with-resources statement.
* *
* If the first exception to be suppressed is {@code null}, that * If the first exception to be suppressed is {@code null}, that
* indicates suppressed exception information will <em>not</em> be * indicates suppressed exception information will <em>not</em> be
......
...@@ -677,8 +677,7 @@ class InetAddress implements java.io.Serializable { ...@@ -677,8 +677,7 @@ class InetAddress implements java.io.Serializable {
static InetAddressImpl impl; static InetAddressImpl impl;
private static HashMap<String, InetAddress[]> lookupTable private static final HashMap<String, Void> lookupTable = new HashMap<>();
= new HashMap<String, InetAddress[]>();
/** /**
* Represents a cache entry * Represents a cache entry
...@@ -737,7 +736,7 @@ class InetAddress implements java.io.Serializable { ...@@ -737,7 +736,7 @@ class InetAddress implements java.io.Serializable {
// As we iterate in insertion order we can // As we iterate in insertion order we can
// terminate when a non-expired entry is found. // terminate when a non-expired entry is found.
LinkedList<String> expired = new LinkedList<String>(); LinkedList<String> expired = new LinkedList<>();
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
for (String key : cache.keySet()) { for (String key : cache.keySet()) {
CacheEntry entry = cache.get(key); CacheEntry entry = cache.get(key);
...@@ -1227,43 +1226,45 @@ class InetAddress implements java.io.Serializable { ...@@ -1227,43 +1226,45 @@ class InetAddress implements java.io.Serializable {
// lookupTable and return null so the // lookupTable and return null so the
// following code would do a lookup itself. // following code would do a lookup itself.
if ((addresses = checkLookupTable(host)) == null) { if ((addresses = checkLookupTable(host)) == null) {
// This is the first thread which looks up the addresses try {
// this host or the cache entry for this host has been // This is the first thread which looks up the addresses
// expired so this thread should do the lookup. // this host or the cache entry for this host has been
for (NameService nameService : nameServices) { // expired so this thread should do the lookup.
try { for (NameService nameService : nameServices) {
/* try {
* Do not put the call to lookup() inside the /*
* constructor. if you do you will still be * Do not put the call to lookup() inside the
* allocating space when the lookup fails. * constructor. if you do you will still be
*/ * allocating space when the lookup fails.
*/
addresses = nameService.lookupAllHostAddr(host);
success = true; addresses = nameService.lookupAllHostAddr(host);
break;
} catch (UnknownHostException uhe) {
if (host.equalsIgnoreCase("localhost")) {
InetAddress[] local = new InetAddress[] { impl.loopbackAddress() };
addresses = local;
success = true; success = true;
break; break;
} } catch (UnknownHostException uhe) {
else { if (host.equalsIgnoreCase("localhost")) {
addresses = unknown_array; InetAddress[] local = new InetAddress[] { impl.loopbackAddress() };
success = false; addresses = local;
ex = uhe; success = true;
break;
}
else {
addresses = unknown_array;
success = false;
ex = uhe;
}
} }
} }
}
// Cache the addresses. // Cache the addresses.
cacheAddresses(host, addresses, success); cacheAddresses(host, addresses, success);
// Delete the host from the lookupTable, and if (!success && ex != null)
// notify all threads waiting for the monitor throw ex;
// for lookupTable. } finally {
updateLookupTable(host); // Delete host from the lookupTable and notify
if (!success && ex != null) // all threads waiting on the lookupTable monitor.
throw ex; updateLookupTable(host);
}
} }
return addresses; return addresses;
...@@ -1271,16 +1272,13 @@ class InetAddress implements java.io.Serializable { ...@@ -1271,16 +1272,13 @@ class InetAddress implements java.io.Serializable {
private static InetAddress[] checkLookupTable(String host) { private static InetAddress[] checkLookupTable(String host) {
// make sure addresses is null.
InetAddress[] addresses = null;
synchronized (lookupTable) { synchronized (lookupTable) {
// If the host isn't in the lookupTable, add it in the // If the host isn't in the lookupTable, add it in the
// lookuptable and return null. The caller should do // lookuptable and return null. The caller should do
// the lookup. // the lookup.
if (lookupTable.containsKey(host) == false) { if (lookupTable.containsKey(host) == false) {
lookupTable.put(host, null); lookupTable.put(host, null);
return addresses; return null;
} }
// If the host is in the lookupTable, it means that another // If the host is in the lookupTable, it means that another
...@@ -1298,10 +1296,11 @@ class InetAddress implements java.io.Serializable { ...@@ -1298,10 +1296,11 @@ class InetAddress implements java.io.Serializable {
// the host. This thread should retry to get the addresses // the host. This thread should retry to get the addresses
// from the addressCache. If it doesn't get the addresses from // from the addressCache. If it doesn't get the addresses from
// the cache, it will try to look up the addresses itself. // the cache, it will try to look up the addresses itself.
addresses = getCachedAddresses(host); InetAddress[] addresses = getCachedAddresses(host);
if (addresses == null) { if (addresses == null) {
synchronized (lookupTable) { synchronized (lookupTable) {
lookupTable.put(host, null); lookupTable.put(host, null);
return null;
} }
} }
......
...@@ -493,55 +493,44 @@ public final class NetworkInterface { ...@@ -493,55 +493,44 @@ public final class NetworkInterface {
* @see java.net.InetAddress#getAddress() * @see java.net.InetAddress#getAddress()
*/ */
public boolean equals(Object obj) { public boolean equals(Object obj) {
if ((obj == null) || !(obj instanceof NetworkInterface)) { if (!(obj instanceof NetworkInterface)) {
return false; return false;
} }
NetworkInterface netIF = (NetworkInterface)obj; NetworkInterface that = (NetworkInterface)obj;
if (name != null ) { if (this.name != null ) {
if (netIF.getName() != null) { if (!this.name.equals(that.name)) {
if (!name.equals(netIF.getName())) {
return false;
}
} else {
return false; return false;
} }
} else { } else {
if (netIF.getName() != null) { if (that.name != null) {
return false; return false;
} }
} }
Enumeration newAddrs = netIF.getInetAddresses();
int i = 0; if (this.addrs == null) {
for (i = 0; newAddrs.hasMoreElements();newAddrs.nextElement(), i++); return that.addrs == null;
if (addrs == null) { } else if (that.addrs == null) {
if (i != 0) { return false;
return false; }
}
} else { /* Both addrs not null. Compare number of addresses */
/*
* Compare number of addresses (in the checked subset) if (this.addrs.length != that.addrs.length) {
*/ return false;
int count = 0;
Enumeration e = getInetAddresses();
for (; e.hasMoreElements(); count++) {
e.nextElement();
}
if (i != count) {
return false;
}
} }
newAddrs = netIF.getInetAddresses();
for (; newAddrs.hasMoreElements();) { InetAddress[] thatAddrs = that.addrs;
boolean equal = false; int count = thatAddrs.length;
Enumeration thisAddrs = getInetAddresses();
InetAddress newAddr = (InetAddress)newAddrs.nextElement(); for (int i=0; i<count; i++) {
for (; thisAddrs.hasMoreElements();) { boolean found = false;
InetAddress thisAddr = (InetAddress)thisAddrs.nextElement(); for (int j=0; j<count; j++) {
if (thisAddr.equals(newAddr)) { if (addrs[i].equals(thatAddrs[j])) {
equal = true; found = true;
break;
} }
} }
if (!equal) { if (!found) {
return false; return false;
} }
} }
...@@ -549,12 +538,7 @@ public final class NetworkInterface { ...@@ -549,12 +538,7 @@ public final class NetworkInterface {
} }
public int hashCode() { public int hashCode() {
int count = name == null? 0: name.hashCode(); return name == null? 0: name.hashCode();
Enumeration<InetAddress> addrs = getInetAddresses();
while (addrs.hasMoreElements()) {
count += addrs.nextElement().hashCode();
}
return count;
} }
public String toString() { public String toString() {
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, 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
...@@ -29,6 +29,7 @@ import java.io.OutputStream; ...@@ -29,6 +29,7 @@ import java.io.OutputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import sun.net.SocksProxy;
import sun.net.www.ParseUtil; import sun.net.www.ParseUtil;
/* import org.ietf.jgss.*; */ /* import org.ietf.jgss.*; */
...@@ -397,6 +398,11 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -397,6 +398,11 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString(); server = ((InetSocketAddress) p.address()).getHostString();
serverPort = ((InetSocketAddress) p.address()).getPort(); serverPort = ((InetSocketAddress) p.address()).getPort();
if (p instanceof SocksProxy) {
if (((SocksProxy)p).protocolVersion() == 4) {
useV4 = true;
}
}
// Connects to the SOCKS server // Connects to the SOCKS server
try { try {
...@@ -700,6 +706,11 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts { ...@@ -700,6 +706,11 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// Use getHostString() to avoid reverse lookups // Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString(); server = ((InetSocketAddress) p.address()).getHostString();
serverPort = ((InetSocketAddress) p.address()).getPort(); serverPort = ((InetSocketAddress) p.address()).getPort();
if (p instanceof SocksProxy) {
if (((SocksProxy)p).protocolVersion() == 4) {
useV4 = true;
}
}
// Connects to the SOCKS server // Connects to the SOCKS server
try { try {
......
...@@ -27,19 +27,15 @@ package java.net; ...@@ -27,19 +27,15 @@ package java.net;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.io.File; import java.lang.ref.*;
import java.io.FilePermission; import java.io.*;
import java.io.InputStream;
import java.io.IOException;
import java.io.Closeable;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLStreamHandlerFactory; import java.net.URLStreamHandlerFactory;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.*;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import java.util.jar.JarFile;
import java.util.jar.Attributes; import java.util.jar.Attributes;
import java.util.jar.Attributes.Name; import java.util.jar.Attributes.Name;
import java.security.CodeSigner; import java.security.CodeSigner;
...@@ -194,6 +190,65 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -194,6 +190,65 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
acc = AccessController.getContext(); acc = AccessController.getContext();
} }
/* A map (used as a set) to keep track of closeable local resources
* (either JarFiles or FileInputStreams). We don't care about
* Http resources since they don't need to be closed.
*
* If the resource is coming from a jar file
* we keep a (weak) reference to the JarFile object which can
* be closed if URLClassLoader.close() called. Due to jar file
* caching there will typically be only one JarFile object
* per underlying jar file.
*
* For file resources, which is probably a less common situation
* we have to keep a weak reference to each stream.
*/
private WeakHashMap<Closeable,Void>
closeables = new WeakHashMap<>();
/**
* Returns an input stream for reading the specified resource.
* If this loader is closed, then any resources opened by this method
* will be closed.
*
* <p> The search order is described in the documentation for {@link
* #getResource(String)}. </p>
*
* @param name
* The resource name
*
* @return An input stream for reading the resource, or <tt>null</tt>
* if the resource could not be found
*
* @since 1.7
*/
public InputStream getResourceAsStream(String name) {
URL url = getResource(name);
try {
if (url == null) {
return null;
}
URLConnection urlc = url.openConnection();
InputStream is = urlc.getInputStream();
if (urlc instanceof JarURLConnection) {
JarURLConnection juc = (JarURLConnection)urlc;
JarFile jar = juc.getJarFile();
synchronized (closeables) {
if (!closeables.containsKey(jar)) {
closeables.put(jar, null);
}
}
} else if (urlc instanceof sun.net.www.protocol.file.FileURLConnection) {
synchronized (closeables) {
closeables.put(is, null);
}
}
return is;
} catch (IOException e) {
return null;
}
}
/** /**
* Closes this URLClassLoader, so that it can no longer be used to load * Closes this URLClassLoader, so that it can no longer be used to load
...@@ -202,8 +257,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -202,8 +257,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* delegation hierarchy are still accessible. Also, any classes or resources * delegation hierarchy are still accessible. Also, any classes or resources
* that are already loaded, are still accessible. * that are already loaded, are still accessible.
* <p> * <p>
* In the case of jar: and file: URLs, it also closes any class files, * In the case of jar: and file: URLs, it also closes any files
* or JAR files that were opened by it. If another thread is loading a * that were opened by it. If another thread is loading a
* class when the {@code close} method is invoked, then the result of * class when the {@code close} method is invoked, then the result of
* that load is undefined. * that load is undefined.
* <p> * <p>
...@@ -213,10 +268,10 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -213,10 +268,10 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* loader has no effect. * loader has no effect.
* <p> * <p>
* @throws IOException if closing any file opened by this class loader * @throws IOException if closing any file opened by this class loader
* resulted in an IOException. Any such exceptions are caught, and a * resulted in an IOException. Any such exceptions are caught internally.
* single IOException is thrown after the last file has been closed. * If only one is caught, then it is re-thrown. If more than one exception
* If only one exception was thrown, it will be set as the <i>cause</i> * is caught, then the second and following exceptions are added
* of this IOException. * as suppressed exceptions of the first one caught, which is then re-thrown.
* *
* @throws SecurityException if a security manager is set, and it denies * @throws SecurityException if a security manager is set, and it denies
* {@link RuntimePermission}<tt>("closeClassLoader")</tt> * {@link RuntimePermission}<tt>("closeClassLoader")</tt>
...@@ -229,21 +284,33 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -229,21 +284,33 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
security.checkPermission(new RuntimePermission("closeClassLoader")); security.checkPermission(new RuntimePermission("closeClassLoader"));
} }
List<IOException> errors = ucp.closeLoaders(); List<IOException> errors = ucp.closeLoaders();
// now close any remaining streams.
synchronized (closeables) {
Set<Closeable> keys = closeables.keySet();
for (Closeable c : keys) {
try {
c.close();
} catch (IOException ioex) {
errors.add(ioex);
}
}
closeables.clear();
}
if (errors.isEmpty()) { if (errors.isEmpty()) {
return; return;
} }
if (errors.size() == 1) {
throw new IOException ( IOException firstex = errors.remove(0);
"Error closing URLClassLoader resource",
errors.get(0) // Suppress any remaining exceptions
);
}
// Several exceptions. So, just combine the error messages
String errormsg = "Error closing resources: ";
for (IOException error: errors) { for (IOException error: errors) {
errormsg = errormsg + "[" + error.toString() + "] "; firstex.addSuppressed(error);
} }
throw new IOException (errormsg); throw firstex;
} }
/** /**
......
...@@ -127,10 +127,15 @@ of proxies.</P> ...@@ -127,10 +127,15 @@ of proxies.</P>
are specified. If SOCKS is supported by a Java SE implementation, the are specified. If SOCKS is supported by a Java SE implementation, the
following properties will be used:</P> following properties will be used:</P>
<UL> <UL>
<LI><P><B>socksProxyHost</B> (default: &lt;non&gt;)<BR> <LI><P><B>socksProxyHost</B> (default: &lt;none&gt;)<BR>
The hostname, or address, of the proxy server.</P> The hostname, or address, of the proxy server.</P>
<LI><P><B>socksProxyPort</B> (default: 1080)<BR> <LI><P><B>socksProxyPort</B> (default: 1080)<BR>
The port number of the proxy server.</P> The port number of the proxy server.</P>
<LI><P><B>socksProxyVersion</B> (default: 5)<BR>
The version of the SOCKS protocol supported by the server. The
default is <code>5</code> indicating SOCKS V5, alternatively
<code>4</code> can be specified for SOCKS V4. Setting the property
to values other than these leads to unspecified behavior.</P>
<LI><P><B>java.net.socks.username</B> (default: &lt;none&gt;)<BR> <LI><P><B>java.net.socks.username</B> (default: &lt;none&gt;)<BR>
Username to use if the SOCKSv5 server asks for authentication Username to use if the SOCKSv5 server asks for authentication
and no java.net.Authenticator instance was found.</P> and no java.net.Authenticator instance was found.</P>
......
...@@ -121,7 +121,7 @@ public final class AccessControlContext { ...@@ -121,7 +121,7 @@ public final class AccessControlContext {
this.context = null; this.context = null;
} }
} else { } else {
List<ProtectionDomain> v = new ArrayList<ProtectionDomain>(context.length); List<ProtectionDomain> v = new ArrayList<>(context.length);
for (int i =0; i< context.length; i++) { for (int i =0; i< context.length; i++) {
if ((context[i] != null) && (!v.contains(context[i]))) if ((context[i] != null) && (!v.contains(context[i])))
v.add(context[i]); v.add(context[i]);
......
...@@ -515,7 +515,7 @@ implements java.io.Serializable ...@@ -515,7 +515,7 @@ implements java.io.Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<String, Permission> permissions = Hashtable<String, Permission> permissions =
new Hashtable<String, Permission>(perms.size()*2); new Hashtable<>(perms.size()*2);
synchronized (this) { synchronized (this) {
permissions.putAll(perms); permissions.putAll(perms);
......
...@@ -188,7 +188,7 @@ public class CodeSource implements java.io.Serializable { ...@@ -188,7 +188,7 @@ public class CodeSource implements java.io.Serializable {
} else if (signers != null) { } else if (signers != null) {
// Convert the code signers to certs // Convert the code signers to certs
ArrayList<java.security.cert.Certificate> certChains = ArrayList<java.security.cert.Certificate> certChains =
new ArrayList<java.security.cert.Certificate>(); new ArrayList<>();
for (int i = 0; i < signers.length; i++) { for (int i = 0; i < signers.length; i++) {
certChains.addAll( certChains.addAll(
signers[i].getSignerCertPath().getCertificates()); signers[i].getSignerCertPath().getCertificates());
...@@ -606,10 +606,10 @@ public class CodeSource implements java.io.Serializable { ...@@ -606,10 +606,10 @@ public class CodeSource implements java.io.Serializable {
// Iterate through all the certificates // Iterate through all the certificates
int i = 0; int i = 0;
List<CodeSigner> signers = new ArrayList<CodeSigner>(); List<CodeSigner> signers = new ArrayList<>();
while (i < certs.length) { while (i < certs.length) {
List<java.security.cert.Certificate> certChain = List<java.security.cert.Certificate> certChain =
new ArrayList<java.security.cert.Certificate>(); new ArrayList<>();
certChain.add(certs[i++]); // first cert is an end-entity cert certChain.add(certs[i++]); // first cert is an end-entity cert
int j = i; int j = i;
......
...@@ -362,7 +362,7 @@ implements Serializable ...@@ -362,7 +362,7 @@ implements Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<Class<?>, PermissionCollection> perms = Hashtable<Class<?>, PermissionCollection> perms =
new Hashtable<Class<?>, PermissionCollection>(permsMap.size()*2); // no sync; estimate new Hashtable<>(permsMap.size()*2); // no sync; estimate
synchronized (this) { synchronized (this) {
perms.putAll(permsMap); perms.putAll(permsMap);
} }
...@@ -567,7 +567,7 @@ implements Serializable ...@@ -567,7 +567,7 @@ implements Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<Permission, Permission> perms = Hashtable<Permission, Permission> perms =
new Hashtable<Permission, Permission>(permsMap.size()*2); new Hashtable<>(permsMap.size()*2);
synchronized (this) { synchronized (this) {
perms.putAll(permsMap); perms.putAll(permsMap);
} }
......
...@@ -336,8 +336,8 @@ public class ProtectionDomain { ...@@ -336,8 +336,8 @@ public class ProtectionDomain {
int swag = 32; int swag = 32;
int vcap = 8; int vcap = 8;
Enumeration<Permission> e; Enumeration<Permission> e;
List<Permission> pdVector = new ArrayList<Permission>(vcap); List<Permission> pdVector = new ArrayList<>(vcap);
List<Permission> plVector = new ArrayList<Permission>(swag); List<Permission> plVector = new ArrayList<>(swag);
// //
// Build a vector of domain permissions for subsequent merge // Build a vector of domain permissions for subsequent merge
......
...@@ -437,7 +437,7 @@ public abstract class Provider extends Properties { ...@@ -437,7 +437,7 @@ public abstract class Provider extends Properties {
private void readObject(ObjectInputStream in) private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
Map<Object,Object> copy = new HashMap<Object,Object>(); Map<Object,Object> copy = new HashMap<>();
for (Map.Entry<Object,Object> entry : super.entrySet()) { for (Map.Entry<Object,Object> entry : super.entrySet()) {
copy.put(entry.getKey(), entry.getValue()); copy.put(entry.getKey(), entry.getValue());
} }
...@@ -719,7 +719,7 @@ public abstract class Provider extends Properties { ...@@ -719,7 +719,7 @@ public abstract class Provider extends Properties {
} }
if (serviceSet == null) { if (serviceSet == null) {
ensureLegacyParsed(); ensureLegacyParsed();
Set<Service> set = new LinkedHashSet<Service>(); Set<Service> set = new LinkedHashSet<>();
if (serviceMap != null) { if (serviceMap != null) {
set.addAll(serviceMap.values()); set.addAll(serviceMap.values());
} }
...@@ -1395,7 +1395,7 @@ public abstract class Provider extends Properties { ...@@ -1395,7 +1395,7 @@ public abstract class Provider extends Properties {
if (s != null) { if (s != null) {
String[] classNames = s.split("\\|"); String[] classNames = s.split("\\|");
List<Class> classList = List<Class> classList =
new ArrayList<Class>(classNames.length); new ArrayList<>(classNames.length);
for (String className : classNames) { for (String className : classNames) {
Class clazz = getKeyClass(className); Class clazz = getKeyClass(className);
if (clazz != null) { if (clazz != null) {
......
...@@ -50,7 +50,7 @@ public class SecureClassLoader extends ClassLoader { ...@@ -50,7 +50,7 @@ public class SecureClassLoader extends ClassLoader {
// HashMap that maps CodeSource to ProtectionDomain // HashMap that maps CodeSource to ProtectionDomain
// @GuardedBy("pdcache") // @GuardedBy("pdcache")
private final HashMap<CodeSource, ProtectionDomain> pdcache = private final HashMap<CodeSource, ProtectionDomain> pdcache =
new HashMap<CodeSource, ProtectionDomain>(11); new HashMap<>(11);
private static final Debug debug = Debug.getInstance("scl"); private static final Debug debug = Debug.getInstance("scl");
......
...@@ -545,8 +545,7 @@ public final class Security { ...@@ -545,8 +545,7 @@ public final class Security {
value = filter.substring(index + 1); value = filter.substring(index + 1);
} }
Hashtable<String, String> hashtableFilter = Hashtable<String, String> hashtableFilter = new Hashtable<>(1);
new Hashtable<String, String>(1);
hashtableFilter.put(key, value); hashtableFilter.put(key, value);
return (getProviders(hashtableFilter)); return (getProviders(hashtableFilter));
...@@ -606,7 +605,7 @@ public final class Security { ...@@ -606,7 +605,7 @@ public final class Security {
// Then only return those providers who satisfy the selection criteria. // Then only return those providers who satisfy the selection criteria.
Provider[] allProviders = Security.getProviders(); Provider[] allProviders = Security.getProviders();
Set<String> keySet = filter.keySet(); Set<String> keySet = filter.keySet();
LinkedHashSet<Provider> candidates = new LinkedHashSet<Provider>(5); LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
// Returns all installed providers // Returns all installed providers
// if the selection criteria is null. // if the selection criteria is null.
...@@ -660,8 +659,7 @@ public final class Security { ...@@ -660,8 +659,7 @@ public final class Security {
} }
// Map containing cached Spi Class objects of the specified type // Map containing cached Spi Class objects of the specified type
private static final Map<String,Class> spiMap = private static final Map<String, Class> spiMap = new ConcurrentHashMap<>();
new ConcurrentHashMap<String,Class>();
/** /**
* Return the Class object for the given engine type * Return the Class object for the given engine type
...@@ -885,7 +883,7 @@ public final class Security { ...@@ -885,7 +883,7 @@ public final class Security {
String attrName, String attrName,
String filterValue, String filterValue,
Provider[] allProviders) { Provider[] allProviders) {
LinkedHashSet<Provider> candidates = new LinkedHashSet<Provider>(5); LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
for (int i = 0; i < allProviders.length; i++) { for (int i = 0; i < allProviders.length; i++) {
if (isCriterionSatisfied(allProviders[i], serviceName, if (isCriterionSatisfied(allProviders[i], serviceName,
algName, algName,
...@@ -1082,7 +1080,7 @@ public final class Security { ...@@ -1082,7 +1080,7 @@ public final class Security {
return Collections.EMPTY_SET; return Collections.EMPTY_SET;
} }
HashSet<String> result = new HashSet<String>(); HashSet<String> result = new HashSet<>();
Provider[] providers = Security.getProviders(); Provider[] providers = Security.getProviders();
for (int i = 0; i < providers.length; i++) { for (int i = 0; i < providers.length; i++) {
......
...@@ -198,7 +198,7 @@ implements java.io.Serializable ...@@ -198,7 +198,7 @@ implements java.io.Serializable
if (this.certs == null) { if (this.certs == null) {
// extract the signer certs // extract the signer certs
ArrayList<java.security.cert.Certificate> signerCerts = ArrayList<java.security.cert.Certificate> signerCerts =
new ArrayList<java.security.cert.Certificate>(); new ArrayList<>();
i = 0; i = 0;
while (i < certs.length) { while (i < certs.length) {
signerCerts.add(certs[i]); signerCerts.add(certs[i]);
......
...@@ -119,7 +119,7 @@ implements java.io.Serializable ...@@ -119,7 +119,7 @@ implements java.io.Serializable
public Enumeration<Permission> elements() { public Enumeration<Permission> elements() {
List<Permission> results = List<Permission> results =
new ArrayList<Permission>(); // where results are stored new ArrayList<>(); // where results are stored
// Get iterator of Map values (which are lists of permissions) // Get iterator of Map values (which are lists of permissions)
synchronized (this) { synchronized (this) {
...@@ -161,7 +161,7 @@ implements java.io.Serializable ...@@ -161,7 +161,7 @@ implements java.io.Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<String, Vector<UnresolvedPermission>> permissions = Hashtable<String, Vector<UnresolvedPermission>> permissions =
new Hashtable<String, Vector<UnresolvedPermission>>(perms.size()*2); new Hashtable<>(perms.size()*2);
// Convert each entry (List) into a Vector // Convert each entry (List) into a Vector
synchronized (this) { synchronized (this) {
...@@ -169,8 +169,7 @@ implements java.io.Serializable ...@@ -169,8 +169,7 @@ implements java.io.Serializable
for (Map.Entry<String, List<UnresolvedPermission>> e : set) { for (Map.Entry<String, List<UnresolvedPermission>> e : set) {
// Convert list into Vector // Convert list into Vector
List<UnresolvedPermission> list = e.getValue(); List<UnresolvedPermission> list = e.getValue();
Vector<UnresolvedPermission> vec = Vector<UnresolvedPermission> vec = new Vector<>(list.size());
new Vector<UnresolvedPermission>(list.size());
synchronized (list) { synchronized (list) {
vec.addAll(list); vec.addAll(list);
} }
...@@ -207,8 +206,7 @@ implements java.io.Serializable ...@@ -207,8 +206,7 @@ implements java.io.Serializable
for (Map.Entry<String, Vector<UnresolvedPermission>> e : set) { for (Map.Entry<String, Vector<UnresolvedPermission>> e : set) {
// Convert Vector into ArrayList // Convert Vector into ArrayList
Vector<UnresolvedPermission> vec = e.getValue(); Vector<UnresolvedPermission> vec = e.getValue();
List<UnresolvedPermission> list = List<UnresolvedPermission> list = new ArrayList<>(vec.size());
new ArrayList<UnresolvedPermission>(vec.size());
list.addAll(vec); list.addAll(vec);
// Add to Hashtable being serialized // Add to Hashtable being serialized
......
...@@ -473,7 +473,9 @@ public class Timestamp extends java.util.Date { ...@@ -473,7 +473,9 @@ public class Timestamp extends java.util.Date {
* @since 1.4 * @since 1.4
*/ */
public int compareTo(Timestamp ts) { public int compareTo(Timestamp ts) {
int i = super.compareTo(ts); long thisTime = this.getTime();
long anotherTime = ts.getTime();
int i = (thisTime<anotherTime ? -1 :(thisTime==anotherTime?0 :1));
if (i == 0) { if (i == 0) {
if (nanos > ts.nanos) { if (nanos > ts.nanos) {
return 1; return 1;
......
...@@ -1452,10 +1452,10 @@ public class Collections { ...@@ -1452,10 +1452,10 @@ public class Collections {
* when o is a Map.Entry, and calls o.setValue. * when o is a Map.Entry, and calls o.setValue.
*/ */
public boolean containsAll(Collection<?> coll) { public boolean containsAll(Collection<?> coll) {
Iterator<?> it = coll.iterator(); for (Object e : coll) {
while (it.hasNext()) if (!contains(e)) // Invokes safe contains() above
if (!contains(it.next())) // Invokes safe contains() above
return false; return false;
}
return true; return true;
} }
public boolean equals(Object o) { public boolean equals(Object o) {
...@@ -3713,45 +3713,91 @@ public class Collections { ...@@ -3713,45 +3713,91 @@ public class Collections {
} }
/** /**
* Returns <tt>true</tt> if the two specified collections have no * Returns {@code true} if the two specified collections have no
* elements in common. * elements in common.
* *
* <p>Care must be exercised if this method is used on collections that * <p>Care must be exercised if this method is used on collections that
* do not comply with the general contract for <tt>Collection</tt>. * do not comply with the general contract for {@code Collection}.
* Implementations may elect to iterate over either collection and test * Implementations may elect to iterate over either collection and test
* for containment in the other collection (or to perform any equivalent * for containment in the other collection (or to perform any equivalent
* computation). If either collection uses a nonstandard equality test * computation). If either collection uses a nonstandard equality test
* (as does a {@link SortedSet} whose ordering is not <i>compatible with * (as does a {@link SortedSet} whose ordering is not <em>compatible with
* equals</i>, or the key set of an {@link IdentityHashMap}), both * equals</em>, or the key set of an {@link IdentityHashMap}), both
* collections must use the same nonstandard equality test, or the * collections must use the same nonstandard equality test, or the
* result of this method is undefined. * result of this method is undefined.
* *
* <p>Care must also be exercised when using collections that have
* restrictions on the elements that they may contain. Collection
* implementations are allowed to throw exceptions for any operation
* involving elements they deem ineligible. For absolute safety the
* specified collections should contain only elements which are
* eligible elements for both collections.
*
* <p>Note that it is permissible to pass the same collection in both * <p>Note that it is permissible to pass the same collection in both
* parameters, in which case the method will return true if and only if * parameters, in which case the method will return {@code true} if and
* the collection is empty. * only if the collection is empty.
* *
* @param c1 a collection * @param c1 a collection
* @param c2 a collection * @param c2 a collection
* @throws NullPointerException if either collection is null * @return {@code true} if the two specified collections have no
* elements in common.
* @throws NullPointerException if either collection is {@code null}.
* @throws NullPointerException if one collection contains a {@code null}
* element and {@code null} is not an eligible element for the other collection.
* (optional)
* @throws ClassCastException if one collection contains an element that is
* of a type which is ineligible for the other collection. (optional)
* @since 1.5 * @since 1.5
*/ */
public static boolean disjoint(Collection<?> c1, Collection<?> c2) { public static boolean disjoint(Collection<?> c1, Collection<?> c2) {
/* // The collection to be used for contains(). Preference is given to
* We're going to iterate through c1 and test for inclusion in c2. // the collection who's contains() has lower O() complexity.
* If c1 is a Set and c2 isn't, swap the collections. Otherwise, Collection<?> contains = c2;
* place the shorter collection in c1. Hopefully this heuristic // The collection to be iterated. If the collections' contains() impl
* will minimize the cost of the operation. // are of different O() complexity, the collection with slower
*/ // contains() will be used for iteration. For collections who's
if ((c1 instanceof Set) && !(c2 instanceof Set) || // contains() are of the same complexity then best performance is
(c1.size() > c2.size())) { // achieved by iterating the smaller collection.
Collection<?> tmp = c1; Collection<?> iterate = c1;
c1 = c2;
c2 = tmp; // Performance optimization cases. The heuristics:
// 1. Generally iterate over c1.
// 2. If c1 is a Set then iterate over c2.
// 3. If either collection is empty then result is always true.
// 4. Iterate over the smaller Collection.
if (c1 instanceof Set) {
// Use c1 for contains as a Set's contains() is expected to perform
// better than O(N/2)
iterate = c2;
contains = c1;
} else if (!(c2 instanceof Set)) {
// Both are mere Collections. Iterate over smaller collection.
// Example: If c1 contains 3 elements and c2 contains 50 elements and
// assuming contains() requires ceiling(N/2) comparisons then
// checking for all c1 elements in c2 would require 75 comparisons
// (3 * ceiling(50/2)) vs. checking all c2 elements in c1 requiring
// 100 comparisons (50 * ceiling(3/2)).
int c1size = c1.size();
int c2size = c2.size();
if (c1size == 0 || c2size == 0) {
// At least one collection is empty. Nothing will match.
return true;
}
if (c1size > c2size) {
iterate = c2;
contains = c1;
}
} }
for (Object e : c1) for (Object e : iterate) {
if (c2.contains(e)) if (contains.contains(e)) {
// Found a common element. Collections are not disjoint.
return false; return false;
}
}
// No common elements were found.
return true; return true;
} }
......
/* /*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, 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
...@@ -41,6 +41,8 @@ import java.math.BigInteger; ...@@ -41,6 +41,8 @@ import java.math.BigInteger;
import java.math.MathContext; import java.math.MathContext;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.text.DateFormatSymbols; import java.text.DateFormatSymbols;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
...@@ -1838,22 +1840,53 @@ import sun.misc.FormattedFloatingDecimal; ...@@ -1838,22 +1840,53 @@ import sun.misc.FormattedFloatingDecimal;
*/ */
public final class Formatter implements Closeable, Flushable { public final class Formatter implements Closeable, Flushable {
private Appendable a; private Appendable a;
private Locale l; private final Locale l;
private IOException lastException; private IOException lastException;
private char zero = '0'; private final char zero;
private static double scaleUp; private static double scaleUp;
// 1 (sign) + 19 (max # sig digits) + 1 ('.') + 1 ('e') + 1 (sign) // 1 (sign) + 19 (max # sig digits) + 1 ('.') + 1 ('e') + 1 (sign)
// + 3 (max # exp digits) + 4 (error) = 30 // + 3 (max # exp digits) + 4 (error) = 30
private static final int MAX_FD_CHARS = 30; private static final int MAX_FD_CHARS = 30;
// Initialize internal data. /**
private void init(Appendable a, Locale l) { * Returns a charset object for the given charset name.
* @throws NullPointerException is csn is null
* @throws UnsupportedEncodingException if the charset is not supported
*/
private static Charset toCharset(String csn)
throws UnsupportedEncodingException
{
Objects.nonNull(csn, "charsetName");
try {
return Charset.forName(csn);
} catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
// UnsupportedEncodingException should be thrown
throw new UnsupportedEncodingException(csn);
}
}
private static final Appendable nonNullAppendable(Appendable a) {
if (a == null)
return new StringBuilder();
return a;
}
/* Private constructors */
private Formatter(Locale l, Appendable a) {
this.a = a; this.a = a;
this.l = l; this.l = l;
setZero(); this.zero = getZero(l);
}
private Formatter(Charset charset, Locale l, File file)
throws FileNotFoundException
{
this(l,
new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset)));
} }
/** /**
...@@ -1867,7 +1900,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1867,7 +1900,7 @@ public final class Formatter implements Closeable, Flushable {
* virtual machine. * virtual machine.
*/ */
public Formatter() { public Formatter() {
init(new StringBuilder(), Locale.getDefault(Locale.Category.FORMAT)); this(Locale.getDefault(Locale.Category.FORMAT), new StringBuilder());
} }
/** /**
...@@ -1881,9 +1914,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1881,9 +1914,7 @@ public final class Formatter implements Closeable, Flushable {
* {@code null} then a {@link StringBuilder} will be created. * {@code null} then a {@link StringBuilder} will be created.
*/ */
public Formatter(Appendable a) { public Formatter(Appendable a) {
if (a == null) this(Locale.getDefault(Locale.Category.FORMAT), nonNullAppendable(a));
a = new StringBuilder();
init(a, Locale.getDefault(Locale.Category.FORMAT));
} }
/** /**
...@@ -1900,7 +1931,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1900,7 +1931,7 @@ public final class Formatter implements Closeable, Flushable {
* is applied. * is applied.
*/ */
public Formatter(Locale l) { public Formatter(Locale l) {
init(new StringBuilder(), l); this(l, new StringBuilder());
} }
/** /**
...@@ -1916,9 +1947,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1916,9 +1947,7 @@ public final class Formatter implements Closeable, Flushable {
* is applied. * is applied.
*/ */
public Formatter(Appendable a, Locale l) { public Formatter(Appendable a, Locale l) {
if (a == null) this(l, nonNullAppendable(a));
a = new StringBuilder();
init(a, l);
} }
/** /**
...@@ -1949,8 +1978,8 @@ public final class Formatter implements Closeable, Flushable { ...@@ -1949,8 +1978,8 @@ public final class Formatter implements Closeable, Flushable {
* creating the file * creating the file
*/ */
public Formatter(String fileName) throws FileNotFoundException { public Formatter(String fileName) throws FileNotFoundException {
init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName))), this(Locale.getDefault(Locale.Category.FORMAT),
Locale.getDefault(Locale.Category.FORMAT)); new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName))));
} }
/** /**
...@@ -2025,8 +2054,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2025,8 +2054,7 @@ public final class Formatter implements Closeable, Flushable {
public Formatter(String fileName, String csn, Locale l) public Formatter(String fileName, String csn, Locale l)
throws FileNotFoundException, UnsupportedEncodingException throws FileNotFoundException, UnsupportedEncodingException
{ {
init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), csn)), this(toCharset(csn), l, new File(fileName));
l);
} }
/** /**
...@@ -2057,8 +2085,8 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2057,8 +2085,8 @@ public final class Formatter implements Closeable, Flushable {
* creating the file * creating the file
*/ */
public Formatter(File file) throws FileNotFoundException { public Formatter(File file) throws FileNotFoundException {
init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))), this(Locale.getDefault(Locale.Category.FORMAT),
Locale.getDefault(Locale.Category.FORMAT)); new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))));
} }
/** /**
...@@ -2133,8 +2161,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2133,8 +2161,7 @@ public final class Formatter implements Closeable, Flushable {
public Formatter(File file, String csn, Locale l) public Formatter(File file, String csn, Locale l)
throws FileNotFoundException, UnsupportedEncodingException throws FileNotFoundException, UnsupportedEncodingException
{ {
init(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), csn)), this(toCharset(csn), l, file);
l);
} }
/** /**
...@@ -2151,9 +2178,8 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2151,9 +2178,8 @@ public final class Formatter implements Closeable, Flushable {
* The stream to use as the destination of this formatter. * The stream to use as the destination of this formatter.
*/ */
public Formatter(PrintStream ps) { public Formatter(PrintStream ps) {
if (ps == null) this(Locale.getDefault(Locale.Category.FORMAT),
throw new NullPointerException(); (Appendable)Objects.nonNull(ps));
init((Appendable)ps, Locale.getDefault(Locale.Category.FORMAT));
} }
/** /**
...@@ -2171,8 +2197,8 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2171,8 +2197,8 @@ public final class Formatter implements Closeable, Flushable {
* The output will be buffered. * The output will be buffered.
*/ */
public Formatter(OutputStream os) { public Formatter(OutputStream os) {
init(new BufferedWriter(new OutputStreamWriter(os)), this(Locale.getDefault(Locale.Category.FORMAT),
Locale.getDefault(Locale.Category.FORMAT)); new BufferedWriter(new OutputStreamWriter(os)));
} }
/** /**
...@@ -2222,13 +2248,15 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2222,13 +2248,15 @@ public final class Formatter implements Closeable, Flushable {
public Formatter(OutputStream os, String csn, Locale l) public Formatter(OutputStream os, String csn, Locale l)
throws UnsupportedEncodingException throws UnsupportedEncodingException
{ {
init(new BufferedWriter(new OutputStreamWriter(os, csn)), l); this(l, new BufferedWriter(new OutputStreamWriter(os, csn)));
} }
private void setZero() { private static char getZero(Locale l) {
if ((l != null) && !l.equals(Locale.US)) { if ((l != null) && !l.equals(Locale.US)) {
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
zero = dfs.getZeroDigit(); return dfs.getZeroDigit();
} else {
return '0';
} }
} }
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
package java.util; package java.util;
/** /**
* Linked list implementation of the {@link List} and {@link Deque} interfaces. * Doubly-linked list implementation of the {@code List} and {@code Deque}
* Implements all optional operations, and permits all elements (including * interfaces. Implements all optional list operations, and permits all
* {@code null}). * elements (including {@code null}).
* *
* <p>All of the operations perform as could be expected for a doubly-linked * <p>All of the operations perform as could be expected for a doubly-linked
* list. Operations that index into the list will traverse the list from * list. Operations that index into the list will traverse the list from
...@@ -249,7 +249,7 @@ public class LinkedList<E> ...@@ -249,7 +249,7 @@ public class LinkedList<E>
* @return the last element in this list * @return the last element in this list
* @throws NoSuchElementException if this list is empty * @throws NoSuchElementException if this list is empty
*/ */
public E getLast() { public E getLast() {
final Node<E> l = last; final Node<E> l = last;
if (l == null) if (l == null)
throw new NoSuchElementException(); throw new NoSuchElementException();
......
/* /*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, 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
...@@ -571,10 +571,8 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -571,10 +571,8 @@ public final class Scanner implements Iterator<String>, Closeable {
* @return A scanner with the specified source and pattern * @return A scanner with the specified source and pattern
*/ */
private Scanner(Readable source, Pattern pattern) { private Scanner(Readable source, Pattern pattern) {
if (source == null) assert source != null : "source should not be null";
throw new NullPointerException("source"); assert pattern != null : "pattern should not be null";
if (pattern == null)
throw new NullPointerException("pattern");
this.source = source; this.source = source;
delimPattern = pattern; delimPattern = pattern;
buf = CharBuffer.allocate(BUFFER_SIZE); buf = CharBuffer.allocate(BUFFER_SIZE);
...@@ -593,7 +591,7 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -593,7 +591,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* interface * interface
*/ */
public Scanner(Readable source) { public Scanner(Readable source) {
this(source, WHITESPACE_PATTERN); this(Objects.nonNull(source, "source"), WHITESPACE_PATTERN);
} }
/** /**
...@@ -620,23 +618,27 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -620,23 +618,27 @@ public final class Scanner implements Iterator<String>, Closeable {
* does not exist * does not exist
*/ */
public Scanner(InputStream source, String charsetName) { public Scanner(InputStream source, String charsetName) {
this(makeReadable(source, charsetName), WHITESPACE_PATTERN); this(makeReadable(Objects.nonNull(source, "source"), toCharset(charsetName)),
WHITESPACE_PATTERN);
} }
private static Readable makeReadable(InputStream source, /**
String charsetName) * Returns a charset object for the given charset name.
{ * @throws NullPointerException is csn is null
if (source == null) * @throws IllegalArgumentException if the charset is not supported
throw new NullPointerException("source"); */
InputStreamReader isr = null; private static Charset toCharset(String csn) {
Objects.nonNull(csn, "charsetName");
try { try {
isr = new InputStreamReader(source, charsetName); return Charset.forName(csn);
} catch (UnsupportedEncodingException uee) { } catch (IllegalCharsetNameException|UnsupportedCharsetException e) {
IllegalArgumentException iae = new IllegalArgumentException(); // IllegalArgumentException should be thrown
iae.initCause(uee); throw new IllegalArgumentException(e);
throw iae;
} }
return isr; }
private static Readable makeReadable(InputStream source, Charset charset) {
return new InputStreamReader(source, charset);
} }
/** /**
...@@ -648,9 +650,7 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -648,9 +650,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* @param source A file to be scanned * @param source A file to be scanned
* @throws FileNotFoundException if source is not found * @throws FileNotFoundException if source is not found
*/ */
public Scanner(File source) public Scanner(File source) throws FileNotFoundException {
throws FileNotFoundException
{
this((ReadableByteChannel)(new FileInputStream(source).getChannel())); this((ReadableByteChannel)(new FileInputStream(source).getChannel()));
} }
...@@ -669,8 +669,27 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -669,8 +669,27 @@ public final class Scanner implements Iterator<String>, Closeable {
public Scanner(File source, String charsetName) public Scanner(File source, String charsetName)
throws FileNotFoundException throws FileNotFoundException
{ {
this((ReadableByteChannel)(new FileInputStream(source).getChannel()), this(Objects.nonNull(source), toDecoder(charsetName));
charsetName); }
private Scanner(File source, CharsetDecoder dec)
throws FileNotFoundException
{
this(makeReadable((ReadableByteChannel)(new FileInputStream(source).getChannel()), dec));
}
private static CharsetDecoder toDecoder(String charsetName) {
Objects.nonNull(charsetName, "charsetName");
try {
return Charset.forName(charsetName).newDecoder();
} catch (IllegalCharsetNameException|UnsupportedCharsetException unused) {
throw new IllegalArgumentException(charsetName);
}
}
private static Readable makeReadable(ReadableByteChannel source,
CharsetDecoder dec) {
return Channels.newReader(source, dec, -1);
} }
/** /**
...@@ -708,10 +727,12 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -708,10 +727,12 @@ public final class Scanner implements Iterator<String>, Closeable {
* if the specified encoding is not found * if the specified encoding is not found
* @since 1.7 * @since 1.7
*/ */
public Scanner(FileRef source, String charsetName) public Scanner(FileRef source, String charsetName) throws IOException {
throws IOException this(Objects.nonNull(source), toCharset(charsetName));
{ }
this(source.newInputStream(), charsetName);
private Scanner(FileRef source, Charset charset) throws IOException {
this(makeReadable(source.newInputStream(), charset));
} }
/** /**
...@@ -733,16 +754,12 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -733,16 +754,12 @@ public final class Scanner implements Iterator<String>, Closeable {
* @param source A channel to scan * @param source A channel to scan
*/ */
public Scanner(ReadableByteChannel source) { public Scanner(ReadableByteChannel source) {
this(makeReadable(source), WHITESPACE_PATTERN); this(makeReadable(Objects.nonNull(source, "source")),
WHITESPACE_PATTERN);
} }
private static Readable makeReadable(ReadableByteChannel source) { private static Readable makeReadable(ReadableByteChannel source) {
if (source == null) return makeReadable(source, Charset.defaultCharset().newDecoder());
throw new NullPointerException("source");
String defaultCharsetName =
java.nio.charset.Charset.defaultCharset().name();
return Channels.newReader(source,
java.nio.charset.Charset.defaultCharset().name());
} }
/** /**
...@@ -757,17 +774,8 @@ public final class Scanner implements Iterator<String>, Closeable { ...@@ -757,17 +774,8 @@ public final class Scanner implements Iterator<String>, Closeable {
* does not exist * does not exist
*/ */
public Scanner(ReadableByteChannel source, String charsetName) { public Scanner(ReadableByteChannel source, String charsetName) {
this(makeReadable(source, charsetName), WHITESPACE_PATTERN); this(makeReadable(Objects.nonNull(source, "source"), toDecoder(charsetName)),
} WHITESPACE_PATTERN);
private static Readable makeReadable(ReadableByteChannel source,
String charsetName)
{
if (source == null)
throw new NullPointerException("source");
if (!Charset.isSupported(charsetName))
throw new IllegalArgumentException(charsetName);
return Channels.newReader(source, charsetName);
} }
// Private primitives used to support scanning // Private primitives used to support scanning
......
...@@ -869,6 +869,8 @@ public class ConcurrentLinkedDeque<E> ...@@ -869,6 +869,8 @@ public class ConcurrentLinkedDeque<E>
/** /**
* Inserts the specified element at the front of this deque. * Inserts the specified element at the front of this deque.
* As the deque is unbounded, this method will never throw
* {@link IllegalStateException}.
* *
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
*/ */
...@@ -878,6 +880,8 @@ public class ConcurrentLinkedDeque<E> ...@@ -878,6 +880,8 @@ public class ConcurrentLinkedDeque<E>
/** /**
* Inserts the specified element at the end of this deque. * Inserts the specified element at the end of this deque.
* As the deque is unbounded, this method will never throw
* {@link IllegalStateException}.
* *
* <p>This method is equivalent to {@link #add}. * <p>This method is equivalent to {@link #add}.
* *
...@@ -889,8 +893,9 @@ public class ConcurrentLinkedDeque<E> ...@@ -889,8 +893,9 @@ public class ConcurrentLinkedDeque<E>
/** /**
* Inserts the specified element at the front of this deque. * Inserts the specified element at the front of this deque.
* As the deque is unbounded, this method will never return {@code false}.
* *
* @return {@code true} always * @return {@code true} (as specified by {@link Deque#offerFirst})
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
*/ */
public boolean offerFirst(E e) { public boolean offerFirst(E e) {
...@@ -900,10 +905,11 @@ public class ConcurrentLinkedDeque<E> ...@@ -900,10 +905,11 @@ public class ConcurrentLinkedDeque<E>
/** /**
* Inserts the specified element at the end of this deque. * Inserts the specified element at the end of this deque.
* As the deque is unbounded, this method will never return {@code false}.
* *
* <p>This method is equivalent to {@link #add}. * <p>This method is equivalent to {@link #add}.
* *
* @return {@code true} always * @return {@code true} (as specified by {@link Deque#offerLast})
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
*/ */
public boolean offerLast(E e) { public boolean offerLast(E e) {
...@@ -983,6 +989,7 @@ public class ConcurrentLinkedDeque<E> ...@@ -983,6 +989,7 @@ public class ConcurrentLinkedDeque<E>
/** /**
* Inserts the specified element at the tail of this deque. * Inserts the specified element at the tail of this deque.
* As the deque is unbounded, this method will never return {@code false}.
* *
* @return {@code true} (as specified by {@link Queue#offer}) * @return {@code true} (as specified by {@link Queue#offer})
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
...@@ -993,6 +1000,8 @@ public class ConcurrentLinkedDeque<E> ...@@ -993,6 +1000,8 @@ public class ConcurrentLinkedDeque<E>
/** /**
* Inserts the specified element at the tail of this deque. * Inserts the specified element at the tail of this deque.
* As the deque is unbounded, this method will never throw
* {@link IllegalStateException} or return {@code false}.
* *
* @return {@code true} (as specified by {@link Collection#add}) * @return {@code true} (as specified by {@link Collection#add})
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
......
...@@ -269,6 +269,8 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E> ...@@ -269,6 +269,8 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
/** /**
* Inserts the specified element at the tail of this queue. * Inserts the specified element at the tail of this queue.
* As the queue is unbounded, this method will never throw
* {@link IllegalStateException} or return {@code false}.
* *
* @return {@code true} (as specified by {@link Collection#add}) * @return {@code true} (as specified by {@link Collection#add})
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
...@@ -298,6 +300,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E> ...@@ -298,6 +300,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
/** /**
* Inserts the specified element at the tail of this queue. * Inserts the specified element at the tail of this queue.
* As the queue is unbounded, this method will never return {@code false}.
* *
* @return {@code true} (as specified by {@link Queue#offer}) * @return {@code true} (as specified by {@link Queue#offer})
* @throws NullPointerException if the specified element is null * @throws NullPointerException if the specified element is null
......
...@@ -1029,6 +1029,8 @@ public class LinkedBlockingDeque<E> ...@@ -1029,6 +1029,8 @@ public class LinkedBlockingDeque<E>
* elements as they existed upon construction of the iterator, and * elements as they existed upon construction of the iterator, and
* may (but is not guaranteed to) reflect any modifications * may (but is not guaranteed to) reflect any modifications
* subsequent to construction. * subsequent to construction.
*
* @return an iterator over the elements in this deque in reverse order
*/ */
public Iterator<E> descendingIterator() { public Iterator<E> descendingIterator() {
return new DescendingItr(); return new DescendingItr();
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册