# HG changeset patch # User duke # Date 1499281139 -7200 # Node ID d8b2864e0ec4377ebd5b3e3a9c9a5e2457e8f334 # Parent ff95a3cea444afbfca6101ba1129c816bf930fff# Parent 77273343c131ea6c4974a47cfcad36df032bd84a Merge diff -r 77273343c131 -r d8b2864e0ec4 jdk/.hgtags --- a/jdk/.hgtags Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/.hgtags Wed Jul 05 20:58:59 2017 +0200 @@ -333,3 +333,4 @@ 6e50b992bef4def597a5033e696e5b1d4fe5b294 jdk9-b88 0d0a63b325592607974612f9cfb48590975aa2d6 jdk9-b89 b433e4dfb830fea60e5187e4580791b62cc362d2 jdk9-b90 +97624df5026a2fb191793697dbd2c604c4d5c66e jdk9-b91 diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/CompileDemos.gmk --- a/jdk/make/CompileDemos.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/CompileDemos.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -23,6 +23,10 @@ # questions. # +################################################################################ +# Build demos for the JDK into $(SUPPORT_OUTPUTDIR)/demos/image. +################################################################################ + default: all include $(SPEC) @@ -31,428 +35,487 @@ include NativeCompilation.gmk include SetupJavaCompilers.gmk include TextFileProcessing.gmk +include ZipArchive.gmk # Prepare the find cache. $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src)) # Append demo goals to this variable. -BUILD_DEMOS = +TARGETS = # The demo structure and contents should really be cleaned up. # Now every other demo has its own quirks where to put the # READMEs and other files. DEMO_SHARE_SRC := $(JDK_TOPDIR)/src/demo/share -DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share -DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris -DEMO_OS_TYPE_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_TYPE) GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc -################################################################################################## +DEMO_MANIFEST := $(SUPPORT_OUTPUTDIR)/demos/java-main-manifest.mf -# This rule will be depended on due to the MANIFEST line +# This rule will be depended on due to the MANIFEST line in SetupBuildDemo +# and SetupBuildJvmtiDemo. $(eval $(call SetupTextFileProcessing, BUILD_JAVA_MANIFEST, \ SOURCE_FILES := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf, \ - OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/demo/java-main-manifest.mf, \ + OUTPUT_FILE := $(DEMO_MANIFEST), \ REPLACEMENTS := \ @@RELEASE@@ => $(RELEASE) ; \ @@COMPANY_NAME@@ => $(COMPANY_NAME) , \ )) -define SetupAppletDemo - $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1, \ +################################################################################ +# Build applet demos. + +# Setup make rules for building a demo applet. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. It is also +# used to locate the name of the applet subdir, and to determine the name +# of the output directory. +# +# Remaining parameters are named arguments. These include: +# SRC_DIR Alternative source directory to use for the demos. +# DISABLE_SJAVAC Passed to SetupJavaCompilation + +SetupBuildAppletDemo = $(NamedParamsMacroTemplate) +define SetupBuildAppletDemoBody + ifeq ($$($1_SRC_DIR), ) + $1_SRC_DIR := $(DEMO_SHARE_SRC)/applets + endif + + $$(eval $$(call SetupJavaCompilation, BUILD_DEMO_APPLET_$1, \ SETUP := GENERATE_USINGJDKBYTECODE, \ - SRC := $(JDK_TOPDIR)/src/$3demo/share/applets/$1, \ - BIN := $(SUPPORT_OUTPUTDIR)/demo/image/applets/$1, \ + SRC := $$($1_SRC_DIR)/$1, \ + BIN := $(SUPPORT_OUTPUTDIR)/demos/image/applets/$1, \ COPY := .html .java .xyz .obj .au .gif, \ - DISABLE_SJAVAC := $2)) - BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1) + DISABLE_SJAVAC := $$($1_DISABLE_SJAVAC), \ + )) + + $1 := $$(BUILD_DEMO_APPLET_$1) + + TARGETS += $$($1) endef ifneq ($(OPENJDK_TARGET_OS), solaris) - $(eval $(call SetupAppletDemo,ArcTest)) - $(eval $(call SetupAppletDemo,BarChart)) - $(eval $(call SetupAppletDemo,Blink)) - $(eval $(call SetupAppletDemo,CardTest)) - $(eval $(call SetupAppletDemo,Clock)) - $(eval $(call SetupAppletDemo,DitherTest)) - $(eval $(call SetupAppletDemo,DrawTest)) - $(eval $(call SetupAppletDemo,Fractal)) - $(eval $(call SetupAppletDemo,GraphicsTest)) - $(eval $(call SetupAppletDemo,NervousText)) - $(eval $(call SetupAppletDemo,SimpleGraph)) - $(eval $(call SetupAppletDemo,SortDemo)) - $(eval $(call SetupAppletDemo,SpreadSheet)) - - ifndef OPENJDK - $(eval $(call SetupAppletDemo,Animator,,closed/)) - $(eval $(call SetupAppletDemo,GraphLayout,true,closed/)) - $(eval $(call SetupAppletDemo,JumpingBox,,closed/)) - $(eval $(call SetupAppletDemo,TicTacToe,,closed/)) - endif + $(eval $(call SetupBuildAppletDemo, ArcTest)) + $(eval $(call SetupBuildAppletDemo, BarChart)) + $(eval $(call SetupBuildAppletDemo, Blink)) + $(eval $(call SetupBuildAppletDemo, CardTest)) + $(eval $(call SetupBuildAppletDemo, Clock)) + $(eval $(call SetupBuildAppletDemo, DitherTest)) + $(eval $(call SetupBuildAppletDemo, DrawTest)) + $(eval $(call SetupBuildAppletDemo, Fractal)) + $(eval $(call SetupBuildAppletDemo, GraphicsTest)) + $(eval $(call SetupBuildAppletDemo, NervousText)) + $(eval $(call SetupBuildAppletDemo, SimpleGraph)) + $(eval $(call SetupBuildAppletDemo, SortDemo)) + $(eval $(call SetupBuildAppletDemo, SpreadSheet)) endif -################################################################################################## +################################################################################ +# Build normal demos. -PATTERNS_TO_COPY = .html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf .xyz .obj +COPY_TO_JAR := .html .txt .properties .js .gif .jpg .theme .data .opt .c .h \ + .png .ttf .xyz .obj README COPYRIGHT + +COPY_TO_IMAGE := *.html *.txt *.png *.xml README* -define SetupDemo - # Param 1 = Name of the demo - # Param 2 = Subdirectory of the demo below the demo directory. - # Param 3 = Additional javac flags. - # Param 4 = The main class for the jar. - # Param 5 = Additional source directory. - # Param 6 = Extra dir below $(JDK_TOPDIR)/src (closed) - # Param 7 = List of files to copy - # Param 8 = Base name of jar file. Defaults to $1 - # Param 9 = Exclude list - # Param 10 = Extra copy patterns - # Param 11 = Extra manifest attribute - # Param 12 = Suffix for compiler setup name +# Setup make rules for building a demo. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# DEMO_SUBDIR The name of the subdir of the demo, below the demo top dir. +# EXTRA_SRC_DIR Additional source directory. +# SRC_SUB_DIR Optional subdir to locate source code in +# SRC_DIR Alternative source directory to use for the demos. +# EXCLUDE_FILES Exclude file list +# JAR_NAME Base name of jar file. Defaults to $1. +# MAIN_CLASS The main class for the jar. Defaults to $1. +# EXTRA_COPY_TO_JAR Additional files to copy to jar (as patterns) +# EXTRA_COPY_TO_IMAGE Additional files to copy to images (as wildcards) +# EXTRA_MANIFEST_ATTR Extra manifest attribute +# SKIP_COMPILATION Skip Java compilation iff true +# DISABLE_SJAVAC Passed to SetupJavaCompilation +SetupBuildDemo = $(NamedParamsMacroTemplate) +define SetupBuildDemoBody + ifeq ($$($1_SRC_DIR), ) + $1_SRC_DIR := $(DEMO_SHARE_SRC) + endif - $1_SRC_BASE := $(JDK_TOPDIR)/src/$6demo/share/$2/$1 - # In some demos the source is found in a subdir called src. - $1_MAIN_SRC := $$(wildcard $$($1_SRC_BASE)/src) - ifeq ($$($1_MAIN_SRC), ) + $1_SRC_BASE := $$($1_SRC_DIR)/$$($1_DEMO_SUBDIR)/$1 + + # In some demos the source is found in a subdir + ifneq ($$($1_SRC_SUB_DIR), ) + $1_MAIN_SRC := $$($1_SRC_BASE)/$$($1_SRC_SUB_DIR) + else + # for allmost all $1_MAIN_SRC := $$($1_SRC_BASE) endif - ifneq ($8, ) - $1_JARFILE := $8.jar - else - $1_JARFILE := $1.jar + # Default is to use demo name as jar file name. + ifeq ($$($1_JAR_NAME), ) + $1_JAR_NAME := $1 endif - ifeq ($(findstring $1,Laffy SwingSet3), ) - $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_$1, \ - SETUP := GENERATE_USINGJDKBYTECODE, \ - ADD_JAVAC_FLAGS := $3, \ - SRC := $$($1_MAIN_SRC) $5, \ - BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/$2/$1, \ - COPY := $(PATTERNS_TO_COPY) $(10), \ - JAR := $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/$$($1_JARFILE), \ - JARMAIN := $4, \ - MANIFEST := $(SUPPORT_OUTPUTDIR)/demo/java-main-manifest.mf, \ - EXTRA_MANIFEST_ATTR := $(11), \ - SRCZIP := $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/src.zip, \ - EXCLUDE_FILES := $9, \ - DISABLE_SJAVAC := $(12))) - - BUILD_DEMOS += $$(BUILD_DEMO_$1) \ - $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/$$($1_JARFILE) \ - $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/src.zip + # Default is to use demo name as jar main class. + ifeq ($$($1_MAIN_CLASS), ) + $1_MAIN_CLASS := $1 + else ifeq ($$($1_MAIN_CLASS), NONE) + $1_MAIN_CLASS := + $1_EXTRA_MANIFEST_ATTR += Main-Class: \n endif - # Copy files. - $1_COPY_TARGETS := $$(patsubst $$($1_SRC_BASE)/%, \ - $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/%, \ - $$(wildcard $$(addprefix $$($1_SRC_BASE)/, $7))) - ifneq ($7, ) - $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/%: $$($1_SRC_BASE)/% - $$(call install-file) - $(CHMOD) -f ug+w $$@ + ifneq ($$($1_SKIP_COMPILATION), true) + $$(eval $$(call SetupJavaCompilation, BUILD_DEMO_$1, \ + SETUP := GENERATE_USINGJDKBYTECODE, \ + SRC := $$($1_MAIN_SRC) $$($1_EXTRA_SRC_DIR), \ + BIN := $(SUPPORT_OUTPUTDIR)/demos/classes/$$($1_DEMO_SUBDIR)/$1, \ + COPY := $(COPY_TO_JAR) $$($1_EXTRA_COPY_TO_JAR), \ + JAR := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/$$($1_JAR_NAME).jar, \ + JARMAIN := $$($1_MAIN_CLASS), \ + MANIFEST := $(DEMO_MANIFEST), \ + EXTRA_MANIFEST_ATTR := $$($1_EXTRA_MANIFEST_ATTR), \ + SRCZIP := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1/src.zip, \ + EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \ + DISABLE_SJAVAC := $$($1_DISABLE_SJAVAC), \ + )) - BUILD_DEMOS += $$($1_COPY_TARGETS) + $1 += $$(BUILD_DEMO_$1) endif + # Copy files. Sort is needed to remove duplicates. + $1_COPY_FILES := $$(sort $$(wildcard $$(addprefix $$($1_SRC_BASE)/, \ + $(COPY_TO_IMAGE) $$($1_EXTRA_COPY_TO_IMAGE)))) + $$(eval $$(call SetupCopyFiles, COPY_DEMO_$1, \ + SRC := $$($1_SRC_BASE), \ + DEST := $(SUPPORT_OUTPUTDIR)/demos/image/$$($1_DEMO_SUBDIR)/$1, \ + FILES := $$($1_COPY_FILES), \ + )) + + $1 += $$(COPY_DEMO_$1) + + TARGETS += $$($1) endef -$(eval $(call SetupDemo,CodePointIM,jfc,,CodePointIM,,,*.html)) -$(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.services: \ - $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar \ - $(DEMO_SHARE_SRC)/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor - (cd $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM && \ - $(MKDIR) -p _the.tmp/META-INF/services && \ - $(CP) $(DEMO_SHARE_SRC)/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor _the.tmp/META-INF/services && \ - cd ./_the.tmp && \ - $(JAR) uf $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \ - cd ./META-INF/services && \ - $(JAR) uf $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor) - $(RM) -r $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.tmp - $(TOUCH) $@ +CODEPOINT_SERVICE := java.awt.im.spi.InputMethodDescriptor +CODEPOINT_METAINF_SERVICE_FILE := \ + $(SUPPORT_OUTPUTDIR)/demos/classes/jfc/CodePointIM/META-INF/services/$(CODEPOINT_SERVICE) -BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.services +$(eval $(call SetupBuildDemo, CodePointIM, \ + DEMO_SUBDIR := jfc, \ + EXTRA_COPY_TO_JAR := $(CODEPOINT_SERVICE), \ +)) + +# We also need to copy the CODEPOINT_SERVICE file to the META-INF/services +# location, and make sure the jar depends on that file to get it included. +$(CODEPOINT_METAINF_SERVICE_FILE): $(DEMO_SHARE_SRC)/jfc/CodePointIM/$(CODEPOINT_SERVICE) + $(call install-file) + +$(BUILD_DEMO_CodePointIM_JAR): $(CODEPOINT_METAINF_SERVICE_FILE) ifneq ($(OPENJDK_TARGET_OS), solaris) - $(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html *.java)) - $(eval $(call SetupDemo,WireFrame,applets,,ThreeD,,,example*.html *.java)) - $(eval $(call SetupDemo,SwingApplet,jfc,,SwingApplet,,,README* *.html)) -endif -$(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*)) -$(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt)) -$(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*)) -$(eval $(call SetupDemo,Notepad,jfc,,Notepad,,,README*)) -$(eval $(call SetupDemo,SampleTree,jfc,,SampleTree,,,README*)) -$(eval $(call SetupDemo,TableExample,jfc,,TableExample,,,README*)) -$(eval $(call SetupDemo,TransparentRuler,jfc,,transparentruler.Ruler,,,README*)) -$(eval $(call SetupDemo,jconsole-plugin,scripting,,,,,*.xml *.txt,,,,Main-Class: \n)) -$(eval $(call SetupDemo,FullThreadDump,management,,FullThreadDump,,,README*)) -$(eval $(call SetupDemo,JTop,management,,JTop,,,README*)) -$(eval $(call SetupDemo,MemoryMonitor,management,,MemoryMonitor,,,README*)) -$(eval $(call SetupDemo,VerboseGC,management,,VerboseGC,,,README*)) + $(eval $(call SetupBuildDemo, MoleculeViewer, \ + DEMO_SUBDIR := applets, \ + MAIN_CLASS := XYZChemModel, \ + EXTRA_COPY_TO_IMAGE := *.java, \ + )) -ifndef OPENJDK - $(eval $(call SetupDemo,Laffy,jfc,,,,closed/,*)) - $(eval $(call SetupDemo,SwingSet3,jfc,,,,closed/,*)) + $(eval $(call SetupBuildDemo, WireFrame, \ + DEMO_SUBDIR := applets, \ + MAIN_CLASS := ThreeD, \ + EXTRA_COPY_TO_IMAGE := *.java, \ + )) - $(eval $(call SetupDemo,Java2D,jfc,,java2d.Java2Demo,,closed/,*.html README*,Java2Demo)) - $(eval $(call SetupDemo,Stylepad,jfc,,Stylepad, \ - $(DEMO_SHARE_SRC)/jfc/Notepad,closed/,*.txt,,$(DEMO_SHARE_SRC)/jfc/Notepad/README.txt)) - $(eval $(call SetupDemo,SwingSet2,jfc,,SwingSet2,,closed/,README* *.html,,,.java COPYRIGHT, \ - SplashScreen-Image: resources/images/splash.png,true)) - - BUILD_DEMOS += $(patsubst $(DEMO_CLOSED_SHARE_SRC)/nbproject/%, \ - $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \ - $(call CacheFind, $(DEMO_CLOSED_SHARE_SRC)/nbproject)) - - $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/% - $(call install-file) - $(CHMOD) -f ug+w $@ + $(eval $(call SetupBuildDemo, SwingApplet, \ + DEMO_SUBDIR := jfc, \ + )) endif -################################################################################################## +$(eval $(call SetupBuildDemo, FileChooserDemo, \ + DEMO_SUBDIR := jfc, \ +)) + +$(eval $(call SetupBuildDemo, Font2DTest, \ + DEMO_SUBDIR := jfc, \ +)) + +$(eval $(call SetupBuildDemo, Metalworks, \ + DEMO_SUBDIR := jfc, \ +)) + +$(eval $(call SetupBuildDemo, Notepad, \ + DEMO_SUBDIR := jfc, \ +)) -# In the old makefiles, j2dbench was not compiled. -#$(eval $(call SetupDemo,J2DBench, java2d, /src, , j2dbench/J2DBench)) +$(eval $(call SetupBuildDemo, SampleTree, \ + DEMO_SUBDIR := jfc, \ +)) + +$(eval $(call SetupBuildDemo, TableExample, \ + DEMO_SUBDIR := jfc, \ +)) + +$(eval $(call SetupBuildDemo, TransparentRuler, \ + DEMO_SUBDIR := jfc, \ + MAIN_CLASS := transparentruler.Ruler, \ +)) + +$(eval $(call SetupBuildDemo, jconsole-plugin, \ + DEMO_SUBDIR := scripting, \ + SRC_SUB_DIR := src, \ + MAIN_CLASS := NONE, \ +)) + +$(eval $(call SetupBuildDemo, FullThreadDump, \ + DEMO_SUBDIR := management, \ +)) -# JVMTI demos are a bit strange and share some files, but be careful the -# shared files are just the *.c and *.h files, not the README or sample -# makefiles. So we always exclude the README.txt and sample.makefile.txt -# from the extra sources. -define SetupJVMTIDemo - # Param 1 = Name of the demo - # Param 2 = add these directories to the includes, default is agent_util - # Param 3 = extra CFLAGS - # Param 4 = C or C++ (defaults to C) - # Param 5 = libs for unix - # Param 6 = libs for windows - # Param 7 = libs for solaris - # Param 8 = libs for linux - # Param 9 = extra directories with required sources - # Param 10 = DISABLED_WARNINGS_gcc - # Param 11 = DISABLED_WARNINGS_microsoft - # Param 12 = DISABLED_WARNINGS_clang - BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \ - $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \ - $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \ - $9 - BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \ - $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, $2)) \ - $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, $2)) - BUILD_DEMO_JVMTI_$1_EXTRA_INC := $$(addprefix -I, $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC)) - ifeq (C++, $4) - BUILD_DEMO_JVMTI_$1_TOOLCHAIN := TOOLCHAIN_LINK_CXX - $1_EXTRA_CXX := $(LDFLAGS_CXX_JDK) $(LIBCXX) +$(eval $(call SetupBuildDemo, JTop, \ + DEMO_SUBDIR := management, \ +)) + +$(eval $(call SetupBuildDemo, MemoryMonitor, \ + DEMO_SUBDIR := management, \ +)) + +$(eval $(call SetupBuildDemo, VerboseGC, \ + DEMO_SUBDIR := management, \ +)) + +################################################################################ +# Build JVMTI demos. + +# Setup make rules for building a JVMTI demo. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. +# +# Remaining parameters are named arguments. These include: +# EXTRA_SRC_SUBDIR Also include these subdirectories +# TOOLCHAIN Optionally specify toolchain to use +SetupBuildJvmtiDemo = $(NamedParamsMacroTemplate) +define SetupBuildJvmtiDemoBody + $1_SRC := \ + $(DEMO_SHARE_SRC)/jvmti/$1 \ + $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, \ + agent_util $$($1_EXTRA_SRC_SUBDIR))) + + ### Build the native lib + $1_CFLAGS_INCLUDE := $$(addprefix -I, $$($1_SRC)) + + $1_CXXFLAGS := $$($1_CFLAGS_INCLUDE) $(CXXFLAGS_JDKLIB) $(CXXFLAGS_DEBUG_SYMBOLS) + + ifeq ($$($1_TOOLCHAIN), TOOLCHAIN_LINK_CXX) + # For C++, we also need some special treatment. + $1_LDFLAGS := $(LDFLAGS_CXX_JDK) + $1_LIBS := $(LIBCXX) + + ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc) + $1_CXXFLAGS := $$(filter-out -xregs=no%appl, $$($1_CXXFLAGS)) + endif endif - $1_CXXFLAGS := $(CXXFLAGS_JDKLIB) -I$(DEMO_SHARE_SRC)/jvmti/$1 \ - $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 \ - $(CXXFLAGS_DEBUG_SYMBOLS) - ifeq ($1-$(OPENJDK_TARGET_CPU_ARCH), waiters-sparc) - $1_FILTER := -xregs=no%appl - $1_CXXFLAGS := $$(filter-out $$($1_FILTER), $$($1_CXXFLAGS)) - endif - - # Workaround for CFLAGS_JDKLIB containing ',' on solaris. If this is added as 'CFLAGS' to the - # eval call below, the comma gets expanded too early. - BUILD_DEMO_JVMTI_$1_CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_DEBUG_SYMBOLS) \ - -I$(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_INC) $3 - # Remove the -incremental:no setting to get .ilk-files like in the old build. - $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1, \ - SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \ - TOOLCHAIN := $$(BUILD_DEMO_JVMTI_$1_TOOLCHAIN), \ + $$(eval $$(call SetupNativeCompilation, BUILD_DEMO_JVMTI_NATIVE_$1, \ + SRC := $$($1_SRC), \ + TOOLCHAIN := $$($1_TOOLCHAIN), \ OPTIMIZATION := LOW, \ + CFLAGS := $$($1_CFLAGS_INCLUDE) $$(CFLAGS_JDKLIB) $$(CFLAGS_DEBUG_SYMBOLS), \ CXXFLAGS := $$($1_CXXFLAGS), \ - DISABLED_WARNINGS_gcc := $(10), \ - DISABLED_WARNINGS_clang := $(12), \ - DISABLED_WARNINGS_microsoft := $(11), \ - LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \ + LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)) \ + $$($1_LDFLAGS), \ LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \ - LIBS := $$($1_EXTRA_CXX), \ - LIBS_unix := $5, \ - LIBS_linux := $8, \ - LIBS_solaris := $7 -lc, \ - LIBS_windows := $6, \ + LIBS := $$($1_LIBS), \ + LIBS_solaris := -lc, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $$(RC_FLAGS) \ -D "JDK_FNAME=$1.dll" \ -D "JDK_INTERNAL_NAME=$1" \ -D "JDK_FTYPE=0x2L", \ - OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1, \ - OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib, \ - LIBRARY := $1)) + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demos/native/jvmti/$1, \ + OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/lib, \ + LIBRARY := $1, \ + )) + + $1 += $$(BUILD_DEMO_JVMTI_NATIVE_$1) + + ### Build the jar, if we have java sources + ifneq ($$(wildcard $(DEMO_SHARE_SRC)/jvmti/$1/*.java), ) + $$(eval $$(call SetupJavaCompilation, BUILD_DEMO_JVMTI_JAVA_$1, \ + SETUP := GENERATE_USINGJDKBYTECODE, \ + SRC := $(DEMO_SHARE_SRC)/jvmti/$1, \ + BIN := $(SUPPORT_OUTPUTDIR)/demos/classes/jvmti/$1, \ + COPY := $(COPY_TO_JAR), \ + JAR := $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/$1.jar, \ + EXTRA_MANIFEST_ATTR := Main-Class: \n, \ + MANIFEST := $(DEMO_MANIFEST), \ + )) - $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \ - SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \ - EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \ - ZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip)) + $1 += $$(BUILD_DEMO_JVMTI_JAVA_$1_JAR) + endif + + ### Build the source zip + $1_EXCLUDE_FILES := \ + $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, \ + agent_util $$($1_EXTRA_SRC_SUBDIR))) \ + $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, \ + agent_util $$($1_EXTRA_SRC_SUBDIR))) - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt + $$(eval $$(call SetupZipArchive, BUILD_DEMO_JVMTI_SRC_$1, \ + SRC := $$($1_SRC), \ + EXCLUDE_FILES := $$($1_EXCLUDE_FILES), \ + ZIP := $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/src.zip, \ + )) + + $1 += $$(BUILD_DEMO_JVMTI_SRC_$1) + + # Copy files to image + $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt $$(call install-file) $(CHMOD) -f ug+w $$@ - ifneq (, $$(wildcard $(DEMO_SHARE_SRC)/jvmti/$1/*.java)) - $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_JVMTI_$1_JAVA, \ - SETUP := GENERATE_USINGJDKBYTECODE, \ - SRC := $(DEMO_SHARE_SRC)/jvmti/$1, \ - BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/jvmti/$1, \ - COPY := $(PATTERNS_TO_COPY), \ - JAR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/$1.jar, \ - EXTRA_MANIFEST_ATTR := Main-Class: \n, \ - MANIFEST := $(SUPPORT_OUTPUTDIR)/demo/java-main-manifest.mf)) + $1 += $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/README.txt + + ifeq ($(OPENJDK_TARGET_OS), windows) + # These lib and exp files normally end up in OBJECT_DIR but for demos they + # are supposed to be included in the distro. Since they are created as + # a side-effect of the library compilation, make does not know about them. + $1_SUPPORT_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/demos/native/jvmti/$1 + $1_IMAGE_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/$1/lib - BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/$1.jar + $$($1_SUPPORT_OUTPUTDIR)/$1.lib: $$(BUILD_DEMO_JVMTI_NATIVE_$1) + + $$($1_SUPPORT_OUTPUTDIR)/$1.exp: $$(BUILD_DEMO_JVMTI_NATIVE_$1) + + $$($1_IMAGE_OUTPUTDIR)/$1.lib: $$($1_SUPPORT_OUTPUTDIR)/$1.lib + $$(call install-file) + + $$($1_IMAGE_OUTPUTDIR)/$1.exp: $$($1_SUPPORT_OUTPUTDIR)/$1.exp + $$(call install-file) + + $1 += $$($1_IMAGE_OUTPUTDIR)/$1.lib $$($1_IMAGE_OUTPUTDIR)/$1.exp endif - BUILD_DEMOS += $$(BUILD_DEMO_JVMTI_$1) \ - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip \ - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt - - ifeq ($(OPENJDK_TARGET_OS), windows) - # These files normally end up in OBJECT_DIR but for demos they - # are supposed to be included in the distro. - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1) - $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.lib $$@ - - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1) - $(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.exp $$@ - - BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib \ - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp - endif + TARGETS += $$($1) endef -$(eval $(call SetupJVMTIDemo,compiledMethodLoad, agent_util)) -$(eval $(call SetupJVMTIDemo,gctest, agent_util)) -$(eval $(call SetupJVMTIDemo,heapTracker, agent_util java_crw_demo)) -$(eval $(call SetupJVMTIDemo,heapViewer, agent_util)) -$(eval $(call SetupJVMTIDemo,minst, agent_util java_crw_demo)) -$(eval $(call SetupJVMTIDemo,mtrace, agent_util java_crw_demo)) -$(eval $(call SetupJVMTIDemo,waiters, agent_util, , C++)) -$(eval $(call SetupJVMTIDemo,versionCheck, agent_util)) +$(eval $(call SetupBuildJvmtiDemo, compiledMethodLoad)) +$(eval $(call SetupBuildJvmtiDemo, gctest)) +$(eval $(call SetupBuildJvmtiDemo, heapViewer)) +$(eval $(call SetupBuildJvmtiDemo, versionCheck)) + +$(eval $(call SetupBuildJvmtiDemo, heapTracker, \ + EXTRA_SRC_SUBDIR := java_crw_demo, \ +)) + +$(eval $(call SetupBuildJvmtiDemo, minst, \ + EXTRA_SRC_SUBDIR := java_crw_demo, \ +)) -################################################################################################## +$(eval $(call SetupBuildJvmtiDemo, mtrace, \ + EXTRA_SRC_SUBDIR := java_crw_demo, \ +)) -$(SUPPORT_OUTPUTDIR)/demo/image/management/index.html: $(DEMO_SHARE_SRC)/management/index.html - $(call install-file) - $(CHMOD) -f ug+w $@ +$(eval $(call SetupBuildJvmtiDemo, waiters, \ + TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ +)) -$(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html - $(call install-file) - $(CHMOD) -f ug+w $@ +################################################################################ +# Build the Poller demo (on Solaris only). + +ifeq ($(OPENJDK_TARGET_OS), solaris) + DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris -BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html \ - $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html + $(eval $(call SetupJavaCompilation, BUILD_DEMO_JAVA_Poller, \ + SETUP := GENERATE_USINGJDKBYTECODE, \ + SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \ + BIN := $(SUPPORT_OUTPUTDIR)/demos/classes/jni/Poller, \ + HEADERS := $(SUPPORT_OUTPUTDIR)/demos/classes/jni/Poller, \ + JAR := $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/Poller.jar, \ + MANIFEST := $(SUPPORT_OUTPUTDIR)/demos/java-main-manifest.mf, \ + SRCZIP := $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/src.zip, \ + COPY := README.txt Poller.c, \ + JARMAIN := Client, \ + )) -################################################################################################## + TARGETS += $(BUILD_DEMO_JAVA_Poller) -# The netbeans project files are copied into the demo directory. -ifeq ($(OPENJDK_TARGET_OS), solaris) - BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \ - $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \ - $(filter-out $(DEMO_SHARE_SRC)/nbproject/jfc/SwingApplet%, \ - $(call CacheFind, $(DEMO_SHARE_SRC)/nbproject))) -else - BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \ - $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \ - $(call CacheFind, $(DEMO_SHARE_SRC)/nbproject)) -endif + $(eval $(call SetupNativeCompilation, BUILD_DEMO_NATIVE_Poller, \ + SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \ + OPTIMIZATION := LOW, \ + CFLAGS := $(CFLAGS_JDKLIB) \ + -I$(SUPPORT_OUTPUTDIR)/demos/classes/jni/Poller, \ + LDFLAGS := $(LDFLAGS_JDKLIB), \ + LIBS_solaris := -lc, \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demos/native/jni/Poller, \ + OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demos/native, \ + LIBRARY := Poller, \ + )) -$(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/% + TARGETS += $(BUILD_DEMO_NATIVE_Poller) + + # We can only compile native code after java has been compiled (since we + # depend on generated .h files) + $(SUPPORT_OUTPUTDIR)/demos/native/jni/Poller/Poller.o: \ + $(BUILD_DEMO_JAVA_POLLER_COMPILE_TARGETS) + + # Copy to image + $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/README.txt: \ + $(DEMO_SOLARIS_SRC)/jni/Poller/README.txt $(call install-file) $(CHMOD) -f ug+w $@ -################################################################################################## + TARGETS += $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/README.txt -$(SUPPORT_OUTPUTDIR)/demo/image/README: $(DEMO_SHARE_SRC)/README + $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/lib/libPoller.so: \ + $(SUPPORT_OUTPUTDIR)/demos/native/libPoller.so $(call install-file) -BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/README - -################################################################################################## + TARGETS += $(SUPPORT_OUTPUTDIR)/demos/image/jni/Poller/lib/libPoller.so +endif -ifeq ($(OPENJDK_TARGET_OS), solaris) +################################################################################ +# Copy html and README files. - $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/%: $(DEMO_SOLARIS_SRC)/jni/Poller/% +$(SUPPORT_OUTPUTDIR)/demos/image/management/index.html: $(DEMO_SHARE_SRC)/management/index.html $(call install-file) $(CHMOD) -f ug+w $@ - $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/README.txt: $(DEMO_SOLARIS_SRC)/jni/Poller/README.txt +$(SUPPORT_OUTPUTDIR)/demos/image/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html $(call install-file) $(CHMOD) -f ug+w $@ - $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar: \ - $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/README.txt \ - $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/Poller.c - - $(eval $(call SetupJavaCompilation,BUILD_DEMO_POLLER_JAR, \ - SETUP := GENERATE_USINGJDKBYTECODE, \ - SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \ - BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \ - HEADERS := $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \ - JAR := $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar, \ - MANIFEST := $(SUPPORT_OUTPUTDIR)/demo/java-main-manifest.mf, \ - SRCZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/src.zip, \ - COPY := README.txt Poller.c, \ - JARMAIN := Client)) - - - - BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar \ - $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/src.zip \ - $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/README.txt - - $(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER, \ - SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \ - OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ - -I$(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \ - LDFLAGS := $(LDFLAGS_JDKLIB), \ - LIBS_solaris := -lc, \ - OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jni/Poller, \ - OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native, \ - LIBRARY := Poller)) - - # - # We can only compile native code after jar has been build (since we depend on generated .h files) - # - $(SUPPORT_OUTPUTDIR)/demo/native/jni/Poller/Poller.o: $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar - - $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX): \ - $(SUPPORT_OUTPUTDIR)/demo/native/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) +$(SUPPORT_OUTPUTDIR)/demos/image/README: $(DEMO_SHARE_SRC)/README $(call install-file) - BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX) +TARGETS += $(SUPPORT_OUTPUTDIR)/demos/image/management/index.html \ + $(SUPPORT_OUTPUTDIR)/demos/image/jvmti/index.html \ + $(SUPPORT_OUTPUTDIR)/demos/image/README + +################################################################################ +# Copy netbeans project files. +$(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/% + $(call install-file) + $(CHMOD) -f ug+w $@ + +ifeq ($(OPENJDK_TARGET_OS), solaris) + TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \ + $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \ + $(filter-out $(DEMO_SHARE_SRC)/nbproject/jfc/SwingApplet%, \ + $(call CacheFind, $(DEMO_SHARE_SRC)/nbproject))) +else + TARGETS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \ + $(SUPPORT_OUTPUTDIR)/demos/image/nbproject/%, \ + $(call CacheFind, $(DEMO_SHARE_SRC)/nbproject)) endif -################################################################################################## - -ifndef OPENJDK - DB_ZIP_DIR := $(wildcard $(JDK_TOPDIR)/src/closed/db) - DB_DEMO_ZIPFILE := $(wildcard $(DB_ZIP_DIR)/*.zip) - - $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped: $(DB_DEMO_ZIPFILE) - $(MKDIR) -p $(@D) - $(RM) -r $(SUPPORT_OUTPUTDIR)/demo/image/db $(SUPPORT_OUTPUTDIR)/demo/image/demo - $(CD) $(SUPPORT_OUTPUTDIR)/demo/image && $(UNZIP) -q -o $< - $(MV) $(SUPPORT_OUTPUTDIR)/demo/image/db-derby-*-bin/demo $(SUPPORT_OUTPUTDIR)/demo/image/db - $(CD) $(SUPPORT_OUTPUTDIR)/demo/image && $(RM) -r db-derby-*-bin - $(TOUCH) $@ +################################################################################ - # Copy this after the unzip above to avoid race with directory creation and mv command. - $(SUPPORT_OUTPUTDIR)/demo/image/db/README-JDK-DEMOS.html: \ - $(DB_ZIP_DIR)/README-JDK-DEMOS.html \ - | $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped - $(MKDIR) -p $(@D) - $(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@ +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, CompileDemos.gmk)) - BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped $(SUPPORT_OUTPUTDIR)/demo/image/db/README-JDK-DEMOS.html -endif - -################################################################################################## - -all: $(BUILD_DEMOS) +all: $(TARGETS) .PHONY: all diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/gendata/GendataPolicyJars.gmk --- a/jdk/make/gendata/GendataPolicyJars.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/gendata/GendataPolicyJars.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -27,7 +27,7 @@ include $(SPEC) include MakeBase.gmk -include JavaCompilation.gmk +include JarArchive.gmk ################################################################################ @@ -57,7 +57,7 @@ endif # -# TODO fix so that SetupArchive does not write files into SRCS +# TODO fix so that SetupJarArchive does not write files into SRCS # then we don't need this extra copying # # NOTE: We currently do not place restrictions on our limited export @@ -76,13 +76,14 @@ US_EXPORT_POLICY_JAR_DEPS := \ $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy -$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, \ +$(eval $(call SetupJarArchive, BUILD_US_EXPORT_POLICY_JAR, \ DEPENDENCIES := $(US_EXPORT_POLICY_JAR_DEPS), \ SRCS := $(US_EXPORT_POLICY_JAR_TMP), \ SUFFIXES := .policy, \ JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \ - SKIP_METAINF := true)) + SKIP_METAINF := true, \ +)) $(US_EXPORT_POLICY_JAR_LIMITED): \ $(US_EXPORT_POLICY_JAR_UNLIMITED) @@ -122,7 +123,7 @@ $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy.jar # -# TODO fix so that SetupArchive does not write files into SRCS +# TODO fix so that SetupJarArchive does not write files into SRCS # then we don't need this extra copying # LOCAL_POLICY_JAR_LIMITED_TMP := \ @@ -138,22 +139,24 @@ $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited/% $(install-file) -$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \ +$(eval $(call SetupJarArchive, BUILD_LOCAL_POLICY_JAR_LIMITED, \ DEPENDENCIES := $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \ $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \ SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \ SUFFIXES := .policy, \ JAR := $(LOCAL_POLICY_JAR_LIMITED), \ EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \ - SKIP_METAINF := true)) + SKIP_METAINF := true, \ +)) -$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \ +$(eval $(call SetupJarArchive, BUILD_LOCAL_POLICY_JAR_UNLIMITED, \ DEPENDENCIES := $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \ SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \ SUFFIXES := .policy, \ JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \ EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \ - SKIP_METAINF := true)) + SKIP_METAINF := true, \ +)) TARGETS += $(LOCAL_POLICY_JAR_LIMITED) $(LOCAL_POLICY_JAR_UNLIMITED) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-java.base.gmk --- a/jdk/make/launcher/Launcher-java.base.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-java.base.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -25,32 +25,51 @@ include LauncherCommon.gmk +JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common +ifdef OPENJDK + JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons" +else + JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" +endif + ################################################################################ # On windows, the debuginfo files get the same name as for java.dll. Build # into another dir and copy selectively so debuginfo for java.dll isn't # overwritten. -$(eval $(call SetupLauncher,java, \ - -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \ - $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \ - $(JAVA_VERSION_INFO_RESOURCE), $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs,true)) +$(eval $(call SetupBuildLauncher, java, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \ + LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR), \ + LIBS_windows := user32.lib comctl32.lib, \ + RC_FLAGS := $(JAVA_RC_FLAGS), \ + VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \ + OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs, \ + OPTIMIZATION := HIGH, \ + WINDOWS_STATIC_LINK := true, \ + NO_JAVA_MS := true, \ +)) $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java) $(MKDIR) -p $(@D) $(RM) $@ - $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@ + $(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs/java$(EXE_SUFFIX) $@ TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX) ifeq ($(OPENJDK_TARGET_OS), windows) - $(eval $(call SetupLauncher,javaw, \ - -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES,,,user32.lib comctl32.lib, \ - $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \ - $(JAVA_VERSION_INFO_RESOURCE),,true)) + $(eval $(call SetupBuildLauncher, javaw, \ + CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \ + LIBS_windows := user32.lib comctl32.lib, \ + RC_FLAGS := $(JAVA_RC_FLAGS), \ + VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \ + WINDOWS_STATIC_LINK := true, \ + NO_JAVA_MS := true, \ + )) endif -$(eval $(call SetupLauncher,keytool, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.keytool.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, keytool, \ + MAIN_CLASS := sun.security.tools.keytool.Main, \ +)) ################################################################################ diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-java.corba.gmk --- a/jdk/make/launcher/Launcher-java.corba.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-java.corba.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,23 +25,26 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,idlj, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.corba.se.idl.toJavaPortable.Compile"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, idlj, \ + MAIN_CLASS := com.sun.tools.corba.se.idl.toJavaPortable.Compile, \ +)) -$(eval $(call SetupLauncher,orbd, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \ - "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \ - "-J-Dcom.sun.CORBA.activation.Port=1049"$(COMMA) \ - "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \ - "com.sun.corba.se.impl.activation.ORBD"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, orbd, \ + MAIN_CLASS := com.sun.corba.se.impl.activation.ORBD, \ + JAVA_ARGS := \ + -Dcom.sun.CORBA.activation.DbDir=./orb.db \ + -Dcom.sun.CORBA.activation.Port=1049 \ + -Dcom.sun.CORBA.POA.ORBServerId=1, \ +)) -$(eval $(call SetupLauncher,servertool, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.corba.se.impl.activation.ServerTool"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, servertool, \ + MAIN_CLASS := com.sun.corba.se.impl.activation.ServerTool, \ +)) -$(eval $(call SetupLauncher,tnameserv, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \ - "-J-Dcom.sun.CORBA.activation.DbDir=./orb.db"$(COMMA) \ - "-J-Djava.util.logging.LoggingPermission=contol"$(COMMA) \ - "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \ - "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, tnameserv, \ + MAIN_CLASS := com.sun.corba.se.impl.naming.cosnaming.TransientNameServer, \ + JAVA_ARGS := \ + -Dcom.sun.CORBA.activation.DbDir=./orb.db \ + -Djava.util.logging.LoggingPermission=contol \ + -Dcom.sun.CORBA.POA.ORBServerId=1, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-java.desktop.gmk --- a/jdk/make/launcher/Launcher-java.desktop.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-java.desktop.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ $(eval $(call IncludeCustomExtension, jdk, launcher/Launcher-java.desktop.gmk)) ifndef BUILD_HEADLESS_ONLY - $(eval $(call SetupLauncher,appletviewer, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.applet.Main"$(COMMA) }',, \ - $(XLIBS))) + $(eval $(call SetupBuildLauncher, appletviewer, \ + MAIN_CLASS := sun.applet.Main, \ + LIBS_unix := $(X_LIBS), \ + )) endif - diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-java.rmi.gmk --- a/jdk/make/launcher/Launcher-java.rmi.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-java.rmi.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,39 +25,10 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,rmid, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.server.Activation"$(COMMA) }')) - -$(eval $(call SetupLauncher,rmiregistry, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.registry.RegistryImpl"$(COMMA) }')) - -########################################################################################## +$(eval $(call SetupBuildLauncher, rmid, \ + MAIN_CLASS := sun.rmi.server.Activation, \ +)) -# -# The java-rmi.cgi script in bin/ only gets delivered in certain situations -# -JAVA_RMI_CGI := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/java-rmi.cgi -ifeq ($(OPENJDK_TARGET_OS), linux) - TARGETS += $(JAVA_RMI_CGI) -endif -ifeq ($(OPENJDK_TARGET_OS), solaris) - TARGETS += $(JAVA_RMI_CGI) -endif - -# TODO: -# On windows java-rmi.cgi shouldn't be bundled since Java 1.2, but has been built all -# this time anyway. Since jdk6, it has been built from the wrong source and resulted -# in a (almost) copy of the standard java launcher named "java-rmi.exe" ending up in -# the final images bin dir. This weird behavior is mimicked here in the converted -# makefiles for now. Should probably just be deleted. -# http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6512052 -ifeq ($(OPENJDK_TARGET_OS), windows) - $(eval $(call SetupLauncher,java-rmi, , \ - $(call SET_SHARED_LIBRARY_MAPFILE,$(JDK_TOPDIR)/make/java/main/java/mapfile-$(OPENJDK_TARGET_CPU)),,,,,,,,,RMI)) -else - $(JAVA_RMI_CGI): $(JDK_TOPDIR)/src/java.rmi/unix/bin/java-rmi.cgi.sh - $(call install-file) - $(CHMOD) a+x $@ -endif - -########################################################################################## +$(eval $(call SetupBuildLauncher, rmiregistry, \ + MAIN_CLASS := sun.rmi.registry.RegistryImpl, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-java.scripting.gmk --- a/jdk/make/launcher/Launcher-java.scripting.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-java.scripting.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,6 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jrunscript, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, jrunscript, \ + MAIN_CLASS := com.sun.tools.script.shell.Main, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-java.security.jgss.gmk --- a/jdk/make/launcher/Launcher-java.security.jgss.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-java.security.jgss.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -26,13 +26,15 @@ include LauncherCommon.gmk ifeq ($(OPENJDK_TARGET_OS), windows) - $(eval $(call SetupLauncher,kinit, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Kinit"$(COMMA) }')) + $(eval $(call SetupBuildLauncher, kinit, \ + MAIN_CLASS := sun.security.krb5.internal.tools.Kinit, \ + )) - $(eval $(call SetupLauncher,klist, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Klist"$(COMMA) }')) + $(eval $(call SetupBuildLauncher, klist, \ + MAIN_CLASS := sun.security.krb5.internal.tools.Klist, \ + )) - $(eval $(call SetupLauncher,ktab, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }')) + $(eval $(call SetupBuildLauncher, ktab, \ + MAIN_CLASS := sun.security.krb5.internal.tools.Ktab, \ + )) endif - diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.compiler.gmk --- a/jdk/make/launcher/Launcher-jdk.compiler.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.compiler.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,26 +25,30 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,javac, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, javac, \ + MAIN_CLASS := com.sun.tools.javac.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ +)) -$(eval $(call SetupLauncher,javah, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javah.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, javah, \ + MAIN_CLASS := com.sun.tools.javah.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ +)) -$(eval $(call SetupLauncher,serialver, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, serialver, \ + MAIN_CLASS := sun.tools.serialver.SerialVer, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ +)) ifeq ($(ENABLE_SJAVAC), yes) # Build sjavac directly to the exploded image so that it does not get included # into any real images - $(eval $(call SetupLauncher,sjavac, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }',,,,,,, \ - $(JDK_OUTPUTDIR)/bin)) + $(eval $(call SetupBuildLauncher, sjavac, \ + MAIN_CLASS := com.sun.tools.sjavac.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ + OUTPUT_DIR := $(JDK_OUTPUTDIR)/bin, \ + )) endif diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.dev.gmk --- a/jdk/make/launcher/Launcher-jdk.dev.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.dev.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,5 +25,6 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jimage,\ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.tools.jimage.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jimage,\ + MAIN_CLASS := jdk.tools.jimage.Main, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk --- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,13 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jsadebugd, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \ - ,,,,,,,,,Info-privileged.plist)) +$(eval $(call SetupBuildLauncher, jsadebugd, \ + MAIN_CLASS := sun.jvm.hotspot.jdi.SADebugServer, \ + MACOSX_SIGNED := true, \ +)) -$(eval $(call SetupLauncher,jhsdb, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \ - ,,,,,,,,,Info-privileged.plist)) - +$(eval $(call SetupBuildLauncher, jhsdb, \ + MAIN_CLASS := sun.jvm.hotspot.SALauncher, \ + MACOSX_SIGNED := true, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jartool.gmk --- a/jdk/make/launcher/Launcher-jdk.jartool.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jartool.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -25,8 +25,10 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jar, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jar, \ + MAIN_CLASS := sun.tools.jar.Main, \ +)) -$(eval $(call SetupLauncher,jarsigner, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jarsigner, \ + MAIN_CLASS := sun.security.tools.jarsigner.Main, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.javadoc.gmk --- a/jdk/make/launcher/Launcher-jdk.javadoc.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.javadoc.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,javadoc, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, javadoc, \ + MAIN_CLASS := com.sun.tools.javadoc.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jcmd.gmk --- a/jdk/make/launcher/Launcher-jdk.jcmd.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jcmd.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,36 +25,41 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jinfo, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \ - "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \ - "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \ - "sun.tools.jinfo.JInfo"$(COMMA) }' \ - -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \ - ,,,,,,,,,Info-privileged.plist)) +$(eval $(call SetupBuildLauncher, jinfo, \ + MAIN_CLASS := sun.tools.jinfo.JInfo, \ + JAVA_ARGS := \ + -Dsun.jvm.hotspot.debugger.useProcDebugger \ + -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \ + APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \ + MACOSX_SIGNED := true, \ +)) -$(eval $(call SetupLauncher,jmap, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \ - "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \ - "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \ - "sun.tools.jmap.JMap"$(COMMA) }' \ - -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \ - ,,,,,,,,,Info-privileged.plist)) +$(eval $(call SetupBuildLauncher, jmap, \ + MAIN_CLASS := sun.tools.jmap.JMap, \ + JAVA_ARGS := \ + -Dsun.jvm.hotspot.debugger.useProcDebugger \ + -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \ + APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \ + MACOSX_SIGNED := true, \ +)) -$(eval $(call SetupLauncher,jps, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jps.Jps"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jps, \ + MAIN_CLASS := sun.tools.jps.Jps, \ +)) -$(eval $(call SetupLauncher,jstack, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) \ - "-J-Dsun.jvm.hotspot.debugger.useProcDebugger"$(COMMA) \ - "-J-Dsun.jvm.hotspot.debugger.useWindbgDebugger"$(COMMA) \ - "sun.tools.jstack.JStack"$(COMMA) }' \ - -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \ - ,,,,,,,,,Info-privileged.plist)) +$(eval $(call SetupBuildLauncher, jstack, \ + MAIN_CLASS := sun.tools.jstack.JStack, \ + JAVA_ARGS := \ + -Dsun.jvm.hotspot.debugger.useProcDebugger \ + -Dsun.jvm.hotspot.debugger.useWindbgDebugger, \ + APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \ + MACOSX_SIGNED := true, \ +)) -$(eval $(call SetupLauncher,jstat, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstat.Jstat"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jstat, \ + MAIN_CLASS := sun.tools.jstat.Jstat, \ +)) -$(eval $(call SetupLauncher,jcmd, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, jcmd, \ + MAIN_CLASS := sun.tools.jcmd.JCmd, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jconsole.gmk --- a/jdk/make/launcher/Launcher-jdk.jconsole.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jconsole.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -25,9 +25,10 @@ include LauncherCommon.gmk -BUILD_LAUNCHER_jconsole_CFLAGS_windows := -DJAVAW -BUILD_LAUNCHER_jconsole_LIBS_windows := user32.lib - -$(eval $(call SetupLauncher,jconsole, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \ - -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }')) +$(eval $(call SetupBuildLauncher, jconsole, \ + MAIN_CLASS := sun.tools.jconsole.JConsole, \ + JAVA_ARGS := -Djconsole.showOutputViewer, \ + APP_CLASSPATH := /lib/jconsole.jar /lib/tools.jar /classes, \ + CFLAGS_windows := -DJAVAW, \ + LIBS_windows := user32.lib, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jdeps.gmk --- a/jdk/make/launcher/Launcher-jdk.jdeps.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jdeps.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -25,12 +25,14 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,javap, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javap.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, javap, \ + MAIN_CLASS := com.sun.tools.javap.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ +)) -$(eval $(call SetupLauncher,jdeps, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jdeps, \ + MAIN_CLASS := com.sun.tools.jdeps.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jdi.gmk --- a/jdk/make/launcher/Launcher-jdk.jdi.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jdi.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jdb, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \ - -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }')) - +$(eval $(call SetupBuildLauncher, jdb, \ + MAIN_CLASS := com.sun.tools.example.debug.tty.TTY, \ + APP_CLASSPATH := /lib/tools.jar /lib/sa-jdi.jar /classes, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jshell.gmk --- a/jdk/make/launcher/Launcher-jdk.jshell.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jshell.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -25,7 +25,8 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jshell, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.internal.jshell.tool.JShellTool"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, jshell, \ + MAIN_CLASS := jdk.internal.jshell.tool.JShellTool, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS \ + -DNEVER_ACT_AS_SERVER_CLASS_MACHINE, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.jvmstat.gmk --- a/jdk/make/launcher/Launcher-jdk.jvmstat.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.jvmstat.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,6 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jstatd, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, jstatd, \ + MAIN_CLASS := sun.tools.jstatd.Jstatd, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.pack200.gmk --- a/jdk/make/launcher/Launcher-jdk.pack200.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -25,8 +25,9 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,pack200, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.java.util.jar.pack.Driver"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, pack200, \ + MAIN_CLASS := com.sun.java.util.jar.pack.Driver, \ +)) ################################################################################ # The order of the object files on the link command line affects the size of the resulting @@ -92,7 +93,7 @@ $(call SET_SHARED_LIBRARY_ORIGIN), \ LIBS := $(UNPACKEXE_LIBS) $(LIBCXX), \ LIBS_solaris := -lc, \ - OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe, \ OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \ PROGRAM := unpack200, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.policytool.gmk --- a/jdk/make/launcher/Launcher-jdk.policytool.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.policytool.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,8 @@ include LauncherCommon.gmk ifndef BUILD_HEADLESS_ONLY - $(eval $(call SetupLauncher,policytool, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \ - $(XLIBS))) + $(eval $(call SetupBuildLauncher, policytool, \ + MAIN_CLASS := sun.security.tools.policytool.PolicyTool, \ + LIBS_unix := $(X_LIBS), \ + )) endif diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.rmic.gmk --- a/jdk/make/launcher/Launcher-jdk.rmic.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.rmic.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,rmic, \ - -DEXPAND_CLASSPATH_WILDCARDS \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, rmic, \ + MAIN_CLASS := sun.rmi.rmic.Main, \ + CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk --- a/jdk/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.scripting.nashorn.shell.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,jjs, \ - -DENABLE_ARG_FILES \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.jjs.Main"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, jjs, \ + MAIN_CLASS := jdk.nashorn.tools.jjs.Main, \ + CFLAGS := -DENABLE_ARG_FILES, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.xml.bind.gmk --- a/jdk/make/launcher/Launcher-jdk.xml.bind.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.xml.bind.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,10 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,schemagen, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.jxc.SchemaGenerator"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, schemagen, \ + MAIN_CLASS := com.sun.tools.internal.jxc.SchemaGenerator, \ +)) -$(eval $(call SetupLauncher,xjc, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, xjc, \ + MAIN_CLASS := com.sun.tools.internal.xjc.Driver, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/Launcher-jdk.xml.ws.gmk --- a/jdk/make/launcher/Launcher-jdk.xml.ws.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/Launcher-jdk.xml.ws.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,10 @@ include LauncherCommon.gmk -$(eval $(call SetupLauncher,wsgen, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsGen"$(COMMA) }')) +$(eval $(call SetupBuildLauncher, wsgen, \ + MAIN_CLASS := com.sun.tools.internal.ws.WsGen, \ +)) -$(eval $(call SetupLauncher,wsimport, \ - -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }')) - +$(eval $(call SetupBuildLauncher, wsimport, \ + MAIN_CLASS := com.sun.tools.internal.ws.WsImport, \ +)) diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/launcher/LauncherCommon.gmk --- a/jdk/make/launcher/LauncherCommon.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/launcher/LauncherCommon.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -28,28 +28,17 @@ # Prepare the find cache. $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher)) -# When building a legacy overlay image (on solaris 64 bit), the launchers -# need to be built with a different rpath and a different output dir. -ifeq ($(OVERLAY_IMAGES), true) - ORIGIN_ROOT := /../.. - OUTPUT_SUBDIR := $(OPENJDK_TARGET_CPU_ISADIR) -else - ORIGIN_ROOT := /.. -endif - ifeq ($(OPENJDK_TARGET_OS), macosx) ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN) else - ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) -endif + ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli) -# -# Applications expect to be able to link against libjawt without invoking -# System.loadLibrary("jawt") first. This was the behaviour described in the -# devloper documentation of JAWT and what worked with OpenJDK6. -# -ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) - ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,$(ORIGIN_ROOT)/lib$(OPENJDK_TARGET_CPU_LIBDIR)) + # Applications expect to be able to link against libjawt without invoking + # System.loadLibrary("jawt") first. This was the behaviour described in the + # devloper documentation of JAWT and what worked with OpenJDK6. + ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), ) + ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib$(OPENJDK_TARGET_CPU_LIBDIR)) + endif endif LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher @@ -61,51 +50,78 @@ GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc JAVA_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.rc MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher -# Until the shuffle is permanent, we can't add this in configure -CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE)) -CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include -CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE)) -CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \ - -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest -define SetupLauncher - # TODO: Fix mapfile on solaris. Won't work with ld as linker. - # Parameter 1 is the name of the launcher (java, javac, jar...) - # Parameter 2 is extra CFLAGS - # Parameter 3 is extra LDFLAGS - # Parameter 4 is extra LIBS_unix - # Parameter 5 is extra LIBS_windows - # Parameter 6 is optional Windows JLI library (full path) - # Parameter 7 is optional Windows resource (RC) flags - # Parameter 8 is optional Windows version resource file (.rc) - # Parameter 9 is different output dir - # Parameter 10 if set, link statically with c runtime on windows. - # Parameter 11 if set, override plist file on macosx. - $(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11)) - $(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk)) +################################################################################ +# Build standard launcher. - $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib - ifneq ($6, ) - $1_WINDOWS_JLI_LIB := $6 - endif - $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE) - ifneq ($8, ) - $1_VERSION_INFO_RESOURCE := $8 +# Setup make rules for building a standard launcher. +# +# Parameter 1 is the name of the rule. This name is used as variable prefix, +# and the targets generated are listed in a variable by that name. It is also +# used as the name of the executable. +# +# Remaining parameters are named arguments. These include: +# MAIN_CLASS The Java main class to launch +# JAVA_ARGS Processed into a -DJAVA_ARGS C flag +# APP_CLASSPATH Processed into a -DAPP_CLASSPATH C flag +# CFLAGS Additional CFLAGS +# CFLAGS_windows Additional CFLAGS_windows +# LIBS_unix Additional LIBS_unix +# LIBS_windows Additional LIBS_windows +# LDFLAGS_solaris Additional LDFLAGS_solaris +# RC_FLAGS Additional RC_FLAGS +# MACOSX_SIGNED On macosx, sign this binary +# WINDOWS_STATIC_LINK On windows, link statically with C runtime and libjli. +# OPTIMIZATION Override default optimization level (LOW) +# OUTPUT_DIR Override default output directory +# VERSION_INFO_RESOURCE Override default Windows resource file +# NO_JAVA_MS Do not add -ms8m to JAVA_ARGS. +SetupBuildLauncher = $(NamedParamsMacroTemplate) +define SetupBuildLauncherBody + # Setup default values (unless overridden) + ifeq ($$($1_VERSION_INFO_RESOURCE), ) + $1_VERSION_INFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE) endif - $1_LDFLAGS := $3 + ifeq ($$($1_OUTPUT_DIR), ) + $1_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) + endif + + ifeq ($$($1_OPTIMIZATION), ) + $1_OPTIMIZATION := LOW + endif + + ifneq ($$($1_NO_JAVA_MS), true) + # The norm is to append -ms8m, unless otherwise instructed. + $1_JAVA_ARGS += -ms8m + endif + + ifneq ($$($1_JAVA_ARGS), ) + $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \ + $$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_MAIN_CLASS), "$$a"$(COMMA) )) }' + $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR) + endif + + ifneq ($$($1_APP_CLASSPATH), ) + $1_APP_CLASSPATH_STR := '{ $$(strip $$(foreach a, \ + $$($1_APP_CLASSPATH), "$$a"$(COMMA) )) }' + # Remove the trailing comma + $1_APP_CLASSPATH_STR := $$(strip $$(subst $$(COMMA) }', }', \ + $$($1_APP_CLASSPATH_STR))) + $1_CFLAGS += -DAPP_CLASSPATH=$$($1_APP_CLASSPATH_STR) + endif + $1_LIBS := ifeq ($(OPENJDK_TARGET_OS), macosx) - $1_PLIST_FILE := Info-cmdline.plist - ifneq ($(11), ) - $1_PLIST_FILE := $(11) - ifneq ($$(findstring privileged, $$($1_PLIST_FILE)), ) + ifeq ($$($1_MACOSX_SIGNED), true) + $1_PLIST_FILE := Info-privileged.plist $1_CODESIGN := true - endif + else + $1_PLIST_FILE := Info-cmdline.plist endif + $1_CFLAGS += -DPACKAGE_PATH='"$(PACKAGE_PATH)"' $1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \ -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE) $1_LIBS += -framework Cocoa -framework Security \ @@ -121,22 +137,12 @@ $1_LIBS += -lz endif - $1_OUTPUT_DIR_ARG := $9 - ifeq (, $$($1_OUTPUT_DIR_ARG)) - $1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) - endif - - # TODO: maybe it's better to move this if-statement out of this function - ifeq ($1, java) - $1_OPTIMIZATION_ARG := HIGH - $1_LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR) + ifeq ($$($1_WINDOWS_STATIC_LINK), true) + $1_CFLAGS += $(filter-out -MD, $(CFLAGS_JDKEXE)) + $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib else - $1_OPTIMIZATION_ARG := LOW - endif - - $1_CFLAGS := $(CFLAGS_JDKEXE) - ifeq ($(10), true) - $1_CFLAGS := $(filter-out -MD, $(CFLAGS_JDKEXE)) + $1_CFLAGS += $(CFLAGS_JDKEXE) + $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib endif # The linker on older SuSE distros (e.g. on SLES 10) complains with: @@ -156,22 +162,23 @@ endif endif - $(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \ + $$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \ SRC := $(LAUNCHER_SRC), \ INCLUDE_FILES := main.c, \ - OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \ + OPTIMIZATION := $$($1_OPTIMIZATION), \ CFLAGS := $$($1_CFLAGS) \ $(LAUNCHER_CFLAGS) \ -DFULL_VERSION='"$(FULL_VERSION)"' \ -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \ -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \ -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \ - -DPROGNAME='"$1"' $(DPACKAGEPATH) \ - $2, \ + -DPROGNAME='"$1"' \ + $$($1_CFLAGS), \ CFLAGS_linux := -fPIC, \ CFLAGS_solaris := -KPIC -DHAVE_GETHRTIME, \ + CFLAGS_windows := $$($1_CFLAGS_windows), \ LDFLAGS := $(LDFLAGS_JDKEXE) \ - $(ORIGIN_ARG) \ + $$(ORIGIN_ARG) \ $$($1_LDFLAGS), \ LDFLAGS_linux := \ $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)) \ @@ -182,27 +189,29 @@ -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli, \ MAPFILE := $$($1_MAPFILE), \ LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \ - LIBS_unix := $4, \ + LIBS_unix := $$($1_LIBS_unix), \ LIBS_linux := -lpthread -ljli $(LIBDL) -lc, \ LIBS_solaris := -ljli -lthread $(LIBDL) -lc, \ LIBS_windows := $$($1_WINDOWS_JLI_LIB) \ - $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \ - OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \ - OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \ + $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \ + $$($1_LIBS_windows), \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \ + OUTPUT_DIR := $$($1_OUTPUT_DIR), \ PROGRAM := $1, \ DEBUG_SYMBOLS := true, \ VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \ - RC_FLAGS := $(RC_FLAGS) \ + RC_FLAGS := $$(RC_FLAGS) \ -D "JDK_FNAME=$1$(EXE_SUFFIX)" \ -D "JDK_INTERNAL_NAME=$1" \ -D "JDK_FTYPE=0x1L" \ - $7, \ + $$($1_RC_FLAGS), \ MANIFEST := $(JAVA_MANIFEST), \ MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \ CODESIGN := $$($1_CODESIGN), \ - ) + )) - TARGETS += $$(BUILD_LAUNCHER_$1) + $1 += $$(BUILD_LAUNCHER_$1) + TARGETS += $$($1) ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix)) $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a @@ -213,18 +222,3 @@ $$($1_WINDOWS_JLI_LIB) endif endef - -########################################################################################## - -XLIBS := $(X_LIBS) -lX11 -ifeq ($(OPENJDK_TARGET_OS), macosx) - DPACKAGEPATH := -DPACKAGE_PATH='"$(PACKAGE_PATH)"' - XLIBS := -endif - -JAVA_RC_FLAGS += -i $(JDK_TOPDIR)/src/java.base/windows/native/common -ifdef OPENJDK - JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/java.base/windows/native/launcher/icons" -else - JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons" -endif diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/lib/Awt2dLibraries.gmk --- a/jdk/make/lib/Awt2dLibraries.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/lib/Awt2dLibraries.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -890,9 +890,9 @@ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \ LDFLAGS := $(LIBSPLASHSCREEN_LDFLAGS) $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ - LIBS := $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \ + LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ) \ $(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \ - LIBS_solaris := -lc, \ + LIBS_aix := -liconv, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ -D "JDK_FNAME=splashscreen.dll" \ diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/lib/CoreLibraries.gmk --- a/jdk/make/lib/CoreLibraries.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/lib/CoreLibraries.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -139,6 +139,12 @@ endif endif +ifeq ($(OPENJDK_TARGET_OS), linux) + ifeq ($(OPENJDK_TARGET_CPU), x86_64) + BUILD_LIBJAVA_Bits.c_CFLAGS := $(C_O_FLAG_NORM) + endif +endif + $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \ LIBRARY := java, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/lib/Lib-java.instrument.gmk --- a/jdk/make/lib/Lib-java.instrument.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/lib/Lib-java.instrument.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -68,10 +68,11 @@ LDFLAGS_macosx := -Xlinker -all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a, \ LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \ LDFLAGS_windows := -export:Agent_OnAttach, \ + LIBS := $(JDKLIB_LIBS), \ LIBS_unix := -ljava $(LIBZ), \ LIBS_linux := -ljli $(LIBDL), \ - LIBS_solaris := -ljli $(LIBDL) -lc, \ - LIBS_aix := -ljli_static $(LIBDL),\ + LIBS_solaris := -ljli $(LIBDL), \ + LIBS_aix := -liconv -ljli_static $(LIBDL), \ LIBS_macosx := -liconv -framework Cocoa -framework Security \ -framework ApplicationServices, \ LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib \ diff -r 77273343c131 -r d8b2864e0ec4 jdk/make/lib/Lib-jdk.jdwp.agent.gmk --- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk Wed Jul 05 20:58:59 2017 +0200 @@ -84,10 +84,11 @@ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjdwp/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ + LIBS := $(JDKLIB_LIBS), \ LIBS_linux := $(LIBDL), \ - LIBS_solaris := $(LIBDL) -lc, \ + LIBS_solaris := $(LIBDL), \ LIBS_macosx := -liconv, \ - LIBS_windows := $(JDKLIB_LIBS), \ + LIBS_aix := -liconv, \ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ RC_FLAGS := $(RC_FLAGS) \ -D "JDK_FNAME=jdwp.dll" \ diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/java/lang/Byte.java --- a/jdk/src/java.base/share/classes/java/lang/Byte.java Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/lang/Byte.java Wed Jul 05 20:58:59 2017 +0200 @@ -463,6 +463,22 @@ } /** + * Compares two {@code byte} values numerically treating the values + * as unsigned. + * + * @param x the first {@code byte} to compare + * @param y the second {@code byte} to compare + * @return the value {@code 0} if {@code x == y}; a value less + * than {@code 0} if {@code x < y} as unsigned values; and + * a value greater than {@code 0} if {@code x > y} as + * unsigned values + * @since 9 + */ + public static int compareUnsigned(byte x, byte y) { + return Byte.toUnsignedInt(x) - Byte.toUnsignedInt(y); + } + + /** * Converts the argument to an {@code int} by an unsigned * conversion. In an unsigned conversion to an {@code int}, the * high-order 24 bits of the {@code int} are zero and the diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/java/lang/Deprecated.java --- a/jdk/src/java.base/share/classes/java/lang/Deprecated.java Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/lang/Deprecated.java Wed Jul 05 20:58:59 2017 +0200 @@ -36,7 +36,7 @@ * *
Use of the @Deprecated annotation on a local variable * declaration or on a parameter declaration or a package declaration - * has no effect. + * has no effect on the warnings issued by a compiler. * * @author Neal Gafter * @since 1.5 diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/java/lang/Short.java --- a/jdk/src/java.base/share/classes/java/lang/Short.java Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/lang/Short.java Wed Jul 05 20:58:59 2017 +0200 @@ -468,6 +468,22 @@ } /** + * Compares two {@code short} values numerically treating the values + * as unsigned. + * + * @param x the first {@code short} to compare + * @param y the second {@code short} to compare + * @return the value {@code 0} if {@code x == y}; a value less + * than {@code 0} if {@code x < y} as unsigned values; and + * a value greater than {@code 0} if {@code x > y} as + * unsigned values + * @since 9 + */ + public static int compareUnsigned(short x, short y) { + return Short.toUnsignedInt(x) - Short.toUnsignedInt(y); + } + + /** * The number of bits used to represent a {@code short} value in two's * complement binary form. * @since 1.5 diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Wed Jul 05 20:58:59 2017 +0200 @@ -66,15 +66,15 @@ private static final String NAME_METHOD_WRITE_REPLACE = "writeReplace"; private static final String NAME_METHOD_READ_OBJECT = "readObject"; private static final String NAME_METHOD_WRITE_OBJECT = "writeObject"; + + private static final String DESCR_CLASS = "Ljava/lang/Class;"; + private static final String DESCR_STRING = "Ljava/lang/String;"; + private static final String DESCR_OBJECT = "Ljava/lang/Object;"; private static final String DESCR_CTOR_SERIALIZED_LAMBDA - = MethodType.methodType(void.class, - Class.class, - String.class, String.class, String.class, - int.class, String.class, String.class, String.class, - String.class, - Object[].class).toMethodDescriptorString(); - private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION - = MethodType.methodType(void.class, String.class).toMethodDescriptorString(); + = "(" + DESCR_CLASS + DESCR_STRING + DESCR_STRING + DESCR_STRING + "I" + + DESCR_STRING + DESCR_STRING + DESCR_STRING + DESCR_STRING + "[" + DESCR_OBJECT + ")V"; + + private static final String DESCR_CTOR_NOT_SERIALIZABLE_EXCEPTION = "(Ljava/lang/String;)V"; private static final String[] SER_HOSTILE_EXCEPTIONS = new String[] {NAME_NOT_SERIALIZABLE_EXCEPTION}; diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java Wed Jul 05 20:58:59 2017 +0200 @@ -1187,20 +1187,23 @@ // store them into the implementation-specific final fields. checkRtype(rtype); checkPtypes(ptypes); - UNSAFE.putObject(this, rtypeOffset, rtype); - UNSAFE.putObject(this, ptypesOffset, ptypes); + UNSAFE.putObject(this, OffsetHolder.rtypeOffset, rtype); + UNSAFE.putObject(this, OffsetHolder.ptypesOffset, ptypes); } - // Support for resetting final fields while deserializing - private static final long rtypeOffset, ptypesOffset; - static { - try { - rtypeOffset = UNSAFE.objectFieldOffset - (MethodType.class.getDeclaredField("rtype")); - ptypesOffset = UNSAFE.objectFieldOffset - (MethodType.class.getDeclaredField("ptypes")); - } catch (Exception ex) { - throw new Error(ex); + // Support for resetting final fields while deserializing. Implement Holder + // pattern to make the rarely needed offset calculation lazy. + private static class OffsetHolder { + private static final long rtypeOffset, ptypesOffset; + static { + try { + rtypeOffset = UNSAFE.objectFieldOffset + (MethodType.class.getDeclaredField("rtype")); + ptypesOffset = UNSAFE.objectFieldOffset + (MethodType.class.getDeclaredField("ptypes")); + } catch (Exception ex) { + throw new Error(ex); + } } } diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/java/util/Arrays.java --- a/jdk/src/java.base/share/classes/java/util/Arrays.java Wed Jul 05 20:58:49 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/util/Arrays.java Wed Jul 05 20:58:59 2017 +0200 @@ -25,6 +25,8 @@ package java.util; +import jdk.internal.HotSpotIntrinsicCandidate; + import java.lang.reflect.Array; import java.util.concurrent.ForkJoinPool; import java.util.function.BinaryOperator; @@ -42,7 +44,6 @@ import java.util.stream.LongStream; import java.util.stream.Stream; import java.util.stream.StreamSupport; -import jdk.internal.HotSpotIntrinsicCandidate; /** * This class contains various methods for manipulating arrays (such as @@ -2586,6 +2587,55 @@ } /** + * Returns true if the two specified arrays of longs, over the specified + * ranges, are equal to one another. + * + *
Two arrays are considered equal if the number of elements covered by + * each range is the same, and all corresponding pairs of elements over the + * specified ranges in the two arrays are equal. In other words, two arrays + * are equal if they contain, over the specified ranges, the same elements + * in the same order. + * + * @param a the first array to be tested for equality + * @param aFromIndex the index (inclusive) of the first element in the + * first array to be tested + * @param aToIndex the index (exclusive) of the last element in the + * first array to be tested + * @param b the second array to be tested fro equality + * @param bFromIndex the index (inclusive) of the first element in the + * second array to be tested + * @param bToIndex the index (exclusive) of the last element in the + * second array to be tested + * @return {@code true} if the two arrays, over the specified ranges, are + * equal + * @throws IllegalArgumentException + * if {@code aFromIndex > aToIndex} or + * if {@code bFromIndex > bToIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code aFromIndex < 0 or aToIndex > a.length} or + * if {@code bFromIndex < 0 or bToIndex > b.length} + * @throws NullPointerException + * if either array is {@code null} + * @since 9 + */ + public static boolean equals(long[] a, int aFromIndex, int aToIndex, + long[] b, int bFromIndex, int bToIndex) { + rangeCheck(a.length, aFromIndex, aToIndex); + rangeCheck(b.length, bFromIndex, bToIndex); + + int aLength = aToIndex - aFromIndex; + int bLength = bToIndex - bFromIndex; + if (aLength != bLength) + return false; + + for (int i = 0; i < aLength; i++) + if (a[aFromIndex++] != b[bFromIndex++]) + return false; + + return true; + } + + /** * Returns {@code true} if the two specified arrays of ints are * equal to one another. Two arrays are considered equal if both * arrays contain the same number of elements, and all corresponding pairs @@ -2615,6 +2665,55 @@ } /** + * Returns true if the two specified arrays of ints, over the specified + * ranges, are equal to one another. + * + *
Two arrays are considered equal if the number of elements covered by + * each range is the same, and all corresponding pairs of elements over the + * specified ranges in the two arrays are equal. In other words, two arrays + * are equal if they contain, over the specified ranges, the same elements + * in the same order. + * + * @param a the first array to be tested for equality + * @param aFromIndex the index (inclusive) of the first element in the + * first array to be tested + * @param aToIndex the index (exclusive) of the last element in the + * first array to be tested + * @param b the second array to be tested fro equality + * @param bFromIndex the index (inclusive) of the first element in the + * second array to be tested + * @param bToIndex the index (exclusive) of the last element in the + * second array to be tested + * @return {@code true} if the two arrays, over the specified ranges, are + * equal + * @throws IllegalArgumentException + * if {@code aFromIndex > aToIndex} or + * if {@code bFromIndex > bToIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code aFromIndex < 0 or aToIndex > a.length} or + * if {@code bFromIndex < 0 or bToIndex > b.length} + * @throws NullPointerException + * if either array is {@code null} + * @since 9 + */ + public static boolean equals(int[] a, int aFromIndex, int aToIndex, + int[] b, int bFromIndex, int bToIndex) { + rangeCheck(a.length, aFromIndex, aToIndex); + rangeCheck(b.length, bFromIndex, bToIndex); + + int aLength = aToIndex - aFromIndex; + int bLength = bToIndex - bFromIndex; + if (aLength != bLength) + return false; + + for (int i = 0; i < aLength; i++) + if (a[aFromIndex++] != b[bFromIndex++]) + return false; + + return true; + } + + /** * Returns {@code true} if the two specified arrays of shorts are * equal to one another. Two arrays are considered equal if both * arrays contain the same number of elements, and all corresponding pairs @@ -2644,6 +2743,55 @@ } /** + * Returns true if the two specified arrays of shorts, over the specified + * ranges, are equal to one another. + * + *
Two arrays are considered equal if the number of elements covered by + * each range is the same, and all corresponding pairs of elements over the + * specified ranges in the two arrays are equal. In other words, two arrays + * are equal if they contain, over the specified ranges, the same elements + * in the same order. + * + * @param a the first array to be tested for equality + * @param aFromIndex the index (inclusive) of the first element in the + * first array to be tested + * @param aToIndex the index (exclusive) of the last element in the + * first array to be tested + * @param b the second array to be tested fro equality + * @param bFromIndex the index (inclusive) of the first element in the + * second array to be tested + * @param bToIndex the index (exclusive) of the last element in the + * second array to be tested + * @return {@code true} if the two arrays, over the specified ranges, are + * equal + * @throws IllegalArgumentException + * if {@code aFromIndex > aToIndex} or + * if {@code bFromIndex > bToIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code aFromIndex < 0 or aToIndex > a.length} or + * if {@code bFromIndex < 0 or bToIndex > b.length} + * @throws NullPointerException + * if either array is {@code null} + * @since 9 + */ + public static boolean equals(short[] a, int aFromIndex, int aToIndex, + short[] b, int bFromIndex, int bToIndex) { + rangeCheck(a.length, aFromIndex, aToIndex); + rangeCheck(b.length, bFromIndex, bToIndex); + + int aLength = aToIndex - aFromIndex; + int bLength = bToIndex - bFromIndex; + if (aLength != bLength) + return false; + + for (int i = 0; i < aLength; i++) + if (a[aFromIndex++] != b[bFromIndex++]) + return false; + + return true; + } + + /** * Returns {@code true} if the two specified arrays of chars are * equal to one another. Two arrays are considered equal if both * arrays contain the same number of elements, and all corresponding pairs @@ -2674,6 +2822,55 @@ } /** + * Returns true if the two specified arrays of chars, over the specified + * ranges, are equal to one another. + * + *
Two arrays are considered equal if the number of elements covered by + * each range is the same, and all corresponding pairs of elements over the + * specified ranges in the two arrays are equal. In other words, two arrays + * are equal if they contain, over the specified ranges, the same elements + * in the same order. + * + * @param a the first array to be tested for equality + * @param aFromIndex the index (inclusive) of the first element in the + * first array to be tested + * @param aToIndex the index (exclusive) of the last element in the + * first array to be tested + * @param b the second array to be tested fro equality + * @param bFromIndex the index (inclusive) of the first element in the + * second array to be tested + * @param bToIndex the index (exclusive) of the last element in the + * second array to be tested + * @return {@code true} if the two arrays, over the specified ranges, are + * equal + * @throws IllegalArgumentException + * if {@code aFromIndex > aToIndex} or + * if {@code bFromIndex > bToIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code aFromIndex < 0 or aToIndex > a.length} or + * if {@code bFromIndex < 0 or bToIndex > b.length} + * @throws NullPointerException + * if either array is {@code null} + * @since 9 + */ + public static boolean equals(char[] a, int aFromIndex, int aToIndex, + char[] b, int bFromIndex, int bToIndex) { + rangeCheck(a.length, aFromIndex, aToIndex); + rangeCheck(b.length, bFromIndex, bToIndex); + + int aLength = aToIndex - aFromIndex; + int bLength = bToIndex - bFromIndex; + if (aLength != bLength) + return false; + + for (int i = 0; i < aLength; i++) + if (a[aFromIndex++] != b[bFromIndex++]) + return false; + + return true; + } + + /** * Returns {@code true} if the two specified arrays of bytes are * equal to one another. Two arrays are considered equal if both * arrays contain the same number of elements, and all corresponding pairs @@ -2703,6 +2900,55 @@ } /** + * Returns true if the two specified arrays of bytes, over the specified + * ranges, are equal to one another. + * + *
Two arrays are considered equal if the number of elements covered by + * each range is the same, and all corresponding pairs of elements over the + * specified ranges in the two arrays are equal. In other words, two arrays + * are equal if they contain, over the specified ranges, the same elements + * in the same order. + * + * @param a the first array to be tested for equality + * @param aFromIndex the index (inclusive) of the first element in the + * first array to be tested + * @param aToIndex the index (exclusive) of the last element in the + * first array to be tested + * @param b the second array to be tested fro equality + * @param bFromIndex the index (inclusive) of the first element in the + * second array to be tested + * @param bToIndex the index (exclusive) of the last element in the + * second array to be tested + * @return {@code true} if the two arrays, over the specified ranges, are + * equal + * @throws IllegalArgumentException + * if {@code aFromIndex > aToIndex} or + * if {@code bFromIndex > bToIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code aFromIndex < 0 or aToIndex > a.length} or + * if {@code bFromIndex < 0 or bToIndex > b.length} + * @throws NullPointerException + * if either array is {@code null} + * @since 9 + */ + public static boolean equals(byte[] a, int aFromIndex, int aToIndex, + byte[] b, int bFromIndex, int bToIndex) { + rangeCheck(a.length, aFromIndex, aToIndex); + rangeCheck(b.length, bFromIndex, bToIndex); + + int aLength = aToIndex - aFromIndex; + int bLength = bToIndex - bFromIndex; + if (aLength != bLength) + return false; + + for (int i = 0; i < aLength; i++) + if (a[aFromIndex++] != b[bFromIndex++]) + return false; + + return true; + } + + /** * Returns {@code true} if the two specified arrays of booleans are * equal to one another. Two arrays are considered equal if both * arrays contain the same number of elements, and all corresponding pairs @@ -2732,6 +2978,55 @@ } /** + * Returns true if the two specified arrays of booleans, over the specified + * ranges, are equal to one another. + * + *
Two arrays are considered equal if the number of elements covered by
+ * each range is the same, and all corresponding pairs of elements over the
+ * specified ranges in the two arrays are equal. In other words, two arrays
+ * are equal if they contain, over the specified ranges, the same elements
+ * in the same order.
+ *
+ * @param a the first array to be tested for equality
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested fro equality
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return {@code true} if the two arrays, over the specified ranges, are
+ * equal
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static boolean equals(boolean[] a, int aFromIndex, int aToIndex,
+ boolean[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ if (aLength != bLength)
+ return false;
+
+ for (int i = 0; i < aLength; i++)
+ if (a[aFromIndex++] != b[bFromIndex++])
+ return false;
+
+ return true;
+ }
+
+ /**
* Returns {@code true} if the two specified arrays of doubles are
* equal to one another. Two arrays are considered equal if both
* arrays contain the same number of elements, and all corresponding pairs
@@ -2759,9 +3054,70 @@
if (a2.length != length)
return false;
- for (int i=0; i Two arrays are considered equal if the number of elements covered by
+ * each range is the same, and all corresponding pairs of elements over the
+ * specified ranges in the two arrays are equal. In other words, two arrays
+ * are equal if they contain, over the specified ranges, the same elements
+ * in the same order.
+ *
+ * Two doubles {@code d1} and {@code d2} are considered equal if:
+ * Two arrays are considered equal if the number of elements covered by
+ * each range is the same, and all corresponding pairs of elements over the
+ * specified ranges in the two arrays are equal. In other words, two arrays
+ * are equal if they contain, over the specified ranges, the same elements
+ * in the same order.
+ *
+ * Two floats {@code f1} and {@code f2} are considered equal if:
+ * Two arrays are considered equal if the number of elements covered by
+ * each range is the same, and all corresponding pairs of elements over the
+ * specified ranges in the two arrays are equal. In other words, two arrays
+ * are equal if they contain, over the specified ranges, the same elements
+ * in the same order.
+ *
+ * Two objects {@code e1} and {@code e2} are considered equal if
+ * {@code Objects.equals(e1, e2)}.
+ *
+ * @param a the first array to be tested for equality
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested fro equality
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return {@code true} if the two arrays, over the specified ranges, are
+ * equal
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static boolean equals(Object[] a, int aFromIndex, int aToIndex,
+ Object[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ if (aLength != bLength)
+ return false;
+
+ for (int i = 0; i < aLength; i++) {
+ if (!Objects.equals(a[aFromIndex++], b[bFromIndex++]))
return false;
}
@@ -5185,4 +5653,3233 @@
public static DoubleStream stream(double[] array, int startInclusive, int endExclusive) {
return StreamSupport.doubleStream(spliterator(array, startInclusive, endExclusive), false);
}
-}
+
+
+ // Comparison methods
+
+ // Compare boolean
+
+ /**
+ * Compares two {@code boolean} arrays lexicographically.
+ *
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Boolean#compare(boolean, boolean)}, at an index within the
+ * respective arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(boolean[], boolean[])} for the definition of a
+ * common and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(boolean[], boolean[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Boolean#compare(boolean, boolean)}, at a
+ * relative index within the respective arrays that is the length of the
+ * prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(boolean[], int, int, boolean[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(boolean[], int, int, boolean[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Byte#compare(byte, byte)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(byte[], byte[])} for the definition of a common and
+ * proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(byte[], byte[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Byte#compare(byte, byte)}, at a relative index
+ * within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(byte[], int, int, byte[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(byte[], int, int, byte[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Byte#compareUnsigned(byte, byte)}, at an index within the
+ * respective arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(byte[], byte[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * @apiNote
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Byte#compareUnsigned(byte, byte)}, at a
+ * relative index within the respective arrays that is the length of the
+ * prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(byte[], int, int, byte[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * @apiNote
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Short#compare(short, short)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(short[], short[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(short[], short[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Short#compare(short, short)}, at a relative
+ * index within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(short[], int, int, short[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(short[], int, int, short[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Short#compareUnsigned(short, short)}, at an index within the
+ * respective arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(short[], short[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * @apiNote
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Short#compareUnsigned(short, short)}, at a
+ * relative index within the respective arrays that is the length of the
+ * prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(short[], int, int, short[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * @apiNote
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Character#compare(char, char)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(char[], char[])} for the definition of a common and
+ * proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(char[], char[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Character#compare(char, char)}, at a relative
+ * index within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(char[], int, int, char[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(char[], int, int, char[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Integer#compare(int, int)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(int[], int[])} for the definition of a common and
+ * proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(int[], int[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Integer#compare(int, int)}, at a relative index
+ * within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(int[], int, int, int[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(int[], int, int, int[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Integer#compareUnsigned(int, int)}, at an index within the
+ * respective arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(int[], int[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * @apiNote
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Integer#compareUnsigned(int, int)}, at a
+ * relative index within the respective arrays that is the length of the
+ * prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(int[], int, int, int[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * @apiNote
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Long#compare(long, long)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(long[], long[])} for the definition of a common and
+ * proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(long[], long[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Long#compare(long, long)}, at a relative index
+ * within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(long[], int, int, long[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(long[], int, int, long[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Long#compareUnsigned(long, long)}, at an index within the
+ * respective arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(long[], long[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * @apiNote
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Long#compareUnsigned(long, long)}, at a
+ * relative index within the respective arrays that is the length of the
+ * prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(long[], int, int, long[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * @apiNote
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Float#compare(float, float)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(float[], float[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(float[], float[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Float#compare(float, float)}, at a relative
+ * index within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(float[], int, int, float[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(float[], int, int, float[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements, as if by
+ * {@link Double#compare(double, double)}, at an index within the respective
+ * arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(double[], double[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * The comparison is consistent with {@link #equals(double[], double[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements, as if by {@link Double#compare(double, double)}, at a relative
+ * index within the respective arrays that is the length of the prefix.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(double[], int, int, double[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * The comparison is consistent with
+ * {@link #equals(double[], int, int, double[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if:
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing two elements of type {@code T} at
+ * an index {@code i} within the respective arrays that is the prefix
+ * length, as if by:
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ * A {@code null} array element is considered lexicographically than a
+ * non-{@code null} array element. Two {@code null} array elements are
+ * considered equal.
+ *
+ * The comparison is consistent with {@link #equals(Object[], Object[]) equals},
+ * more specifically the following holds for arrays {@code a} and {@code b}:
+ * This method behaves as if (for non-{@code null} array references
+ * and elements):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing two
+ * elements of type {@code T} at a relative index {@code i} within the
+ * respective arrays that is the prefix length, as if by:
+ * The comparison is consistent with
+ * {@link #equals(Object[], int, int, Object[], int, int) equals}, more
+ * specifically the following holds for arrays {@code a} and {@code b} with
+ * specified ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively:
+ * This method behaves as if (for non-{@code null} array elements):
+ * If the two arrays share a common prefix then the lexicographic
+ * comparison is the result of comparing with the specified comparator two
+ * elements at an index within the respective arrays that is the prefix
+ * length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(Object[], Object[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * A {@code null} array reference is considered lexicographically less
+ * than a non-{@code null} array reference. Two {@code null} array
+ * references are considered equal.
+ *
+ * @apiNote
+ * This method behaves as if (for non-{@code null} array references):
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the lexicographic comparison is the result of comparing with the
+ * specified comparator two elements at a relative index within the
+ * respective arrays that is the prefix length.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(Object[], int, int, Object[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * @apiNote
+ * This method behaves as if (for non-{@code null} array elements):
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ * The specified comparator is used to determine if two array elements
+ * from the each array are not equal.
+ *
+ * If the two arrays share a common prefix then the returned index is the
+ * length of the common prefix and it follows that there is a mismatch
+ * between the two elements at that index within the respective arrays.
+ * If one array is a proper prefix of the other then the returned index is
+ * the length of the smaller array and it follows that the index is only
+ * valid for the larger array.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b}, share a proper
+ * prefix if the following expression is true:
+ * If the two arrays, over the specified ranges, share a common prefix
+ * then the returned relative index is the length of the common prefix and
+ * it follows that there is a mismatch between the two elements at that
+ * relative index within the respective arrays.
+ * If one array is a proper prefix of the other, over the specified ranges,
+ * then the returned relative index is the length of the smaller range and
+ * it follows that the relative index is only valid for the array with the
+ * larger range.
+ * Otherwise, there is no mismatch.
+ *
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a common
+ * prefix of length {@code pl} if the following expression is true:
+ * Two non-{@code null} arrays, {@code a} and {@code b} with specified
+ * ranges [{@code aFromIndex}, {@code atoIndex}) and
+ * [{@code bFromIndex}, {@code btoIndex}) respectively, share a proper
+ * if the following expression is true:
+ *
* For example, if the following is specified in the property:
*
- * The default order for looking up the preferred locale providers is "CLDR,JRE",
- * so specifying "CLDR,JRE" is identical to the default behavior. Applications which
+ * The default order for looking up the preferred locale providers is "CLDR,COMPAT",
+ * so specifying "CLDR,COMPAT" is identical to the default behavior. Applications which
* require implementations of the locale sensitive services must explicitly specify
* "SPI" in order for the Java runtime to load them from the classpath.
*
diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java Wed Jul 05 20:58:49 2017 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java Wed Jul 05 20:58:59 2017 +0200
@@ -124,6 +124,10 @@
if (order != null && order.length() != 0) {
String[] types = order.split(",");
for (String type : types) {
+ type = type.trim().toUpperCase(Locale.ROOT);
+ if (type.equals("COMPAT")) {
+ type = "JRE";
+ }
try {
Type aType = Type.valueOf(type.trim().toUpperCase(Locale.ROOT));
if (!typeList.contains(aType)) {
diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp
--- a/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp Wed Jul 05 20:58:49 2017 +0200
+++ b/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp Wed Jul 05 20:58:59 2017 +0200
@@ -26,8 +26,7 @@
#include {@code new Double(d1).equals(new Double(d2))}
+ * (Unlike the {@code ==} operator, this method considers
+ * {@code NaN} equals to itself, and 0.0d unequal to -0.0d.)
+ *
+ * @param a the first array to be tested for equality
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested fro equality
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return {@code true} if the two arrays, over the specified ranges, are
+ * equal
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @see Double#equals(Object)
+ * @since 9
+ */
+ public static boolean equals(double[] a, int aFromIndex, int aToIndex,
+ double[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ if (aLength != bLength)
+ return false;
+
+ for (int i = 0; i < aLength; i++) {
+ Double va = a[aFromIndex++], vb = b[bFromIndex++];
+ if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
+ if (!Double.isNaN(va) || !Double.isNaN(vb))
+ return false;
+ }
return true;
}
@@ -2794,9 +3150,70 @@
if (a2.length != length)
return false;
- for (int i=0; i {@code new Float(f1).equals(new Float(f2))}
+ * (Unlike the {@code ==} operator, this method considers
+ * {@code NaN} equals to itself, and 0.0f unequal to -0.0f.)
+ *
+ * @param a the first array to be tested for equality
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested fro equality
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return {@code true} if the two arrays, over the specified ranges, are
+ * equal
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @see Float#equals(Object)
+ * @since 9
+ */
+ public static boolean equals(float[] a, int aFromIndex, int aToIndex,
+ float[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ if (aLength != bLength)
+ return false;
+
+ for (int i = 0; i < aLength; i++) {
+ float va = a[aFromIndex++], vb = b[bFromIndex++];
+ if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
+ if (!Float.isNaN(va) || !Float.isNaN(vb))
+ return false;
+ }
return true;
}
@@ -2827,9 +3244,60 @@
return false;
for (int i=0; i{@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Boolean.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(boolean[] a, boolean[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Boolean.compare(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code boolean} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Boolean.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(boolean[] a, int aFromIndex, int aToIndex,
+ boolean[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ boolean va = a[aFromIndex++];
+ boolean vb = b[bFromIndex++];
+ if (va != vb) return Boolean.compare(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare byte
+
+ /**
+ * Compares two {@code byte} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Byte.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(byte[] a, byte[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Byte.compare(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code byte} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Byte.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(byte[] a, int aFromIndex, int aToIndex,
+ byte[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ byte va = a[aFromIndex++];
+ byte vb = b[bFromIndex++];
+ if (va != vb) return Byte.compare(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ /**
+ * Compares two {@code byte} arrays lexicographically, numerically treating
+ * elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Byte.compareUnsigned(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are
+ * equal and contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compareUnsigned(byte[] a, byte[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Byte.compareUnsigned(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+
+ /**
+ * Compares two {@code byte} arrays lexicographically over the specified
+ * ranges, numerically treating elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Byte.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is null
+ * @since 9
+ */
+ public static int compareUnsigned(byte[] a, int aFromIndex, int aToIndex,
+ byte[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ byte va = a[aFromIndex++];
+ byte vb = b[bFromIndex++];
+ if (va != vb) return Byte.compareUnsigned(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare short
+
+ /**
+ * Compares two {@code short} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Short.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(short[] a, short[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Short.compare(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code short} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Short.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(short[] a, int aFromIndex, int aToIndex,
+ short[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ short va = a[aFromIndex++];
+ short vb = b[bFromIndex++];
+ if (va != vb) return Short.compare(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ /**
+ * Compares two {@code short} arrays lexicographically, numerically treating
+ * elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Short.compareUnsigned(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are
+ * equal and contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compareUnsigned(short[] a, short[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Short.compareUnsigned(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code short} arrays lexicographically over the specified
+ * ranges, numerically treating elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Short.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is null
+ * @since 9
+ */
+ public static int compareUnsigned(short[] a, int aFromIndex, int aToIndex,
+ short[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ short va = a[aFromIndex++];
+ short vb = b[bFromIndex++];
+ if (va != vb) return Short.compareUnsigned(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare char
+
+ /**
+ * Compares two {@code char} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Character.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(char[] a, char[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Character.compare(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code char} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Character.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(char[] a, int aFromIndex, int aToIndex,
+ char[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ char va = a[aFromIndex++];
+ char vb = b[bFromIndex++];
+ if (va != vb) return Character.compare(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare int
+
+ /**
+ * Compares two {@code int} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Integer.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(int[] a, int[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Integer.compare(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code int} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Integer.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(int[] a, int aFromIndex, int aToIndex,
+ int[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ int va = a[aFromIndex++];
+ int vb = b[bFromIndex++];
+ if (va != vb) return Integer.compare(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ /**
+ * Compares two {@code int} arrays lexicographically, numerically treating
+ * elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Integer.compareUnsigned(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are
+ * equal and contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compareUnsigned(int[] a, int[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Integer.compareUnsigned(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code int} arrays lexicographically over the specified
+ * ranges, numerically treating elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Integer.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is null
+ * @since 9
+ */
+ public static int compareUnsigned(int[] a, int aFromIndex, int aToIndex,
+ int[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ int va = a[aFromIndex++];
+ int vb = b[bFromIndex++];
+ if (va != vb) return Integer.compareUnsigned(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare long
+
+ /**
+ * Compares two {@code long} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Long.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(long[] a, long[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Long.compare(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code long} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Long.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(long[] a, int aFromIndex, int aToIndex,
+ long[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ long va = a[aFromIndex++];
+ long vb = b[bFromIndex++];
+ if (va != vb) return Long.compare(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ /**
+ * Compares two {@code long} arrays lexicographically, numerically treating
+ * elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Long.compareUnsigned(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are
+ * equal and contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compareUnsigned(long[] a, long[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return Long.compareUnsigned(a[i], b[i]);
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code long} arrays lexicographically over the specified
+ * ranges, numerically treating elements as unsigned.
+ *
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Long.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is null
+ * @since 9
+ */
+ public static int compareUnsigned(long[] a, int aFromIndex, int aToIndex,
+ long[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ long va = a[aFromIndex++];
+ long vb = b[bFromIndex++];
+ if (va != vb) return Long.compareUnsigned(va, vb);
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare float
+
+ /**
+ * Compares two {@code float} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Float.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(float[] a, float[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ float va = a[i], vb = b[i];
+ if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
+ int c = Float.compare(va, vb);
+ if (c != 0) return c;
+ }
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code float} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Float.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(float[] a, int aFromIndex, int aToIndex,
+ float[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ float va = a[aFromIndex++], vb = b[bFromIndex++];
+ if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
+ int c = Float.compare(va, vb);
+ if (c != 0) return c;
+ }
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare double
+
+ /**
+ * Compares two {@code double} arrays lexicographically.
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return Double.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @return the value {@code 0} if the first and second array are equal and
+ * contain the same elements in the same order;
+ * a value less than {@code 0} if the first array is
+ * lexicographically less than the second array; and
+ * a value greater than {@code 0} if the first array is
+ * lexicographically greater than the second array
+ * @since 9
+ */
+ public static int compare(double[] a, double[] b) {
+ if (a == b)
+ return 0;
+ if (a == null || b == null)
+ return a == null ? -1 : 1;
+
+ int length = Math.min(a.length, b.length);
+ for (int i = 0; i < length; i++) {
+ double va = a[i], vb = b[i];
+ if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
+ int c = Double.compare(va, vb);
+ if (c != 0) return c;
+ }
+ }
+
+ return a.length - b.length;
+ }
+
+ /**
+ * Compares two {@code double} arrays lexicographically over the specified
+ * ranges.
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return Double.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @return the value {@code 0} if, over the specified ranges, the first and
+ * second array are equal and contain the same elements in the same
+ * order;
+ * a value less than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically less than the second array; and
+ * a value greater than {@code 0} if, over the specified ranges, the
+ * first array is lexicographically greater than the second array
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int compare(double[] a, int aFromIndex, int aToIndex,
+ double[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ double va = a[aFromIndex++], vb = b[bFromIndex++];
+ if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
+ int c = Double.compare(va, vb);
+ if (c != 0) return c;
+ }
+ }
+
+ return aLength - bLength;
+ }
+
+ // Compare objects
+
+ /**
+ * Compares two {@code Object} arrays, within comparable elements,
+ * lexicographically.
+ *
+ * {@code
+ * Comparator.nullsFirst(Comparator.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two array lengths.
+ * (See {@link #mismatch(Object[], Object[])} for the definition of a common
+ * and proper prefix.)
+ *
+ * {@code
+ * Arrays.equals(a, b) == (Arrays.compare(a, b) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, b);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return a[i].compareTo(b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @param {@code
+ * Comparator.nullsFirst(Comparator.
+ * Otherwise, one array is a proper prefix of the other and, lexicographic
+ * comparison is the result of comparing the two range lengths.
+ * (See {@link #mismatch(Object[], int, int, Object[], int, int)} for the
+ * definition of a common and proper prefix.)
+ *
+ * {@code
+ * Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) ==
+ * (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0)
+ * }
+ *
+ * @apiNote
+ * {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return a[aFromIndex + i].compareTo(b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @param {@code
+ * int i = Arrays.mismatch(a, b, cmp);
+ * if (i >= 0 && i < Math.min(a.length, b.length))
+ * return cmp.compare(a[i], b[i]);
+ * return a.length - b.length;
+ * }
+ *
+ * @param a the first array to compare
+ * @param b the second array to compare
+ * @param cmp the comparator to compare array elements
+ * @param {@code
+ * int i = Arrays.mismatch(a, aFromIndex, aToIndex,
+ * b, bFromIndex, bToIndex, cmp);
+ * if (i >= 0 && i < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * return cmp.compare(a[aFromIndex + i], b[bFromIndex + i]);
+ * return (aToIndex - aFromIndex) - (bToIndex - bFromIndex);
+ * }
+ *
+ * @param a the first array to compare
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be compared
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be compared
+ * @param b the second array to compare
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be compared
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be compared
+ * @param cmp the comparator to compare array elements
+ * @param {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * a[pl] != b[pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(boolean[] a, boolean[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code boolean} arrays over the specified ranges, otherwise return -1 if
+ * no mismatch is found. The index will be in the range of 0 (inclusive) up
+ * to the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * a[aFromIndex + pl] != b[bFromIndex + pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(boolean[] a, int aFromIndex, int aToIndex,
+ boolean[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (a[aFromIndex++] != b[bFromIndex++]) return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch byte
+
+ /**
+ * Finds and returns the index of the first mismatch between two {@code byte}
+ * arrays, otherwise return -1 if no mismatch is found. The index will be
+ * in the range of 0 (inclusive) up to the length (inclusive) of the smaller
+ * array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * a[pl] != b[pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(byte[] a, byte[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code byte} arrays over the specified ranges, otherwise return -1 if no
+ * mismatch is found. The index will be in the range of 0 (inclusive) up to
+ * the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * a[aFromIndex + pl] != b[bFromIndex + pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(byte[] a, int aFromIndex, int aToIndex,
+ byte[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (a[aFromIndex++] != b[bFromIndex++]) return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch char
+
+ /**
+ * Finds and returns the index of the first mismatch between two {@code char}
+ * arrays, otherwise return -1 if no mismatch is found. The index will be
+ * in the range of 0 (inclusive) up to the length (inclusive) of the smaller
+ * array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * a[pl] != b[pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(char[] a, char[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code char} arrays over the specified ranges, otherwise return -1 if no
+ * mismatch is found. The index will be in the range of 0 (inclusive) up to
+ * the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * a[aFromIndex + pl] != b[bFromIndex + pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(char[] a, int aFromIndex, int aToIndex,
+ char[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (a[aFromIndex++] != b[bFromIndex++]) return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch short
+
+ /**
+ * Finds and returns the index of the first mismatch between two {@code short}
+ * arrays, otherwise return -1 if no mismatch is found. The index will be
+ * in the range of 0 (inclusive) up to the length (inclusive) of the smaller
+ * array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * a[pl] != b[pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(short[] a, short[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code short} arrays over the specified ranges, otherwise return -1 if no
+ * mismatch is found. The index will be in the range of 0 (inclusive) up to
+ * the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * a[aFromIndex + pl] != b[bFromIndex + pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(short[] a, int aFromIndex, int aToIndex,
+ short[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (a[aFromIndex++] != b[bFromIndex++]) return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch int
+
+ /**
+ * Finds and returns the index of the first mismatch between two {@code int}
+ * arrays, otherwise return -1 if no mismatch is found. The index will be
+ * in the range of 0 (inclusive) up to the length (inclusive) of the smaller
+ * array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * a[pl] != b[pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(int[] a, int[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code int} arrays over the specified ranges, otherwise return -1 if no
+ * mismatch is found. The index will be in the range of 0 (inclusive) up to
+ * the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * a[aFromIndex + pl] != b[bFromIndex + pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(int[] a, int aFromIndex, int aToIndex,
+ int[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (a[aFromIndex++] != b[bFromIndex++]) return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch long
+
+ /**
+ * Finds and returns the index of the first mismatch between two {@code long}
+ * arrays, otherwise return -1 if no mismatch is found. The index will be
+ * in the range of 0 (inclusive) up to the length (inclusive) of the smaller
+ * array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * a[pl] != b[pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(long[] a, long[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (a[i] != b[i]) return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code long} arrays over the specified ranges, otherwise return -1 if no
+ * mismatch is found. The index will be in the range of 0 (inclusive) up to
+ * the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * a[aFromIndex + pl] != b[bFromIndex + pl]
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(long[] a, int aFromIndex, int aToIndex,
+ long[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (a[aFromIndex++] != b[bFromIndex++]) return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch float
+
+ /**
+ * Finds and returns the index of the first mismatch between two {@code float}
+ * arrays, otherwise return -1 if no mismatch is found. The index will be
+ * in the range of 0 (inclusive) up to the length (inclusive) of the smaller
+ * array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * Float.compare(a[pl], b[pl]) != 0
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(float[] a, float[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ float va = a[i], vb = b[i];
+ if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
+ if (!Float.isNaN(va) || !Float.isNaN(vb))
+ return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code float} arrays over the specified ranges, otherwise return -1 if no
+ * mismatch is found. The index will be in the range of 0 (inclusive) up to
+ * the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * Float.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(float[] a, int aFromIndex, int aToIndex,
+ float[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ float va = a[aFromIndex++], vb = b[bFromIndex++];
+ if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
+ if (!Float.isNaN(va) || !Float.isNaN(vb))
+ return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch double
+
+ /**
+ * Finds and returns the index of the first mismatch between two
+ * {@code double} arrays, otherwise return -1 if no mismatch is found. The
+ * index will be in the range of 0 (inclusive) up to the length (inclusive)
+ * of the smaller array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * Double.compare(a[pl], b[pl]) != 0
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(double[] a, double[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ double va = a[i], vb = b[i];
+ if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
+ if (!Double.isNaN(va) || !Double.isNaN(vb))
+ return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code double} arrays over the specified ranges, otherwise return -1 if
+ * no mismatch is found. The index will be in the range of 0 (inclusive) up
+ * to the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * Double.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(double[] a, int aFromIndex, int aToIndex,
+ double[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ double va = a[aFromIndex++], vb = b[bFromIndex++];
+ if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
+ if (!Double.isNaN(va) || !Double.isNaN(vb))
+ return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ // Mismatch objects
+
+ /**
+ * Finds and returns the index of the first mismatch between two
+ * {@code Object} arrays, otherwise return -1 if no mismatch is found. The
+ * index will be in the range of 0 (inclusive) up to the length (inclusive)
+ * of the smaller array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * Arrays.equals(a, 0, pl, b, 0, pl) &&
+ * !Objects.equals(a[pl], b[pl])
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * Arrays.equals(a, 0, Math.min(a.length, b.length),
+ * b, 0, Math.min(a.length, b.length))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @return the index of the first mismatch between the two arrays,
+ * otherwise {@code -1}.
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(Object[] a, Object[] b) {
+ int length = Math.min(a.length, b.length); // Check null array refs
+ if (a == b)
+ return -1;
+
+ for (int i = 0; i < length; i++) {
+ if (!Objects.equals(a[i], b[i]))
+ return i;
+ }
+
+ return a.length != b.length ? length : -1;
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between two
+ * {@code Object} arrays over the specified ranges, otherwise return -1 if
+ * no mismatch is found. The index will be in the range of 0 (inclusive) up
+ * to the length (inclusive) of the smaller range.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * Arrays.equals(a, aFromIndex, aFromIndex + pl, b, bFromIndex, bFromIndex + pl) &&
+ * !Objects.equals(a[aFromIndex + pl], b[bFromIndex + pl])
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * Arrays.equals(a, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex),
+ * b, 0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex))
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @return the relative index of the first mismatch between the two arrays
+ * over the specified ranges, otherwise {@code -1}.
+ * @throws IllegalArgumentException
+ * if {@code aFromIndex > aToIndex} or
+ * if {@code bFromIndex > bToIndex}
+ * @throws ArrayIndexOutOfBoundsException
+ * if {@code aFromIndex < 0 or aToIndex > a.length} or
+ * if {@code bFromIndex < 0 or bToIndex > b.length}
+ * @throws NullPointerException
+ * if either array is {@code null}
+ * @since 9
+ */
+ public static int mismatch(
+ Object[] a, int aFromIndex, int aToIndex,
+ Object[] b, int bFromIndex, int bToIndex) {
+ rangeCheck(a.length, aFromIndex, aToIndex);
+ rangeCheck(b.length, bFromIndex, bToIndex);
+
+ int aLength = aToIndex - aFromIndex;
+ int bLength = bToIndex - bFromIndex;
+ int length = Math.min(aLength, bLength);
+ for (int i = 0; i < length; i++) {
+ if (!Objects.equals(a[aFromIndex++], b[bFromIndex++]))
+ return i;
+ }
+
+ return aLength != bLength ? length : -1;
+ }
+
+ /**
+ * Finds and returns the index of the first mismatch between two
+ * {@code Object} arrays, otherwise return -1 if no mismatch is found.
+ * The index will be in the range of 0 (inclusive) up to the length
+ * (inclusive) of the smaller array.
+ *
+ * {@code
+ * pl >= 0 &&
+ * pl < Math.min(a.length, b.length) &&
+ * IntStream.range(0, pl).
+ * map(i -> cmp.compare(a[i], b[i])).
+ * allMatch(c -> c == 0) &&
+ * cmp.compare(a[pl], b[pl]) != 0
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * a.length != b.length &&
+ * IntStream.range(0, Math.min(a.length, b.length)).
+ * map(i -> cmp.compare(a[i], b[i])).
+ * allMatch(c -> c == 0) &&
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @param cmp the comparator to compare array elements
+ * @param {@code
+ * pl >= 0 &&
+ * pl < Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex) &&
+ * IntStream.range(0, pl).
+ * map(i -> cmp.compare(a[aFromIndex + i], b[bFromIndex + i])).
+ * allMatch(c -> c == 0) &&
+ * cmp.compare(a[aFromIndex + pl], b[bFromIndex + pl]) != 0
+ * }
+ * Note that a common prefix length of {@code 0} indicates that the first
+ * elements from each array mismatch.
+ *
+ * {@code
+ * (aToIndex - aFromIndex) != (bToIndex - bFromIndex) &&
+ * IntStream.range(0, Math.min(aToIndex - aFromIndex, bToIndex - bFromIndex)).
+ * map(i -> cmp.compare(a[aFromIndex + i], b[bFromIndex + i])).
+ * allMatch(c -> c == 0)
+ * }
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index (inclusive) of the first element in the
+ * first array to be tested
+ * @param aToIndex the index (exclusive) of the last element in the
+ * first array to be tested
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index (inclusive) of the first element in the
+ * second array to be tested
+ * @param bToIndex the index (exclusive) of the last element in the
+ * second array to be tested
+ * @param cmp the comparator to compare array elements
+ * @param
*
*
- * java.locale.providers=SPI,CLDR,JRE
+ * java.locale.providers=SPI,CLDR,COMPAT
*
* the locale sensitive services in the SPI providers are looked up first. If the
* desired locale sensitive service is not available, then the runtime looks for CLDR,
- * JRE in that order.
+ * COMPAT in that order.
*
- * {@code
- *
- *
- *
- */
- private String extractURL(String xml) {
- Pattern urlExtractorPattern = Pattern.compile("BufferStrategy
object
@@ -1143,9 +1143,7 @@
* @since 1.3
*/
public GraphicsConfiguration getGraphicsConfiguration() {
- synchronized(getTreeLock()) {
- return getGraphicsConfiguration_NoClientCode();
- }
+ return getGraphicsConfiguration_NoClientCode();
}
final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
@@ -3622,18 +3620,17 @@
}
/**
- * Creates an off-screen drawable image
- * to be used for double buffering.
- * @param width the specified width
- * @param height the specified height
- * @return an off-screen drawable image, which can be used for double
- * buffering. The return value may be null
if the
- * component is not displayable. This will always happen if
- * GraphicsEnvironment.isHeadless()
returns
- * true
.
+ * Creates an off-screen drawable image to be used for double buffering.
+ *
+ * @param width the specified width
+ * @param height the specified height
+ * @return an off-screen drawable image, which can be used for double
+ * buffering. The {@code null} value if the component is not
+ * displayable or {@code GraphicsEnvironment.isHeadless()} returns
+ * {@code true}.
* @see #isDisplayable
* @see GraphicsEnvironment#isHeadless
- * @since 1.0
+ * @since 1.0
*/
public Image createImage(int width, int height) {
ComponentPeer peer = this.peer;
@@ -3646,19 +3643,19 @@
}
/**
- * Creates a volatile off-screen drawable image
- * to be used for double buffering.
- * @param width the specified width.
- * @param height the specified height.
- * @return an off-screen drawable image, which can be used for double
- * buffering. The return value may be null
if the
- * component is not displayable. This will always happen if
- * GraphicsEnvironment.isHeadless()
returns
- * true
.
+ * Creates a volatile off-screen drawable image to be used for double
+ * buffering.
+ *
+ * @param width the specified width
+ * @param height the specified height
+ * @return an off-screen drawable image, which can be used for double
+ * buffering. The {@code null} value if the component is not
+ * displayable or {@code GraphicsEnvironment.isHeadless()} returns
+ * {@code true}.
* @see java.awt.image.VolatileImage
* @see #isDisplayable
* @see GraphicsEnvironment#isHeadless
- * @since 1.4
+ * @since 1.4
*/
public VolatileImage createVolatileImage(int width, int height) {
ComponentPeer peer = this.peer;
@@ -3674,22 +3671,26 @@
}
/**
- * Creates a volatile off-screen drawable image, with the given capabilities.
- * The contents of this image may be lost at any time due
- * to operating system issues, so the image must be managed
- * via the VolatileImage
interface.
- * @param width the specified width.
- * @param height the specified height.
- * @param caps the image capabilities
- * @exception AWTException if an image with the specified capabilities cannot
- * be created
- * @return a VolatileImage object, which can be used
- * to manage surface contents loss and capabilities.
+ * Creates a volatile off-screen drawable image, with the given
+ * capabilities. The contents of this image may be lost at any time due to
+ * operating system issues, so the image must be managed via the
+ * {@code VolatileImage} interface.
+ *
+ * @param width the specified width
+ * @param height the specified height
+ * @param caps the image capabilities
+ * @return a VolatileImage object, which can be used to manage surface
+ * contents loss and capabilities. The {@code null} value if the
+ * component is not displayable or
+ * {@code GraphicsEnvironment.isHeadless()} returns {@code true}.
+ * @throws AWTException if an image with the specified capabilities cannot
+ * be created
* @see java.awt.image.VolatileImage
* @since 1.4
*/
public VolatileImage createVolatileImage(int width, int height,
- ImageCapabilities caps) throws AWTException {
+ ImageCapabilities caps)
+ throws AWTException {
// REMIND : check caps
return createVolatileImage(width, height);
}
diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.desktop/share/classes/java/awt/Window.java
--- a/jdk/src/java.desktop/share/classes/java/awt/Window.java Wed Jul 05 20:58:49 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java Wed Jul 05 20:58:59 2017 +0200
@@ -347,7 +347,7 @@
* @see #getOpacity()
* @since 1.7
*/
- private float opacity = 1.0f;
+ private volatile float opacity = 1.0f;
/**
* The shape assigned to this window. This field is set to {@code null} if
@@ -1040,9 +1040,7 @@
closeSplashScreen();
Dialog.checkShouldBeBlocked(this);
super.show();
- synchronized (getTreeLock()) {
- this.locationByPlatform = false;
- }
+ locationByPlatform = false;
for (int i = 0; i < ownedWindowList.size(); i++) {
Window child = ownedWindowList.elementAt(i).get();
if ((child != null) && child.showWithParent) {
@@ -1115,9 +1113,7 @@
modalBlocker.unblockWindow(this);
}
super.hide();
- synchronized (getTreeLock()) {
- this.locationByPlatform = false;
- }
+ locationByPlatform = false;
}
final void clearMostRecentFocusOwnerOnHide() {
@@ -3411,7 +3407,7 @@
return super.canContainFocusOwner(focusOwnerCandidate) && isFocusableWindow();
}
- private boolean locationByPlatform = locationByPlatformProp;
+ private volatile boolean locationByPlatform = locationByPlatformProp;
/**
@@ -3482,9 +3478,7 @@
* @since 1.5
*/
public boolean isLocationByPlatform() {
- synchronized (getTreeLock()) {
- return locationByPlatform;
- }
+ return locationByPlatform;
}
/**
@@ -3573,9 +3567,7 @@
* @since 1.7
*/
public float getOpacity() {
- synchronized (getTreeLock()) {
- return opacity;
- }
+ return opacity;
}
/**
diff -r 77273343c131 -r d8b2864e0ec4 jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java
--- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java Wed Jul 05 20:58:49 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java Wed Jul 05 20:58:59 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,7 @@
*/
public abstract class CachedPainter {
// CacheMap maps from class to ImageCache.
- private static final Map